HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

trigger looping

08-14-2004, 05:03 AM#1
Master-O-Chaos
How do you loop a trigger i know its a noob question but how :\
08-14-2004, 04:12 PM#2
Ninja73
Well, u can do alot of things.

Use a peridoc so it runs every few seconds
Use a condition: boolean - this trigger is on = true, then trigger - run this trigger checking conditions
Or if ur making some sorta maze map and ur making like catapults fire in a sequence then do map initilzation, then take the catapults cooldown like 4 seconds or whatever, then divide that by the number of catapults, lets say we have 5 catapults, then u would add a wait .8 seconds after each 1 attacks ground. Then after the last wait add trigger run this trigger checking conditions and make sure u have condition - boolean - this trigger is on = true. That way right after the first catapult attacks it would take exactally 3 seconds b4 it got around to the same 1 again. And the condition is so that if u turn off the trigger it would no longer run. Make sure that if ur using RUN THIS TRIGGER u have waits so that it doesnt flood warcraft by running the same trigger 100000000000 times and cause it to crash.
08-18-2004, 03:35 AM#3
Taelrie
those are all very inefficient ways. This is by far the easiest, and best way to do it. first make a loop action, and set the integer A from 1 to 2 then stick whatever you want looped in it. Then cut it, or if its in a trigger on its own go to edit-->convert to custom text. This will turn it into a bunch of gibberish (at least if you don't know how to read JASS), but look for "Set bj_forLoopAIndex = bj_forLoopAIndex + 1. What this does is it ends the loop. What you want to do is move it to a place where it will only go off until a certain condition is met (which you should specify before you convert it) and just wait. you do NOT want to make an infinite loop however, it will crash the system. But until that bj_forLoopAIndex line goes off the loop will keep on oging until that particular one goes off.

I haven't found much use for doing this however, except for the save/load code on my map where it continuously loops, the variable for finding a particular item going up one every time, until it finds and item. When it finds the item the loop stops, and you could never do this any other way.