Jump to content
Sign in to follow this  
Needleman52

Keep custom armaments on vehicle after respawn

Recommended Posts

Hello,

I'm incredibly new to scripting and have no idea really what I'm doing but by reading forums I've gotten this far. So, I play OPTRE with some friends a lot. We decided that the default armaments on the Pelican weren't really all that hot, so we used commands in the Pelican's init in EDEN to spawn it with some extra firepower. The problem lies in the fact that I have the vehicles sync'd to the Vehicle Respawn module. Whenever they automatically respawn at base, they respawn with default armaments, not the 30mm cannons nor JIAN missiles we added in EDEN. Is it possible to add the custom weapons every time they spawn via a script? What I use currently for them is the following:

"this addWeaponTurret ["gatling_30mm",[0]];   

this addMagazineTurret ["250Rnd_30mm_HE_shells",[0]];

this addMagazineTurret ["250Rnd_30mm_HE_shells",[0]];

this addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]];   

this addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]];

this addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]];

this addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]];

this addWeaponTurret ["missiles_Jian",[0]];   

this addMagazineTurret ["4Rnd_LG_Jian",[0]];

this addMagazineTurret ["4Rnd_LG_Jian",[0]];

this addMagazineTurret ["4Rnd_LG_Jian",[0]];

this addMagazineTurret ["4Rnd_LG_Jian",[0]];

this addMagazineTurret ["4Rnd_LG_Jian",[0]];"

Any help on compiling an SQF to spawn the vehicles with these armaments would be much appreciated. Thank you!

Share this post


Link to post
Share on other sites

The respawn module has an expression field that will be executed upon respawn, passed parameters are [newVehicle,oldVehicle], so could go like this:


//respawn module expression field:
params ["_newVehicle","_oldVehicle"];
_newVehicle addWeaponTurret ["gatling_30mm",[0]];   
_newVehicle addMagazineTurret ["250Rnd_30mm_HE_shells",[0]];
_newVehicle addMagazineTurret ["250Rnd_30mm_HE_shells",[0]];
_newVehicle addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]];
_newVehicle addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]];
_newVehicle addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]];
_newVehicle addMagazineTurret ["250Rnd_30mm_APDS_shells",[0]];
_newVehicle addWeaponTurret ["missiles_Jian",[0]];   
_newVehicle addMagazineTurret ["4Rnd_LG_Jian",[0]];
_newVehicle addMagazineTurret ["4Rnd_LG_Jian",[0]];
_newVehicle addMagazineTurret ["4Rnd_LG_Jian",[0]];
_newVehicle addMagazineTurret ["4Rnd_LG_Jian",[0]];
_newVehicle addMagazineTurret ["4Rnd_LG_Jian",[0]];

Cheers

Share this post


Link to post
Share on other sites

Hello, sorry for the late response. 

 

I tried putting what you suggested in the Respawn module but it did not seem to work. I put the code above into the expression box (init) via Eden and then destroyed it to respawn it, no armaments were added. Did I do something wrong?

Share this post


Link to post
Share on other sites
1 hour ago, Needleman52 said:

Hello, sorry for the late response. 

 

I tried putting what you suggested in the Respawn module but it did not seem to work. I put the code above into the expression box (init) via Eden and then destroyed it to respawn it, no armaments were added. Did I do something wrong?

You put it in the init field, it needs to be in the expression field as stated above.

 

XV3aMRX.jpg?1

The tooltips basically give it away.

 

Cheers

Share this post


Link to post
Share on other sites

Well now I feel stupid, shows how new I am to this shindig. Worked like a charm, thank you so much!

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×