Moving unit for each player that spawns units

Dalemil

New Member
Reaction score
2
Here's my problem. Player 1, 2 and 3 all buy spawners. Player 1 buys his first, but when Player 2 buys his spawner, Player 1's spawner stops spawning units. When Player 3 buys a spawner, Player 2's spawner stops spawning units. So the only one that spawns units is Player 3's. I can't find the leak where ever it be. Please help me with this. Also, I was lazy and only posted the "human" spawning trigger. All four of them look the same.

Trigger:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Game - Set the time of day to 6.00
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 50
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across (Playable map area)
          • Player - Turn Gives bounty On for (Picked player)
          • Camera - Pan camera for (Picked player) to (Center of (Playable map area)) over 0.00 seconds
      • Countdown Timer - Start timer as a Repeating timer that will expire in 5.00 seconds

Trigger:
  • Spawn Pick
    • Events
      • Unit - A unit Sells a unit
    • Conditions
    • Actions
      • Set Sold_unit = (Sold unit)
      • Set owner_Sold = (Owner of (Sold unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Sold unit)) Equal to Night Elf Spawner
        • Then - Actions
          • Unit - Create 1 Basic Night Elf for owner_Sold at (owner_Sold start location) facing Default building facing degrees
          • Unit - Move Sold_unit instantly to (owner_Sold start location)
          • Camera - Pan camera for owner_Sold to (Position of Sold_unit) over 0.00 seconds
          • Trigger - Turn on Picks Night Elf <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Sold unit)) Equal to Orc Spawner
        • Then - Actions
          • Unit - Create 1 Basic Orc for owner_Sold at (owner_Sold start location) facing Default building facing degrees
          • Unit - Move Sold_unit instantly to (owner_Sold start location)
          • Camera - Pan camera for owner_Sold to (Position of Sold_unit) over 0.00 seconds
          • Trigger - Turn on Picks Orc <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Sold unit)) Equal to Undead Spawner
        • Then - Actions
          • Unit - Create 1 Basic Undead for owner_Sold at (owner_Sold start location) facing Default building facing degrees
          • Unit - Move Sold_unit instantly to (owner_Sold start location)
          • Camera - Pan camera for owner_Sold to (Position of Sold_unit) over 0.00 seconds
          • Trigger - Turn on Picks Undead <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Sold unit)) Equal to Human Spawner
        • Then - Actions
          • Unit - Create 1 Basic Human for owner_Sold at (owner_Sold start location) facing Default building facing degrees
          • Unit - Move Sold_unit instantly to (owner_Sold start location)
          • Camera - Pan camera for owner_Sold to (Position of Sold_unit) over 0.00 seconds
          • Trigger - Turn on Picks Human <gen>
        • Else - Actions

Trigger:
  • Picks Human
    • Events
      • Time - timer expires
    • Conditions
      • (Unit-type of Sold_unit) Equal to Human Spawner
    • Actions
      • Set temp_point = (Position of Sold_unit)
      • Unit - Create 2 Footman for owner_Sold at temp_point facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_temp_point)
 

Mishtiff

New Member
Reaction score
0
im not entirely sure, but it seems as though the trigger you have relates to only the last created unit. which means that youre just excluding all the others. you will have to make new triggers that relate to each player. so it would be "Last created unit for player 1". does that make sense?
 

Dalemil

New Member
Reaction score
2
No, it doesn't really make sense. Could I use a player array or unit array to differentiate between the players/units?
 

Dalemil

New Member
Reaction score
2
I think I came up with a solution, although i can't really tell if its leakless.

Trigger:
  • Night Elf1
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Sold unit)) Equal to Night Elf Spawner
    • Actions
      • Set Sold_unit[1] = (Sold unit)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Trigger - Turn on Night Elf2 <gen>
          • Player - Make (Unit-type of Sold_unit[1]) Unavailable for training/construction by (Picked player)
          • Unit - Move Sold_unit[1] instantly to ((Owner of Sold_unit[1]) start location)
      • Unit - Create 1 Basic Night Elf for (Owner of (Sold unit)) at temp_point[1] facing Default building facing degrees


Trigger:
  • Night Elf2
    • Events
      • Time - timer expires
    • Conditions
    • Actions
      • Set temp_point[1] = (Position of Sold_unit[1])
      • Unit - Create 2 Treant for (Owner of Sold_unit[1]) at (Position of Sold_unit[1]) facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_temp_point[1])
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top