HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Fx created when a unit is attacked with a certain item...

11-24-2006, 11:12 PM#1
JetFangInferno
i need help making a trigger that creates an effect on the attacked unit if the attacking unit has a specific item. i made this trigger 4 times for 4 different elements: fire,water,winda,water. Is there a way to group them all together? Here's what i have so far:

FireSwordEffect
Events
Unit - A unit Is attacked
Conditions
((Attacking unit) is A Hero) Equal to True
((Attacking unit) has an item of type Fire Sword) Equal to True
Actions
Special Effect - Create a special effect at (Position of (Attacked unit)) using war3mapImported\FireSwordHit.mdx
Special Effect - Destroy (Last created special effect)

EarthSwordEffect
Events
Unit - A unit Is attacked
Conditions
((Attacking unit) is A Hero) Equal to True
((Attacking unit) has an item of type Earth Sword) Equal to True
Actions
Special Effect - Create a special effect at (Position of (Attacked unit)) using war3mapImported\EarthSwordHit.mdx
Special Effect - Destroy (Last created special effect)

WaterSwordEffect
Events
Unit - A unit Is attacked
Conditions
((Attacking unit) is A Hero) Equal to True
((Attacking unit) has an item of type Water Sword) Equal to True
Actions
Special Effect - Create a special effect at (Position of (Attacked unit)) using war3mapImported\WaterSwordHit.mdx
Special Effect - Destroy (Last created special effect)

WindSwordEffect
Events
Unit - A unit Is attacked
Conditions
((Attacking unit) is A Hero) Equal to True
((Attacking unit) has an item of type Wind Sword) Equal to True
Actions
Special Effect - Create a special effect at (Position of (Attacked unit)) using war3mapImported\WindSwordHit.mdx
Special Effect - Destroy (Last created special effect)



is there something wrong?
11-24-2006, 11:30 PM#2
shadow1500
Few things:
  • The effects will be created on the ground and not on the unit.
  • You are leaking a location in each of the triggers.
  • The "A unit is attacked" event when the unit is about to execute the attack, not when the attack hits.

Yes you can shorten it to one trigger like this:
Trigger:
FireSwordEffect
Collapse Events
Unit - A unit Is attacked
Collapse Conditions
((Attacking unit) is A Hero) Equal to True
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Attacking unit) has an item of type Earth Sword) Equal to True
Collapse Then - Actions
Special Effect - Create a special effect at (Position of (Attacked unit)) using war3mapImported\FireSwordHit.mdx
Special Effect - Destroy (Last created special effect)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Attacking unit) has an item of type Fire Sword) Equal to True
Collapse Then - Actions
Special Effect - Create a special effect at (Position of (Attacked unit)) using war3mapImported\FireSwordHit.mdx
Special Effect - Destroy (Last created special effect)
Else - Actions
ETC for each item
11-25-2006, 04:36 PM#3
JetFangInferno
thx man ^^ +rep for helping me