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

Back to say I got it working on my server as well :p. Thanks again.

Btw, it's a "vanilla" DayZ chernarus, but we have loads of other script addons.

Edit: Nvm, I was wrong about the database saving :(
 
Back to say I got it working on my server as well :p. Thanks again.

Btw, it's a "vanilla" DayZ chernarus, but we have loads of other script addons. No problems with the normal deployables saving to database on bliss/reality for me. However I still can't get custom recipes I've added to save at all despite all my attempts and scouring over the code for reasons why they won't publish (before and after adding your changes)...

Did you just do what the guide said or did you fix it yourself? If you did mind posting what you did?
 
I just followed his directions and had no problems, so I can't really say what I did differently besides the fact I had to work around a lot of my other script additions. As for my custom recipes issue I'm following kikyou2's suggestion from the other thread.
 
Back to say I got it working on my server as well :p. Thanks again.

Btw, it's a "vanilla" DayZ chernarus, but we have loads of other script addons. No problems with the normal deployables saving to database on bliss/reality for me. However I still can't get custom recipes I've added to save at all despite all my attempts and scouring over the code for reasons why they won't publish (before and after adding your changes)...

This provides hope. >.<
Thank you for posting your results. I'll attempt again.
 
This provides hope. >.<
Thank you for posting your results. I'll attempt again.

so this is working for reality (base building)? ive tried many times and gotten only the creating of buildings. but never saved to database. if anyone can acknowledge this work for REALITY and is saving to the database. that would be great.
 
I've tried several times as well, and followed the tut to my best ability. It didn't work.

My buildings don't save into the database with this code revision.

I have BB1.2 working originally, so I'll wait until this is officially released for Bliss/Reality by Kikyou.
 
Ok sorry guys, out of excitement I posted a little prematurely. With more testing I have to reverse some of my last statement it does seem to refuse saving normal buildables as well as my custom recipes but I think I know why now.



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";
if (isServer) then {
dayzPublishObj call server_publishObj;
};
} else {cutText ["You need the EXACT amount of whatever you are trying to build without extras.", "PLAIN DOWN"];call _funcExitScript;};

In the vanilla BB1.2, for reality users we had to remove the following portion in order for the hive to properly publish our deployables. This portion is inclusive with this code revision and if you try to take it out, "Edit Code" and "Remove Object" will not work.

Code:
if (isServer) then {
dayzPublishObj call server_publishObj;
};
 
My users discovered a Bug with Safes in DayZ Epoch.

If you use DayZEpoch just replace server_publishObject.sqf in server.pbo with this one

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
 
 
//if (!(_object isKindOf "Building")) exitWith {
//deleteVehicle _object;
//};
_allowed = [_object, "Server"] call check_publishobject;
if (!_allowed) exitWith { };
 
 
//diag_log ("PUBLISH: Attempt " + str(_object));
 
//get UID
_uid = _worldspace call dayz_objectUID2;
 
//Send request
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], _fuel,_uid];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
 
//_code = _fuel * 1000; //would be only necessary if we wouldn't pass the code from player_build.sqf
_object setVariable ["Code", _code,true]; //set the Code to the Object
_object setVariable ["ObjectUID", _uid,true]; //set ObjectUID to the Object
_object setVariable ["Classname", _class,true]; //set Classname to the Object
 
_allowedObjects = ["TentStorage", "VaultStorageLocked", "Hedgehog_DZ", "Sandbag1_DZ","TrapBear","Fort_RazorWire","WoodGate_DZ","Land_HBarrier1_DZ"];
 
if ((typeOf _object) in _allowedObjects) then {
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
 
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
 
//diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);
} else {
 
//get UID
_uid = _worldspace call dayz_objectUID2;
 
//Send request
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _charID, _worldspace, [], [], 0,_uid];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
 
_object setVariable ["lastUpdate",time];
_object setVariable ["ObjectUID", _uid,true];
_object setVariable ["characterID",dayz_characterID,true];
 
if ((typeOf _object) in dayz_allowedObjects) then {
_object addMPEventHandler ["MPKilled",{_this call vehicle_handleServerKilled;}];
};
 
dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,_object];
 
//diag_log ("PUBLISH: Created " + (_class) + " with ID " + _uid);
};
 
Ok sorry guys, out of excitement I posted a little prematurely. With more testing I have to reverse some of my last statement it does seem to refuse saving normal buildables as well as my custom recipes but I think I know why now.



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";
if (isServer) then {
dayzPublishObj call server_publishObj;
};
} else {cutText ["You need the EXACT amount of whatever you are trying to build without extras.", "PLAIN DOWN"];call _funcExitScript;};

In the vanilla BB1.2, for reality users we had to remove the following portion in order for the hive to properly publish our deployables. This portion is inclusive with this code revision and if you try to take it out, "Edit Code" and "Remove Object" will not work.

Code:
if (isServer) then {
dayzPublishObj call server_publishObj;
};

So taking out that code lets it save to the database at the cost of "edit code and "remove objects" not working?
 
