HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

i have so many questions today

05-19-2004, 06:07 PM#1
Kaluo
Here's whats gotta happen. A trigger determines how many times a certain trigger-produced spell could be cast by dividing casters mana by mana cost. Then i add random units from the units in an area not already in that temp group based on how many times the spell can be cast. Then the amount of units * casting cost is reduced from the caster via trigger and the spell is cast.
All right i know that didn't make any sense because it could be done a million ways easier. I didn't fill it all in but that's the ONLY way it could work.
The thing is i'm not sure how to run the action of adding random unit to unit group the amount of times that the spell can be cast. A series of 'if/then/elses and skip remaining actions' wouldnt work because i need the action at the end of the trigger. The 'For each integer/variable loop actions' confuse me and id really like to know how they worked. I tried putting for each (number of times spell can be cast) from 1 to 10 loop the pick unit but that will just pick 10 units regardless of mana.

I know that was confusing as all hell but please look through it if you know anything about triggers. Can anyone help me?
05-19-2004, 06:48 PM#2
johnfn
Arrgh, that was confusing. I mean, severly confusing. But, your in luck because I think I know what your driving at and can help.

(Activates translation program)

What I THINK you want to do is make a certain amount of units depending on how many casters can cast a spell. Yes? No? Maybe? Anyway. What I'll show you is how to use the for loops, 2 for loops in fact, to make the right amount of units.

(You have to get the amount of casting units, and how many units are created per caster, but thats all you need)

For each integer A from 1 to (Amount_Of_Casting_units)
For each Integer B from 1 to (Units_produced_for_every_casting_unit)
Create one Spawned_unit at (spawining location) facing default building facing degrees.


Eh?!? What does that do? Well the A loop says to do everything inside it an amount of times that is designated by the amount of casting units. Loop B creates, say, 6 units per each casting unit (because it goes as many times as there are casting units, times six, because of the for loops). If that didnt make any sense, re-read, look over the trigger. Its confusing but when you get it its suprisingly helpful.

I hope that made sense. If I got your request totally wrong, dont shoot :-p