Jump to content
Sign in to follow this  
bolbies

Two script addaction

Recommended Posts

Is it possible for an addaction to call 2 completely different scripts at once? I need one that will execute a completely separate script as well as call a subscript(?). So something like this.

_action = _helo addaction ["<t color='#00b7ff'>Give a LZ to the pilot</t>", {[arg1, 2, 3] call taxi; "mapclick.sqf"}, "", 0, true, true, "", "_this == player"];

Share this post


Link to post
Share on other sites

execute a script that executes both scripts.

helo addaction ["Give LZ to Pilot","scripts.sqf"];

then in scripts.sqf

null = []execVM script1.sqf;

null = []execVM script2.sqf;

or similar of course.

Share this post


Link to post
Share on other sites

Don't need a separate file. Just use execVM instead of just the quotations alone.

_action = _helo addAction ["Give LZ to Pilot",{_null = [arg1, 2, 3] call taxi; _null = [] execVM "mapclick.sqf";}, "", 0, true, true, "", "_this == player"];

Share this post


Link to post
Share on other sites
Don't need a separate file. Just use execVM instead of just the quotations alone.

_action = _helo addAction ["Give LZ to Pilot",{_null = [arg1, 2, 3] call taxi; _null = [] execVM "mapclick.sqf";}, "", 0, true, true, "", "_this == player"];

Oh my god I forgot execVM. Thank you! But in the taxi subscript, how would I assign those arguments? I know that typically addaction arguments would be (_this select 3) select 0; but I don't know about this.

Share this post


Link to post
Share on other sites

This would yield the same results as the my first post.

_action = _helo addAction [
"Give LZ to Pilot",
{_null = [color="#FF0000"](_this select 3)[/color] call taxi; _null = [] execVM "mapclick.sqf"},
[color="#FF0000"][arg1,2,3][/color],
0,
true,
"",
"_this == player"
];

I made [arg1,2,3] the the third element of the addAction array, the arguments. That array becomes _this select 3 in the addAction code block. Send that array to your taxi function and presto...

Share this post


Link to post
Share on other sites

Alright I got that but how do I define them in taxi?

I tried what I mentioned above with _this select 3 select 0 but that doesn't work. My rpt says it's getting an object but expects an array.

Share this post


Link to post
Share on other sites

Your taxi function will work the same...

_this select 0 is arg1

_this select 1 is 2

_this select 2 is 3

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  

×