Jump to content
skitz.

Ending a Script [Help]

Recommended Posts

Hey guys, Need help I'm making a mission that you click the map and an explosion happens with this code

// ----> Local only
if (!local player) exitWith {};

// ----> Hint
hint "Open your map and mark the target with a single click.";

// ----> (Re)Set variable
MapClicked = false;

// ----> Get the map click
onMapSingleClick "clickPos = _pos; MapClicked = true; onMapSingleClick {};";

// ----> Wait until clicked
waitUntil {MapClicked};

// ----> Create bomb
[west, "AirBase"] sideChat "ETA 15 Seconds";
sleep 15;
"Bo_GBU12_LGB" createVehicle clickPos;
sleep 1;
[west, "AirBase"] sideChat "Airstrike Complete";

And I have my trigger that executes the command like this.
 

player addAction ["Drop bomb","ClickBomb.sqf"];

Now the only problem is, I want to make it only used once... how can I remove it from the list after it has been done once?
Thank you sorry for the noob response!

Share this post


Link to post
Share on other sites

Fast and dirty:

ACT_ID = player addAction ["Drop bomb","ClickBomb.sqf"];

 

and in the last line of ur script:

player removeAction ACT_ID;

 

Share this post


Link to post
Share on other sites
14 minutes ago, sarogahtyp said:

Fast and dirty:


ACT_ID = player addAction ["Drop bomb","ClickBomb.sqf"];

 

and in the last line of ur script:


player removeAction ACT_ID;

 

I did this and it does not seem to work
I put this into the trigger

ACT_ID = player addAction ["Drop bomb","ClickBomb.sqf"];

I put this at the end of the script file

player removeAction ACT_ID;

 

Share this post


Link to post
Share on other sites

What does not work?

The script?

The addAction?

The onMapSingleClick?

 

If you go through the effort to quote someone and put up a post, at least add in some crucial information.

 

Cheers

Share this post


Link to post
Share on other sites
17 hours ago, Grumpy Old Man said:

What does not work?

The script?

The addAction?

The onMapSingleClick?

 

If you go through the effort to quote someone and put up a post, at least add in some crucial information.

 

Cheers

Sorry, The Remove action does not work, It will not remove from the list I have done what the other guy suggested no luck :(
 

 

Share this post


Link to post
Share on other sites

Maybe you didnt wait for your own sleep delays while testing it?

 

move the removeAction line from the end of the script direct below this line in your script and test again.

waitUntil {MapClicked};

 

 

P.S.:

The other guy is me and I ve a name in this forum. Try to learn copy and paste if it is to complex to write my name manually.

Or just give me a nickname e.g. Saro

Share this post


Link to post
Share on other sites
59 minutes ago, sarogahtyp said:

Maybe you didnt wait for your own sleep delays while testing it?

 

move the removeAction line from the end of the script direct below this line in your script and test again.


waitUntil {MapClicked};

 

 

P.S.:

The other guy is me and I ve a name in this forum. Try to learn copy and paste if it is to complex to write my name manually.

Or just give me a nickname e.g. Saro

Legend!! thank you so much many it works!! :D :D

Share this post


Link to post
Share on other sites

Also you don't need global variables to keep track of an addAction ID, since it's being passed into the code field as a third parameter:

player addAction ["Drop bomb","ClickBomb.sqf"];

ClickBomb.sqf:

params ["_actionObject","_caller","_actionID"];
_actionObject sideChat format ["%1 poked me!", name _caller];
_actionObject removeAction _actionID;

 

Cheers

  • Like 1

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

×