Home   Help Search Login Register  

Author Topic: Removing an action  (Read 484 times)

0 Members and 3 Guests are viewing this topic.

magnar

  • Guest
Removing an action
« on: 17 Feb 2004, 07:04:31 »
Ok, sorry guys, another "action" question.  I'm working on a mission and have added an action (via trigger)  to a "sentry", so when the player gets near him it activiates the action for the player.  This works fine, no problem.  However, if the player doesnt pay attention to the briefing and goes in guns blazing, he will kill the sentry, now the problem........., when player gets into the trigger area, the player still gets the action if the sentry is dead.  I've got a trigger set up (east not present) to remove it, but I cant find the right text to do it.  I tried ~ guard removeaction 0 ~ in the trigger, but that doesnt work.   the actual action/script is "guard addaction ["Show Papers","Papers.sqs"]".  How can I remove it if the guard is dead?  I'm not really good with technical scripting stuff, so the simpler the answer the better................thanks :-* for your help in advance!

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:Removing an action
« Reply #1 on: 17 Feb 2004, 07:40:42 »
When you add an action it is always good to assign it to a variable for its ID.  The ID of an action is assigned in the order they are created, but keeping track of these numbers can be difficult if you are adding and deleting many actions in a game.  In short to add your action do:
Code: [Select]
shwprps = guard addaction ["Show Papers","Papers.sqs"]  
This will assign the action ID to the variable "shwprps" you can use any variable you want (except for OFP reserved vars like "time").

Now to remove the action you do not need to remeber if it was ID 0 or 1 or whatever, you just need to rememeber the name you used for the ID, in this case "shwprps".  The format to remove the action is:

Code: [Select]
guard removeAction shwprps

magnar

  • Guest
Re:Removing an action
« Reply #2 on: 17 Feb 2004, 08:01:50 »
thanks alot, I think I understand exactly what you mean..........the "0" I used obviously didnt correleate with the "identity" for the script, as there a couple others in there.  I'll give it a go right now exactly how you recommended.  Thanks alot.
« Last Edit: 17 Feb 2004, 08:13:44 by magnar »