- Joined
- Jun 20, 2017
- Messages
- 380
I had a spawn system in jass, but the units were moving slowly (stuck while walking)!
So I decided to change it to gui while watching this thread
Creating Levels in a Defense Map
And this one to solve it!
How to reduce lag, "many units move to"
My problem is that spawning won't stop! and it crashes my game!
I have this one (shorter) but it doesn't work properly!
So I decided to change it to gui while watching this thread
Creating Levels in a Defense Map
And this one to solve it!
How to reduce lag, "many units move to"
My problem is that spawning won't stop! and it crashes my game!
-
Creeps Spawn2
-
Events
-
Time - Every 0.05 seconds of game time
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of living UnitTypes_Creep[Integer_CurrentLevel] units owned by Player 21 (Coal)) Equal to Integers_CreepCount[Integer_CurrentLevel]
-
(Number of living UnitTypes_Creep[Integer_CurrentLevel] units owned by Player 22 (Snow)) Equal to Integers_CreepCount[Integer_CurrentLevel]
-
-
Then - Actions
-
-------- We then turn off this trigger if the desired number of spawned creeps is meet --------
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-------- If the number of creeps is still not enough, the creation will still continue --------
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[1] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 1
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[1]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[1]
-
-
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[2] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 2
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[2]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[2]
-
-
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[3] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 3
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[3]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[3]
-
-
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[4] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 4
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[4]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[4]
-
-
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[5] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 5
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[5]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[5]
-
-
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[6] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 6
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[6]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[6]
-
-
-
-------- --------
-
-------- --------
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[7] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 7
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[7]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[7]
-
-
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[8] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 8
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[8]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[8]
-
-
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[9] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 9
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[9]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[9]
-
-
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[10] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 10
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[10]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[10]
-
-
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[11] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 11
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[11]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[11]
-
-
-
-------- --------
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[12] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to 12
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[12]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[12]
-
-
-
-
-
-
-
Creeps Spawn
-
Events
-
Time - Every 0.05 seconds of game time
-
-
Conditions
-
Actions
-
Set VariableSet Integer_Temp = 0
-
Set VariableSet Integer_Temp = (Integer_Temp + 1)
-
Set VariableSet Integer_Temp2 = 6
-
Set VariableSet Integer_Temp2 = (Integer_Temp2 + 1)
-
-------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of living UnitTypes_Creep[Integer_CurrentLevel] units owned by Player 21 (Coal)) Equal to Integers_CreepCount[Integer_CurrentLevel]
-
(Number of living UnitTypes_Creep[Integer_CurrentLevel] units owned by Player 22 (Snow)) Equal to Integers_CreepCount[Integer_CurrentLevel]
-
-
Then - Actions
-
-------- We then turn off this trigger if the desired number of spawned creeps is meet --------
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-------- If the number of creeps is still not enough, the creation will still continue --------
-
-------- --------
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 22 (Snow) at Points_CreepSpawn[((Integer A) + Integer_Temp)] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to Integer_Temp
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[1]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[Integer_Temp]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[Integer_Temp]
-
-
-
-
-
-------- --------
-
For each (Integer A) from 7 to 12, do (Actions)
-
Loop - Actions
-
Unit - Create 1 UnitTypes_Creep[Integer_CurrentLevel] for Player 21 (Coal) at Points_CreepSpawn[((Integer A) + Integer_Temp2)] facing Default building facing degrees
-
Unit - Set the custom value of (Last created unit) to Integer_Temp2
-
Unit Group - Add (Last created unit) to UnitGroup_Creep
-
Unit Group - Add (Last created unit) to UnitGroups_TeamCreeps[2]
-
Unit Group - Add (Last created unit) to UnitGroups_PlayerCreeps[Integer_Temp2]
-
Unit Group - Pick every unit in UnitGroup_Creep and do (Actions)
-
Loop - Actions
-
Unit - Order (Picked unit) to Attack-Move To Points_CreepMoveTo[Integer_Temp2]
-
-
-
-
-
-
-
-