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

Rossymond

Moderator
Staff member
I'm getting feeling that my Reality fix isn't working for some people because there have been some mistakes made along the way of your installations :p

Possibly, but a fair few experienced admins are having issues. To be fair, I gave up. I was spending far too much time arsing around with it, for little gain. So I moved onto other things.
 

seaweeduk

OpenDayZ Rockstar!
I'm getting feeling that my Reality fix isn't working for some people because there have been some mistakes made along the way of your installations :p


Correct me if I'm wrong here but no one besides yourself has gotten this working on Reality fully unless I've totally missed something.

By that I'm talking about:

Tents which can still be added/packed and save contents still using player ID
Buildables which can be removed and stay removed after a server restart using Player UID

I went through everything in the thread yesterday testing all the fixes I saw, including your post here http://opendayz.net/threads/release...ycode-permanent-owner.10485/page-5#post-48673

My table was setup as detailed here - http://opendayz.net/threads/release...ycode-permanent-owner.10485/page-4#post-48358 . Tents with a character ID instead of UID would never work under this table setup btw since it defines unique_id as the foreign key and not id, resulting in a foreign key error any time a user builds a tent because it will still insert a character ID.

As I have already said I can't understand how any of these changes are going to fix tents which by default are always going to insert a character ID not a UID, if you remove the foreign key constraint so the inserts still work, removal of all objects breaks. Everything else was saving 100% correctly to my database, newly built objects editted codes etc and I had no errors in from the hive.

So I gave up trying to use the original code with the UIDs. Instead I wanted to try and get the ability to have a 4 digit code and have an owner be able to edit this code (assuming they hadn't died and char ID had changed). That way it wouldn't matter about the UID's, they could still access their base with their code when they died.

So I went back to basebuilding 1.2 again (fully working on my server for a number of months we have hundreds of player built structures). I followed kikyou's steps but replaced every instance I could see of the players UID with the character_ID instead. Everything saves and edits in the database without any problems, but I no longer have the removal options triggered by selfActions.

If I am wasting my time trying to get this working using the above method and someone has a FULLY working reality based chernarus server which is saving and removing after server restart all deployables including tents correctly without any errors I would be very interested to hear something from them. I spent a lot of time on this yesterday.
 

spectrez

Member
Staff member
Then try this, also untested.

Open your fn_selfactions.sqf

search for
Code:
_ownerID = _cursorTarget getVariable ["characterID","0"];

below that add this if you use my 4 digit system
Code:
_code = _cursorTarget getVariable ["Code","0"];

and if you use normal Basebuilding System try
Code:
_code = _cursorTarget getVariable ["ObjectUID","0"];

then search for

Code:
if((speed player <= 1) && !removeObject && (typeOf(cursortarget) in allbuildables_class) && cursorTarget distance player < 5 && _canDo) then {

and change that line to (doesn't matter if my version or not)
Code:
if((speed player <= 1) && !removeObject && (typeOf(cursortarget) in allbuildables_class) && cursorTarget distance player < 5 && _canDo && (_code > 0)) then {

If this works you will not get a Enter Code option for the things where the code is 0

If it doesn't work I will later have a quick look at that myself and test it. ;)
'

you're getting closer :)

The menu doesnt appear on the custom items, but also doesnt appear on stuff placed by players :)
 

MajoeT

Member
How would you disable the code removal option as a temporary measure until we can get this working? :)
 

seaweeduk

OpenDayZ Rockstar!
How would you disable the code removal option as a temporary measure until we can get this working? :)


remove this section from your fnSelfActions

Code:
    // Enter Code to remove object
    if((speed player <= 1) && !removeObject && (typeOf(cursortarget) in allbuildables_class) && cursorTarget distance player < 5 && _canDo) then {
            if (s_player_codeObject < 0) then {
                s_player_codeObject = player addaction [("<t color=""#8E11F5"">" + ("Enter Code of Object to remove") +"</t>"),"dayz_code\external\keypad\fnc_keyPad\enterCode.sqf","",5,false,true,"",""];
            };
    } else {
        player removeAction s_player_codeObject;
        s_player_codeObject = -1;
    };

and this one for keypads

Code:
    // Enter Code to Operate Gates Action
    if((speed player <= 1) && !keyValid && (typeOf(cursortarget) == "Infostand_2_EP1") && cursorTarget distance player < 5 && _canDo) then {
        if (s_player_enterCode < 0) then {
            s_player_enterCode = player addaction [("<t color=""#4DFF0D"">" + ("Enter Key Code to Operate Gate") +"</t>"),"dayz_code\external\keypad\fnc_keyPad\enterCode.sqf","",5,false,true,"",""];
        };
    } else {
        player removeAction s_player_enterCode;
        s_player_enterCode = -1;
    };
 

MajoeT

Member
Great, as I'm using the little fix kikyou2 has put in for admins to be able to remove and no-body writes down all their codes so we end up having to help anyway :)

Will get this removed as before I started using BB1.2 I was making bases in the editor.. and we have quite a few!

Thanks mate :)
 

