Jump to content

Player Safe Reset Mission


Recommended Posts

Im trying to just use an event, forget the mission, to reset the safe codes AND lockbox codes. Ive tried this query

UPDATE FROM `object_data`
WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY)
AND `CharacterID` > 0
AND `Classname` LIKE '%vault%' OR Classname LIKE '%box%'
AND `Inventory` IS NOT NULL

When I use

Select * FROM `object_data`

to test it, it returns lock boxes that have a last updated entry from today.. any ideas?

 

I think I fixed this by changing it like so

UPDATE `object_data` 
SET `CharacterID` = 0 
WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) 
AND `CharacterID` > 0 
AND `Classname` IN ('VaultStorageLocked','LockboxStorageLocked')  
AND `Inventory` <> '[]' 
AND `Inventory` IS NOT NULL
Link to comment
Share on other sites

I use these Events with this mission working really good

 

CREATE EVENT unlockAbandonedVehicles
    ON SCHEDULE EVERY 1 DAY
    DO
      UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 7 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 7 DAY) AND `CharacterID` > 0 AND `Classname` NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage')  AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL
;
CREATE EVENT deleteAbandonedVehicles
    ON SCHEDULE EVERY 1 DAY
    DO
      DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `CharacterID` > 0 AND `Classname` NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage')  AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL
;
CREATE EVENT unlockAbandonedSafes
    ON SCHEDULE EVERY 1 DAY
    DO
      UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 30 DAY) AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL
;
CREATE EVENT deleteAbandonedSafes
    ON SCHEDULE EVERY 1 DAY
    DO
      DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 28 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 30 DAY) AND `CharacterID` > 0 AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL
;

Link to comment
Share on other sites

  • 2 weeks later...

need to test

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"];

diag_log ("Checking vaults...");
_allvaults = (allmissionobjects "VaultStorageLocked") + (allmissionobjects "LockboxStorageLocked");
_vaultarray = [];
{
	_curvault = _x;
	_curvaultcode = parseNumber (_curvault getVariable "CharacterID");
	if (_curvaultcode == 0 ) then {
		_vaultarray = _vaultarray + [_curvault];
		};
}forEach _allvaults;

_numvaults = (count _vaultarray);
diag_log ("Total open vaults on server: " + str(_numvaults));

if (_numvaults == 0) exitWith {};
_counter = 0;

{
if(_counter < 5)then{
_position = getPos _x;
_markerRadius = 250; 
_iPosX = _position select 0;
_iPosY = _position select 1;
_positionOffset = Random(_markerRadius);
_randomMath = Random(4);
if (_randomMath < 1 ) then {
 _randomPosition = [_iPosX - _positionOffset,_iPosY - _positionOffset,0 ];
} else {
	if (_randomMath < 2 ) then {
		_randomPosition = [_iPosX + _positionOffset,_iPosY + _positionOffset,0 ];
	} else{
		if (_randomMath < 3 ) then {
			_randomPosition = [_iPosX - _positionOffset,_iPosY + _positionOffset,0 ];
		} else {
			_randomPosition = [_iPosX + _positionOffset,_iPosY - _positionOffset,0 ];
		};
	};
};
_event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _randomPosition];
_event_marker setMarkerShape "ELLIPSE";
_event_marker setMarkerColor "Color4_FD_F";
_event_marker setMarkerSize [_markerRadius, _markerRadius];
_event_marker setMarkerText "Abandoned Safe: 0000";
/*
_event_marker2 = createMarker [ format ["loot_event_marker_%2", _start_time], _position];
_event_marker2 setMarkerShape "ICON";
_event_marker2 setMarkerType "mil_dot";
_event_marker2 setMarkerColor "ColorBlack";
*/
_counter = _counter + 1;
};
}forEach _vaultarray;
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
Bandit i tested your event

 

it threw undefined variable erros but its easy fix

it needs to be defined

_start_time

_randomPosition

 

once i defined it worked with the exception of 

_event_marker setMarkerText "Abandoned Safe: 0000";

the text doesn't show on the marker

and your color for the marker is misspelled or it doesn't exist

 

its been a while but hope you can still work on it, the random location inside the marker is awesome.

Link to comment
Share on other sites

  On 5/26/2015 at 7:10 AM, SmokeyBR said:

Bandit i tested your event

 

it threw undefined variable erros but its easy fix

it needs to be defined

_start_time

_randomPosition

 

once i defined it worked with the exception of 

_event_marker setMarkerText "Abandoned Safe: 0000";

the text doesn't show on the marker

and your color for the marker is misspelled or it doesn't exist

 

its been a while but hope you can still work on it, the random location inside the marker is awesome.

 

 

How defined? :

 

_start_time

_randomPosition

Link to comment
Share on other sites

hey legit players having fun at the "expenses" of cheaters, why not ?

 

ofc is not perfect a player that just started could end up having thousands of briefcases but it gives a different dynamic on "kill bots take loots" but not enough people interested in it, it seems.

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

To fix the bug:  Error in expression <curvault getVariable "CharacterID";

Change:

for "_i" from 0 to _numvaults do {
	_curvault = _allvaults select _i;
	_curvaultcode = _curvault getVariable "CharacterID";
	if (_curvaultcode == "0000" ) then {
		_vaultarray = _vaultarray + [_curvault];
		};
};

To:

{
_curvaultcode = (_x getVariable ["CharacterID","0"]);
    if (_curvaultcode == "0000" ) then {
        _vaultarray = _vaultarray + [_x];
        };
} forEach (allmissionobjects "VaultStorageLocked");
	
Link to comment
Share on other sites

  • 3 months later...
  On 11/14/2016 at 5:37 PM, TheCloud said:

To fix the bug:  Error in expression <curvault getVariable "CharacterID";

Change:

for "_i" from 0 to _numvaults do {
	_curvault = _allvaults select _i;
	_curvaultcode = _curvault getVariable "CharacterID";
	if (_curvaultcode == "0000" ) then {
		_vaultarray = _vaultarray + [_curvault];
		};
};

To:

{
_curvaultcode = (_x getVariable ["CharacterID","0"]);
    if (_curvaultcode == "0000" ) then {
        _vaultarray = _vaultarray + [_x];
        };
} forEach (allmissionobjects "VaultStorageLocked");
	
Expand  

I wanne run this event on epoch 1.0.6, but I get this error again:

  Quote

 1:15:07 Error in expression <["CharacterID","0"]);
if (_curvaultcode == "0000" ) then {
_vaultarray = _vaulta>
 1:15:07   Error position: <== "0000" ) then {
_vaultarray = _vaulta>
 1:15:07   Error Allgemeiner Fehler in Ausdruck
 1:15:07 File z\addons\dayz_server\modules\abandonedvaults.sqf, line 16

Expand  

 

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...

works in 1061 with no errors - if my memory is correct the error happens if there is no 0000 safe

17:55:06 "RUNNING EVENT: 0000safe on [2017,7,18,12,55]"
17:55:06 "Checking vaults..."
17:55:06 "Total open vaults on server: 17"
17:55:06 "Location of randomly picked 0000 vault = [8864.98,15135.8,0.000671387]"
17:55:06 "Loot event setup, waiting for 900 seconds"

  Reveal hidden contents

 

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...