HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spell Trigger Help

11-23-2009, 02:07 AM#1
Itachi[EOSS]
Ok well, this spell is called "Omnislash" and the point of it is to move instantly to one unit then damage it through triggers, then move instantly to another unit, etc. Level one attacks 3 random units, level two is 6, and level three is 9.
The blood mage model with a skin over it is the caster. War stomp is the hero spell and Storm Bolt is the spell to target individual units.

The problem? When the spell is cast, sometimes (on all levels), it doesn't hit the number of units it should. Actually, sometimes, the hero hits less units then it should.

Trigger:
Omnislash test2
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Omnislash
Collapse Actions
Set OmnislashCaster = (Casting unit)
Set PlayerForOmni = (Owner of OmnislashCaster)
Set OmnislashCaster = (Casting unit)
Set OmnislashPlayerNumber = (1 x (Player number of (Owner of OmnislashCaster)))
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Unit - Make OmnislashCaster Invulnerable
Unit - Add Omnislash [Blink] to OmnislashCaster
Unit Group - Pick every unit in (Units within 1000.00 of (Target point of ability being cast)) and do (Unit Group - Add (Picked unit) to OmnislashGroup)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of Omnislash for OmnislashCaster) Equal to 1
(Integer((Mana of OmnislashCaster))) Greater than or equal to 90
Collapse Then - Actions
Unit - Set mana of OmnislashCaster to ((Mana of OmnislashCaster) - 90.00)
Collapse For each (Integer A) from 1 to 3, do (Actions)
Collapse Loop - Actions
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Unit - Order OmnislashCaster to Human Mountain King - Storm Bolt (Random unit from OmnislashGroup)
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Wait 0.03 seconds
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of Omnislash for OmnislashCaster) Equal to 2
(Integer((Mana of OmnislashCaster))) Greater than or equal to 90
Collapse Then - Actions
Unit - Set mana of OmnislashCaster to ((Mana of OmnislashCaster) - 90.00)
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Unit - Order OmnislashCaster to Human Mountain King - Storm Bolt (Random unit from OmnislashGroup)
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Wait 0.03 seconds
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Level of Omnislash for OmnislashCaster) Equal to 3
(Integer((Mana of OmnislashCaster))) Greater than or equal to 90
Collapse Then - Actions
Unit - Set mana of OmnislashCaster to ((Mana of OmnislashCaster) - 90.00)
Collapse For each (Integer A) from 1 to 9, do (Actions)
Collapse Loop - Actions
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Unit - Order OmnislashCaster to Human Mountain King - Storm Bolt (Random unit from OmnislashGroup)
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Wait 0.03 seconds
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Collapse Else - Actions
Do nothing
Wait 0.05 seconds
Unit - Remove Omnislash [Blink] from OmnislashCaster
Unit Group - Remove all units from OmnislashGroup
Unit - Make OmnislashCaster Vulnerable
Selection - Select OmnislashCaster for (Owner of OmnislashCaster)

And the accompanying trigger for when the Caster casts Storm Bolt to blink and do damage, I purposely set it high to see how much units gets hit.

Trigger:
Omnislash blink
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Omnislash [Blink]
Collapse Actions
Unit - Cause OmnislashCaster to damage (Target unit of ability being cast), dealing (500.00 x (Real((Level of Omnislash for OmnislashCaster)))) damage of attack type Chaos and damage type Normal
Unit - Move OmnislashCaster instantly to (Target point of ability being cast)
11-23-2009, 11:39 AM#2
Anitarf
If another trigger runs while this trigger is running (which can happen since you have wait actions in there) and that trigger also uses an integer A loop, it will override your current loop. You should use a unique variable for your loop here.
11-23-2009, 10:37 PM#3
Itachi[EOSS]
I'm not sure if I'm doing it right because the problem is still there, so in a nutshell... All I changed in my triggers is from
Trigger:
For each (Integer A) from 1 to 3, do (Actions)
Collapse Loop - Actions
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Unit - Order OmnislashCaster to Human Mountain King - Storm Bolt (Random unit from OmnislashGroup)
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Wait 0.03 seconds
Selection - Remove OmnislashCaster from selection for PlayerForOmni
to
Trigger:
For each (Integer OmnislashAmount) from 1 to 3, do (Actions)
Collapse Loop - Actions
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Unit - Order OmnislashCaster to Human Mountain King - Storm Bolt (Random unit from OmnislashGroup)
Selection - Remove OmnislashCaster from selection for PlayerForOmni
Wait 0.03 seconds
Selection - Remove OmnislashCaster from selection for PlayerForOmni

All was changed is from Integer A -> Integer OmnislashAmount
and I set OmnislashAmount = 1
I had also tried it like this:
Trigger:
Set OmnislashAmount = (3 x (Level of Omnislash for OmnislashCaster))
Truthfully, when I had it at Integer A, it worked much better.
12-03-2009, 11:28 PM#4
Kueken
Try to pick only alive units, the way you have it now you try to attack dead units, too.