[Release] BaseBuilding 1.2 Improvements 0.1 (better and editable Keycode, permanent Owner)

Inside the Database they are stored as X.XXX the scripts calculates its back.


That *may* be my issue. Since the 'fuel' column is set to double(13,0) ("`Fuel` double(13,0) NOT NULL DEFAULT 0 AFTER `Hitpoints`,") Which would allow 13 digits before the decimal and zero after it, rounding to the nearest whole value. I'm hoping that changing it to 'double(4,3)' (allowing 3 digits after the decimal) will solve my issue.



Ref:http://dev.mysql.com/doc/refman/5.5/en/floating-point-types.html
 
If you have Navicat just right click at the table and choose "Design Table"

It should look like this

6QFjmV6.png
 
Right, Reality server ordered, to hell with dayz.st


As soon as its online i'll be starting from scratch with this. I'm determined to get this working lol. If anyone has this running on Chernarus Reality Build, please let me know, help would be appreciated.
 
Right, Reality server ordered, to hell with dayz.st


As soon as its online i'll be starting from scratch with this. I'm determined to get this working lol. If anyone has this running on Chernarus Reality Build, please let me know, help would be appreciated.

Heh, you know you can upgrade the database DayZ.ST gives you to a Reality build right? I'm running DayZ.ST as well. I just upgraded the schema to 0.39...
 
Heh, you know you can upgrade the database DayZ.ST gives you to a Reality build right? I'm running DayZ.ST as well. I just upgraded the schema to 0.39...



I didnt know that. But when HFB are far superior for service and features. Plus I spotted a 50% off for life deal :)
 
im kinda confused I have a epoch server do I just do steps 1-5 and don't do anything to the code? cause I did that and im stuck on wait for host any help would be great
 
Hey guys, i just started with dayz scripting / servers ... and all this some days before and i have a lot of fun to waste my time with all this dayz stuff!

i love basebuilding because its an important feature for me to beat origins...

SO... i had the same problem like some people here.

i was unable to save data to db!

i think i found a way after i study the db calls. it should works for most / all of you guys :)

like i sad already im "0day"with this stuff so maybe its not the best way !but it works!. maybe it also helps the people here that do this stuff longer like me to find the best / or a better way now.

the problem is (seems) the structure of the DB "AND" the relation to owner_id [(for me in bliss) changing as defined down should work for all. maybe you just have to change the table names / culumn names as needed for other servers]

SOLUTION:

so try this new structure for "instance_deployable" (as is needed by my bliss):

CREATE TABLE IF NOT EXISTS `instance_deployable` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`unique_id` varchar(60) NOT NULL,
`deployable_id` smallint(5) unsigned NOT NULL,
`owner_id` varchar(60) NOT NULL,
`instance_id` bigint(20) unsigned NOT NULL DEFAULT '1',
`worldspace` varchar(60) NOT NULL DEFAULT '[0,[0,0,0]]',
`inventory` varchar(2048) NOT NULL DEFAULT '[]',
`last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`Hitpoints` varchar(500) NOT NULL DEFAULT '[]',
`Fuel` decimal(4,3) DEFAULT '0.000',
`Damage` double(13,0) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx1_instance_deployable` (`deployable_id`),
KEY `idx3_instance_deployable` (`instance_id`),
KEY `idx2_instance_deployable` (`unique_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=68 ;

--->

`unique_id` varchar(60) NOT NULL, changed to varchar because should be same as unique_id from survivor table!
KEY `idx2_instance_deployable` (`unique_id`) is the new relation (ID (int) before)
Fuel` decimal(4,3) DEFAULT '0.000', changed from float to dec so you have no rounding issue!

---

server_ObjectPublish.sqf / server_PuglishObject.sqf:

_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], _fuel,_uid];

---

this work for me perfectly for me for saving buildings directly and loading them after restart.

i hope this helps you guys!

... but results another small problem (im sure).

if i build a tent now (from item) it will not saved because i think it not forward the fuel number (0 should be good). this probably happen also to other stuff that you build not from BaseBuilding...

i would be happy if somebody can help me to save some time to find a own way to fix my issue!

