Home   Help Search Login Register  

Author Topic: Making a script stop?  (Read 781 times)

0 Members and 1 Guest are viewing this topic.

Bad Maniac

  • Guest
Making a script stop?
« 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?

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Making a script stop?
« Reply #1 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 ;)

Bad Maniac

  • Guest
Re:Making a script stop?
« Reply #2 on: 28 Apr 2003, 03:17:37 »
Will that work in Multiplayer?
If it does, then it was easier then I though  :D

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Making a script stop?
« Reply #3 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 ;)

Bad Maniac

  • Guest
Re:Making a script stop?
« Reply #4 on: 28 Apr 2003, 19:10:11 »
I'll try it out now, thanks Sui  :)