• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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: 93
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