Spawning creeps at intervals

Vroomfondel

New Member
Reaction score
0
Code:
Monster Spawn Sweep
    Events
        Time - Every 0.50 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 0 to NumSpawners, do (Actions)
            Loop - Actions
                Game - Display to (All players) the text: ((String((Integer A))) + ( -  + (String(Frequencies[(Integer A)]))))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (MonsterSpawners[(Integer A)] is alive) Equal to True
                        (Number of units in MonsterGroups[(Integer A)]) Less than MaxMonsters[(Integer A)]
                        EnableSpawners[(Integer A)] Equal to True
                    Then - Actions
                        Set Frequencies[(Integer A)] = (Frequencies[(Integer A)] - 1)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Frequencies[(Integer A)] Equal to 0
                            Then - Actions
                                Set Frequencies[(Integer A)] = FrequenciesInit[(Integer A)]
                                Unit - Create 1 SpawnTypes[(Integer A)] for Player 12 (Brown) at (Position of MonsterSpawners[(Integer A)]) facing (Random real number between 0.00 and 360.00) degrees
                                Unit Group - Add all units of (Last created unit group) to MonsterGroups[(Integer A)]
                                Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                            Else - Actions
                    Else - Actions

I copied this with changes from the Reign of Chaos official map Warchasers.

my map is still in the testing phase, so I only have two spawners. they both start spawning exactly when I tell them to, and they stop when they hit the cap. Frequencies[0] is 4, so a new creep spawns every two seconds. Frequencies[1] is also 4, but it's only decrementing when Frequencies[0] hits 0 and resets to 4.

I put this line in, that's how I figured it out: "Display text: Integer A + Frequencies[Integer A]"

Sample output:

0 4
0 3
0 2
0 1 (unit[0] spawns#1)
1 4
0 4
0 3
0 2
0 1 (unit[0] spawns#2)
1 3
0 4
0 3
0 2
0 1 (unit[0] spawns#3)
1 2
0 4
0 3
0 2
0 1 (unit[0] spawns#4)
1 1 (unit[1] spawns#1)

~then it repeats until unit[0] has 7 out~

0 4
0 3
0 2
0 1 (unit[0] spawns#7)
1 4
1 3
1 2
1 1 (unit[1] spawns#2)

etc.


I keep mentally walking through the code, and I don't see why they aren't counting at the same rate.
 
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