maybe i can make an if/else routine that give the tent the _fuel to 0.000 if its <null> and / or undefined when u build it? (but im not sure how to make it and where to place the code)

Cheers Guys

I hope it works for you guys too now :)

PS:
DEFAULT '0.000 at "Fuel" is not needed.
 
Hey guys, i just started with dayz scripting / servers ... and all this some days before and i have a lot of fun to waste my time with all this dayz stuff!

i love basebuilding because its an important feature for me to beat origins...

SO... i had the same problem with trying to get the stuff i build in the game saved to the DB...
i think i found a way to get it working for most / all of you guys :)

i study the db calls and then i found a solution that works for me (tested)

the problem is the structure of the DB "AND" the relation to owner_id [(for me in bliss) changing as defined down should work for all. maybe you just have to change the table names / culumn names as needed]

so see this example for my bliss:

CREATE TABLE IF NOT EXISTS `instance_deployable` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`unique_id` varchar(60) NOT NULL,
`deployable_id` smallint(5) unsigned NOT NULL,
`owner_id` varchar(60) NOT NULL,
`instance_id` bigint(20) unsigned NOT NULL DEFAULT '1',
`worldspace` varchar(60) NOT NULL DEFAULT '[0,[0,0,0]]',
`inventory` varchar(2048) NOT NULL DEFAULT '[]',
`last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`Hitpoints` varchar(500) NOT NULL DEFAULT '[]',
`Fuel` decimal(4,3) DEFAULT '0.000',
`Damage` double(13,0) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx1_instance_deployable` (`deployable_id`),
KEY `idx3_instance_deployable` (`instance_id`),
KEY `idx2_instance_deployable` (`unique_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=68 ;

--->
`unique_id` varchar(60) NOT NULL, changed to varchar because should be same as unique_id from survivor table!
KEY `idx2_instance_deployable` (`unique_id`) is the new relation (ID (int) before)
Fuel` decimal(4,3) DEFAULT '0.000', changed from float to dec so you have no rounding issue

---

server_ObjectPublish.sqf / server_PuglishObject.sqf:

_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], _fuel,_uid];

---

this work for me perfectly... but results another small problem.

if i build a tent now (from item) it will not saved because i think it not forward the fuel number (0 should be good)

i hope this helps you guys.

i would be happy if somebody can help me now to save some time for my issue!

maybe i can make an if/else routine that give the tent the _fuel to 0.000 if its <null> and / or undefined when u build it?

Cheers Guys

I hope it works for you guys too now :)

That should definitely help users who don't want to upgrade to Reality. I didn't mention this before but I have run into this problem after my testing. However I'm working on fixing the issue with tents as I post this.
 
@[La.usch.io]

http://opendayz.net/threads/release...ycode-permanent-owner.10485/page-2#post-46731

Just do it like in this post

put inside this

Code:
private ["_class","_uid","_charID","_object","_worldspace","_key","_code","_fuel"];
//[dayz_characterID,_tent,[_dir,_location],"TentStorage"]
_charID =_this select 0;
_object =_this select 1;
_worldspace =_this select 2;
_class =_this select 3;
 
if ((typeOf _object) in allbuildables_class) then {
_fuel =_this select 4;
_code =_this select 5; //added to pick up the code which we passed from player_build.sqf
 
 
//put in normal code for basebuilding
} else {
normal code which you would need for all other objects
};

Should work.
 
Hi kikyou2, may i ask u something? with this mod players in my server can create their own base?, if i give you my mission.pbo and server can u add this mod for me please?, i dont know, but i can donate too if u need.-
Thanks
 
@kikyou2
if ((typeOf _object) in allbuildables_class) then {
_fuel =_this select 4;
_code =_this select 5; //added to pick up the code which we passed from player_build.sqf

//put in normal code for basebuilding
} else {
normal code which you would need for all other objects
};

this was exactly what i need for my issue. thank you! cannot belive i don´t realised this post! :)
 
kikyou2 do I just follow the first 5 steps on my epoch server? I did and I get waiting for host... any help would be great
 
@[La.usch.io]

