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

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 14.11.2016 at 6: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");
	

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

 

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
2 hours ago, DAmNRelentless said:

He said that this script already exists for 1.0.6.1

I have not seen it for 1.0.6.1 my players liked it on 1.0.5.1 kinda added a new mission the way it marks unlocked safes. Never thought about updating since I have base raiding and safe raiding now.

Link to comment
Share on other sites

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"

Spoiler

// 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 = [];
_curvault = 0;
{
_curvaultcode = (_x getVariable ["CharacterID","0"]);
    if (_curvaultcode == "0000" ) then {
        _vaultarray = _vaultarray + [_x];
        };
} forEach (allmissionobjects "VaultStorageLocked");

_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.50; // Percentage chance of event happening
_markerRadius = 150; // Radius the loot can spawn and used for the marker
_wait_time = 900; 
_start_time = time;
_debug = true; // 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 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;
};

RemoteMessage = ["radio","There is a safe with 0000 as it's code. Check your map!"];
publicVariable "RemoteMessage";

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;

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

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