• 🏆 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!

How Do You Create A Trigger That Turns Over Control After A Building Is Taken

Status
Not open for further replies.
Level 3
Joined
Nov 28, 2009
Messages
28
By that I mean the way in TAF or games like that after you take a city it becomes yours. If theres a Tutorial That explains this, I must have missed it, but if there isnt one please give me help with the Trigger.:ned:
 
Level 7
Joined
Jun 16, 2008
Messages
327
Hey there, AngryRedMidget
If you want individual buildings to be captured and turned over to the player whose units have captured the building, there are several ways to do it.

The most common way is to damage the building:
  • Example: Capture damaged building
  • Events
    • Unit - <Building>'s life becomes less than <value>
  • Conditions
  • Actions
    • Unit - Change ownership of <Building> to (Owner of (Killing unit)) and Change Color
    • Unit - Set life of <Building> to 100%
-----

Another way is to use an ability to capture the building:

  • Example: Capture Building with Ability
  • Events
    • Unit - A unit Finishes casting an ability
  • Conditions
    • (Ability being cast) Equal to Capture Building
    • ((Target unit of ability being cast) is A structure) Equal to True
  • Actions
    • Unit - Change ownership of <Building> to (Owner of (Killing unit)) and Change Color
(Remember to use an ability that can be cast on buildings for this one. "Capture Building" is just used as an example; it should be replaced by the name of the ability you have made to suit this purpose.)

-----

Finally, another way is to use or bring an item to the building. This can be done in two ways; bring an item to the building, or use an item on the building.

The first way I'll show as an example is to bring an item to the building:

First off, you need to create a unit variable which is assigned to the carrier of the unit. Make a trigger that sets the variable to the unit whenever it acquires or picks up the item. Remember to also make a trigger that nulls the variable (sets it to nothing) when the carrier of the item drops it. (In my example, it will be called ItemCarrier.)
  • Example: Capture Building With Item Brought
  • Events
    • Unit - A unit comes within 150.00 of ItemCarrier
  • Conditions
  • Actions
    • Unit - Change ownership of <Building> to (Owner of (Killing unit)) and Change Color

The other way is to use the item on the building itself:
  • Example: Capture Building With Use of Item
  • Events
    • Unit - A unit Uses an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to Building Capture Item
    • ((Target unit of issued order) is A structure) Equal to True
  • Actions
    • Unit - Change ownership of <Building> to (Owner of (Killing unit)) and Change Color
 
Level 9
Joined
May 30, 2008
Messages
430
  • Example: Capture damaged building
  • Events
  • Unit - <Building>'s life becomes less than <value>
  • Conditions
  • Actions
  • Unit - Change ownership of <Building> to (Owner of (Killing unit)) and Change Color
  • Unit - Set life of <Building> to 100%
should be

"Unit - Change ownership of <attacked unit> to (Owner of (attacking unit)) and Change Color
Unit - Set life of <attacked unit> to 100%


  • Example: Capture Building with Ability
  • Events
  • Unit - A unit Finishes casting an ability
  • Conditions
  • (Ability being cast) Equal to Capture Building
  • ((Target unit of ability being cast) is A structure) Equal to True
  • Actions
  • Unit - Change ownership of <Building> to (Owner of (Killing unit)) and Change Color
should be

"Unit - Change ownership of <targeted of ability being cast> to (Owner of (casting unit))

  • Example: Capture Building With Item Brought
  • Events
  • Unit - A unit comes within 150.00 of ItemCarrier
  • Conditions
  • Actions
  • Unit - Change ownership of <Building> to (Owner of (Killing unit)) and Change Color
should be
Conditions
triggering unit is a unit of type "your building goes here"
Actions
Unit - Change ownership of <triggering unit> to (Owner of (ItemCarrier)) and Change Color
note "ItemCarrier" must be set as variable in another trigger



  • Example: Capture Building With Use of Item
  • Events
  • Unit - A unit Uses an item
  • Conditions
  • (Item-type of (Item being manipulated)) Equal to Building Capture Item
  • ((Target unit of issued order) is A structure) Equal to True
  • Actions
  • Unit - Change ownership of <Building> to (Owner of (Killing unit)) and Change Color
should be

((Target unit of issued order) is A structure) Equal to True (NO NEED OF THIS)

conditions
unit type of unit being targeted is "your unit goes here"
actions
Unit - Change ownership of <targeted unit> to (Owner of (casting unit)) and Change Color
 
Status
Not open for further replies.
Top