• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Damage a random enemy hero

Status
Not open for further replies.
Level 3
Joined
Aug 31, 2010
Messages
35
Hey,
I've got a problem with my trigger.
I want a random enemy hero on the map to take X damage. But this trigger damages every enemy hero. What have I made wrong? I could also have missed something, but I just know not what.

I am noob if it is about the World editor. Are lenient please that I do not know everything.

My WE is in German but i tried to translate some words as good as i can. Not every word may fit with the one of the english WE.

Thanks to everyone helping me.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • 'IF'-Conditions
      • (((Picked unit) is a hero) equal True) and (((Picked unit) belongs to an enemy of (Owner of (Casting unit))) equal True)
    • 'THEN'-Actions
      • Unit Group - Add (Picked unit) to EnemyHeroes[(Player number of (Owner of (Casting unit)))]
      • Set WotLTarget[(Player number of (Owner of (Casting unit)))] = (Random unit from EnemyHeroes[(Player number of (Owner of (Casting unit)))])
      • Unit - Cause (Casting unit) to damage WotLTarget[(Player number of (Owner of (Casting unit)))], dealing (300.00 x (Real((Level of Wrath of the Legion for (Casting unit))))) damage of attack type Chaos and damage type Normal
      • Unit Group - Remove all units from EnemyHeroes[(Player number of (Owner of (Casting unit)))]
      • Special Effect - Create a special effect attached to the origin of WotLTarget[(Player number of (Owner of (Casting unit)))] using Abilities\Spells\Other\Doom\DoomDeath.mdl
      • Special Effect - Destroy (Last created special effect)
    • 'ELSE'-Actions
      • Do nothing
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
I assume you're doing everything under a group enumeration.

You could just do this instead:
  • Set EnemyHeroes = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))))
  • Set RandomEnemyHero = (Random unit from EnemyHeroes)
EnemyHeroes is a unit group variable while RandomEnemyHero is a unit variable.

Some Notes:

  • Don't use Do Nothing
  • Use Triggering unit over Casting unit
  • You can use Triggering player instead of Owner of (Triggering unit)). It's because of the way the event works.
 
Status
Not open for further replies.
Top