Jump to content
Sign in to follow this  
mihikle

How to remove an addAction

Recommended Posts

Hey guys,

Having a few problems with removing an addAction from a living Civvie named elder1. It is basically a scripted conversation where the actions are what YOU say, and he responds.

in elder 1 init:

this exec "speech\initiate.sqf"; this allowDammage false;

initiate.sqf

_elder1 = elder1 addAction ["Hello Sir!", "speech\first.sqf"];

exit;

first.sqf

elder1 globalChat "Greetings, let the Shura begin.";

sleep 5;

elder1 globalChat "What do you want to talk about today?";

sleep 2;

_elder2 = elder1 addAction ["How are your family and Village Members?", "speech\second1.sqf"];

_elder3 = elder1 addAction ["Do you know where the Taliban are?", "speech\second2.sqf"];


exit;

The problem I am having is that I cannot remove the addaction for initiate.sqf - I have tried using (below) in both second1.sqf, second2.sqf, and first.sqf with no luck.

elder1 removeAction _elder1

HOWEVER it does appear to work if I put it in initiate.sqf - although I now get no action come up at all (that's why I know it is working!). Is there a way to make it delete itself in another script? or in my initiate.sqf make it so that it won't delete until the action has been activated?

Share this post


Link to post
Share on other sites

Just a quick glance and I notice your using this exec "speech\initiate.sqf"; this allowDammage false; it should be

this execvm "speech\initiate.sqf"; this allowDammage false;

exec is for sqs files.

Share this post


Link to post
Share on other sites

elder2 = elder1 addAction ["How are your family and Village Members?", "speech\second1.sqf"];

elder1 removeAction elder2;

Share this post


Link to post
Share on other sites

@F2k Sel - execVM never works for me with an SQF :( I get an error come up.

@Giallustio - That doesn't work unfortunately :(

Share this post


Link to post
Share on other sites

nul = [this] execVM "speech\initiate.sqf";

Also remove the exit; lines. They're unnecessary, the script will stop once nothing else has to be executed.

Use this to remove the action:

_ID = _this select 2;

// All the elder code stuff here

elder removeAction _ID;

Share this post


Link to post
Share on other sites

@trytryker - That still does not work :( However thanks for telling me how to execVM!

Share this post


Link to post
Share on other sites

I have never used 'exit;' in my scripts.. Do you have showscripterrors on? If there is an error in your script it wont execute the code after the error.

Try: use the show script errors parameter

put

_ID = _this select 2;

elder removeAction _ID;

at the top of your script and see if it works then (a bit of a hack workaround to see if it is the code or your script that is the problem...)

As Gia said... something is wrong because that should work!

edit: Very nice idea for conversation though... are you using variables to track it at all (eg. wont tell you something unless you have asked something else first?)

Edited by Zodd

Share this post


Link to post
Share on other sites

@mihikle

And please be sure to post up your results because I want to learn more about this.

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  

×