Jump to content
Sign in to follow this  
Winters

Remove Action problem

Recommended Posts

Hey guys i have an added action that i am using in a mission and the trouble is the first time i use it it gets removed but after having it active again it won't remove itself anymore. Does anyone know why it does this? it is a simple script but its making me nuts.

here is the script:

PlaceMarker.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

Player switchmove "CombatToPutDown"

~5

Player switchmove "PutDownToCombat"

~1

hint "Marker Placed"

"marker1" SetMarkerType "Warning"

player RemoveAction 0

exit

I am using a trigger that activates when the player enters it and in its onavtivation i have:

player addaction ["Place Marker", "PlaceMarker.sqs"]

Now i made other scripts and markers and triggers that go PlaceMarker2.sqs, PlaceMarker3.sqs but once i activate this a second time the action does not remove itself from the list.

Thanks

Share this post


Link to post
Share on other sites

When you give an action, its 'number' is always one up from the previous action given, even if they dont have it any more.. so it will go up from 0, 1, 2, 3, 4, 5, etc..

You can instead use<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player removeaction (_this select 2)Which will always remove the action that you just used.

Share this post


Link to post
Share on other sites

Or you assign the action a global variable and then remove it when you want to.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">action1 = player addaction ["Do Something","something.sqs"]

~5

player removeaction action1

exit

Share this post


Link to post
Share on other sites

or in that case a local variable is better

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_action1 = player addaction ["Do Something","something.sqs"]

~5

player removeaction _action1

exit

but yeah, return value = action reference to object

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  

×