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

Is this trigger working the way I want it to ?

Status
Not open for further replies.

Ardenian

A

Ardenian

  • Hero Choice
    • Events
      • Player - Player 1 (Red) selects a unit
      • Player - Player 2 (Blue) selects a unit
      • Player - Player 3 (Lightblue) selects a unit
      • Player - Player 4 (Purple) selects a unit
      • Player - Player 5 (Yellow) selects a unit
    • Conditions
      • (Owner of (Triggering unit)) Equal Neutral passiv
      • ((Triggering player) is in playergroup) Equal False
    • Actions
      • Unit - Change ownership of (Triggering unit) to (Triggering player) and change color
      • Playergroup - Add (Triggering player) to playergroup
        • If ((Triggering player) Equal Player 1 (Red)) then do (Set Hero_Player1 = (Triggering unit))
  • else do (If ((Triggering player) Equal Player 2 (Blue)) then do (Set Hero_Player2 = (Triggering unit))
  • else do (If ((Triggering player) Equal Player 3 (Lightblue)) then do (Set Hero_Player3 = (Triggering unit))
  • else do (If ((Triggering player) Equal Player 4 (Purple) then do (Set Hero_Player4 = (Triggering unit))
  • else do (If ((Triggering player) Equal Player 5 (Yellow)) then do (Set Hero_Player5 = (Triggering unit))
  • else do ( Do nothing)
Is this trigger alright and does what I want it to ?

I want that a hero that is selected by a player changes ownership and a special variable is set to the selected unit ( I will need this variable for certain stuff later).
For better overview I broke syntax.

I am glad if you could comment on it.
 
Level 9
Joined
Apr 23, 2011
Messages
527
it will, probably, but the trigger is messy, you should optimize it like this:
  • Hero Choice
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Passive
      • ((Triggering player) is in playergroup) Not equal to True
    • Actions
      • Set playernumber = (Player number of (Triggering player))
      • Player Group - Add (Player(playernumber)) to playergroup
      • Unit - Change ownership of (Triggering unit) to (Player(playernumber)) and Change color
      • Set Hero_Player[playernumber] = (Triggering unit)
 
Status
Not open for further replies.
Top