Tuna

Underwater Crate Script

31 posts in this topic

Here is a script i am using to have crates spawn under water. These crates only spawn once per restart. I take no credit for this script, i only modified it. You will need R3F Tow script enabled to be able to pick up the crate underwater. The crate class name i am using is Box_NATO_Wps_F.

Add this to your init.sqf 

[] execVM "watercrate.sqf";

Then create an sqf called watercrate.sqf and add that file to your mpmission folder.

//All CREDIT GOES TO ORGINAL OWNERS AND MODIFIERS//
//Random Loot Crates by Darth_Rogue & Chisel (tdwhite)  
//HUGE thanks to deadeye & Robio for helping work out the last bugs!
//////////////////////////////////////////////////////////////////////
// Modified by Tuna to only spawn in water on out skirts of map


//watercrate.sqf

if (isServer) then {
_numberofcrates = 5;  //  Number of crates around the map
_spawnCenter = [15199.1,14300.6,0]; 
//_spawnCenter = getmarkerpos "center"; // Use this if you want the global center of the map, it's declared in mission.sqm, island specific

_min = 7000; // 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 = 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

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 setMarkerBrush "Solid";
        _event_marker setMarkerColor "ColorRed";
        _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 select 0, _pos select 1, 0];
    };    

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

    _box = "Box_NATO_Wps_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
     // Add items to the crate        Ex. 2 + random 2 = possible 4   ///  random 8 possible 1-8 items 
    _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)];


	
    
  }
};

Have fun watching players dive 500m under water to get loot!

I would like to add AI with SDAR at the crates, if anyone can help with that let me know. 

Edited by Tuna
2 people like this

Share this post


Link to post
Share on other sites

Get u even open inventory underwater? I thought this was a setting that needed to be enabled somewhere?

Share this post


Link to post
Share on other sites
Advertisement

No you cannot hence the R3F tow script needed to be enabled. Then load it into a boat and away you go.

Share this post


Link to post
Share on other sites

good script man all that needs changing for exile without other mods is the guns and mags otherwise works on my test server 

Edited by hogansheroes

Share this post


Link to post
Share on other sites
3 hours ago, Tuna said:

 

Have fun watching players dive 500m under water to get loot!

 

 

Share this post


Link to post
Share on other sites

lol john thats the fun of it, to see whos mad enough to dive that far down but if they get wetsuit and redreather they are sweet.

also they are random spawns at restart, so i added 10 location with only 7 possible loots .

i would like it if it spawned in the bay also 

Edited by hogansheroes

Share this post


Link to post
Share on other sites

hi great script and idea, love the need for boats now :)

but, anyone found a crate? i went offshore and couldnt see anything past 50m deep, went to shore and dived there, 100m out from land again no visual only blue, even disappeared in 3rd person, am i missing something? goggles? lol (had wetsuit and rebreather on)

tried night vision, glow sticks no luck

anyone used this?

Share this post


Link to post
Share on other sites
4 hours ago, McDaggart said:

hi great script and idea, love the need for boats now :)

but, anyone found a crate? i went offshore and couldnt see anything past 50m deep, went to shore and dived there, 100m out from land again no visual only blue, even disappeared in 3rd person, am i missing something? goggles? lol (had wetsuit and rebreather on)

tried night vision, glow sticks no luck

anyone used this?

It will because of ingame fog. When it gets foggy in the server it goes under water..... i know weird. When its really deep you will need NV.

Share this post


Link to post
Share on other sites

no fog above water, sunny setting is fog free

had NV on me,

just a washy blue screen, as i said, in 3rd person view i cant see my character anymore past 50 m deep

is this a game setting? server setting? some config setting for water?

Share this post


Link to post
Share on other sites

works great as long as you have nvg's with you also loot is mainly in the centre.

you can add/remove stuff from the loot to suit your server.

nice work tuna.

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.