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

Triggering: change Owner Building

Status
Not open for further replies.
Level 3
Joined
Oct 20, 2012
Messages
18
hey guys, I've got a problem making a triggers.. and i'm very new on making maps,.. how can i trigger like this []
when an attacking units attack (triggering structure) >
probably (triggering structure) is destroyed > then the (Triggering structure) will rise with 50%hp > and (triggering Structure) will be change owner to a player who destroy it. im sure you can help me making this trigger.
 
Your first step is unneeded, cause you can put the second one as event.
You can't resurrect a building, so you should create a new one instead.

So, basically it is :

-Event : An unit Dies
-Condition : If unit-type = TheBuildingUnit'sType
-Actions :
- Create 1 <Building> at position of Dying Unit for Owner of Killing Unit.
- Set life of Last Created Unit to 50%
 
Level 11
Joined
Jun 20, 2009
Messages
880
  • Chance Owner
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Farm
    • Actions
      • Set TempLoc = (Position of (Triggering unit))
      • Unit - Create 1 Farm for (Owner of (Killing unit)) at TempLoc facing Default building facing degrees
      • Unit - Set life of (Last created unit) to 50.00%
      • Custom script: call RemoveLocation(udg_TempLoc)
Download the demo map below if needed.

Edit:
Aww, im too slow :/
 

Attachments

  • Demo Map.w3x
    13 KB · Views: 94
Level 33
Joined
Mar 27, 2008
Messages
8,035
Although there is more efficient method (by not dynamically creating units - would clog up the game memory (I heard units are not properly removed/recycle eh ?)), you could detect if the unit's HP < 0.405, change the owner and increase its HP up to 50%.

This way, the building can never be destroyed (since that is your purpose - only to change ownership when it is "destroyed").
 
Level 3
Joined
Oct 20, 2012
Messages
18
Costom Script Error

why i do have a script error on " call RemoveLocation(udg_Temploc) it shows after i click test map.. is there something wrong? i make some variable like this
variable name Temploc
Variable type point
i try again and again but it still end up like this...
 
Status
Not open for further replies.
Top