OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Bad Maniac on 28 Apr 2003, 02:39:03

Title: Making a script stop?
Post by: Bad Maniac on 28 Apr 2003, 02:39:03
I have finally got my follow script to work, it's basically an infinite loop of move commands, that tells a group to move to the position of a given unit at set intervals.
Now I want them to STOP following me when they reach a certain waypoint, or trigger.

How can I stop a script from repeating again when a certain event has occurred?
Title: Re:Making a script stop?
Post by: Sui on 28 Apr 2003, 02:59:35
One way is to have a variable that is set to true when you want the script to stop. It goes something like this:

Init.sqs or any units init field

Stopnow = false

Script

#loop
~0.5
...blah blah blah...
? not Stopnow: goto "loop"

Waypoint OnActivation field

Stopnow = true


So when the unit gets to their waypoint, Stopnow becomes true. This means your script will no longer loop ;)
Title: Re:Making a script stop?
Post by: Bad Maniac on 28 Apr 2003, 03:17:37
Will that work in Multiplayer?
If it does, then it was easier then I though  :D
Title: Re:Making a script stop?
Post by: Sui on 28 Apr 2003, 14:16:09
Hmm.... should do, though you will have to Publicvariable your variable.

It depends on a lot of things... I'm sure as hell no expert when it comes to Multiplayer editing ;)
Title: Re:Making a script stop?
Post by: Bad Maniac on 28 Apr 2003, 19:10:11
I'll try it out now, thanks Sui  :)