MajoeT

Member
The keypads one isnt an issue, nobodies made on in the editor its all been made ingame so thats fine its just the removal code for anything placed in the editor or already on the map :)

Just removed the first thing you quoted and about to test now. TYVM :)
 

seaweeduk

OpenDayZ Rockstar!
Great, as I'm using the little fix kikyou2 has put in for admins to be able to remove and no-body writes down all their codes so we end up having to help anyway :)

Will get this removed as before I started using BB1.2 I was making bases in the editor.. and we have quite a few!

Thanks mate :)

Hope it helps, by the way if you keep your owner_id's updated people can remove their own objects after they have died (provided server has restarted since you run the following sql code on your database) I just run it as scheduled task before I restart the server

Code:
UPDATE instance_deployable d LEFT JOIN (
SELECT DISTINCT d.owner_id, s.unique_id
FROM instance_deployable d
LEFT JOIN survivor s ON s.id = d.owner_id
WHERE s.is_dead =1
) AS dead ON dead.owner_id = d.owner_id
LEFT JOIN survivor live ON live.unique_id = dead.unique_id
SET d.owner_id = live.id WHERE live.is_dead =0
 

MajoeT

Member
Thats for bliss though isnt it? Not quite sure how to do it for my database

Your second quoted code btw would remove putting keycodes in completely on all keypanels if I'm reading it right, the first one removes the code to remove objects :)
 

seaweeduk

OpenDayZ Rockstar!
Thats for bliss though isnt it? Not quite sure how to do it for my database

Your second quoted code btw would remove putting keycodes in completely on all keypanels if I'm reading it right, the first one removes the code to remove objects :)


No idea about the epoch db structure I'm afraid that code was for reality/bliss schema but I imagine the differences are minimal and someone can help.

If you are using the code from this thread successfully to use player UID instead of ID for owner_id you won't need to run it anyway I think it's only us dayzmod guys having the problems
 

spectrez

Member
Staff member
How Can i setup a script that changes that ownerid? On every restart, cause then I'm just gonna disable keycodes as well
 

MajoeT

Member
I added the dome tents to the ingame buildable menu but they don't save items, any ideas on this one? :)

That owner db code is for bliss, unsure of the hive I use on how to work it.. not important really, dont get many requests to remove stuff
 

Phoenix

Member
Correct me if I'm wrong here but no one besides yourself has gotten this working on Reality fully unless I've totally missed something.

By that I'm talking about:

Tents which can still be added/packed and save contents still using player ID
Buildables which can be removed and stay removed after a server restart using Player UID

I went through everything in the thread yesterday testing all the fixes I saw, including your post here http://opendayz.net/threads/release...ycode-permanent-owner.10485/page-5#post-48673

My table was setup as detailed here - http://opendayz.net/threads/release...ycode-permanent-owner.10485/page-4#post-48358 . Tents with a character ID instead of UID would never work under this table setup btw since it defines unique_id as the foreign key and not id, resulting in a foreign key error any time a user builds a tent because it will still insert a character ID.

As I have already said I can't understand how any of these changes are going to fix tents which by default are always going to insert a character ID not a UID, if you remove the foreign key constraint so the inserts still work, removal of all objects breaks. Everything else was saving 100% correctly to my database, newly built objects editted codes etc and I had no errors in from the hive.

