Jump to content

Deconstruct Buildables


Snowmobil

Recommended Posts

So which SQL query does one use to ensure that players can still remove buildables after death, which ALSO makes sure that vaults/lockable doors don't change?

That's the only thing that keeps me from installing the script for now, I need to be sure that it doesn't mess up anything besides the only thing it should do; being able to remove stuff including; removing stuff after death.

Link to comment
Share on other sites

This thread has really developed into two topics. The main topic is how to remove buildables and the other is how to have a proper SQL query to reset a plotpole to a player's new PlayerID after they die. I am more interested in the plotpole part.

 

So, just to verify, I want to make it so when a player dies, his plot pole is reassigned to the new PlayerID. This only happens after server restart. Can someone please verify that this is the right code, which I obtained from the first page:

DELIMITER ;
DROP TRIGGER IF EXISTS epoch.`update_owner`;
DELIMITER //
CREATE TRIGGER epoch.`update_owner`
AFTER INSERT ON epoch.character_data
FOR EACH ROW
BEGIN
    UPDATE epoch.object_data SET CharacterID = NEW.CharacterID WHERE CharacterID IN
(SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID)
AND NOT (Classname LIKE '%door%' OR Classname LIKE '%vault%' OR Classname LIKE '%box%');
END//
DELIMITER ;
Link to comment
Share on other sites

I don't think the trigger is right, the trigger above should be like this:

 

 

 

DELIMITER ;
DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`;
DELIMITER //
CREATE TRIGGER dayz_epoch.`update_owner`
AFTER INSERT ON dayz_epoch.character_data
FOR EACH ROW
BEGIN
UPDATE dayz_epoch.object_data SET CharacterID = NEW.CharacterID WHERE CharacterID IN
(SELECT CharacterID FROM character_data WHERE PlayerUID = NEW.PlayerUID)

AND NOT (Classname = 'CinderWallDoorLocked_DZ' OR Classname =
'CinderWallDoorSmallLocked_DZ' OR Classname = 'VaultStorageLocked' OR
Classname = 'LockboxStorageLocked');
END//
DELIMITER ;

 

%door% is for sure not enough! I'm not that deep in the object_data, but all combinationlocks and all vehicle keys are stored in the CharacterID, so if the trigger change the CharacterID, because it is in the array of a player, then a key will not work, or a locked door will not work!

Like it is now, the trigger should not be used, that is what I think.

We tried it yesterday, the trigger did not change all CharacterIDs, it should, but it doesn't.

Link to comment
Share on other sites

Here a tip for you guys:
 

DELIMITER ;
DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`;
DELIMITER //
CREATE TRIGGER dayz_epoch.`update_owner`
AFTER INSERT ON dayz_epoch.character_data
FOR EACH ROW
BEGIN
UPDATE dayz_epoch.object_data SET CharacterID= NEW.CharacterID WHERE CharacterID IN
(SELECT CharacterID FROM player_login WHERE PlayerUID= NEW.PlayerUID)
AND (Classname = 'WoodSmallWall_DZ' OR Classname = 'WoodSmallWallThird_DZ');
END
DELIMITER ;

That is a part of our trigger and this one is working for sure, but you have to add all item where the CharacterID have to be updated, the blue part ist only an example. The red part was wrong in the other triggers! It makes no sence to look into character_data, there should be after server restart only alive player, the data you have to look for are in player_login.

 

If you wanna see the trigger working, join our server. But we have our own working remove script.

Link to comment
Share on other sites

Just one problem I see. In remove.sqf, you show this code:

