• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Uhm, Confused as Heck

Status
Not open for further replies.
I am working on a map that spawns creeps in multiple areas, all at once, but for some reason, the spawn doesn't work with more than one play. Here are the triggers.

  • Spawn Timer
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Countdown Timer - Start SpawnTimer as a Repeating timer that will expire in 10.00 seconds
      • Countdown Timer - Create a timer window for SpawnTimer with title Round One In:
  • Spawn Trigger
    • Events
      • Time - SpawnTimer expires
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Unit - Move PlayerHero[(Player number of (Picked player))] instantly to (Center of PlayerRegions[(Player number of (Picked player))])
          • Wait 2.00 seconds
          • Unit - Create SpawnInteger[Round] SpawnType[Round] for Neutral Hostile at (Random point in PlayerRegions[(Player number of (Picked player))]) facing Default building facing degrees
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is unused
              • ((Picked player) slot status) Equal to Has left the game
            • Then - Actions
            • Else - Actions
              • Unit Group - Pick every unit in (Units in PlayerRegions[(Player number of (Picked player))]) and do (Actions)
                • Loop - Actions
                  • Unit - Kill (Picked unit)
      • Countdown Timer - Destroy (Last created timer window)
      • Trigger - Turn on Time Between Round <gen>
      • Countdown Timer - Pause SpawnTimer
  • Time Between Round
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in (Playable map area) owned by Neutral Hostile)) Equal to 0
        • Then - Actions
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • Unit - Move PlayerHero[(Player number of (Picked player))] instantly to (Center of Shop Region <gen>)
              • Player - Add 300 to (Picked player) Current gold
              • Player - Add 200 to (Picked player) Current lumber
          • Set Round = (Round + 1)
          • Game - Display to (All players) the text: You have 60 Seconds...
          • Countdown Timer - Start SpawnTimer as a Repeating timer that will expire in 60.00 seconds
          • Countdown Timer - Create a timer window for SpawnTimer with title Round Starts In:
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Unit Setup
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set Round = 1
      • Set SpawnInteger[1] = 1
      • Set SpawnType[1] = Footman
      • Set SpawnInteger[2] = 1
      • Set SpawnType[2] = Knight
      • Set SpawnInteger[3] = 1
      • Set SpawnType[3] = Rifleman
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
1. The spawn system leaks... badly.
2. I think all players contains all 16 players. This means the 12 usable player slots and 4 neutral slots. I doubt neutral players have the arrays set for them so you can guess there may be a problem here.
3. Why bother spawning units when the player is not there... This wastes system resources and leaks memory (as units leak no mater what you do).
4. Your one condition makes no sense. You are checking if the player slot status is equal to a value and a different value. A number cannot be two different numbers at a same time so the condition always fails.

The solution is to use a player group global containing all active players to spawn for. You fill this at the map start by checking through all players group and only adding appropriate players to the group. When a player leaves/loses you then remove him from the player group. Then when the timer expires you spawn for all players in this player group (like you do now) but this time with no slot status check.
 
Status
Not open for further replies.
Top