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

[Trigger] Hero select problem

Status
Not open for further replies.
Level 17
Joined
Apr 24, 2005
Messages
762
  • Hero SelectRed
    • Events
      • Unit - A unit enters Archmage <gen>
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entering unit) Equal to (Picked unit)
            • Then - Actions
              • Unit - Kill (Entering unit)
              • Unit - Create 1 Archmage for Player 1 (Red) at (Center of Player1Respawn <gen>) facing Default building facing degrees
            • Else - Actions
              • Unit - Create 1 Archmage for Player 2 (Blue) at (Center of Player 2 Respawn <gen>) facing Default building facing degrees
So if a wisp owned by player 1 enters the region it creates an archmage for player 1. If the wisp isnt owned by player 1 it creates an archmage for player 2. But for some reason it creates 2 archmages for player 2 and 1 archmage for player 1. What could cause this?

EDIT: ok turns out that player 1 having 2 units (instead of only the wisp) caused 2 archmages to appear for player 2 somehow.
 
Level 6
Joined
Mar 2, 2006
Messages
306
dont pick anything here.
just do:
  • If unit type of entering unit equal to wisp then
    • If owner of entering unit equal to player 1 then
      • Unit - create a hero on the left side
      • Camera - pan camera to left side over 1 seconds
    • Else
      • Unit - create a hero on the right side side
      • Camera - pan camera to right side over 1 seconds
    • Unit - remove entering unit from the game
  • Else
    • Do nothing.
do not pan camera as neccessary. change time to 0sec or to 2sec if you want.
 
Level 21
Joined
Jan 5, 2005
Messages
3,515
edge just to clean your up a little you should end up with something like this:

  • Oh Noes
    • Events
      • Unit - A unit enters Archmage <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Wisp
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Unit - Create 1 Archmage for Player 1 (Red) at (Center of Player 1 Respawn <gen>) facing Default building facing degrees
        • Else - Actions
          • Unit - Create 1 Archmage for Player 2 (Blue) at (Center of Player 2 Respawn <gen>) facing Default building facing degrees
 
Level 11
Joined
Jul 12, 2005
Messages
764
And what about
  • ...this?
  • Events
    • Unit - A unit enters Archmage <gen>
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Wisp
  • Actions
    • Unit - Create 1 Archmage for (Owner of (Triggering unit)) at Respawn[(Player number of (Owner of (Triggering unit)))] facing Default building facing degrees
You only have to store the spawn locations initially like:
Set Respawn[1] = (Center of Player 1 Respawn <gen>)
Set Respawn[2] = (Center of Player 2 Respawn <gen>)
Set Respawn[3] = (Center of Player 3 Respawn <gen>)
...
 
Status
Not open for further replies.
Top