• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Fatal Error after renamed variable...

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
i just renamed variable (but variable was used in jass trigger) and after that everytime when i try launch the map its crash even the variable name is correct

i attached the map, since i got no ideea why error at ~33% loading


JASS:
function NewEffectIndex takes nothing returns integer
    local integer i = 0
    loop
        exitwhen udg_Buff_Effect[i] == null
        set i = i + 1
    endloop
    return i
endfunction

function NewUnitIndex takes nothing returns integer
    local integer i = 0
    loop
        exitwhen udg_Buff_Unit[i] == null
        set i = i + 1
    endloop
    return i
endfunction

function CountUnitBuff takes integer cv returns integer
    local integer i = 25 //max buff amount on unit
    local integer bv = udg_Buff_Value[cv]
    local integer r = 0
    loop
        exitwhen bv == 0
        if bv > R2I(Pow(2, i)) then
            set bv = bv - R2I(Pow(2, i))
            set r = r + 1
        endif
        set i = i - 1
    endloop
    return r
endfunction

function RemoveUnitBuff takes integer id, integer buffid returns nothing
    local integer cv = GetUnitUserData(udg_Buff_Unit[id])
    local integer e = LoadInteger(udg_Buff_EffectTable, cv, buffid)
    local integer v = LoadInteger(udg_Buff_Amount, cv, buffid)
    set udg_Buff_Value[cv] = udg_Buff_Value[cv] - R2I(Pow(2, buffid))
    call DestroyEffect (udg_Buff_Effect[e])
    call SaveInteger(udg_Buff_EffectTable, cv, buffid, 0)
    call SaveInteger(udg_Buff_Timer, cv, buffid, 0)
    call SaveInteger(udg_Buff_Amount, cv, buffid, 0)
    if udg_Buff_Value[cv] == 0 then
        set udg_Buff_Unit[id] = null
    endif
    if buffid==2 then
            set udg_Critical[cv] = udg_Critical[cv] - v
    endif
    if buffid==3 then
            set udg_Eva[cv] = udg_Eva[cv] - v
    endif
endfunction

function log takes integer n returns integer
    local integer i = 2
    local integer c = 1
    if n == 1 then
        set c = 0
    endif
    loop
        exitwhen i >= n
        set c = c + 1
        set i = i * 2
    endloop
    return c
endfunction

JASS:
function Trig_Melee_Initialization_Actions takes nothing returns nothing
local integer i = 0
local integer v = 1
set udg_Buff_Timer = InitHashtable()
set udg_Buff_EffectTable = InitHashtable()
set udg_Buff_Amount = InitHashtable()
set udg_Effect[0] = "Abilities\\Spells\\NightElf\\Barkskin\\BarkSkinTarget.mdl"
set udg_Effect[1] = "Abilities\\Spells\\Undead\\Cripple\\CrippleTarget.mdl"
set udg_Buff_Max = 29
//set bufftype(buffvalue) and buffid (bufftype=2^buffid)
    loop
        exitwhen i > udg_Buff_Max
        set udg_Buff_ID2V[i] = R2I(Pow(2,i))
        set i = i + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Map_Initialization takes nothing returns nothing
    set gg_trg_Map_Initialization = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Map_Initialization, function Trig_Melee_Initialization_Actions )
endfunction

JASS:
function Trig_Cast_buff_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A002'
endfunction

