• 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.

Change ownership of attacked/dying unit

Status
Not open for further replies.
Level 6
Joined
May 31, 2008
Messages
218
I'm trying to make a trigger so that when a specific unit is attacked, and lost a certain amount of life/died, it will change onwership to the player that killed/damaged it. The unit should be able to be killed over and over again several times. This is what i tried to make, but it obviously is rather bad since if a unit have to much attack and kills the unit the unit dissapears instead of chaning ownership. Anyone that is willing to help?

  • Untitled Trigger 003
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Life of (Attacked unit)) Less than or equal to (<=) 10.00
      • (Unit-type of (Attacked unit)) Equal to (==) Gold Income
    • Actions
      • Unit - Change ownership of (Attacked unit) to (Owner of (Attacking unit)) and Change color
      • Unit - Set life of (Attacked unit) to 100.00%
 
Last edited:
Level 3
Joined
Apr 13, 2009
Messages
49
Well this should do I think (Untested)

First Trigger:

When the incident happens that a unit is killed it will be created for that player.

  • Unit Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
    • Actions
      • Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Killing unit)) at (Position of (Killing unit)) facing Default building facing degrees
Should the health of the unit go below 10 then his ownership will change

  • Untitled Trigger 002
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Life of (Attacked unit)) Less than or equal to 10.00
    • Actions
      • Unit - Change ownership of No unit to (Owner of (Attacking unit)) and Change color
      • Unit - Set life of (Attacked unit) to 100.00%
 
Status
Not open for further replies.
Top