// Double check that object is not null
if(!isNull(_obj)) then {
 
+                if (_isLockableDoor and {_obj animationPhase "Open_hinge" == 0}) exitWith {TradeInprogress = false; cutText ["Cannot remove locked door.", "PLAIN DOWN"];};
 
                 deleteVehicle _obj;
 
But the remove.sqf is slightly different in the current Epoch version:
 

// Double check that object is not null
if(!isNull(_obj)) then {
 
_ipos = getPosATL _obj;
 
deleteVehicle _obj;
 
Should I just do it like this?
 
// Double check that object is not null
if(!isNull(_obj)) then {
 
if (_isLockableDoor and {_obj animationPhase "Open_hinge" == 0}) exitWith {TradeInprogress = false; cutText ["Cannot remove locked door.", "PLAIN DOWN"];};
 
_ipos = getPosATL _obj;
 
deleteVehicle _obj;
Link to comment
Share on other sites

Here a tip for you guys:

 

That is a part of our trigger and this one is working for sure, but you have to add all item where the CharacterID have to be updated, the blue part ist only an example. The red part was wrong in the other triggers! It makes no sence to look into character_data, there should be after server restart only alive player, the data you have to look for are in player_login.

 

If you wanna see the trigger working, join our server. But we have our own working remove script.

 

CharacterID is in both player_login and character_data, so I assume both work?

 

What about this? It would change the PlayerID on all wood, cinderblock and pole items (I could add more, like generator, etc) but would exclude locked items (locked door, locked vault, etc) since they have codes:

DELIMITER ;
DROP TRIGGER IF EXISTS epoch.`update_owner`;
DELIMITER //
CREATE TRIGGER epoch.`update_owner`
AFTER INSERT ON epoch.character_data
FOR EACH ROW
BEGIN
    UPDATE epoch.object_data SET CharacterID = NEW.CharacterID WHERE CharacterID IN
(SELECT CharacterID FROM player_login WHERE PlayerUID = NEW.PlayerUID)
AND (Classname LIKE '%wood%' OR Classname LIKE '%cinder%' OR Classname LIKE '%pole%')
AND NOT (Classname LIKE '%Locked%' OR Classname LIKE '%vault%' OR Classname LIKE '%box%');
END//
DELIMITER ;
Link to comment
Share on other sites

 

CharacterID is in both player_login and character_data, so I assume both work?

And you don't clean the old dead player in you character_data? If not then you are right. I do a cleanup every server restart and then it will not work.

SELECT * FROM `object_data` WHERE (`Classname` LIKE '%wood%' OR `Classname` LIKE '%cinder%' OR `Classname` LIKE '%pole%') AND NOT (`Classname` LIKE '%Locked%' OR `Classname` LIKE '%vault%' OR `Classname` LIKE '%box%');

^ that will technical work, if you only want to update wood, cinder and the pole, I got some more stuff what I want to be updated.

Link to comment
Share on other sites

yeap that is clear, if you use a trigger, then you have to exclude safes, locked cars/chopper/planes/doors and so on.

Epoch is using the CharacterID in the Object_data to store the code for your carkey, combolock and so on and if one code for a combolock match an old CharacterID of the player who triggert the trigger, then the code of your combolock will be changed ;).

Link to comment
Share on other sites

Do you have a correct trigger to solve this ?

 

http://dayzepoch.com/forum/index.php?/topic/1723-deconstruct-buildables/?p=24114

AND (Classname = 'WoodSmallWall_DZ' OR Classname = 'WoodSmallWallThird_DZ');[/php]

 

You have to add all the things what should not updated like this obove, I do it that way (I got 54 items in that line ;) ), you can try it also like BetterDeadThenZed tried: http://dayzepoch.com/forum/index.php?/topic/1723-deconstruct-buildables/?p=24172

[php](`Classname` LIKE '%wood%' OR `Classname` LIKE '%cinder%' OR `Classname` LIKE '%pole%') AND NOT (`Classname` LIKE '%Locked%' OR `Classname` LIKE '%vault%' OR `Classname` LIKE '%box%');

But I miss here for example M240Nest_DZ or StickFence_DZ and so on.

I like my way, because only what I add to that line will be updated, nothing else, it is a little bit more work to find out what has to be add, but I am sure that there will no wrong item be updated.

 

Link to comment
Share on other sites

I don't know your admins, if they are good, they can delete everything in the database, if you have your code and this one is uniq it would take 1min to find you door. But if the trigger changed the code, they have to search it with the coordinates and that can take a little bit more.

 

We have made a sript, that the owner can remove his stuff by himself (ok for a door you have to unkock it first ;) ), two of our admins can remove everything in game ;) (also locked doors :D ). So I go (teleport) to that door and delete it, that's it ;).