function Trig_Cast_buff_Actions takes nothing returns nothing
    local integer buffid = 2 //buff id
    local integer buffvalue = R2I(Pow(2, buffid)) //buffvalue what i add to unit buff value
    local integer dur = 10 //duration in sec
    local unit u = GetTriggerUnit()
    local integer alv = GetUnitAbilityLevel(u, 'A002')
    local unit pu
    local player p = GetTriggerPlayer()
    local integer cv
    local integer nuIndex //new unit array index
    local integer neIndex //new effect array index
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local integer times
    call GroupEnumUnitsInRange(udg_UG, x, y, 350.00, null)
    loop
        set pu = FirstOfGroup(udg_UG)
        exitwhen (pu==null)
        set cv = GetUnitUserData(pu)
        set times = LoadInteger(udg_Buff_Timer, cv, buffid)
        if not IsUnitEnemy(pu, p) and times == 0 then //if unit dont have timer, and unit is not enemy
            set nuIndex = NewUnitIndex()
            set neIndex = NewEffectIndex()
    if udg_Buff_Value[cv] == 0 then            
            set udg_Buff_Unit[nuIndex] = pu
     endif
            set udg_Critical[cv] = udg_Critical[cv] + alv * 15
            set udg_Buff_Value[cv] = udg_Buff_Value[cv] + buffvalue
            set udg_Buff_Effect[neIndex] = AddSpecialEffectTarget( udg_Effect[0], pu, "overhead" )
            call SaveInteger(udg_Buff_EffectTable, cv, buffid, neIndex)
            call SaveInteger(udg_Buff_Amount, cv, buffid, alv * 15)
            call SaveInteger(udg_Buff_Timer, cv, buffid, dur)
            call DisplayTextToForce( GetPlayersAll(), "Buffed unit name:" + GetUnitName(udg_Buff_Unit[nuIndex]) + "  duration:" + I2S(dur) + "  buff id:" + I2S(buffid) + "  effect id:" + I2S(neIndex) + "   buff value:" + I2S(udg_Buff_Value[cv]))
            if nuIndex > udg_index then
                set udg_index = nuIndex
            endif
            
        endif
        call GroupRemoveUnit(udg_UG, pu)
    endloop

    set u = null
    set p = null
    set pu = null
endfunction

//===========================================================================
function InitTrig_Cast_buff takes nothing returns nothing
    set gg_trg_Cast_buff = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Cast_buff, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddCondition( gg_trg_Cast_buff, Condition( function Trig_Cast_buff_Conditions ) )
    call TriggerAddAction( gg_trg_Cast_buff, function Trig_Cast_buff_Actions )
endfunction

JASS:
function Trig_Timer_Actions takes nothing returns nothing
    local integer buffvalue // R2I(Pow(buffid, 2)) buffvalue what i add to unit buff value
    local integer bv //buff value
    local integer i = 0
    local integer po = 0
    local integer cv
    local integer count = 0
    local integer buffid = 0
    local integer maxbuff = udg_Buff_Max
    local integer times = 0
    loop
        exitwhen i > udg_index
        if udg_Buff_Unit[i] != null then
            set cv = GetUnitUserData(udg_Buff_Unit[i])
            set bv = udg_Buff_Value[cv]
            if bv > 0 then
                loop
                    exitwhen bv == 0
                    set po = R2I(Pow(2, maxbuff - count))
                    if bv >= po then
                        set bv = bv - po
                        set buffid = log(po)//maxbuff - count
                        set times = LoadInteger(udg_Buff_Timer, cv, buffid)
                        if IsUnitType(udg_Buff_Unit[i], UNIT_TYPE_DEAD) or udg_Buff_Purge[cv] then
                             set times = 0
                          endif
                    call DisplayTextToForce( GetPlayersAll(), "Unit[" + I2S(i) + "] = " + GetUnitName(udg_Buff_Unit[i]) + ": buff value:" + I2S(bv) + " | Buff id:" + I2S(buffid) + " | Unit custom value:" + I2S(cv) +" | time left:"+I2S(times)  )
                        if times < 1 then
                            call RemoveUnitBuff (i, buffid)
                        else
                            call SaveInteger(udg_Buff_Timer, cv, buffid, times - 1)
                        endif
                    endif
                    set count = count + 1
                endloop
            endif
            set count = 0
            set udg_Buff_Purge[cv] = false
        endif
        set i = i + 1
    endloop

endfunction

//===========================================================================
function InitTrig_Timer takes nothing returns nothing
    set gg_trg_Timer = CreateTrigger( )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Timer, 1.00 )
    call TriggerAddAction( gg_trg_Timer, function Trig_Timer_Actions )
endfunction
 

Attachments

  • buff test.w3x
    63.4 KB · Views: 85
Level 17
Joined
Nov 13, 2006
Messages
1,814
i dont imported any model there, i opened more map and somehow tranfered from another and no backup :/

i deleted all model what was somehow added (still i dont understand how coz it wasjust a test map) and saved but same crash at loading


overall somebody can tell me why somehow transfered things from 1 map to another without i import them?

see all item somehow transfered , buffs and upgrades but ability and units no, also imported file list was transfered but i dont imported nothing to that map, and not 1st time when happen this :/

its occured suddenly when i switch between maps (open1 then open another etc)
 

Attachments

  • 1.jpg
    1.jpg
    40.2 KB · Views: 129
Last edited:
Status
Not open for further replies.
Top