So I gave up trying to use the original code with the UIDs. Instead I wanted to try and get the ability to have a 4 digit code and have an owner be able to edit this code (assuming they hadn't died and char ID had changed). That way it wouldn't matter about the UID's, they could still access their base with their code when they died.

So I went back to basebuilding 1.2 again (fully working on my server for a number of months we have hundreds of player built structures). I followed kikyou's steps but replaced every instance I could see of the players UID with the character_ID instead. Everything saves and edits in the database without any problems, but I no longer have the removal options triggered by selfActions.

If I am wasting my time trying to get this working using the above method and someone has a FULLY working reality based chernarus server which is saving and removing after server restart all deployables including tents correctly without any errors I would be very interested to hear something from them. I spent a lot of time on this yesterday.

Well first off in my experience with modding, 95% of the time you put out a feature or a fix people will consume and use it without providing any feedback at all (especially if they got it working on their own) unless they don't get it working.

The changes I made negate the point you are getting stuck on. What I did was fairly simple. I separated the vanilla publish variable/arrays/keys from the Base Building 1.2 (kikyou2's) publish variable/arrays/keys. Tents/Wire/Tank Traps/Sandbags can now all save exactly how they did before because buildables under _allowedObjects cannot conform to the same constraints that the allbuildables_class objects kikyou2's improvements modify.

More Simply put: Tents can use CharacterID while the Buildables can use PlayerUID as valid ID's to publish as the Owner_ID. No foreign key error. I have all my keys. All the tents and buildables on my server add/save/delete and update inventory just fine.

However, to be completely fair, I may or may not have lost track of previous fixes I applied to damyio's code from his thread BUT I encountered the same issues most of you are dealing with right now and what I posted fixed it for me. I'm new to this so I'm sorry if I can't explain it better for those with problems. I didn't exactly document this when I spent 4 days restarting my server 100's of times testing and trying to fix this issue.

Here's some pics of my database after one of my tests showing the saving and the indexes.
http://i.imgur.com/PN6gLLS.png
http://i.imgur.com/jFeXBYX.png
http://i.imgur.com/Zm6lKdU.png
 

seaweeduk

OpenDayZ Rockstar!
Well first off in my experience with modding, 95% of the time you put out a feature or a fix people will consume and use it without providing any feedback at all (especially if they got it working on their own) unless they don't get it working.

The changes I made negate the point you are getting stuck on. What I did was fairly simple. I separated the vanilla publish variable/arrays/keys from the Base Building 1.2 (kikyou2's) publish variable/arrays/keys. Tents/Wire/Tank Traps/Sandbags can now all save exactly how they did before because buildables under _allowedObjects cannot conform to the same constraints that the allbuildables_class objects kikyou2's improvements modify.

More Simply put: Tents can use CharacterID while the Buildables can use PlayerUID as valid ID's to publish as the Owner_ID. No foreign key error. I have all my keys. All the tents and buildables on my server add/save/delete and update inventory just fine.

However, to be completely fair, I may or may not have lost track of previous fixes I applied to damyio's code from his thread BUT I encountered the same issues most of you are dealing with right now and what I posted fixed it for me. I'm new to this so I'm sorry if I can't explain it better for those with problems. I didn't exactly document this when I spent 4 days restarting my server 100's of times testing and trying to fix this issue.

Here's some pics of my database after one of my tests showing the saving and the indexes.
http://i.imgur.com/PN6gLLS.png
http://i.imgur.com/jFeXBYX.png
http://i.imgur.com/Zm6lKdU.png


I found it easy enough to read the thread and apply your fixes, and I also had no issues reading and understanding what your code was doing and why it was needed.

It just broke the ability to pitch tents because it would still leave a foreign key error (as charID isnt a UID). Any time I would add I tent I could see the query error because it was inserting a CharID into a column which now had a foreign key relationship with unique_id as the instructions in this thread had said to change it to.

I didn't see a post from anyone saying they had removed the foreign key relationship on the owner_id (you didn't screenshot this section so I can't see yours). I can't understand how this would ever work without doing that, unless you can have a foreign key in two columns?! So I tried removing the FK out - removal of all objects and tents stopped working. I originally tried the table setup suggested in this thread by others, then made my own changes later to try and get things working without errors from the hive.

If you are saying everything is working 100% for you - no hive errors tents pitch, pack and save inventory, buildables are removed and all stay removed after server restart etc then I will gladly continue attempting to get this working fully again from scratch. I would still love to see your foreign keys though....
 

Michael Garcia

New Member
Hi guys,

Would like to point out to all the people involved that this is a awesome project and great work!!
But for some reason i cant seem to get basebuilding items to save on the database...

I've been for at least 2 days working around this, searching and trying to fix it...
So far i've broke the tents... Fixed them...

And today i tried the database fix:
http://opendayz.net/threads/release...ycode-permanent-owner.10485/page-4#post-48358

Broke the tents updating again and didnt fix any buildings... :(

I have a Namalsk server on DayZ.St.

Ill attach my files in case anyone cares to give a look... But ill keep trying to get it working...

Checked my rpt log but cant find any errors..

Code:
13:02:34  bin\config.bin/CfgMovesZombie/States/AinvPknlMstpSnonWnonDnon_medic.InterpolateTo: Bad move AinvPknlMstpSnonWnonDr_medic0S
13:03:08 "HIVE: WRITE: "CHILD:303:73046804060235:[[[],[]],[[],[]],[[],[]]]:""
13:04:08 "DEBUG: Checking if Object: 1af96400# 200646: cncblock.p3d REMOTE is allowed published by Server"
13:04:08 "DEBUG: Object: 1af96400# 200646: cncblock.p3d REMOTE published by Server is Safe"
13:05:16 "DEBUG FPS  : 50"
13:07:15 "READ/WRITE: "["PASS",[2013,6,6,9,7]]""
13:08:17 "DEBUG FPS  : 50"
13:09:32 "DISCONNECT: Clear Shot (106369350) Object: B 1-1-B:1 (Clear Shot) REMOTE, _characterID: 466"
13:09:32 Client: Remote object 3:15 not found

P.S.- Although i do my best, im not really good with coding...

http://www.mediafire.com/?tl1t0zm8qr91dv3
 

tay200k

Member
Can i request a noob guide how to implement base building and this into epoch 1.0.1.1? I have been trying all day with no luck i have managed to build objects in game but there not saving after a restart i just used guess work.
I would love if someone could knock up a quick guide from the beginning.
Cheers.
 

Mike Dobrowney

New Member
Question is the description.ext file at the top meant to look like this :

#include "defines2.hpp"
#include "defines.hpp"
#include "build_recipe_dialog.hpp"
#include "build_recipe_list_dialog.hpp"

or like this :
#include "defines2.hpp"
#include "build_recipe_dialog.hpp"
#include "build_recipe_list_dialog.hpp"
 

Phoenix

Member
I found it easy enough to read the thread and apply your fixes, and I also had no issues reading and understanding what your code was doing and why it was needed.

It just broke the ability to pitch tents because it would still leave a foreign key error (as charID isnt a UID). Any time I would add I tent I could see the query error because it was inserting a CharID into a column which now had a foreign key relationship with unique_id as the instructions in this thread had said to change it to.

I didn't see a post from anyone saying they had removed the foreign key relationship on the owner_id (you didn't screenshot this section so I can't see yours). I can't understand how this would ever work without doing that, unless you can have a foreign key in two columns?! So I tried removing the FK out - removal of all objects and tents stopped working. I originally tried the table setup suggested in this thread by others, then made my own changes later to try and get things working without errors from the hive.

If you are saying everything is working 100% for you - no hive errors tents pitch, pack and save inventory, buildables are removed and all stay removed after server restart etc then I will gladly continue attempting to get this working fully again from scratch. I would still love to see your foreign keys though....

Well, as I mentioned a few pages back...my build of Reality doesn't have "foreign keys" at all in instances_deployable. Instead the would be foreign keys are indexes...that's why I posted the index page. Do you have index entries? Also, did you try remove all the foreign keys or just the one referencing owner_id?


Question is the description.ext file at the top meant to look like this :

#include "defines2.hpp"
#include "defines.hpp"
#include "build_recipe_dialog.hpp"
#include "build_recipe_list_dialog.hpp"

or like this :
#include "defines2.hpp"
#include "build_recipe_dialog.hpp"
#include "build_recipe_list_dialog.hpp"


You are adding more defines and as such, defines2.hpp to the list so yes, like the first one.
 
Top