• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] H2I crash my game :<

Status
Not open for further replies.
Level 11
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 :D


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 :p), im not even sure if this is a good method 2 do it ^^
 
Last edited:
Status
Not open for further replies.
Top