Jump to content
flakked

Vehicle Respawn Module Expression

Recommended Posts

Hello! So the issue I've been running into is trying to recycle a vehicle's original ini after respawning using the built in vehicle respawn module. From what I've read, it appears that the ini doesn't get recycled by default, which makes things a bit trickier. My next move was to get the respawn module to activate a script upon vehicles respawning via the Expression field, but I'm not sure what the syntax would be for executing a simple external .sqf, and unfortunately there isn't a built in syntax checker like ini's have. Any help for this would be greatly appreciated! :)

Share this post


Link to post
Share on other sites

Make a function:

myFunction =
{
code that you want on vehicle respawn goes here.
       e.g _this setPos (position player);
};

Then in the Vehicle Respawn Module expression field put:

(_this select 0) spawn myFunction;

This will run the function every time the vehicle respawns and sends the argument "(_this select 0)", which is the vehicle, to the function.

Edited by chaoticgood
  • Like 1

Share this post


Link to post
Share on other sites

Hey, guys. I have a question. Where do I make the function and how do I make it? I would appreciate any help. 

Thanks in advance.

Share this post


Link to post
Share on other sites
45 minutes ago, Kjx said:

Hey, guys. I have a question. Where do I make the function and how do I make it? I would appreciate any help. 

Thanks in advance.

 

For answering your question:

Your scenario (folder) is in Arm3, or Arma3 - other profiles   \<yourProfileName>\missions

You can write an sqf file, here, in mission root (where mission.sqm is), or inside a sub-folder.

then execVM it from expression field of the BI module:
(_this select 0) execVM "yourCode.sqf";   // if yourCode is the name of your sqf.

 

or, you can write your code in init.sqf (to be created and added in root folder):
Something like:

yourCode = {.... };   // code/function is inside curly brackets (brace);
then spawn it from expression field of the BI module:

(_this select 0) spawn yourCode;   // if yourCode is the name of your function.

 

You can also create a function in a description.ext (to be added in root folder), then spawn this function as above. (see BIKI).

 

 

If you don't want to bother you with that, I suggest my "Respawn Vehicles" module, far more elaborated than BI one (appearance, pylons, loadouts in cargo, crew, waypoints...), each time a vehicle respawn (not only the 1st time!)

 

 

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

×