http://opendayz.net/threads/release...ycode-permanent-owner.10485/page-2#post-46731

Just do it like in this post

put inside this

Code:
private ["_class","_uid","_charID","_object","_worldspace","_key","_code","_fuel"];
//[dayz_characterID,_tent,[_dir,_location],"TentStorage"]
_charID =_this select 0;
_object =_this select 1;
_worldspace =_this select 2;
_class =_this select 3;
 
if ((typeOf _object) in allbuildables_class) then {
_fuel =_this select 4;
_code =_this select 5; //added to pick up the code which we passed from player_build.sqf
 
 
//put in normal code for basebuilding
} else {
normal code which you would need for all other objects
};

Should work.

Tried this fix...then instead of tents simply not saving, you place them and the server removes them immediately after with this:

Code:
23:51:33 "DEBUG: Deleting object TentStorage with invalid ID at [6885.52,11462.5,0.000793457]"
 
Tried this fix...then instead of tents simply not saving, you place them and the server removes them immediately after with this:

Code:
23:51:33 "DEBUG: Deleting object TentStorage with invalid ID at [6885.52,11462.5,0.000793457]"


hey Phoenix, had the same problem. i was not sure its in relation to BB so i dont posted it before...

so this is the way to get it working:

server_objectUpdate.sqf / server_updateObject.sqf

if (!_parachuteWest) then {
if (_objectID == "0" && _uid == "0" && (vehicle _object getVariable ["Sarge",0] != 1)) then {
_object_position = getPosATL _object;
diag_log format ["DEBUG: Deleting object %1 with invalid ID at [%2,%3,%4]", typeOf _object, _object_position select 0, _object_position select 1, _object_position select 2];
_isNotOk = true;
};
};
if (_isNotOk) exitWith { deleteVehicle _object; };

change too

if (!_parachuteWest) then {
if (_objectID == "0" && _uid == "0" && (vehicle _object getVariable ["Sarge",0] != 1)) then {
_object_position = getPosATL _object;
diag_log format ["DEBUG: Deleting object %1 with invalid ID at [%2,%3,%4]", typeOf _object, _object_position select 0, _object_position select 1, _object_position select 2];
_isNotOk = true;
};
};
//if (_isNotOk) exitWith { deleteVehicle _object; };


---

Cheers
L@usch
 
I did everything like you said, but i got a problem where you can't build tents because the tents still want to use the playerID and not his UID. So i made some changes to my database and now i'm able to build the tents but i get another problem with the inventory of the tents not synchronizing to the database after the server has restarted.

Build tent -> Put some items in -> Gets synchronized -> Server restart -> Take items from tent -> new inventory from tent doesn't get synchronized.
 
hey Phoenix, had the same problem. i was not sure its in relation to BB so i dont posted it before...

so this is the way to get it working:

server_objectUpdate.sqf / server_updateObject.sqf

if (!_parachuteWest) then {
if (_objectID == "0" && _uid == "0" && (vehicle _object getVariable ["Sarge",0] != 1)) then {
_object_position = getPosATL _object;
diag_log format ["DEBUG: Deleting object %1 with invalid ID at [%2,%3,%4]", typeOf _object, _object_position select 0, _object_position select 1, _object_position select 2];
_isNotOk = true;
};
};
if (_isNotOk) exitWith { deleteVehicle _object; };

change too

if (!_parachuteWest) then {
if (_objectID == "0" && _uid == "0" && (vehicle _object getVariable ["Sarge",0] != 1)) then {
_object_position = getPosATL _object;
diag_log format ["DEBUG: Deleting object %1 with invalid ID at [%2,%3,%4]", typeOf _object, _object_position select 0, _object_position select 1, _object_position select 2];
_isNotOk = true;
};
};
//if (_isNotOk) exitWith { deleteVehicle _object; };


---

Cheers
L@usch

Unfortunately this won't get us very far. It may solve the immediate issue of the deletion but it's being deleted as a cleanup since the tent is not getting assigned a correct UID. It is being given an ID of 0, which according to the above (and to my logs) cannot happen. So the tent will still not get sent to database. Commenting that line simply lets the game continue trying to publish the invalid ID.

