Jump to content
Sign in to follow this  
1para{god-father}

how to addaction to a spawned Object

Recommended Posts

Having an issue putting a add action onto a spawned object just not gettting it , how can I do this ?

_random = floor(random 5);
_spawnspot = ["point1", "point3", "point3","point4","point5","point6"] select _random; 
_name = "Notebook" createVehicle getmarkerpos _spawnspot;

_name setVehicleInit "radaradd = _name addaction ['Pickup','missionradar.sqf']";
processInitCommands;

Share this post


Link to post
Share on other sites

problem is your not using double quotes inside the init string:

it should be like this:

_name setVehicleInit "radaradd = this addaction [""Pickup"", ""missionradar.sqf""]";

you can also use ' instead of double quotes.

also _name is a variable local to the script, and it wont be interpreted by the init as having a value, using this fixes that

Share this post


Link to post
Share on other sites

You might want to use the MPF instead of setvehicle init. Then you don't have to worry about getting the format command right:

radaradd = [nil, _name, "per", rADDACTION, "Pickup", "missionradar.sqf"] call RE;

If you need to access the id outside of missionradar.sqf this method won't work though.

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  

×