Base Building DayZ 1.2 Released

I'm not getting the option to edit the code because in this line in fn_selfactions:

Code:
if((typeOf(cursortarget) in allbuildables_class) && _canDo && !procBuild && !remProc && (_ownerID == dayz_playerUID)) then {

(_ownerID == dayz_playerUID) is returning false. Is dayz_playerUID still valid in 1.8?

Also in server_monitor at startup when it spawns in all the objects I'm getting these errors in my rpt:

Code:
_code = _fuel * 1000;
_object setVariable ["Code", _code,true]>
17:14:08   Error position: <_object setVariable ["Code", _code,true]>
17:14:08   Error Undefined variable in expression: _object
17:14:08 File z\addons\dayz_server\system\server_monitor.sqf, line 248
17:14:08 "Spawned: "4106926405697" Base_WarfareBBarrier10x"
17:14:08 Error in expression < _damage;

I'm not sure whether its relevant, or anything to be concerned about.
 
Kikyou's improvements were designed to work with the Epoch hive, other DB schemas use variations on formatting and table layout.

I know that with Reality, there is what they call a foreign key check on the instance_deployable table. This check makes sure when writing the table that the owner_id matches a character_id from the survivor table. For this reason, you can't use playerUID for the ownerID because it will cause the foreign key check to fail and it will simply not write it to the database.

Also, for the fuel column, most database schemas save the fuel to a single figure, so something like 0 for none, 0.5 for half, 1 for full etc. Whereas the Epoch database defaults to storing it like this 0.00000 which is how he can store a code in it.

For the first problem, the easiest solution is to change every reference he makes to playerUID to characterID instead. PlayerUID is a valid variable still in 1.8 but most database schemas don't use that value in their instance_deployable or object_data tables.

For the fuel, you'll need to edit the fuel column of the table. You have to set it's "Length/Values" (or some variation on that title) to 13/5 instead of 13/0.

As for the error in the RPT from server_monitor, it looks like you're using _object and perhaps the server file doesn't use _object so it doesn't know what to do with that variable because it hasn't been defined anywhere.
 
right. now I see why he's multiplying the fuel value by 1000 ;) I'll do the substitution of characterID for playerUID but i'm not sure that's gonna fix it. I tried that already in selfactions and it didn't work. Thanks very much for your help once again.
 
No problem. I know from fixing this for somebody else, who was running Overwatch, that replacing those variables and editing the database is all that's required. Provided you did everything else all right haha.
 
No problem. I know from fixing this for somebody else, who was running Overwatch, that replacing those variables and editing the database is all that's required. Provided you did everything else all right haha.

Hi, ok finally had time to play with this. Still can't get it to work - if I die I cannot get the option to remove/edit code. In my selfactions I have (at the top of the file):

ownerID = _cursorTarget getVariable ["characterID","0"];

then further down...

if((typeOf(cursortarget) in allbuildables_class) && _canDo && !procBuild && !remProc && (_ownerID == dayz_characterID)) then {

but ( _ownerID == dayz_characterID) is returning false. I don't get it.

At the bottom of my player_build I have:

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

which I *think* is correct. but, yeah, still not working unfortunately...
 
That's normal behaviour, since characterID changes every time you die and get a new character.

Check my post here for a 'sort of' workaround. It's by no means a perfect solution, but it's only going to be temporary at this stage anyway.
 
It did, but it only works with the official hive or the epoch hive as far as I'm aware. That's what the changes you carried out with replacing playerUID with characterID, playerUID remains constant but only some database schemas allow it to be used on deployables.
You can set that script up as an sql event to run before each server restart.
 
yeah, you're right. there is a foreign key constraint on (instance_deployable.owner_id==survivor.id)

so I removed it... and now my objects write to the db with the owners guid. I don't really see a need for that constraint, but will it break anything?

and now i've got another problem, I think unrelated... tents don't write to the db anymore. I get the following error in my rpt:

19:04:06 "PUBLISH: Created TentStorage with ID 4126026567036"
19:04:06 Error in expression <;
_fuel = _this select 4;
_code = _this select 5;

#line 1 "z\addons\dayz_serve>
19:04:06 Error position: <select 5;

#line 1 "z\addons\dayz_serve>
19:04:06 Error Zero divisor
19:04:06 File z\addons\dayz_server\compile\server_publishObject.sqf, line 8

I think because tent writes aren't called by player_build so server_publishobject isn't being passed values for fuel and code.

Also just for reference, codecheck.sqf needs to be updated with the new PVDZ_obj_Publish and PVDZ_obj_Delete function calls, or codes won't be updated.
 
Yeah deleting the foreign key check was always an option, I prefer not to delete the checks though because they help secure it against hackers using the DB to store all manner of things. Plus, this is all going to become redundant very soon.

What version of DayZ are you running again? I don't run Kikyou's improvements and I really can't be bothered testing ways to fix it just now since it's so close to being replaced but off the top of my head you could try doing this in server_publishObject to see if it sorts the problem. You'd have to test to see if it'd work with base building and tent placement.
Replace this
Code:
_fuel = _this select 4;
_code = _this select 5;
With this

Code:
_fuel =        [];
_code =        []; //added to pick up the code which we passed from player_build.sqf
if (count _this > 4) then {
    _fuel = _this select 4;
        if (count _fuel > 0) then {
            _code = _this select 5;
        };
    };
};
 
hmmm. i see what you're doing there, you got an extra end bracket in there but when i remove it, for tent creation I get nothing writing to db, nothing in rpt but the following error in hive log:

2013-11-24 20:24:56 HiveExt: [Error] Error executing |CHILD:308:1:TentStorage:0:47:[359.966,[4126.8,2658.41,0.00885868]]:[]:[]:[]:41268265840360:|

trying to create a buildable object gives me this in rpt:

20:33:31 Error in expression <> 4) then {
_fuel = _this select 4;
if (count _fuel > 0) then {
_code = _this se>
20:33:31 Error position: <count _fuel > 0) then {
_code = _this se>
20:33:31 Error count: Type Number, expected Array,Config entry
20:33:31 File z\addons\dayz_server\compile\server_publishObject.sqf, line 11
 
Ah yeah, easy mistake, I got overzealous with my tabbing for the second if statement haha.

Switch the definers to 0 instead of array possibly.
So like this
Code:
_fuel = 0;
_code = 0;
 
thanks. tents save normally again. But when creating objects, i get the following error in my rpt:

22:29:34 Error in expression <> 4) then {
_fuel = _this select 4;
if (count _fuel > 0) then {
_code = _this se>
22:29:34 Error position: <count _fuel > 0) then {
_code = _this se>
22:29:34 Error count: Type Number, expected Array,Config entry
22:29:34 File z\addons\dayz_server\compile\server_publishObject.sqf, line 11

It doesn't seem to like "if (count _this > 4) then {"
 
Ah of course sorry you can't count fuel now they it isn't defined as an array.
Try changing
Code:
count _fuel > 0
to
Code:
_fuel != 0
 
awesome! that seems to have fixed it.

It's got me thinking about the age-old tent ownership issue... what if pitchtent.sqf was moved server-side (and maybe player_createstash too, but once a stash is down you can't really change it) and characterID changed to playerID. In the same way as the buildable objects, the tents would be locked to players forever. you could even modify those files to pass zero value fuel and code variables to server_publishobject, thereby making all the changes required above redundant.
 
You wouldn't want to move them server side, but you can move them to the mission file (if you make the relevant edits to associated files such as compiles.sqf) and edit them in there yes. The changes above though don't harm anything so you don't need to edit anything other than the variable they are passing for the owner.
 
Back
Top