Jump to content
Sign in to follow this  
TAW_T-Bone

addAction and Trigger

Recommended Posts

Hi guys,

I couldn't find this and tried it but couldn't get it to work either.

Can you use a script with addAction on a flag pole, like you would use it as a trigger.

As i would use it on a flag pole:

this addAction ["spawn vehicle", "spawnvehicle.sqf", [10, 5, "spawn", "WP1"]];

This how it would be in a trigger:

SPveh = [10, 5, "spawn", "WP1"] execVM "spawnvehicle.sqf";

The trigger works the flag pole doesn't.

Share this post


Link to post
Share on other sites

Dunno if it will work this way:

this addAction ["spawn vehicle", " SPveh = [10, 5, "spawn", "WP1"] execVM "spawnvehicle.sqf" "];

Share this post


Link to post
Share on other sites
this addAction ["spawn vehicle", "spawnvehicle.sqf", [10, 5, "spawn", "WP1"]]; 

that's the right syntax - but you have to change your spawnvehicle.sqf slightly.

The arguments passed to the script as _this are - let's say - extended a little:

[target, caller, ID, arguments]

to get your 'real' arguments in the script you can do something like

_myRealArguments = _this select 3;

biki: addAction

Share this post


Link to post
Share on other sites

Ok i still don't get it - the only thing i get is that what i am trying that it is possible.

Now this is what i have:

SPvehicle = [] execVM "spawnvehicle_WP.sqf"

//Define variables
_type           = _this select 0;
_location       = _this select 1;
_side            = _this select 2;
_wp1            = _this select 3;
_wp2            = _this select 4;
_wp3            = _this select 5; 

The script will spawn any vehicle with AI's and move towards 3 waypoints.

I want to start this with the addAction at a flag pole. What do i write?

Share this post


Link to post
Share on other sites

Your arguments array is passed as _this select 3 in your script.

so, in your script create a temp var like _paramarray = _this select 3;

then you can pull out the individual values from that array.

_spawntime = _paramarray select 0..1,2,3 .. etc. for each of the things you have listed.

Hope that helps.

Edited by GeneralCarver
more to say

Share this post


Link to post
Share on other sites

This is how i set it up:

//Define variables
_type = _this select 0;
_location = _this select 1;
_side = _this select 2;
_wp1 = _this select 3;
_wp2 = _this select 4;
_wp3 = _this select 5;


_paramarray = _this select 3;
_type = _paramarray select 0;
_location = _paramarray select 1;
_side = _paramarray select 2;
_wp1 = _paramarray select 3;
_wp2 = _paramarray select 4;
_wp3 = _paramarray select 5;

This is working for the addAction thing like this:

this addAction ["start AA", "spawnvehicle_WP.sqf", ["T90", "SP1", East, "WP1", "WP2", "WP3"]];

But if i now try the same thing for the trigger the trigger stopped working:

SPvehicle = ["T90", "SP1", East, "WP1", "WP2", "WP3"] execVM "spawnvehicle_WP.sqf";

I fixed this by using the script with _paramarray (spawnvehicle_WP1.sqf) only for flag pole and without _paramarray (spawnvehicle_WP.sqf) for Triggers.

If there is a fix so i could use one script for both Trigger and flag pole(addAction) - that would be great.

Share this post


Link to post
Share on other sites
this addAction ["start AA", "spawnvehicle_WP.sqf", ["T90", "SP1", East, "WP1", "WP2", "WP3"]];
SPvehicle = [objNull,objNull,0,["T90", "SP1", East, "WP1", "WP2", "WP3"]] execVM "spawnvehicle_WP.sqf";

_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_this = _this select 3;
 _type = _this select 0;
 _location = _this select 1;
 _side = _this select 2;
 _wp1 = _this select 3;
 _wp2 = _this select 4;
 _wp3 = _this select 5;

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  

×