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

Change owner when...

Status
Not open for further replies.
Level 5
Joined
Oct 6, 2010
Messages
85

I have special buildings all around my map and I need a trigger to Change the owner of those buildings when a player puts a flag in a specific region.


I imagine that it would go something like this:

Event - A building is built in [Region]
Condition - Owner of built structure is equal to [Player]
Action - Change owner and colour of 'unit' to [Player]
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Something like this:
  • Untitled Trigger 035
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Barracks
      • (region contains (Constructed structure)) Equal to True
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Gryphon Aviary) and do (Actions)
        • Loop - Actions
          • Unit - Change ownership of (Picked unit) to (Triggering player) and Change color
 
Level 5
Joined
Oct 6, 2010
Messages
85
This seems to work but I don't know if it works for all players

197680-albums4574-picture44889.png
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
It should be Owner of Triggering Unit, not Triggering Player. Change that, and the trigger he made for you should work.

Both can be used:
Owner of Triggering unit
Triggering player
Owner of Triggering unit = Triggering player

Triggering player executes at a higher rate speed.

Trigger Example:
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Banish
    • Actions
      • Unit - Change ownership of (Target unit of ability being cast) to (Triggering player) and Change color
 
Status
Not open for further replies.
Top