- Joined
- Apr 6, 2008
- Messages
- 760
hi, im try to "bind" a real array to a unit with H2I method, but it causes my game to crash. well here's my code
this is the first time i work with H2I(some time have to be the first ), im not even sure if this is a good method 2 do it ^^
JASS:
globals
private constant integer MIN_HANDLE = 0x100000
private real array hp [8191]
endglobals
//in a loop some where
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
call GroupAddUnit(d.g,u)
set life = GetUnitState(u,UNIT_STATE_MAX_LIFE)/100*(d.lvl*10)
debug if (H2I(u)-MIN_HANDLE>=8191) then
debug call BJDebugMsg("Handle index to high")
debug call BJDebugMsg(I2S(H2I(u)-MIN_HANDLE))
debug else
set hp[H2I(u)-MIN_HANDLE] = life
debug call BJDebugMsg(I2S(H2I(u)-MIN_HANDLE))
debug endif
call AddUnitMaxState(u,UNIT_STATE_MAX_LIFE,life)
endif
endloop
this is the first time i work with H2I(some time have to be the first ), im not even sure if this is a good method 2 do it ^^
Last edited: