Tuna

Underwater Crate Script

43 posts in this topic

anyone have this actually spawning underwater? I really wants it to spawn under the water lol. I changed it from a crate to a sub so that players would be able to dive for it and have to bring the sub back to the surface,......but the sub only spawns ontop of the water....

any help getting it to spawn underwater would be great.

Share this post


Link to post
Share on other sites

Some how this script is not working on my server, and I cannot find out why... So, who can help this noob? ;-)

my watercrate.sqf, placed in the a folder for neatness efforts ;-)

Spoiler

//[] execVM "custom\watercrate.sqf";


//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 = 3;  //  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_ConcreteFloorKit", 2 + (random 10)];
    _box addItemCargoGlobal ["Exile_Item_WoodPlank", 20 + (random 10)];
    _box addItemCargoGlobal ["Exile_Item_SafeKit", (random 3)];    
    _box addItemCargoGlobal ["Exile_Item_ConcreteWallKit", 2 + (random 10)];
    _box addItemCargoGlobal ["Exile_Item_InstaDoc", 1 + (random 5)];
    _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 ["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)];
    _box addMagazineCargoGlobal ["Exile_Item_Laptop", (random 1)];


    
    
  }
};

 

the lines out of the init.sqf

Spoiler

//Underwater crates
{
    [] execVM "custom\watercrate.sqf";
};


I am running the latest Arma 3 and InfiSTAR. After I added this, packed the PBO again and started the server. But no markers can be found... 

Anyone knows what I am doing wrong here?
Am I missing "Starting spawncrates.sqf" or is that a standard sqf that every server has? I also run DMS and ZCP, and those do work fine. Server is running the Altis map, no additional mods.


Cheers,
VM

Edited by VirtualMechanic

Share this post


Link to post
Share on other sites
Advertisement

I have this working, but... all of my other missions stop spawning in?  Yes!  I'm a newb.

Any help would be appreciated. 

Edited by Denzilla

Share this post


Link to post
Share on other sites

 

Anyone out there?  

I'v got

[] execVM "watercrate.sqf";

in the init.sqf

and I created the watercrate.sqf and placed it in my mpmission folder.....  The watercrates work great, but it caused every other mission I had running with DMS to stop working.  No zombies either.  The only changes I made to the watercrate.sqf were the minimum and maximum from center and the max range.

Any help would be great!  

 

//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)];


	
    
  }
};

Share this post


Link to post
Share on other sites
On 22.07.2016 at 0:50 AM, Sir_Joker said:

i have ki with sdar, spawning with dms :)

you have to define a class diver in config.sqf


//Create AI with DMS
	
	_side = "bandit";
	_AICount = 3 + (round (random 7));
	_group =
	[
		_pos,					// Position of AI
		_AICount,				// Number of AI
		"random",				// "random","hardcore","difficult","moderate", or "easy"
		"diver", 				// "random","assault","MG","sniper" or "unarmed" OR [_type,_launcher]
		_side 					// "bandit","hero", etc.
	] call DMS_fnc_SpawnAIGroup;

 

Where? @ExileServer\addons\a3_dms   ? 

Share this post


Link to post
Share on other sites
On 10/04/2017 at 11:33 PM, JGr124_borada said:

Where? @ExileServer\addons\a3_dms   ? 

Did you ever receive an answer to this? I have been trawling everywhere... cannot figure out what to do, to add divers instead of the bobbing Ghilli suited AI O.o lol

UPDATE:

So I bit the bullet and had a crack at what i thought  SIr_Joker meant... the config.sqf (that needs to be amended to create your own custom class such as divers) IS in a3_dms!

After opening the config.sqf (from a3_dms) head down to where you find  //Assault Class  ...that's where you will find the available inputs, such as: "DMA_assault_weps = , DMS_assault_pistols ="  etc. use these as guides to create and name your cusom class i.e. DMA_diver_weps =  ...ended up creating mine right above the assault class entry for ease.. watch the "," they are a code killer if u miss them! ;) 

Below is the very simple and basic code I used for anyone that wants it:

Spoiler

 //Diver Class
 DMS_diver_weps =                         [  

                                            //Weapons for Diver Class
                                            "arifle_SDAR_F"
                                                            ];
    
