• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Function (FadeFire) is not executing?

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
JASS:
private function FadeFire takes nothing returns nothing
        local unit u = tempFire 
        call KillUnit(u)
        set u = null
    endfunction
    
    private function ForGroup_Periodic takes nothing returns nothing
        local unit u = GetEnumUnit()
        local integer i = GetUnitUserData(u)
        local real dmg = 10
        set stackTime[i] = stackTime[i] - 1
        call BJDebugMsg("Index: " + I2S(i) + " | time  " + I2S(stackTime[i]) + " | damage " + R2S(stackDmg[i]))
      
        if GetUnitState(u, UNIT_STATE_LIFE) <= 0 then
            set tempFire = fire[i]
            call ExecuteFunc("FadeFire")
            set tempFire = null
        endif
        
       if stackTime[i] == 0 then
            set stackDmg[i] = 0
            call GroupRemoveUnit(stackGroup, u)
            set stackGroupCount = stackGroupCount - 1
            if stackGroupCount == 0 then
                call DisableTrigger(trgPeriodic)
            endif
            // Start Fire 
            // fire[i] == null (temporary)
        elseif fire[i] == null then
            if stackDmg[i] >= REQ_STACK*GetUnitState(u, UNIT_STATE_MAX_LIFE)*(1 + fireResistance[i]) then
                set fire[i] = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), FIRE_DUMMY, GetUnitX(u), GetUnitY(u), 0)
            endif
        else 
            call UnitDamageTarget(fire[i], u, dmg, true, false, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS)
        endif        
        
        set u = null
    endfunction
 
FadeFire is a private function. After jasshelper compiles private functions, it'll add a prefix to them (depending on the scope/library container name), with a random number of underscores. So ExecuteFunc("FadeFire") won't work. You have to use:
call ExecuteFunc(SCOPE_PRIVATE + "FadeFire")
SCOPE_PRIVATE is a special keyword that tells the compiler to use the appropriate prefix of the given scope.
http://www.wc3c.net/vexorian/jasshelpermanual.html#sconst
 
Status
Not open for further replies.
Top