Which leads to this log spam:

Code:
22:32:46 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:32:46 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:32:46 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:33:00 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:33:12 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:33:15 Server: Object 3:155 not found (message 94)
22:33:15 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:33:16 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:33:17 Server: Object 3:157 not found (message 70)
22:33:17 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:33:17 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:33:17 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:33:30 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:33:42 "DEBUG: Deleting object TentStorage with invalid ID at [6885.76,11463.1,0.000823975]"
22:33:52 "DELETE: Deleted by UID: 0"

But hey I got good news :) I got a fix finally...


(Vanilla DayZ) Reality users! If you are still having problems getting this add-on working...

Make 100% sure you have daimyo's original BB1.2 working on your server. Once you know that, follow the directions by Kikyou2 and get it functioning, then and only then make the changes shown below in this post and in my server_publishObject.

(Vanilla DayZ) Bliss Users!
Same as Reality, but you need also need to follow La.usch.io's post on database tweaks...
I cannot test this on Bliss atm so I can not confirm it works.

Now...
Inside Player_Build.sqf, near the bottom...

Replace this:

Code:
// Send to database
_fuel = _code / 1000; //added to calculate valid fuel value for the database
_object setVariable ["characterID",dayz_playerUID,true];
dayzPublishObj = [dayz_playerUID,_object,[_dir,_location],_classname,_fuel,_code]; //added _code to pass to the publishObj function to prevent calculation errors
publicVariableServer "dayzPublishObj";
} else {cutText ["You need the EXACT amount of whatever you are trying to build without extras.", "PLAIN DOWN"];call _funcExitScript;};

With this:

Code:
    if ((typeOf _object) in allbuildables_class) then {            // Send to database if part of the buildlist array
 
    _fuel = _code / 1000; //added to calculate valid fuel value for the database
    _object setVariable ["characterID",dayz_playerUID,true];
 
        dayzPublishObj = [dayz_playerUID,_object,[_dir,_location],_classname,_fuel,_code]; //added _code to pass to the publishObj function to prevent calculation errors
            publicVariableServer "dayzPublishObj";
 
    } else {                                                    //Send to database if part of _allowedObjects
 
    _object setVariable ["characterID",dayz_characterID,true];
 
        dayzPublishObj = [dayz_characterID,_object,[_dir,_location],_classname];
            publicVariableServer "dayzPublishObj";
    };
 
} else {                                                    //Exits construction if you don't have the exact materials
 
    cutText ["You need the EXACT amount of whatever you are trying to build without extras.", "PLAIN DOWN"];
    call _funcExitScript;
};

ALSO! You need to edit your server_publishObject / server_objectPublish! However, because I can't account for what mod/map/changes you have made, use these as guides:

Publishing Fix
server_publishObject / server_objectPublish
Note: If you do not do this part correctly, your tents will not save to DB properly, nor likely will your buildables. You will know you did something wrong if you see something like this in your .rpt log:

Code:
16:10:43 "DEBUG: Checking if Object: 1f9d0800# 1055591: a_tent.p3d REMOTE is allowed published by Server"
16:10:43 "DEBUG: Object: 1f9d0800# 1055591: a_tent.p3d REMOTE published by Server is Safe"
16:10:43 Error in expression <uel =        _this select 4;
_code =        _this select 5;
 
 
 
 
_allowed = [_object, "Ser>
16:10:43  Error position: <select 5;
 
 
 
 
_allowed = [_object, "Ser>
16:10:43  Error Zero divisor
16:10:43 File z\addons\dayz_server\compile\server_publishObject.sqf, line 8

Merge at your own discretion.


You should now have
  • Buildables and custom buildables saving to DB again (with Kikyou2's improvements!)
  • Tents saving to DB once again
  • Loot in tents updating/saving once again (make sure it is a newly placed tent after your changes to the database and with my final fixes, cannot guarantee old tents update properly)
Enjoy :D
 
I got tents and items in tent to save to DB but custom buildings still will not with the above instructions, anyone else with same issue?
 
Back
Top