DMS_diver_equipment =                [    

                                             // Equipment for Diver Class AI (stuff that goes in toolbelt slots)
                                            "ItemGPS",
                                            "NVGoggles"
                                                            ];
   
   DMS_diver_items =                      [    

                                            // Items for Diver Class AI (Loot stuff that goes in uniform/vest/backpack)
                                            "Exile_Item_InstaDoc",
                                            "Exile_Item_BBQSandwich",
                                            "Exile_Item_Energydrink",
                                            "20Rnd_556x45_UW_mag",
                                            "20Rnd_556x45_UW_mag"
                                                            ];
                                        
  DMS_diver_clothes    =                [    

                                            // Uniforms for Diver Class                                    
                                            "U_O_Wetsuit"
                                                           ];    
                                            
  DMS_diver_vests =                       [    

                                             // Vests for Diver Class                                        
                                            "V_RebreatherIA"
                                                          ];    
                                            
 DMS_diver_backpacks =               [    

                                            // Backpacks for Diver Class                                     
                                            "B_Bergen_mcamo"
                                                           ];    

 

After you have created your new class.. dont forget to ADD it into the DMS_ai_SupportedClasses =    further down the config.sqf page.

Spoiler

DMS_ai_SupportedClasses =            [// Allowed AI classes. If you want to create your own class, make sure you define everything as I've defined above, and add it here
                                            "diver",  
                                            "assault",
                                            "MG",
                                            "sniper"     
                                        ];

Good luck! ;)

Edited by Numbat177

Share this post


Link to post
Share on other sites
On 16/01/2017 at 2:25 PM, Denzilla said:

Anyone out there?  

Not sure if anyone answered .. or you figured this out.. but I use "a3_exile_extras.pbo" (put it in @exileserver\addons) on my server and it works great!

If you get an error... you may have to remove the init.sqf below.... not sure though:

[] execVM "watercrate.sqf";

Anyway here's the link:

http://www.exilemod.com/topic/12517-release-exile-occupation-roaming-ai-more-updated-2016-08-15/?do=findComment&comment=101220

Hope it works for you! :) 

Edited by Numbat177

Share this post


Link to post
Share on other sites
22 hours ago, Numbat177 said:

Did you ever receive an answer to this? I have been trawling everywhere... cannot figure out what to do, to add divers instead of the bobbing Ghilli suited AI O.o lol

UPDATE:

So I bit the bullet and had a crack at what i thought  SIr_Joker meant... the config.sqf (that needs to be amended to create your own custom class such as divers) IS in a3_dms!

After opening the config.sqf (from a3_dms) head down to where you find  //Assault Class  ...that's where you will find the available inputs, such as: "DMA_assault_weps = , DMS_assault_pistols ="  etc. use these as guides to create and name your cusom class i.e. DMA_diver_weps =  ...ended up creating mine right above the assault class entry for ease.. watch the "," they are a code killer if u miss them! ;) 

Below is the very simple and basic code I used for anyone that wants it:

  Reveal hidden contents

 //Diver Class
 DMS_diver_weps =                         [  

                                            //Weapons for Diver Class
                                            "arifle_SDAR_F"
                                                            ];
    
DMS_diver_equipment =                [    

                                             // Equipment for Diver Class AI (stuff that goes in toolbelt slots)
                                            "ItemGPS",
                                            "NVGoggles"
                                                            ];
   
   DMS_diver_items =                      [    

                                            // Items for Diver Class AI (Loot stuff that goes in uniform/vest/backpack)
                                            "Exile_Item_InstaDoc",
                                            "Exile_Item_BBQSandwich",
                                            "Exile_Item_Energydrink",
                                            "20Rnd_556x45_UW_mag",
                                            "20Rnd_556x45_UW_mag"
                                                            ];
                                        
  DMS_diver_clothes    =                [    

                                            // Uniforms for Diver Class                                    
                                            "U_O_Wetsuit"
                                                           ];    
                                            
  DMS_diver_vests =                       [    

                                             // Vests for Diver Class                                        
                                            "V_RebreatherIA"
                                                          ];    
                                            
 DMS_diver_backpacks =               [    

                                            // Backpacks for Diver Class                                     
                                            "B_Bergen_mcamo"
                                                           ];    

 

After you have created your new class.. dont forget to ADD it into the DMS_ai_SupportedClasses =    further down the config.sqf page.

  Reveal hidden contents

DMS_ai_SupportedClasses =            [// Allowed AI classes. If you want to create your own class, make sure you define everything as I've defined above, and add it here
                                            "diver",  
                                            "assault",
                                            "MG",
                                            "sniper"     
                                        ];

Good luck! ;)

Hey @Numbat177, thanks for this!  I have created my new class of DMS, but I am not sure how to call that class in the waterCrates.sqf...  How do I make it so only "diver" class AI spawn for the waterCrates?

 

Edit:  I think I have figured it out, by looking at a DMS mission file...

So, the 2nd "random" should be the class, correct?

Quote

_group = [_spawnPosition, _AICount, "random", "random", "bandit"] call DMS_fnc_SpawnAIGroup;

 

Edited by gfourth

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.