But they can change the code to your wishes when they found the door in the database.
 

Link to comment
Share on other sites

http://dayzepoch.com/forum/index.php?/topic/1723-deconstruct-buildables/?p=24114

AND (Classname = 'WoodSmallWall_DZ' OR Classname = 'WoodSmallWallThird_DZ');[/php]

 

You have to add all the things what should not updated like this obove, I do it that way (I got 54 items in that line ;) ), you can try it also like BetterDeadThenZed tried: http://dayzepoch.com/forum/index.php?/topic/1723-deconstruct-buildables/?p=24172

[php](`Classname` LIKE '%wood%' OR `Classname` LIKE '%cinder%' OR `Classname` LIKE '%pole%') AND NOT (`Classname` LIKE '%Locked%' OR `Classname` LIKE '%vault%' OR `Classname` LIKE '%box%');

But I miss here for example M240Nest_DZ or StickFence_DZ and so on.

I like my way, because only what I add to that line will be updated, nothing else, it is a little bit more work to find out what has to be add, but I am sure that there will no wrong item be updated.

 

 

Thanks Nasdero. I will try it and make you a feedback.

Last question : Is it possible to got your trigger ?

Link to comment
Share on other sites

Since no one has managed to get returnable items from de-constructed parts, I have managed to do this myself. So far I've been working through manually and just returning the items it took to build each piece. (Slightly unrealistic I know).

This is a WIP so far and I'll be happy to release what I've written once a bit more testing has gone into it.

Has anyone got any better ways of getting returnable items from the modular parts since they don't have any pre-written tables to suggest the parts needed to construct them.

 

I've so far done most of the wooden wall/floor items, cinder walls/doors and metal floors. There are some other items that I've found to be non-removable once placed which I'd also like to take care of if possible.

 

I'm very interested in how you did this. Got anything to share? I'd be happy to supply you with with any missing removable or non-removable items/classnames you might have. 

Link to comment
Share on other sites

Never mind, I found my error. Works Perfectly! Many thanks and again love your work.

 

 

EDIT: NVM FIXED it

 

And do you like to share the solution with us? Do you know how a community works? :|

 

 

 

 

Edit: Okay found it:

 

