Jump to content
Sign in to follow this  
barbolani

BIS_fnc_MP addAction and removeAllActions

Recommended Posts

Hi!

On Antistasi, I give the player the feature of "retaking" the flag when AAF conquered one.

I use a combination of BIS_fnc_MP, addAction and removeAllActions.

In the "Sector Lost" script I have this:

[[_bandera,"remove"],"flagaction", true] call BIS_fnc_MP;
sleep 5;
[[_bandera,"take"],"flagaction", true] call BIS_fnc_MP;

And the function flagaction:

private ["_flag","_tipo"];

if (isDedicated) exitWith {};

_flag = _this select 0;
_tipo = _this select 1;

if (_tipo == "take") then {_flag addAction ["Take the Flag", {[[_this select 0, _this select 1],"mrkWIN", true] call BIS_fnc_MP;},nil,0,false,true];};
if (_tipo == "remove") then {removeAllActions _flag};

The problem: sometimes players don't see any action added to the flag. It seems like the removeAllActions happened AFTER the "Take the Flag" action has been added. That's why I added that sleep between funtcion calls (which seems nosense, but who knows?)

Any tip?

Thanks in advance!

Share this post


Link to post
Share on other sites

It's probably easier to just always have both actions but broadcast a condition variable rather than running the addAction each time.

Share this post


Link to post
Share on other sites

Thanks Fight9, not sure I understood you. You mean leave the actions allways present without removal?

Share this post


Link to post
Share on other sites

player addaction ["mytext","myscript.sqf",myvariable,1,False,True,"",' conditons-go-here-checked-every-frame '];

made with editing tool

try that.

when conditions arent met the action will not appear.

Share this post


Link to post
Share on other sites

Ah! Understood. Thanks! But I shouldnt do it that way.

Antistasi is an extremely dynamic misión (you are welcome to try it on my signature), everything scripted, any zone (flag, and action) may spawn depending on proximities of various things (users, AI user dependant, AI non user dependant), flags may have actions depending on the owner of the flag... A total mess :)

This means: I cannot use global or local variables to make those conditions, I could use setVariable, but I would generate additional traffic, If I could avoid that...

Share this post


Link to post
Share on other sites
Ah! Understood. Thanks! But I shouldnt do it that way.

Antistasi is an extremely dynamic misión (you are welcome to try it on my signature), everything scripted, any zone (flag, and action) may spawn depending on proximities of various things (users, AI user dependant, AI non user dependant), flags may have actions depending on the owner of the flag... A total mess :)

This means: I cannot use global or local variables to make those conditions, I could use setVariable, but I would generate additional traffic, If I could avoid that...

Either one could be used in theory, both complete the same task just in different ways, setVariable could propigate its value across the network on its own though, which reduces what you need to do (probably also faster since once its gone to the engine layer everything is done in C++ which is much faster)

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  

×