[How-To] Add new Buildings and Objects via database

Doc

Valued Member!
How to add buildings to chernarus without editing the mission file

Adding new buildings in DayZ without requiring your client to download your DayZ files or rMod is entirely possible. We can do this by utilizing the object_data table in the hivemind database.

Object_data is used for adding vehicles, tents, traps etc into the game world and saving their location. However, it doesn't matter what the class name of the object being added is - they are all the same whether they are Bicycles or Military Hangars.

STEP ONE: Location of your object

You first need to get a location of where you want to put your object, roughly. Do this by standing in the spot you want and opening your character_data table in Navicat or similar and grabbing the worldposition of your character. If your table was already open, you can just refresh the table to get your latest coordinates.

It will look something like this: [ppp,[xxxx,yyyy,zzz]]
The numbers are represented as follows:
p = compass direction you are facing
x = position on X axis from WESTERN side of map
y = position on Y axis from SOUTHERN side of map
z = height

The positions are in meters, so you can use that to fine-tune your building location later on.

STEP TWO: Add a new column to object_data
This is an optional, but highly recommended step. It basically adds a bypass filter so your objects are not counted as vehicles by fGetVehCount.
Add the column "Landmark" to `object_data` as a TINYINT(1) data type. DEFAULT 0
Now edit fGetVehCount and replace it with this:
Code:
BEGIN
 
    DECLARE iVehCount    SMALLINT(3) DEFAULT 0;
 
    SELECT COUNT(*)
        INTO iVehCount
        FROM object_data
            WHERE
                Landmark = '0'
                AND Classname != 'dummy'
                AND Classname != 'TentStorage'
                AND Classname != 'Hedgehog_DZ'
                AND Classname != 'Wire_cat1'
                AND Classname != 'Sandbag1_DZ'
                AND Classname != 'TrapBear';
 
    RETURN iVehCount;
END

STEP THREE: Finding the classname of your desired object
Simple, just find it here (click me!)
Some objects and vehicles are banned, obviously. DayZ buildings spawn zeds, so becareful if using one when building a base.

STEP FOUR: Adding object into object_data
Now you need to add a new entry to object_data for your building.

For each data column:
ObjectID = carry on from your last highest ObjectID if it did not autoincrement itself
ObjectUID = A unique numerical ID for your building. I just give mine a prefix, eg 123 and then start counting after. ie 123001,123002 etc.
Instance = Same as your server instance, this is probably 1.
Classname = Class name of building you found in step three
Damage = 0
CharacterID = 0
Worldspace = The position you gathered earlier
Inventory = []
Hitpoints = []
Fuel = 0
Datestamp = the current datestamp (in navicat, double click on box and press green arrow)

It is VERY important that the irrelevant boxes (ie fuel etc) have the values specified, otherwise it will cause your server to crash.

If you added an object which has carrying capacity, IE an ammo box, you can set it's inventory the same way as you do a vehicle etc. For example:
[[[],[]],[["ItemJerrycan"],[10]],[[],[]]]
FYI: [[[guns-and-tools],[quantity]],[[items-and-ammo],[quantity]],[[backpacks],[quantity]]]

STEP FIVE: Saving and restarting the server

Now you have added your data to the table, save the table and restart your server. Remember to move your character out of the way first so you are not crushed! (I learnt the hard way...). Restart your server (using #restart is sufficient)

TADA Buildings!

Imgur album: http://imgur.com/a/w0DuK
Snippet of my admin base





Guys please don't spam this with SQF discussion. You obviously can add buildings via SQF and it is easier, but not everybody has access to the mission file when they buy hosting from certain companies. This page is for THEM using the DATABASE method.

In response to an earlier post: the lighting is me throwing flares :rolleyes:
 

Doc

Valued Member!
When i restart the server nothing spawns and i followed everything? and good work by the way. :)
What objects are you trying to spawn? Some are banned in the DayZ code. Test it with this Classname, I know this one works: "Land_Mil_ControlTower" (without the quotations).

If it isn't spawning you're probably getting one of these wrong:
-The object is illegal
-The classname is mis-typed
-Your coordinates are wrong
-One of the "non-applicable" columns were not filled in as stated (Inventory/Damage/Fuel etc)
-You didn't save the new entry into the database
-If you use my Landmark column along with my Hacked Vehicle prevention, you must set your Legit column with your codeword and your Landmark to '1'
 

Xyberviri

Valued Member!
World space is just [dir, [x,y,z]] im case anyone was wondering. You should be able to use the 3d editor to place the building then just open the mission.bedi file to get the position down
 
Thanks for this info. I've added several new buildings around the map. I do have a few questions though.
How do you do the walls without getting gaps between them? I've tried it a few times, but I don't know the exact distance using the coordinates and I end up with gaps. I'm not using the map editor, just Navicat so far. I can't get the 3d editor to open up the Dayz mission file.

