HELP: fatal error-memory could not be written

Tar-Quaeron

New Member
Reaction score
0
Hello,

There seems to be a problem with my function corrosive acid. Every time, and on different computers (at first I thought it was a ram problem on my old computer) when the buff for corrosive acid should be removed there comes a fatal error. Warcraft closes and the message I get is: fatal error, ... ... the memory could not be written at 0x00000008 * A2F0... I can't remember the exact text (there is something before "the memory could not be written") or the exact numbers. If it's important I can do it again and look it up.

Does anyone know what's going on? Am I calling on an array with a negative index perhaps?

Here's the code: the only important part I would think is the corrosive acid function, but it might be useful to have the whole trigger sequence.

JASS:

// === MURLOC VENOM BUFF + SLOW ===


function MurlocVenom takes nothing returns nothing 
    local group venomaff = GetUnitsInRangeOfLocMatching(60 + 30 * GetUnitUserData(GetAttacker()), GetUnitLoc(GetTriggerUnit()), Condition(function MainFilter))
    local group venomhavebuff = CreateGroup()
    local effect array poison
    local integer i = 0
    local unit current
    loop
        set current = FirstOfGroup(venomaff)
        exitwhen current == null
        call SetUnitMoveSpeed(current, (1.00 - 0.075 * GetUnitUserData(GetEventDamageSource())) * GetUnitMoveSpeed(current))
        if LoadInteger(udg_Buffs_Hash, 'B00O' + 10, GetHandleId(current)) == 0 then
            set poison<i> = AddSpecialEffectTarget(&quot;Abilities\\Weapons\\PoisonSting\\PoisonStingTarget.mdl&quot;, current, &quot;head&quot;)
            call UnitAddAbility(current, &#039;A031&#039;)
            set i = i + 1
        endif
        call SaveInteger(udg_Buffs_Hash, &#039;B00O&#039;, GetHandleId(current), LoadInteger(udg_Buffs_Hash, &#039;B00O&#039;, GetHandleId(current)) + 1)
        call GroupRemoveUnit(venomaff, current)
        call GroupAddUnit(venomhavebuff, current)
    endloop
    call TriggerSleepAction(5.5)
    loop
        set current = FirstOfGroup(venomhavebuff)
        exitwhen current == null
        call DestroyEffect(poison<i>)
        if LoadInteger(udg_Buffs_Hash, &#039;B00O&#039;, GetHandleId(current)) == 1 then
            set i = i - 1
            call DestroyEffect(poison<i>)
            call UnitRemoveAbility(current, &#039;A031&#039;)
            call UnitRemoveAbility(current, &#039;B00O&#039;)
        endif
        call SaveInteger(udg_Buffs_Hash, &#039;B00O&#039;, GetHandleId(current), LoadInteger(udg_Buffs_Hash, &#039;B00O&#039;, GetHandleId(current)) - 1) 
        call GroupRemoveUnit(venomhavebuff, current)
    endloop
    call DestroyGroup(venomaff)
    call DestroyGroup(venomhavebuff)
    set venomaff = null
    set venomhavebuff = null
    loop
        exitwhen i == 25
        set poison<i> = null
        set i = i + 1
    endloop
    set current = null
endfunction


// === CORROSIVE ACID BUFF ===


//LOOK HERE FOR THE CORROSIVE ACID FUNCTION WHICH SEEMS TO BE RESPONSIBLE FOR THE PROBLEM
function CorrosiveAcid takes nothing returns nothing
    local group corrosiveaff = GetUnitsInRangeOfLocMatching(200, GetUnitLoc(GetTriggerUnit()), Condition(function MainFilter))
    local group corrosivehavebuff = CreateGroup()
    local effect array acid
    local integer i = 0
    local unit current
    loop
        set current = FirstOfGroup(corrosiveaff)
        exitwhen current == null      
        if LoadInteger(udg_Buffs_Hash, &#039;B00Q&#039;, GetHandleId(current)) == 0 then
            set acid<i> = AddSpecialEffectTarget(&quot;Abilities\\Weapons\\ChimaeraAcidMissile\\ChimaeraAcidMissile.mdl&quot;, current, &quot;chest&quot;)
            call UnitAddAbility(current, &#039;A035&#039;)
            set i = i + 1    
        endif
        call SaveInteger(udg_Buffs_Hash, &#039;B00Q&#039;, GetHandleId(current), LoadInteger(udg_Buffs_Hash, &#039;B00Q&#039;, GetHandleId(current)) + 1)
        call GroupRemoveUnit(corrosiveaff, current)
        call GroupAddUnit(corrosivehavebuff, current)
    endloop
    call TriggerSleepAction(5)
    loop
        set current = FirstOfGroup(corrosivehavebuff)
        exitwhen current == null
        if LoadInteger(udg_Buffs_Hash, &#039;B00Q&#039;, GetHandleId(current)) == 1 then
            set i = i - 1
            call DestroyEffect(acid<i>)
            call UnitRemoveAbility(current, &#039;A035&#039;)
            call UnitRemoveAbility(current, &#039;B00Q&#039;)
        endif
        call SaveInteger(udg_Buffs_Hash, &#039;B00Q&#039;, GetHandleId(current), LoadInteger(udg_Buffs_Hash, &#039;B00Q&#039;, GetHandleId(current)) - 1)
        call GroupRemoveUnit(corrosivehavebuff, current)
    endloop
    call DestroyGroup(corrosiveaff)
    call DestroyGroup(corrosivehavebuff)
    set corrosiveaff = null
    set corrosivehavebuff = null
    loop
        exitwhen i == 25
        set acid<i> = null
        set i = i + 1
    endloop
    set current = null
endfunction


// === DETECT UNIT DAMAGED TRIGGER ===


function UnitDamaged_Actions takes nothing returns nothing
    local trigger dt
//-----Murlocs (poison pool)
    if GetUnitTypeId(GetEventDamageSource()) == &#039;o00W&#039; or GetUnitTypeId(GetEventDamageSource()) == &#039;o00X&#039; or GetUnitTypeId(GetEventDamageSource()) == &#039;o00Y&#039; then
        call MurlocVenom()
    endif
//-----Noxious Stronghold (poison pool)
    if GetUnitTypeId(GetEventDamageSource()) == &#039;h02Y&#039; then
        call CorrosiveAcid()
    endif
    call DestroyTrigger(GetTriggeringTrigger())
    call SaveInteger(udg_DmgTrig_Hash, GetHandleId(GetEventDamageSource()), GetHandleId(GetTriggerUnit()), LoadInteger(udg_DmgTrig_Hash, GetHandleId(GetEventDamageSource()), GetHandleId(GetTriggerUnit())) -1)
    if LoadInteger(udg_DmgTrig_Hash, GetHandleId(GetEventDamageSource()), GetHandleId(GetTriggerUnit())) != 0 then
        set dt = CreateTrigger()
        call TriggerRegisterUnitEvent(dt, GetTriggerUnit(), EVENT_UNIT_DAMAGED)
        call TriggerAddAction(dt, function UnitDamaged_Actions)
        call SaveInteger(udg_DmgTrig_Hash, GetHandleId(GetEventDamageSource()), GetHandleId(GetTriggerUnit()), LoadInteger(udg_DmgTrig_Hash, GetHandleId(GetEventDamageSource()), GetHandleId(GetTriggerUnit())) + 1)
    endif
endfunction



function Cond_CreateDamageTrigger takes nothing returns boolean 
    return LoadInteger(udg_DmgTrig_Hash, GetHandleId(GetAttacker()), GetHandleId(GetTriggerUnit())) == 0 and (GetUnitTypeId(GetAttacker()) == &#039;o00W&#039; or GetUnitTypeId(GetAttacker()) == &#039;o00X&#039; or GetUnitTypeId(GetAttacker()) == &#039;o00Y&#039; or GetUnitTypeId(GetAttacker()) == &#039;h02Y&#039;) 
endfunction

function CreateDamageTrigger takes nothing returns nothing
    local trigger dt = CreateTrigger()
    call TriggerRegisterUnitEvent(dt, GetTriggerUnit(), EVENT_UNIT_DAMAGED)
    call TriggerAddAction(dt, function UnitDamaged_Actions)
// Records how many damage triggers are active upon a unit/attacker
    call SaveInteger(udg_DmgTrig_Hash, GetHandleId(GetAttacker()), GetHandleId(GetTriggerUnit()), LoadInteger(udg_DmgTrig_Hash, GetHandleId(GetAttacker()), GetHandleId(GetTriggerUnit()))+ 1)
    set dt = null
    call DisplayTextToForce(GetPlayersAll(), &quot;CreateDamageTrigger &quot; + I2S(LoadInteger(udg_DmgTrig_Hash, GetHandleId(GetAttacker()), GetHandleId(GetTriggerUnit()))))
    call DisplayTextToForce(GetPlayersAll(), I2S(GetHandleId(GetAttacker())) + &quot;  &quot; + I2S(GetHandleId(GetTriggerUnit())))
endfunction
        
//===========================================================================
function InitTrig_Unit_Attacked takes nothing returns nothing
    set gg_trg_Unit_Attacked = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Unit_Attacked, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(gg_trg_Unit_Attacked, Condition(function Cond_CreateDamageTrigger))
    call TriggerAddAction(gg_trg_Unit_Attacked, function CreateDamageTrigger)
    set gg_trg_Unit_Attacked = null
endfunction
</i></i></i></i></i></i></i>
 

Tar-Quaeron

New Member
Reaction score
0
Sorry I realize that this belongs more into the JASS section. I thought I was there (I just followed what firefox proposed). I don't know how to move it though (I guess only admins can do that?). I hope someone is still able to help me.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top