• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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