Jump to content
Sign in to follow this  
GODSPEEDSNAKE

Spawn object adding 'init' code

Recommended Posts

Hi all sorry been searching for ages trying to make it work and the last part of this script just doesn't seem to work, I know I must be doing something wrong :( pls help...

I managed to get the script to work and the box spawns near the player however I'm trying to get the 'init' for the spawned item to work attaching either the 'arsenal' addAction or filling the box cargo up with ammo and weapons' The issue is getting the 'init' to work

 

_spawn = "Land_WoodenBox_F";
_posplr = [((getPos player) select 0) + 2, ((getPos player) select 1) + 2, 0];
_dirplr = getDir player;
_spwnveh = _spawn createVehicle (_posplr);
_spwnveh setVariable ["Sarge",1,true];
_spwnveh = setVehicleInit ["this addAction "<t color='#00aeff'>ARSENAL</t>","scripts\arsenal.sqf", [false], 1, false, true, "", "(_target distance _this) < 3"];

 

Share this post


Link to post
Share on other sites

Ok so how can I spawn a box and attached an add action? or empty a spawned ammo box and put my own chosen gear in it? If what ur saying is I can't use scripts to spawn and setVehicleInit... Cause the script I have works and spawns in the object just I dont know how to attach a addAction or edit what spawns inside the box...

Share this post


Link to post
Share on other sites

You're already referencing the spawned object, just add the action to it, or add inventories, or whatever else you need to do with it. Example:

_spwnveh addAction [//code];

You'll only need remoteExec if you're trying to script for multiplayer. But as Harzach said, setVehicleInit and it's related commands were disabled (as the linked wiki description states). 

  • Like 2

Share this post


Link to post
Share on other sites
9 hours ago, beno_83au said:

You'll only need remoteExec if you're trying to script for multiplayer.

 

Laziness on my part, thanks @beno_83au 🙃

  • Haha 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  

×