Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- File: spawncrates.sqf
- Author: NedFox [TZW]
- Description: Custom Crates, randomly placed around a marker which is visible (or not).
- */
- if (!isServer) exitWith {};
- _numberofcrates = 6; // this is the number of crates that you want to spawn
- _world = (toLower worldName);
- _middle = worldSize/2;
- _spawnCenter = [_middle,_middle,0];
- _max = _middle - 100;
- switch (toLower worldName) do
- {
- case "altis":
- {
- _spawnCenter = [15834.2,15787.8,0];
- _max = 16000;
- };
- case "chernarus":
- {
- _spawnCenter = [7652.9634, 7870.8076,0];
- _max = 7500;
- };
- case "taviana":
- {
- _spawnCenter = [12800, 12800,0];
- _max = 12800;
- };
- };
- diag_log format['[waterCrates] worldname: %1 Centre: %2 radius: %3',_world,_spawnCenter,_max];
- _min = 0; // minimum distance from the center position (Number) in meters
- _mindist = 5; // minimum distance from the nearest object (Number) in meters, ie. spawn at least this distance away from anything within x meters..
- _water = 2; // water mode (Number) 0: cannot be in water , 1: can either be in water or not , 2: must be in water
- _shoremode = 0; // 0: does not have to be at a shore , 1: must be at a shore
- _marker = True; // Draw a green circle in which the crate will be spawned randomly
- _markersize = 100; // Radius of the marker in meters
- private['_position'];
- diag_log format['[waterCrates] Starting @ %1',time];
- for "_i" from 1 to _numberofcrates do
- {
- _validspot = false;
- while{!_validspot} do
- {
- sleep 1;
- _position = [_spawnCenter,_min,_max,_mindist,_water,2000,_shoremode] call BIS_fnc_findSafePos;
- _validspot = true;
- //Check if near another crate
- // Get nearest CargoNet_01_box_F
- _nearOtherCrate = (nearestObjects [_position,["CargoNet_01_box_F"],750]) select 0;
- if (!isNil "_nearOtherCrate") then
- {
- _nearestCrate = _position distance _nearOtherCrate;
- if (_nearestCrate < 750) then
- {
- _validspot = false;
- };
- };
- //Check if near player base
- // Get nearest Exile_Construction_Flag_Static
- _nearBase = (nearestObjects [_position,["Exile_Construction_Flag_Static"],750]) select 0;
- if (!isNil "_nearBase") then
- {
- _nearestBase = _position distance _nearBase;
- if (_nearestBase < 750) then
- {
- _validspot = false;
- };
- };
- };
- if (_marker) then
- {
- _event_marker = createMarker [ format ["loot_marker_%1", _i], _position];
- _event_marker setMarkerColor "ColorGreen";
- _event_marker setMarkerAlpha 1;
- _event_marker setMarkerText "Gear Crate";
- _event_marker setMarkerType "loc_Tree";
- _event_marker setMarkerBrush "Vertical";
- _event_marker setMarkerSize [(3), (3)];
- };
- diag_log format['Spawncrate %1 : Location %2',_i,_position];
- //Infantry spawns using the DMS
- _AICount = 1 + (round (random 2));
- _spawnPosition = [_position select 0, _position select 1, 0];
- _group = [_spawnPosition, _AICount, "random", "random", "bandit"] call DMS_fnc_SpawnAIGroup;
- _group setVariable ["DMS_LockLocality",nil];
- _group setVariable ["DMS_SpawnedGroup",true];
- _group setVariable ["DMS_Group_Side", "bandit"];
- [_group, _spawnPosition, 100] call bis_fnc_taskPatrol;
- _group setBehaviour "STEALTH";
- _group setCombatMode "RED";
- diag_log text format ["[waterCrates]: Creating crate drop zone %1 with %2 guards",_spawnPosition,_AICount];
- _box = "CargoNet_01_box_F" createvehicle _position;
- clearMagazineCargoGlobal _box;
- clearWeaponCargoGlobal _box;
- clearItemCargoGlobal _box;
- _box setVariable ["permaLoot",true]; //stay until reset
- _box allowDamage false; // Prevent boxes to explode when spawning
- _box addItemCargoGlobal ["Exile_Item_DuctTape", 2 + (random 2)];
- _box addItemCargoGlobal ["Exile_Item_JunkMetal", (random 8)];
- _box addItemCargoGlobal ["Exile_Item_MetalPole", (random 7)];
- _box addMagazineCargoGlobal ["ClaymoreDirectionalMine_Remote_Mag", (random 2)];
- _box addItemCargoGlobal ["Exile_Item_WoodFloorKit", 2 + (random 10)];
- _box addItemCargoGlobal ["Exile_Item_WoodPlank", 20 + (random 10)];
- _box addItemCargoGlobal ["Exile_Item_WoodWallKit", (random 7)];
- _box addItemCargoGlobal ["Exile_Item_InstaDoc", 1 + (random 2)];
- _box addItemCargoGlobal ["Exile_Item_FortificationUpgrade", (random 4)];
- _box addItemCargoGlobal ["Exile_Item_BBQSandwich_Cooked", 1 + (random 4)];
- _box addItemCargoGlobal ["Exile_Item_Energydrink", 1 + (random 3)];
- _box addWeaponCargoGlobal ["srifle_LRR_camo_F", (random 1)];
- _box addWeaponCargoGlobal ["srifle_mas_ksvk_c", (random 1)];
- _box addWeaponCargoGlobal ["srifle_mas_m107", (random 1)];
- _box addWeaponCargoGlobal ["arifle_SDAR_F", 1 + (random 1)];
- _box addMagazineCargoGlobal ["20Rnd_556x45_UW_mag",3 + (random 5)];
- _box addMagazineCargoGlobal ["SatchelCharge_Remote_Mag", (random 1)];
- _box addItemCargoGlobal ["Exile_Item_Bandage", 1 + (random 5)];
- _box addMagazineCargoGlobal ["150Rnd_93x64_Mag", (random 2)];
- _box addMagazineCargoGlobal ["130Rnd_338_Mag", (random 2)];
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement