TMHackSaW

Loot Crates

6 posts in this topic

Hello Guys!!!

Does anyone of you can tell me if it is possible to put a loot crate in an area and these to be refill every restart. 

I wan to do a custom mission and it will be the reward. 

Thanks in advance. :D

Share this post


Link to post
Share on other sites

I use some of the files in a3_custom.pbo in server side. For example: to call boxes in fn_init.sqf register call compile preprocessFileLineNumbers "\ x \ addons \ a3_custom \ spawncrates.sqf";

if (isServer) then {

_numberofcrates = 1; 
_spawnCenter = [13510,3297,0]; 
//_spawnCenter = getmarkerpos "center"; // Use this if you want the global center of the map, it's declared in mission.sqm, island specific

_min = 1; // minimum distance from the center position (Number) in meters

//_max = 12000; // maximum distance from the center position (Number) in meters
 _max = 4; // Example : maximum range of spawned crates, to keep them INSIDE the sector B compound

_mindist = 1; // minimum distance from the nearest object (Number) in meters, ie. spawn at least this distance away from anything within x meters..
_water = 0; // 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 = 50; // Radius of the marker in meters

diag_log format['Starting spawncrates.sqf'];

for "_i" from 1 to _numberofcrates do
  {
    _pos = [_spawnCenter,_min,_max,_mindist,_water,800,_shoremode] call BIS_fnc_findSafePos; // find a random location within range

    if (_marker) then {
        _event_marker = createMarker [ format ["loot_marker_%1", _i], _pos];
        _event_marker setMarkerShape "ELLIPSE";
        _event_marker setMarkerColor "ColorBlue";
        _event_marker setMarkerAlpha 0.45;
        _event_marker setMarkerSize [(_markersize+15), (_markersize+15)]; //green circle slightly bigger , box can spawn just outside if not increased
        _pos = [_pos,0,_markersize,0,_water,800,_shoremode] call BIS_fnc_findSafePos;  //find a random spot INSIDE the marker area
        _pos = [_pos select 0, _pos select 1, 0];
    };    

    diag_log format['Spawncrate %1 : Location %2',_i,_pos];

    _box = "O_CargoNet_01_ammo_F" createvehicle _pos;   //create the crate  .. These ARE liftable with chopper like the CH-67 , but will not stay after restarts !
   
    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", 4 + (random 2)];  // between 4-6
    _box addItemCargoGlobal ["Exile_Item_JunkMetal", 10 + (random 10)]; // between 10-20
    _box addItemCargoGlobal ["Exile_Item_MetalPole", 8 + (random 7)]; // between 8-15
  //...bla,bla,bla...
    _box addMagazineCargoGlobal ["ClaymoreDirectionalMine_Remote_Mag", (random 5)];
    
  }
};

Share this post


Link to post
Share on other sites
Advertisement

Thank for this . So I can find the file in a3_custom.pbo?  Or do I have to create one file spawncrates.sqf and call it from init.

just to be clear. 

 

Share this post


Link to post
Share on other sites
On 10/13/2015 at 4:26 AM, TMHackSaW said:

Thank for this . So I can find the file in a3_custom.pbo?  Or do I have to create one file spawncrates.sqf and call it from init.

just to be clear. 

 

Did u ever figure out how to call it ?

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.