- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
Not sure why this error keeps popping up, but here is the error and code.
Not sure why this error keeps popping up, but here is the error and code.
JASS:
method addMonster takes unit u returns boolean
local integer i = 0 //counter for looping
local MonsterStruct m = MonsterStruct.create()
if totalMonsters < MAX_MONSTERS:
m.destroy()
return false //failed to add a new monster
else: //we know we have room for the new monster
set m.monster = u
set m.id = GetUnitTypeId(u)
set m.index = monsterId2Index(m.id)
set m.heroLevel = GetHeroLevel(u)
set m.playerId = this.playerId
if totalActive < MAX_ACTIVE_MONSTERS: //check to see if the party has an open spot
set m.active = true
loop
exitwhen i > MAX_ACTIVE_MONSTERS
if activeMonsters[i] == 0:
set activeMonsters[i] = m
endif
set i = i + 1
endloop
set totalActive = totalActive + 1
else: //totalInactive < MAX_ACTIVE_MONSTERS
set m.active = false
loop
exitwhen i > MAX_INACTIVE_MONSTERS
if inactiveMonsters[i] == 0:
set inactiveMonsters[i] = m
endif
set i = i + 1
endloop
set totalInactive = totalInactive + 1
endif
totalMonsters = totalMonsters + 1 //increment the total monster count
return true //we successfully added a new monster
endif
endmethod