Is "0" true north in the world space brackets?

do you know an easy way to add the LHD? I've tried several and all have failed miserably.

I am new to all this so could you explain or add a spoiler on how to:
Add the column "Landmark" to `object_data` as a TINYINT(1) data type. DEFAULT 0



Thanks!
 

Xyberviri

Valued Member!
LHD has a creation script in rmod, however when i placed it, there was no collision. so i'm not sure if it was just the 3d editor or what. you can get a standalone script to place it here:

http://forums.bistudio.com/showthread.php?73882-LHD-(Aircraft-Carrier)-spawning-script


as far as placing things so they are perfect i use the 3d editor to setup my scene then i import them into the multiplayer editor after converting the mission.biedi to a mission.sqm file using 3de_conv

The instructions are location on this forum here: http://opendayz.net/index.php?threa...ildings-and-bases-bliss-dayz-st-servers.7137/

the file you need is here: http://armed-assault.de/downloads/converter-biedi--sqm.html

Additionally your going to want to download ASG here:
http://forums.bistudio.com/showthread.php?t=109362
And also Dren's OA Editor update here:
http://www.armaholic.com/page.php?id=11668

Lastly your going to want the ShowClass script so you can identify buildings you can't place but still want to via trickery(ie save the map, change the class name in the file while arma is loaded using notepad++, save the file, reload in arma, poof a sandbag wall becomes a house).

That is located here:
http://www.armaholic.com/page.php?id=8481
 
I've a question one of you may be able to answer regarding a building's worldspace. I created an elaborate bridge to Skalisty island and military base on the island itself.
It worked fine on test server I crafted it on, but in porting the tables to another server...half of the structures over water are now floating. The bridge pier pieces and larger structures are still sound in orientation but the smaller object's Z axis are completely boned.

Is there anything...a configuration or couple lines of code that would affect certain object's Z orientation from server to server?

I've included links of what it SHOULD look like.
https://www.dropbox.com/s/k5jcoscorqbk3qz/SKALIBridgeB.png

...and what it looks like on another server.
https://www.dropbox.com/s/y7700xfdmcd3ky1/skaliwtf.png

I can't release it if it's not functioning properly for everyone; any help or insight is much appreciated; thanks!
Apologies, if I should have started a new thread for this btw :(
 

Xyberviri

Valued Member!
Did you make it on a map Utes by chance and then imported it to cherno? Chernarus has waves with affects the height of the objects when placed over water, normally you only encounter this when trying to place the LHD.

for that you need to use the following command in the init field of the structure:
Code:
this setPos [getPos this select 0, getPos this select 1, 20]
The 20 is the height
 
I put it all together on a DayZ server running Chernarus.
The waves affect on building height makes a lot of sense, thank you for the swift reply; and I'll give that a shot.
Much appreciated and I'll post results.
 

Doc

Valued Member!
Waves affect the height and this is how. The waves are dynamic, they move up and down continuously. On server start, the height of the building is relative to that of the wave at that given moment. So if the height is 2m, it would be 2m above the single spot on the wave directly below its central point. If you try line up multiple objects in the db, the positions are relative to each individual wave and not each other, this is the reason you cannot spawn the LHD well in this method.
 

axeman

OpenDayZ Rockstar!
I have also noticed when placing flags on top of castle structures that the flags end up 10 or 20 metres up in the air. Most of the castles are sunk into the ground to bring the door down to ground level. Presumably the server creates all the buildings / objects then adjusts them, somehow leaving my flag way up there. Took us ages to find it..
 
Hi!
How do you remove an object you have previously spawned, i am using the 3D-editor to spawn them,
but i'm not sure how to remove them from my Mysql server!

Thanks! :)
 

Doc

Valued Member!
Hiya, if the object is spawned by the 3D editor, it can only be despawned via the mission file. If it was spawned via the database, you only need to delete the object entry from object_data and restart the server for it to disappear.
 
Hiya, if the object is spawned by the 3D editor, it can only be despawned via the mission file. If it was spawned via the database, you only need to delete the object entry from object_data and restart the server for it to disappear.
Alright! Ehm, and how do i do that!? I mean, how do i change the "mission file"

Pardon my "noobishness".
 

Doc

Valued Member!
I will be making a tutorial on a much easier way to add buildings. It should work on every server build as well.

Lets just say its as easy as copy and paste.
There are easier methods, but you must also remember not all hosts a) know them or b) have access to them. This is a more accessible alternative that I thought people should be aware of :p
 

dagg929

Well-Known Member
How are people getting bridges in to SKalisty bychance then? What building is that for the bridge? I'm encountering issue with placing piers and them showing at the bottom of the ocean on server reboot.
 
Top