| 03-17-2005, 09:17 AM | #1 |
This is 2 my trigger: Trigger 1 : learn Event unit learn skill Con learn hero skill equal to "A spell" Action trigger turn on "ActionTrigger" Trigger 2 : ActionTrigger Even Every 2 second of game time Con none Action Pick every unit in "My Hero" within 400 range and do action if picked unit has buff "A's Buff Spell" equal False then Create 1 "Caster Spell" at Pos(My hero) ..... Order Last created unit To "A spell" To Picked Unit ok !!! I start this map and train 1 Hero my auto spell has no problem ...... But when I train more 1 or 2 or 3 ...... Hero. Alway has 1 Hero(the last hero) can auto cast spell Then I want to ask how to make my trigger on muti unit(when train or create it ) ? |
| 03-17-2005, 10:07 AM | #2 |
Well, that's because your trigger only checks units around a single hero, and that hero is the last one to learn the skill. Instead of MyHero being a normal unit variable, you should turn it into a unit variable array. Then you also need an integer, let's name it NumberOfHeroes. Now, make the following trigger: Code:
Events:
A unit enters playable map area
Conditions:
(entering unit is a hero) equal to true
Actions:
Set NumberOfHeroes = NumberOfHeroes + 1
Set MyHero[NumberOfHeroes] = (entering unit)Now for the spell's trigger: Code:
Events:
Every 2 seconds of game-time
Conditions:
Actions:
For each integer A from 1 to NumberOfHeroes do actions
Loop - Actions:
If - Then - Else multiple functions:
If - conditions:
(level of (spell A) for MyHero[(Integer A)]) greater than 0
Then - actions:
[i]Pick every unit in "My Hero" within 400 range and do action
if picked unit has buff "A's Buff Spell" equal False then
Create 1 "Caster Spell" at Pos(My hero) .....
Order Last created unit To "A spell" To Picked Unit[/i]
Else - actions:
do nothing |
| 03-17-2005, 01:08 PM | #3 |
First , thanks you about that !!! :-) Second , this my example, not real spell. I post this to know how to make it on muti unit ! I made so much spell like this example, and now i think your trigge will help me to comple these spell. And the third : ...... Thanks you so much ! hehehe |
