Cramps2 Posted April 12, 2014 Report Share Posted April 12, 2014 Hi folks, I on my server and really liked it. Here's the sql event I used: DROP EVENT IF EXISTS resetVaults; CREATE EVENT resetVaults ON SCHEDULE EVERY 1 DAY COMMENT 'Sets safe codes to 0000 if not accessed for 14 days' DO UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `CharacterID` > 0 AND `Classname` IN ('VaultStorageLocked') AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL I thought it would be nice to add a mission to reveal the location of abandoned safes so players can fight over them :D This script does that, just add abandonedvaults.sqf (code below) to your server pbo (dayz_server/modules). // Abandoned player safe mission by Cramps (zfclan.org/forum) // Needs an SQL event set up to turn abandoned vault codes to 0000 private ["_rndvault","_curvaultcode","_curvault","_vaultarray","_numvaults","_allvaults","_spawnChance", "_spawnMarker", "_spawnRadius", "_markerRadius", "_item", "_debug", "_start_time", "_loot", "_loot_amount", "_loot_box", "_wait_time", "_spawnRoll", "_position", "_event_marker"]; // First chack if there is a vault available, no point running if not diag_log ("Checking vaults..."); _allvaults = (allmissionobjects "VaultStorageLocked"); _numvaults = (count _allvaults); _vaultarray = []; for "_i" from 0 to _numvaults do { _curvault = _allvaults select _i; _curvaultcode = _curvault getVariable "CharacterID"; if (_curvaultcode == "0000" ) then { _vaultarray = _vaultarray + [_curvault]; }; }; _numvaults = (count _vaultarray); diag_log ("Total open vaults on server: " + str(_numvaults)); // Exit if no safes if (_numvaults == 0) exitWith {}; _rndvault = _vaultarray select (floor (random (count _vaultarray))); _position = getPos _rndvault; diag_log ("Location of randomly picked 0000 vault = " + str(_position)); // Main epoch mission stuff _spawnChance = 0.20; // Percentage chance of event happening _markerRadius = 150; // Radius the loot can spawn and used for the marker _wait_time = 900; _start_time = time; _debug = false; // Ignores the random chance and runs every time. if (isNil "EPOCH_EVENT_RUNNING") then { EPOCH_EVENT_RUNNING = false; }; // Check for another event running if (EPOCH_EVENT_RUNNING) exitWith { diag_log("Event already running"); }; // Random chance of event happening _spawnRoll = random 1; if (_spawnRoll > _spawnChance and !_debug) exitWith {}; // Draw markers & tell players _event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _position]; _event_marker setMarkerShape "ELLIPSE"; _event_marker setMarkerColor "ColorKhaki"; _event_marker setMarkerSize [(_markerRadius + 100), (_markerRadius + 100)]; _event_marker2 = createMarker [ format ["loot_event_marker_%2", _start_time], _position]; _event_marker2 setMarkerShape "ICON"; _event_marker2 setMarkerType "mil_dot"; _event_marker2 setMarkerColor "ColorBlack"; _event_marker2 setMarkerText "Abandoned Survivor Safe"; if (_debug) then { _debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _position]; _debug_marker setMarkerShape "ICON"; _debug_marker setMarkerType "mil_dot"; _debug_marker setMarkerColor "ColorBlack"; _debug_marker setMarkerAlpha 1; }; [nil,nil,"per",rTITLETEXT,"It's rumored there is a survivor safe lost with 0000 as it's code. Go find it!","PLAIN DOWN"] call RE; diag_log(format["Loot event setup, waiting for %1 seconds", _wait_time]); // Wait sleep _wait_time; // Clean up EPOCH_EVENT_RUNNING = false; deleteMarker _event_marker; deleteMarker _event_marker2; Just add it as a mission in the init.sqf the same as you would any other, here's an example: EpochEvents = [["any","any","any","any",30,"abandonedvault"],["any","any","any","any",30,"crash_spawner"],["any","any","any","any",0,"crash_spawner"],["any","any","any","any",15,"supply_drop"],["any","any","any","any",22,"Military"],["any","any","any","any",37,"Treasure"],["any","any","any","any",7,"Supplyitems"],["any","any","any","any",52,"Construction"]]; I just added ["any","any","any","any",30,"abandonedvault"], to the line, it gets called at half past the hour every hour. The script checks for empty vaults, if there are some and the percent chance test is passed, it will spawn a marker on the map revealing the location. Enjoy! CartoonrBOY, MGT, MatthewK and 1 other 4 Link to comment Share on other sites More sharing options...
Tommy Sunshine Posted May 13, 2014 Report Share Posted May 13, 2014 This works like a charm! The only thing I have a problem with is the issue of a base being around the safe with my indestructible no maintenance server. I have to doors set to destructible now but I guess the doors which were built when I still had the doors set as indestructible are still that way. I need to have combo locks reset on 30 days as well but I realize there are like what 6 different checks for different doors with combo locks? I could probably figure it out just haven't spent the time yet.. Thanks for the great idea and script though! LOVE IT! Link to comment Share on other sites More sharing options...
Genesis Posted May 17, 2014 Report Share Posted May 17, 2014 awesome !!! Link to comment Share on other sites More sharing options...
KamikazeXeX Posted May 18, 2014 Report Share Posted May 18, 2014 Now to wait for some safes that are 2 weeks old :P this is probably the most awesome mission i've seen xD Link to comment Share on other sites More sharing options...
malamuc Posted May 21, 2014 Report Share Posted May 21, 2014 Hi folks, I on my server and really liked it. Here's the sql event I used: DROP EVENT IF EXISTS resetVaults; CREATE EVENT resetVaults ON SCHEDULE EVERY 1 DAY COMMENT 'Sets safe codes to 0000 if not accessed for 14 days' DO UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `CharacterID` > 0 AND `Classname` IN ('VaultStorageLocked') AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL can anybody tell me how to add this to sql events? i'm trying to add via navicat "funcions". is it right? Link to comment Share on other sites More sharing options...
Oshydaka Posted May 21, 2014 Report Share Posted May 21, 2014 No no, just run the code as a standard mysql query Link to comment Share on other sites More sharing options...
MGT Posted May 21, 2014 Report Share Posted May 21, 2014 Nice mission :) You can also unlock vaults using a MySQL procedure (edit, ive removed datestamp as there can be issues when vaults are packed and re-placed with the dates screwing up, hence I only use lastupdated) UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `CharacterID` > 0 AND `Classname` = ('VaultStorageLocked') AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL Link to comment Share on other sites More sharing options...
shaundibble69 Posted May 26, 2014 Report Share Posted May 26, 2014 struggling to get this running, should it be EpochEvents = [["any","any","any","any",30,"abandonedvault],["any","any","any","any",30,"crash_spawner"],["any","any","any","any",0,"crash_spawner"],["any","any","any","any",15,"supply_drop"],["any","any","any","any",22,"Military"],["any","any","any","any",37,"Treasure"],["any","any","any","any",7,"Supplyitems"],["any","any","any","any",52,"Construction"]]; abandonedvault or abandonedvaults as the file i created and added to the modules folder was abondedvaults.sqf. MGT - this is an awesome mission by the way, thank you in advance for your help EDIT Ignore me got it working and its awesome just changed to abondonedvaults (init.sqf) and works flawlessly, awesome mission and thank you MGT Link to comment Share on other sites More sharing options...
Raptoruk Posted June 19, 2014 Report Share Posted June 19, 2014 copy and pasted the sql into my databases sql input, hit go and it just underlined many words in red it didn't seem to like, am I being thick or can someone help pls ? didn't get chance to input the abdonedvaults sqf as the above part seemed to have failed regards Link to comment Share on other sites More sharing options...
stonXer Posted June 19, 2014 Report Share Posted June 19, 2014 Sweet thanks, works awesome, have set it to 1 day after the bases despawn :) Link to comment Share on other sites More sharing options...
Kimzer Posted June 27, 2014 Report Share Posted June 27, 2014 Any updates for 1.0.5.1 ? Getting errors 3:34:37 Error in expression <_name = name _target; deleteMarker MH_marker; deleteMarker MH_shade; > 3:34:37 Error position: <MH_marker; deleteMarker MH_shade; > 3:34:37 Error Undefined variable in expression: mh_marker 3:35:05 "RUNNING EVENT: Abandonedsafe on [2014,6,27,13,35]" 3:35:05 "Checking vaults..." 3:35:05 Error in expression <= _allvaults select _i; _curvaultcode = _curvault getVariable "CharacterID"; if > 3:35:05 Error position: <_curvault getVariable "CharacterID"; if > 3:35:05 Error Undefined variable in expression: _curvault 3:35:05 File z\addons\dayz_server\modules\Abandonedsafe.sqf, line 16 Link to comment Share on other sites More sharing options...
mat2k Posted July 3, 2014 Report Share Posted July 3, 2014 same here Link to comment Share on other sites More sharing options...
mat2k Posted July 5, 2014 Report Share Posted July 5, 2014 bump Link to comment Share on other sites More sharing options...
Guest Posted July 6, 2014 Report Share Posted July 6, 2014 jeah well thats the 112555 beta patch, im just running my server with parameter -noLogs so errors wont log. because these undefined variable most times dont mean that the script doesnt work ... Link to comment Share on other sites More sharing options...
Guest Posted July 6, 2014 Report Share Posted July 6, 2014 as far as the safe reset stuff goes there must be a possibility to let the server unlock them automatically, you would need to check the vaults when they spawn in and call the unlock action or something, should be possible Link to comment Share on other sites More sharing options...
Cramps2 Posted July 6, 2014 Author Report Share Posted July 6, 2014 Nice mission :) You can also unlock vaults using a MySQL procedure (edit, ive removed datestamp as there can be issues when vaults are packed and re-placed with the dates screwing up, hence I only use lastupdated) UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `CharacterID` > 0 AND `Classname` = ('VaultStorageLocked') AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL Wish I'd noticed this earlier, was getting some weirdness as described so took it off my server and didn't get the chance to look into why some safes were getting abandoned early. I'm going to add this version of the SQL and update the code for 1051. Watch this space! Link to comment Share on other sites More sharing options...
mat2k Posted July 6, 2014 Report Share Posted July 6, 2014 Very nice, i look forward to this... Link to comment Share on other sites More sharing options...
Stranger Posted July 21, 2014 Report Share Posted July 21, 2014 Does this work on 1.0.5.1? Link to comment Share on other sites More sharing options...
PeterBeer Posted July 21, 2014 Report Share Posted July 21, 2014 Does this work on 1.0.5.1? I wanna know this too :) Link to comment Share on other sites More sharing options...
Cramps2 Posted July 21, 2014 Author Report Share Posted July 21, 2014 I wanna know this too :) Install it lol :D Then tell me! I will get around to putting this back on my server, my players want it back. Link to comment Share on other sites More sharing options...
Millasaurus Posted July 23, 2014 Report Share Posted July 23, 2014 Does this work on 1.0.5.1? Yes it does. If you're on 112555 it'll throw some undefined variable errors every time it runs, but nothing to worry about, it still works. MGT 1 Link to comment Share on other sites More sharing options...
Tricks Posted July 31, 2014 Report Share Posted July 31, 2014 I can't get this running on 125548, missions don't pop up, safes don't change their combos to 0000. Anyone got this running on the latest patches? Maybe you can post what you have? Link to comment Share on other sites More sharing options...
Stranger Posted July 31, 2014 Report Share Posted July 31, 2014 I got this running - everything works pretty fine. The filename is different then the events name in the first topic. That is why it may does not work for you. Name the file exact as you named the event. Link to comment Share on other sites More sharing options...
Tricks Posted July 31, 2014 Report Share Posted July 31, 2014 I got this running - everything works pretty fine. The filename is different then the events name in the first topic. That is why it may does not work for you. Name the file exact as you named the event. Do you mean the "s" at the end of "abandonedvault.sqf"? Link to comment Share on other sites More sharing options...
PeterBeer Posted July 31, 2014 Report Share Posted July 31, 2014 Two Questions : 1) _spawnChance = 0.99; if I put this too _spawnChance = 1; will it be the highest rate of spawning ? I got this running - everything works pretty fine. The filename is different then the events name in the first topic. That is why it may does not work for you. Name the file exact as you named the event. 2) So I name this like this ? ["any","any","any","any",30,"abandonedvaults"] Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now