Jump to content
simicsko

Set Object Init in script

Recommended Posts

I would like to place the following code in the init field of an spawned object by a script:

["init", [this, "PHOTOS\Photo_1.jpg", "Target Area"]] call BIS_fnc_initLeaflet

As I have read, the setVehicleinit command has been removed from the Arma, but I have not found a clear replacement for it.

Can anyone show me a solution for this?

Thanks in advance...

Share this post


Link to post
Share on other sites

Init fields are run before any of the init scripts, so even if this were possible it wouldn't do anything. Check out the Initialization Order. Also, does this require the function to be called in the init field? Why not this:

_myVehicle = createVehicle [etc...];
["init", [_myVehicle, "PHOTOS\Photo_1.jpg", "Target Area"]] call BIS_fnc_initLeaflet

 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, dreadedentity said:

Init fields are run before any of the init scripts

 

Not when the unit is spawned by script during mission runtime. But that's not relevant as setVehicleInit and processInitCommands were removed nine years ago. Your solution is the way.

  • Like 1

Share this post


Link to post
Share on other sites
On 3/30/2022 at 8:29 PM, dreadedentity said:

Init fields are run before any of the init scripts, so even if this were possible it wouldn't do anything. Check out the Initialization Order. Also, does this require the function to be called in the init field? Why not this:


_myVehicle = createVehicle [etc...];
["init", [_myVehicle, "PHOTOS\Photo_1.jpg", "Target Area"]] call BIS_fnc_initLeaflet

 

 

It works! Thank You so much. 😉

Share this post


Link to post
Share on other sites
On 3/30/2022 at 10:56 PM, Harzach said:

 

Not when the unit is spawned by script during mission runtime. But that's not relevant as setVehicleInit and processInitCommands were removed nine years ago. Your solution is the way. 

 

Thanks my Bro! 😉

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

×