You need to Change

	if(_isDestructable or _isWreck or _isRemovable or _isWreckBuilding) then {
if(_hasToolbox and "ItemCrowbar" in _itemsPlayer) then {
_player_deleteBuild = true;

to

	if(_isDestructable or _isWreck or _isRemovable or _isWreckBuilding) then {
if(_hasToolbox = "ItemCrowbar" in _itemsPlayer) then {
_player_deleteBuild = true;

because "ItemCrowbar" is the variable for _hasToolbox. But if i change this, i have no removeoption ingame and can´t speak to traders :|

Link to comment
Share on other sites

I'm very interested in how you did this. Got anything to share? I'd be happy to supply you with with any missing removable or non-removable items/classnames you might have. 

 

Sorry for my late reply, I've been pretty busy lately.

For my deconstruction and returning of parts I wrote the following code into my remove.sqf file.

You can probably expand on it and make more parts return items as they're not all listed there.

It also has the option to supply admin ID's so admin's can remove any deployed item in the game. (apart from camo netting which is impossible to remove...)

 

http://pastebin.com/xUmJjA0Z

 

I don't mind who uses my code but I'd appreciate credit where credit is due.

Let me know if you have any issues.

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Normally I would not share the whole trigger, cause I gave you guys all infos you needed and you should do a bit work by yourself, not only copy and paste, learning by doing ;)

Sure I can find a logic to make it shorter, but why? Here I am absolutly sure only the stuff in my trigger will be changed.But you have to add new items by your self.

 


DELIMITER ;
DROP TRIGGER IF EXISTS dayz_epoch.`update_owner`;
DELIMITER //
CREATE TRIGGER dayz_epoch.`update_owner`
AFTER INSERT ON dayz_epoch.character_data
FOR EACH ROW
BEGIN
UPDATE dayz_epoch.object_data SET CharacterID= NEW.CharacterID WHERE CharacterID IN
(SELECT CharacterID FROM player_login WHERE PlayerUID= NEW.PlayerUID)
AND (Classname = 'WoodSmallWall_DZ' OR Classname = 'WoodSmallWallThird_DZ' OR Classname = 'WoodLargeWall_DZ' OR Classname = 'Land_DZE_GarageWoodDoor' OR Classname = 'WoodLargeWallDoor_DZ' OR Classname = 'WoodSmallWallDoor_DZ' OR Classname = 'WoodStairs_DZ' OR Classname = 'WoodStairsSans_DZ' OR Classname = 'WoodSmallWallWin_DZ' OR Classname = 'WoodLargeWallWin_DZ' OR Classname = 'WoodShack_DZ' OR Classname = 'WoodRamp_DZ' OR Classname = 'WoodLadder_DZ' OR Classname = 'WoodFloor_DZ' OR Classname = 'WoodFloorQuarter_DZ' OR Classname = 'WoodFloorHalf_DZ' OR Classname = 'Wooden_shed_DZ' OR Classname ='Land_DZE_WoodDoor' OR Classname = 'Land_DZE_LargeWoodDoor' OR Classname = 'Land_DZE_GarageWoodDoor' OR Classname = 'CinderWall_DZ' OR Classname = 'CinderWallHalf_DZ' OR Classname = 'CinderWallDoorway_DZ' OR Classname = 'CinderWallDoor_DZ' OR Classname = 'CinderWallSmallDoorway_DZ' OR Classname = 'CinderWallDoorSmall_DZ' OR Classname = 'Plastic_Pole_EP1_DZ' OR Classname = 'TentStorage' OR Classname = 'TentStorageDomed' OR Classname = 'TentStorageDomed2' OR Classname = 'LightPole_DZ' OR Classname ='SandNest_DZ' OR Classname = 'MetalFloor_DZ' OR Classname = 'Hedgehog_DZ' OR Classname = 'Sandbag1_DZ' OR Classname = 'WoodGate_DZ' OR Classname = 'Land_HBarrier1_DZ' OR Classname = 'Land_HBarrier3_DZ' OR Classname = 'Fence_corrugated_DZ' OR Classname = 'M240Nest_DZ' OR Classname = 'CanvasHut_DZ' OR Classname = 'ParkBench_DZ' OR Classname = 'MetalGate_DZ' OR Classname = 'OutHouse_DZ' OR Classname = 'WoodShack_DZ' OR Classname = 'StorageShed_DZ' OR Classname = 'StickFence_DZ' OR Classname = 'DesertCamoNet_DZ' OR Classname = 'ForestCamoNet_DZ' OR Classname = 'DesertLargeCamoNet_DZ' OR Classname = 'ForestLargeCamoNet_DZ' OR Classname = 'DeerStand_DZ' OR Classname = 'MetalPanel_DZ' OR Classname = 'WorkBench_DZ' );
END
DELIMITER ;
Link to comment
Share on other sites

  • 3 weeks later...

Normally I would not share the whole trigger, cause I gave you guys all infos you needed and you should do a bit work by yourself, not only copy and paste, learning by doing ;)

Sure I can find a logic to make it shorter, but why? Here I am absolutly sure only the stuff in my trigger will be changed.But you have to add new items by your self.

 

I appreciate the help, but I'm getting this error when I submit this query in Navicat.

[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER' at line 9
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
×
×
  • Create New...