- Joined
- Oct 17, 2013
- Messages
- 29
Why wont this work?
- Creeps
- it doesn't initialize
- it's mean't to create units(complete) and, moveloop(incomplete).
- psss. I'm new to this so don't expect me to write structs and modules and such.
-
- Creeps
- it doesn't initialize
- it's mean't to create units(complete) and, moveloop(incomplete).
- psss. I'm new to this so don't expect me to write structs and modules and such.
-

JASS:
library Creeps /*
*/ initializer Init
//requires
//GroupUtils
//RandomRectXY
//AutoIndex
globals
/* Constants */
/* Time Interval - Lesser for Better Performance, Higher for Lesser Lag Spikes
0.50 - 2.00 */ private constant real MOVE_INTERVAL = 0.90
/* Spawn Interval, Distance - 30 to 90 */
private constant real SPAWN_INTERVAL = 60.00
/* Player Id */
private constant player DP = Player(5)
private constant player EP = Player(11)
/* Unit Id */
private constant integer DMid = 'Hmkg'
private constant integer DRid = 'Emoo'
private constant integer EMid = 'Edem'
private constant integer ERid = 'Hblm'
/* Trigger */
/* Region/Rect */
private rect DSpawnRect
private rect ESpawnRect
private rect array TopMoveRect
private rect array MidMoveRect
private rect array BotMoveRect
/* Timer */
private timer SpawnTimer = CreateTimer()
/* End Constants */
private boolean Spawning
private integer SpawnTime
private integer SpawnCount
private boolean array TopLane
private boolean array MidLane
private boolean array BotLane
private real array Cx
private real array Cy
private real array Mx
private real array My
endglobals
private function SpawnUnits takes nothing returns nothing
if SpawnTime <= SPAWN_INTERVAL then
set SpawnTime = SpawnTime + 1
call DisplayTextToForce( GetPlayersAll(), "SpawnTime = " + R2S(SpawnTime) )
else
set SpawnTime = 0
set Spawning = true
call DisplayTextToForce( GetPlayersAll(), "Spawning" )
endif
if Spawning == true then
call DisplayTextToForce( GetPlayersAll(), "SpawnCount = " + R2S(SpawnCount) )
set SpawnCount = SpawnCount + 1
set Cx[1] = GetRectCenterX(DSpawnRect)
set Cy[1] = GetRectCenterY(DSpawnRect)
set Cx[2] = GetRectCenterX(ESpawnRect)
set Cy[2] = GetRectCenterY(ESpawnRect)
set Mx[1] = GetRectCenterX(TopMoveRect[1])
set My[1] = GetRectCenterY(TopMoveRect[1])
set Mx[2] = GetRectCenterX(ESpawnRect)
set My[2] = GetRectCenterY(ESpawnRect)
set Mx[3] = GetRectCenterX(BotMoveRect[1])
set My[3] = GetRectCenterY(BotMoveRect[1])
set Mx[4] = GetRectCenterX(TopMoveRect[2])
set My[4] = GetRectCenterY(TopMoveRect[2])
set Mx[5] = GetRectCenterX(ESpawnRect)
set My[5] = GetRectCenterY(ESpawnRect)
set Mx[6] = GetRectCenterX(BotMoveRect[2])
set My[6] = GetRectCenterY(BotMoveRect[2])
if SpawnCount <= 5 then
call CreateUnit(DP,DMid,Cx[1],Cy[1],0.00)
set TopLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[1],My[1])
call CreateUnit(EP,EMid,Cx[2],Cy[2],180.00)
set TopLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[4],My[4])
call CreateUnit(DP,DMid,Cx[1],Cy[1],0.00)
set MidLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[2],My[2])
call CreateUnit(EP,EMid,Cx[2],Cy[2],180.00)
set MidLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[5],My[5])
call CreateUnit(DP,DMid,Cx[1],Cy[1],0.00)
set BotLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[3],My[3])
call CreateUnit(EP,EMid,Cx[2],Cy[2],180.00)
set BotLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[6],My[6])
else
call CreateUnit(DP,DRid,Cx[1],Cy[1],0.00)
set TopLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[1],My[1])
call CreateUnit(EP,ERid,Cx[2],Cy[2],180.00)
set TopLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[4],My[4])
call CreateUnit(DP,DRid,Cx[1],Cy[1],0.00)
set MidLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[2],My[2])
call CreateUnit(EP,ERid,Cx[2],Cy[2],180.00)
set MidLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[5],My[5])
call CreateUnit(DP,DRid,Cx[1],Cy[1],0.00)
set BotLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[3],My[3])
call CreateUnit(EP,ERid,Cx[2],Cy[2],180.00)
set BotLane[GetUnitId(bj_lastCreatedUnit)] = true
call IssuePointOrder(bj_lastCreatedUnit,"attack",Mx[6],My[6])
endif
if SpawnCount == 8 then
set Spawning = false
endif
endif
endfunction
private function MoveLoop takes nothing returns nothing
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TimerStart(SpawnTimer, 1.00, true, function SpawnUnits)
call TriggerRegisterTimerEventPeriodic(t, 1.00)
call TriggerAddAction(t, function SpawnUnits)
/* SpawnUnits */
set DSpawnRect = gg_rct_Spawn_Mid_1
set ESpawnRect = gg_rct_Spawn_Mid_2
set TopMoveRect[1] = gg_rct_Move_Top_1
set TopMoveRect[2] = gg_rct_Move_Top_2
set BotMoveRect[1] = gg_rct_Move_Bot_1
set BotMoveRect[2] = gg_rct_Move_Bot_2
endfunction
endlibrary
Attachments
Last edited: