HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Custom Spell Trigger Partly Not Working..

12-26-2006, 04:43 AM#1
Tinki3
My trigger doesn't loop properly.. And if it does loop, it doesn't do any of the loop actions at all except for playing the triggering unit's attack animation

Can anyone help?
Trigger:
Mana Slash
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Mana Slash
Collapse Actions
Set Damage = 0.00
Unit - Turn collision for (Triggering unit) Off
Special Effect - Create a special effect attached to the weapon, right of (Triggering unit) using Abilities\Weapons\SpiritOfVengeanceMissile\SpiritOfVengeanceMissile.mdl
Set MS_FX[1] = (Last created special effect)
Special Effect - Create a special effect attached to the weapon, left of (Triggering unit) using Abilities\Weapons\SpiritOfVengeanceMissile\SpiritOfVengeanceMissile.mdl
Set MS_FX[2] = (Last created special effect)
Collapse For each (Integer A) from 1 to (((Level of Mana Slash for (Triggering unit)) x 2) + 2), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) is alive) Equal to True
((Target unit of ability being cast) is alive) Equal to True
Collapse Then - Actions
Set Damage = (Damage + ((Mana of (Triggering unit)) x 0.05))
Set MS_Target_loc = (Position of (Target unit of ability being cast))
Unit - Move (Triggering unit) instantly to MS_Target_loc
Animation - Play (Triggering unit)'s attack animation
Special Effect - Create a special effect attached to the chest of (Target unit of ability being cast) using Abilities\Spells\Other\Charm\CharmTarget.mdl
Special Effect - Destroy (Last created special effect)
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing Damage damage of attack type Hero and damage type Normal
Custom script: call RemoveLocation(udg_MS_Target_loc)
Wait 0.32 game-time seconds
Collapse Else - Actions
Unit - Turn collision for (Triggering unit) On
For each (Integer A) from 1 to 2, do (Special Effect - Destroy MS_FX[(Integer A)])
Unit - Turn collision for (Triggering unit) On
For each (Integer A) from 1 to 2, do (Special Effect - Destroy MS_FX[(Integer A)])
12-26-2006, 06:13 AM#2
Pyrogasm
It's because you're using the "Target unit of ability being cast" function to refer to a unit after a wait command. The problem is that after any sort of a wait command, only the "Triggering Unit" function and variable references work.

I suggest you use a local variable in order to be able to refer to the unit, so the trigger would look something like this:
Trigger:
Mana Slash
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Mana Slash
Collapse Actions
Custom Script: local unit udg_Mana_Slash_Target
Set Damage = 0.00
Unit - Turn collision for (Triggering unit) Off
Special Effect - Create a special effect attached to the weapon, right of (Triggering unit) using Abilities\Weapons\SpiritOfVengeanceMissile\SpiritOfVengeanceMissile.mdl
Set MS_FX[1] = (Last created special effect)
Special Effect - Create a special effect attached to the weapon, left of (Triggering unit) using Abilities\Weapons\SpiritOfVengeanceMissile\SpiritOfVengeanceMissile.mdl
Set MS_FX[2] = (Last created special effect)
Collapse For each (Integer A) from 1 to (((Level of Mana Slash for (Triggering unit)) x 2) + 2), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
((Triggering unit) is alive) Equal to True
((Mana_Slash_Unit) is alive) Equal to True
Collapse Then - Actions
Set Damage = (Damage + ((Mana of (Triggering unit)) x 0.05))
Set MS_Target_loc = (Position of (Mana_Slash_Unit))
Unit - Move (Triggering unit) instantly to MS_Target_loc
Animation - Play (Triggering unit)'s attack animation
Special Effect - Create a special effect attached to the chest of (Mana_Slash_Unit) using Abilities\Spells\Other\Charm\CharmTarget.mdl
Special Effect - Destroy (Last created special effect)
Unit - Cause (Triggering unit) to damage (Mana_Slash_Unit), dealing Damage damage of attack type Hero and damage type Normal
Custom script: call RemoveLocation(udg_MS_Target_loc)
Wait 0.32 game-time seconds
Collapse Else - Actions
Unit - Turn collision for (Triggering unit) On
For each (Integer A) from 1 to 2, do (Special Effect - Destroy MS_FX[(Integer A)])
Custom Script: set udg_Mana_Slash_Unit = null
Another thing is that you have 2 repeated actions at the end, which I have removed (Turn collision off and remove SFX)

That should do it, and if you don't understand the local variable thing, make sure you read this guide on MUI (Multi-user instanceablity, which is something that this spell also lacks).
12-26-2006, 06:44 AM#3
Tinki3
Quote:
It's because you're using the "Target unit of ability being cast" function to refer to a unit after a wait command. The problem is that after any sort of a wait command, only the "Triggering Unit" function and variable references work.

Wow. I knew about the triggering unit being able to work after a wait, but not the target unit of ability being cast NOT being able to be used after a wait. Thanks!

Quote:
That should do it, and if you don't understand the local variable thing, make sure you read this guide on MUI (Multi-user instanceablity, which is something that this spell also lacks).

Don't worry, I understand the local variable thing

I usually always make my spells in GUI, then make them 100% MUI later on.

Thx for your help!
12-26-2006, 06:56 AM#4
Pyrogasm
Yup, only "Triggering Unit" works after a wait. Goddamnit the WE for it working that way. I work the same way you do, and I'm glad I could help out