Jump to content

Trade Loot Event


Recommended Posts

This uses the Dayz Mission to call the AI, what I did was copied and rename one of the addunit.sqf's then edited the loadouts to suit myself.

private ["_spawnChance", "_spawnMarker", "_spawnRadius", "_markerRadius", "_item", "_debug", "_start_time", "_loot", "_loot_amount", "_loot_box", "_wait_time", "_spawnRoll", "_loot_pos", "_event_marker", "_loot_pos", "_debug_marker","_loot_box", "_hint"];

_spawnChance =  100; // Percentage chance of event happening
_markerRadius = 500; // Radius the loot can spawn and used for the marker
_debug = false; // Puts a marker exactly were the loot spawns

_loot_box = "TKVehicleBox_EP1";
_loot_lists = [[[""],["MortarBucket","MortarBucket","MortarBucket","MortarBucket","MortarBucket","MortarBucket","MortarBucket","MortarBucket","MortarBucket","MortarBucket","PartWoodPlywood","PartWoodPlywood","PartWoodPlywood","PartWoodPlywood","PartWoodPlywood","PartWoodLumber","PartWoodLumber","PartWoodLumber","PartWoodLumber","PartWoodLumber","PartWoodLumber","ItemCorrugated","ItemCorrugated","ItemCorrugated","ItemCorrugated","ItemCorrugated","ItemCorrugated","ItemWire","ItemWire","ItemWire","ItemWire","ItemWire","ItemSandbag","ItemSandbag","ItemSandbag","ItemSandbag","ItemSandbag","ItemSandbag","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks","CinderBlocks","ItemWire","ItemWire","ItemWire","ItemWire","ItemWire","ItemSandbag","ItemSandbag","ItemSandbag","ItemSandbag","ItemSandbag","ItemSandbag","30m_plot_kit","ItemGenerator"]]];
_loot = _loot_lists call BIS_fnc_selectRandom;

_loot_amount = 75;
_wait_time = 900; 

// Dont mess with theses unless u know what yours doing
_start_time = time;
_spawnRadius = 5000;
_spawnMarker = 'center';

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 {};

// Random location
_loot_pos = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;

diag_log(format["Spawning loot event at %1", _loot_pos]);

_event_marker = createMarker [ format ["loot_event_marker_%1", _start_time], _loot_pos];
_event_marker setMarkerShape "ELLIPSE";
_event_marker setMarkerColor "ColorBlue";
_event_marker setMarkerAlpha 0.5;
_event_marker setMarkerSize [(_markerRadius + 75), (_markerRadius + 75)];

_loot_pos = [_loot_pos,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;

if (_debug) then {
	_debug_marker = createMarker [ format ["loot_event_debug_marker_%1", _start_time], _loot_pos];
	_debug_marker setMarkerShape "ICON";
	_debug_marker setMarkerType "mil_dot";
	_debug_marker setMarkerColor "ColorBlue";
	_debug_marker setMarkerAlpha 1;
};

diag_log(format["Creating ammo box at %1", _loot_pos]);

// Create ammo box
_loot_box = createVehicle [_loot_box,_loot_pos,[], 0, "NONE"];
clearMagazineCargoGlobal _loot_box;
clearWeaponCargoGlobal _loot_box;

//Spawn AI

_aispawn = [_loot_pos,80,6,6,1] execVM "\z\addons\dayz_server\missions\add_unit_server_event.sqf";//AI Guards
sleep 5;
_aispawn = [_loot_pos,80,6,6,1] execVM "\z\addons\dayz_server\missions\add_unit_server_event.sqf";//AI Guards
sleep 5;
_aispawn = [_loot_pos,40,4,4,1] execVM "\z\addons\dayz_server\missions\add_unit_server_event.sqf";//AI Guards
sleep 5;
_aispawn = [_loot_pos,40,4,4,1] execVM "\z\addons\dayz_server\missions\add_unit_server_event.sqf";//AI Guards
sleep 5;

// Cut the grass around the loot position
_clutter = createVehicle ["ClutterCutter_small_2_EP1", _loot_pos, [], 0, "CAN_COLLIDE"];
_clutter setPos _loot_pos;
// cut the grass    end

// Add loot
{
_loot_box addWeaponCargoGlobal [_x,1];
} forEach (_loot select 0);
{
_loot_box addMagazineCargoGlobal [_x,1];
} forEach (_loot select 1);

// Send message to users
[nil,nil,rTitleText,"**Priority BLUE** - A supply crate has fell off the back of a lorry, and has been located within the shaded area on the map, you have 15 minutes to secure the crate.", "PLAIN",10] call RE;
[nil,nil,rGlobalRadio,"**Priority BLUE** - A supply crate has fell off the back of a lorry, and has been located within the shaded area on the map, you have 15 minutes to secure the crate."] call RE;
[nil,nil,rHINT,"**Priority BLUE** - A supply crate has fell off the back of a lorry, and has been located within the shaded area on the map, you have 15 minutes to secure the crate."] call RE;

diag_log(format["Loot event setup, waiting for %1 seconds", _wait_time]);

// Wait
sleep _wait_time;

// Clean up
EPOCH_EVENT_RUNNING = false;
deleteVehicle _loot_box;
deleteMarker _event_marker;
if (_debug) then {
	deleteMarker _debug_marker;
};

// Send message to users 
[nil,nil,rTitleText,"The Supply Crate is gone and everything that was around is gone with it. You missed your chance.", "PLAIN",10] call RE;
[nil,nil,rGlobalRadio,"The Supply Crate is gone and everything that was around is gone with it. You missed your chance."] call RE;
[nil,nil,rHINT,"The Supply Crate is gone and everything that was around is gone with it. You missed your chance."] call RE;

Works like a charm but pops an error up when the event is triggerred.

 

In the rpt the error is 

Warning Message: No entry 'bin\config.bin/CfgWeapons.'.

Anyone any ideas what could be causing this error?

Link to comment
Share on other sites

  • 7 months later...

i see this topic is old, but i answer this for everyone with this problem

 

change this:

_loot_lists = [[[""],["MortarBucket","MortarBucket","Mortar............

to this:

_loot_lists = [[[],["MortarBucket","MortarBucket","Mortar..............

you must remove the "" in the weapon slot or the system searching a weapon with the name "nothing"

Link to comment
Share on other sites

  • 1 year later...

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
  • Discord

×
×
  • Create New...