OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: SEAL84 on 27 Aug 2002, 20:50:04

Title: Limiting repetition of an action?
Post by: SEAL84 on 27 Aug 2002, 20:50:04
Just wondering if this is possible...i.e. keep track of how many times the player uses a custom action and then removes it from the menu after it has been used X amount of times.

Here's what I did....I added an action that camcreates flares at the chopper (they fall a little before igniting...looks cool and took about 3 seconds to do), and every time you use the action it fires one flare.  Is there a way to limit the number of times I can select the action?
Title: Re:Limiting repetition of an action?
Post by: Wolfrug on 27 Aug 2002, 20:58:31
Easily, with a global variable, just put something like:

flares_fired=flares_fired+1

at the very beginning of the script. Beneath it, put something like:

?flares_fired == desired# : Player removeAction ActionId

you might want to define the variable flares_fired first, for instance in your init.sqs.

So, once you've fired it as many times as you wanted, the action is removed (however the final fired script obviously finishes first)

That should solve it ;)

Wolfrug out.