So taking out that code lets it save to the database at the cost of "edit code and "remove objects" not working?

No, not from what I can see. We will just have to wait for a solution from kikyou2 or someone else more familiar with arma scripting since I'm only a learner.

Edit: I didn't have the ability to thoroughly test before, because I only had my public server, but I set up a test center and I'll see what I can find out.
 
No, not from what I can see. We will just have to wait for a solution from kikyou2 or someone else more familiar with arma scripting since I'm only a learner.

Edit: I didn't have the ability to thoroughly test before, because I only had my public server, but I set up a test center and I'll see what I can find out.


Confirming the updated code is not working for us either.

Running latest Reality build and Chernarus 1.7.6.1

Here are the relevent hive logs:


Code:
2013-05-25 22:17:56 HiveExt: [Information] Method: 308 Params: 1:0:0:26939206:[158.863,[954.624,1886.79,-8.149e-04]]:[]:[]:0:9546188680159:
2013-05-25 22:17:56 HiveExt: [Error] Error executing |CHILD:308:1:0:0:26939206:[158.863,[954.624,1886.79,-0.000814915]]:[]:[]:0:9546188680159:|


After deleting: if (isServer) then {
dayzPublishObj call server_publishObj;
};
Code:
2013-05-25 18:00:52 HiveExt: [Information] Method: 308 Params: 1:Land_Misc_Cargo2E:0:26939206:[150.786,[954.674,1886.65,0.109]]:[]:[]:0:9547188671151:
 
2013-05-25 18:00:52 HiveExt: [Information] Result: ["PASS"]
 
2013-05-25 18:00:52 Database: [Error] Error 1452 (Cannot add or update a child row: a foreign key constraint fails (`dayz`.`instance_deployable`, CONSTRAINT `instance_deployable_ibfk_2` FOREIGN KEY (`owner_id`) REFERENCES `survivor` (`id`))) in MySQLStmtExecute SQL: 'insert into `instance_deployable` (`unique_id`, `deployable_id`, `owner_id`, `instance_id`, `worldspace`, `inventory`, `Damage`,`Hitpoints`, `Fuel`, `created`) select ?, d.id, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP from deployable d where d.class_name = ? VALUES(9547188671151, 26939206, 1, "[150.786,[954.674,1886.65,0.109]]", "[]", 0, "[]", 0, "Land_Misc_Cargo2E")'

Edit: I can supply all relevant files if you need them.
 
Yep, same issue here, nothing writes to hive with an error the same as above. Will be playing with this more over the next few days to see if I can get anywhere. I never actually bothered to fully test stock bb1.2 after people reported problems. But when I first tested it on my home box last week, I did have everything saving to DB
 
Ok apparently it IS working fine when you remove...

Code:
if (isServer) then {
dayzPublishObj call server_publishObj;
};

...however it is really touchy. Sometimes when using other scripts they can break the Edit Code and Remove functions. However, they are fixed upon a relog. I actually got everything to save to the database again, including my custom recipes....yay!
 
Ok apparently it IS working fine when you remove...

Code:
if (isServer) then {
dayzPublishObj call server_publishObj;
};

...however it is really touchy. Sometimes when using other scripts they can break the Edit Code and Remove functions. However, they are fixed upon a relog. I actually got everything to save to the database again, including my custom recipes....yay!


You're sure? The issue seems to be with the way that the string is sent to the database. What mods have you seen causing issues? I've checked the entire publish object funtion and none of my mods would really have an impact, yet the issue remains..
 
You're sure? The issue seems to be with the way that the string is sent to the database. What mods have you seen causing issues? I've checked the entire publish object funtion and none of my mods would really have an impact, yet the issue remains..


i agree and after removing this code it still doesn't write to database
 
You're sure? The issue seems to be with the way that the string is sent to the database. What mods have you seen causing issues? I've checked the entire publish object funtion and none of my mods would really have an impact, yet the issue remains..

To be honest, I'm not sure. I don't know exactly WHY it works now, and have no idea why now as opposed to before. I may have made a change to another script that fixed it but I can't remember. I have a lot of different scripts running so it could be any one of them or combination of them that is messing with it. It's inconsistent and I haven't done enough testing so I can't really elaborate more on it yet. I can prove to you guys it works for me now though (if you want me to), so there is hope lol.

For the most part it is stable for me, however I still trying to recreate the instance(s) that may have broken it those few times for me.
 
I'll be going through it all from scratch tonight, fresh PBO's and just the BB system, see how far i get with that
 
To be honest, I'm not sure. I don't know exactly WHY it works now, and have no idea why now as opposed to before. I may have made a change to another script that fixed it but I can't remember. I have a lot of different scripts running so it could be any one of them or combination of them that is messing with it. It's inconsistent and I haven't done enough testing so I can't really elaborate more on it yet. I can prove to you guys it works for me now though (if you want me to), so there is hope lol.

For the most part it is stable for me, however I still trying to recreate the instance(s) that may have broken it those few times for me.


Can you post your server_publishobj and player_build so I can compare? Do your codes work past restart?
 
Back
Top