Parsival
Active Member
- Reaction score
- 6
Hi.
I'm making a TD map and I need to spawn large amount of creeps each round (~25 for each player and there is place for 10ppl). Well, that's how I do it, but I tried many solutions:
And that's the body of UnitSpawn function:
Well, it causes annoying lag during each spawn. Is there any way to make it more smooth? I tried adding 'Wait' action before each single spawn but it makes this lag even longer. It froze my comp for half a minute.
I also tried to make separate trigger which orders each unit who entered spawn to move, but it changed nothing.
Same with spawn action. I tried For loop which creates 1 unit x times and normal spawn action which creates x units on location.
Any ideas? (
Thanks.
I'm making a TD map and I need to spawn large amount of creeps each round (~25 for each player and there is place for 10ppl). Well, that's how I do it, but I tried many solutions:
Trigger:
- Actions
- For each (Integer IntegerC) from 1 to AllPlayers, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- PlayerOwned[IntegerC] Equal to FALSE
- Then - Actions
- Set TempPoint = (Center of Spawn[IntegerC])
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Real(IntegerC)) mod 2.00) Equal to 0.00
- Then - Actions
- Custom script: call UnitSpawn(udg_Monster_Amount[udg_NextLevel], udg_Monsters[udg_NextLevel], 11)
- Else - Actions
- Custom script: call UnitSpawn(udg_Monster_Amount[udg_NextLevel], udg_Monsters[udg_NextLevel], 10)
- If - Conditions
- Custom script: call RemoveLocation (udg_TempPoint)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- For each (Integer IntegerC) from 1 to AllTeams, do (Actions)
- Loop - Actions
- Set TempPoint = (Center of Team[IntegerC])
- Unit Group - Pick every unit in (Units in LeftTeam[IntegerC]) and do (Unit - Order (Picked unit) to Move TempPoint)
- Unit Group - Pick every unit in (Units in RightTeam[IntegerC]) and do (Unit - Order (Picked unit) to Move TempPoint)
- Custom script: call RemoveLocation (udg_TempPoint)
- Loop - Actions
- For each (Integer IntegerC) from 1 to AllPlayers, do (Actions)
And that's the body of UnitSpawn function:
JASS:
function UnitSpawn takes integer Number, integer UnitID, integer Enemy returns nothing
loop
set Number = Number - 1
exitwhen Number < 0
call CreateUnitAtLoc(Player(Enemy), UnitID, udg_TempPoint, bj_UNIT_FACING)
endloop
endfunction
Well, it causes annoying lag during each spawn. Is there any way to make it more smooth? I tried adding 'Wait' action before each single spawn but it makes this lag even longer. It froze my comp for half a minute.
I also tried to make separate trigger which orders each unit who entered spawn to move, but it changed nothing.
Same with spawn action. I tried For loop which creates 1 unit x times and normal spawn action which creates x units on location.
Any ideas? (
Thanks.