• 🏆 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!

crash behaivor i cant explain

Status
Not open for further replies.
Level 3
Joined
Jun 2, 2015
Messages
45
map has 9 triggers, and it will sometimes crash even when only 3 are enabled:
JASS:
globals
    //To hold spawned units, to be filled later.
    integer spawnDiff = 0
    //Income per building, the unit types of the buildings, and each players income.
    integer array incAmountPer
    integer array incBuildings
    integer playerInc
    //Timers
    timer gameTimer
    timer endTimer
    timerdialog GameTime
    //Counter for game time counter that counts up.
    integer counter = 0
    leaderboard P_Income
    unit builder
    integer tmpInt
endglobals

library GlobalFilters
    function Unit takes nothing returns boolean
        return GetUnitMoveSpeed(GetFilterUnit())>0
    endfunction
    function Structure takes nothing returns boolean
        return GetUnitMoveSpeed(GetFilterUnit())<=0
    endfunction
    function GenFilter takes nothing returns boolean
        if GetUnitTypeId(GetFilterUnit())==tmpInt then 
            return true
        else 
            return false
        endif
    endfunction
    function HordeFilter takes nothing returns boolean
        if GetOwningPlayer(GetFilterUnit()) == Player(10) and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) >= .405 then
            return true
        endif
        return false
    endfunction
endlibrary
JASS:
scope Init initializer init
    //Done on initialization.
    private function init takes nothing returns nothing
        //Populate player array and get total players.
        local unit u
        call FogMaskEnable(false)
        set u=CreateUnit(Player(0), 'h000', GetStartLocationX(GetPlayerStartLocation(Player(0))), GetStartLocationY(GetPlayerStartLocation(Player(0))), bj_UNIT_FACING)
        set builder=u
        call SetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD, 100)
        call SetPlayerState(Player(10), PLAYER_STATE_GIVES_BOUNTY, 1)
        //Populate income arrays, to keep track of the order of upgrades and to keep track of how much income they give.
        set incBuildings[0]='h004'
        set incAmountPer[0]=1
        set incBuildings[1]='h01O'
        set incAmountPer[1]=3
        set incBuildings[2]='h01P'
        set incAmountPer[2]=5
        set incBuildings[3]='h01Q'
        set incAmountPer[3]=7
        set incBuildings[4]='h01R'
        set incAmountPer[4]=10
        set incBuildings[5]='h01S'
        set incAmountPer[5]=15
        set incBuildings[6]='h01T'
        set incAmountPer[6]=25
        set incBuildings[7]='h01V'
        set incAmountPer[7]=40
        set incBuildings[8]='h01U'
        set incAmountPer[8]=65
        set incBuildings[9]='h01W'
        set incAmountPer[9]=100
        set incBuildings[10]='h01X'
        set incAmountPer[10]=150
        set counter=0
        set gameTimer=CreateTimer()
        set GameTime=CreateTimerDialog(gameTimer)
        call TimerDialogSetTitle(GameTime, "Game Time")
        call TimerDialogSetRealTimeRemaining(GameTime, 0)
        call TimerStart(gameTimer,0,false,null)
        call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, 2000, 0)
        set u=null
    endfunction
endscope
JASS:
function income takes nothing returns nothing
     local group g = CreateGroup()
     local integer i =0
     local integer count = 0
     local unit first
     set playerInc=0
     loop
         exitwhen i==10
         set tmpInt = incBuildings[i]
         set count=0
         call GroupEnumUnitsOfPlayer(g, Player(0), Filter(function GenFilter))
         loop
             set first=FirstOfGroup(g)
             exitwhen first==null
             set count=count+1
             call GroupRemoveUnit(g,first)
         endloop
         set playerInc=playerInc+count*incAmountPer[i]
         set i=i+1
         call LeaderboardSetItemValue(P_Income, LeaderboardGetPlayerIndex(P_Income, Player(0)), playerInc)
     endloop
     call SetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD)+playerInc)
     call DestroyGroup(g)
     set g = null
     set first=null
endfunction
function Order takes unit u returns nothing
     if GetUnitCurrentOrder(u) != OrderId("attack") and GetUnitCurrentOrder(u) != OrderId("firebolt") then
         call IssuePointOrder(u, "attack", GetRandomReal(-5200, 3275), GetRandomReal(-1400, 1400))
     endif
endfunction
function spawnFilter takes nothing returns boolean
     local integer id=GetUnitTypeId(GetFilterUnit())
     if id == 'o000' or id == 'o001' or id == 'o002' or id == 'o004' or id == 'o00O' or id == 'o00E' or id == 'o00P' or id == 'o00Q' or id == 'o00B' or id == 'o00R' or id == 'o00A' then
         return true
     endif
     return false
endfunction
function spawn takes unit spawner returns nothing
     local unit u
     local integer chance=GetRandomInt(0, spawnDiff)
     if chance>3 then
         if chance >=47 then
             set u = CreateUnit(Player(10), 'o00B', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
         endif
         if chance >=37 and chance <47 then
             set u = CreateUnit(Player(10), 'o004', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
         endif
         if chance >=27 and chance <37 then
             set u = CreateUnit(Player(10), 'o002', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
         endif
         if chance>=17 and chance <27 then
             set u = CreateUnit(Player(10), 'o001', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
         endif
         if chance<17 then
             set u = CreateUnit(Player(10), 'o000', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
         endif
     endif
     set u = null
endfunction
function spawnPlus takes unit spawner returns nothing
     local unit u
     if spawnDiff==55 then
         set u = CreateUnit(Player(10), 'o00R', GetUnitX(spawner), GetUnitY(spawner), 0)
//        set HealWave_boss = u
//        call HealWave_init()
     endif
     if spawnDiff==45 then
         set u = CreateUnit(Player(10), 'o00Q', GetUnitX(spawner), GetUnitY(spawner), 0)
     endif
     if spawnDiff==35 then
         set u = CreateUnit(Player(10), 'o00P', GetUnitX(spawner), GetUnitY(spawner), 0)
     endif
     if spawnDiff==25 then
         set u = CreateUnit(Player(10), 'o00E', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
     endif
     if spawnDiff == 15 then
         set u = CreateUnit(Player(10), 'o00O', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
     endif
     if spawnDiff >=50 then
         set u = CreateUnit(Player(10), 'o00B', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
         set u = CreateUnit(Player(10), 'o00B', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
     endif
     if spawnDiff >=40 and spawnDiff < 50 then
         set u = CreateUnit(Player(10), 'o004', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
         set u = CreateUnit(Player(10), 'o004', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
     endif
     if spawnDiff >=30 and spawnDiff < 40 then
         set u = CreateUnit(Player(10), 'o002', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
         set u = CreateUnit(Player(10), 'o002', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
     endif
     if spawnDiff >=20 and spawnDiff < 30 then
         set u = CreateUnit(Player(10), 'o001', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
         set u = CreateUnit(Player(10), 'o001', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
     endif
     if spawnDiff >=3 and spawnDiff<20 then
         set u = CreateUnit(Player(10), 'o000', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
         set u = CreateUnit(Player(10), 'o000', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
     endif
     set u = null
endfunction
function Trig_Gametime_Actions takes nothing returns nothing
     local integer i = 0
     local integer a = 0
     local unit first
     local group g = CreateGroup()
     if(counter==0) then
         call TimerDialogDisplay(GameTime, true)
         set P_Income=CreateLeaderboard()
         call PlayerSetLeaderboard(Player(0), P_Income)
         call LeaderboardAddItem(P_Income, GetPlayerName(Player(0)), 0, Player(0))
         call LeaderboardSetLabel(P_Income, "Income")
         call LeaderboardSetSizeByItemCount(P_Income, LeaderboardGetItemCount(P_Income))
         call LeaderboardDisplay(P_Income, true)
     endif
     call TimerStart(gameTimer, counter, false, null)
     call PauseTimer(gameTimer)
     call GroupEnumUnitsOfPlayer(g, Player(10), Filter(function spawnFilter))
     loop
         set first=FirstOfGroup(g)
         exitwhen first==null
         call Order(first)
         call GroupRemoveUnit(g,first)
     endloop
     if counter==5 then
         call DisplayTextToPlayer(Player(0), 0, 0, "Defend from the endless waves...")
     endif
     if counter==10 then
         call DisplayTextToPlayer(Player(0), 0, 0, "The horde arrives at 4:00.")
     endif
     if counter==240 then
         set spawnDiff=3
     endif
     if counter==270 then
         set spawnDiff=4
     endif
     if counter==300 then
         set spawnDiff=5
     endif
     if counter==330 then
         set spawnDiff=6
     endif
     if counter==360 then
         set spawnDiff=7
     endif
     if counter==390 then
         set spawnDiff=8
     endif
     if counter==420 then
         set spawnDiff=9
     endif
     if counter==450 then
         set spawnDiff=10
     endif
     if counter==480 then
         set spawnDiff=11
     endif
     if counter==510 then
         set spawnDiff=12
     endif
     if counter==540 then
         set spawnDiff=13
     endif
     if counter==570 then
         set spawnDiff=14
     endif
     if counter==600 then
         set spawnDiff=15
     endif
     if counter==620 then
         set spawnDiff=16
     endif
     if counter==660 then
         set spawnDiff=17
     endif
     if counter==690 then
         set spawnDiff=18
     endif
     if counter==720 then
         set spawnDiff=19
     endif
     if counter==750 then
         set spawnDiff=20
     endif
     if counter==780 then
         set spawnDiff=21
     endif
     if counter==810 then
         set spawnDiff=22
     endif
     if counter==840 then
         set spawnDiff=23
     endif
     if counter==870 then
         set spawnDiff=24
     endif
     if counter==900 then
         set spawnDiff=25
     endif
     if counter==920 then
         set spawnDiff=26
     endif
     if counter==960 then
         set spawnDiff=27
     endif
     if counter==990 then
         set spawnDiff=28
     endif
     if counter==1020 then
         set spawnDiff=29
     endif
     if counter==1050 then
         set spawnDiff=30
     endif
     if counter==1080 then
         set spawnDiff=31
     endif
     if counter==1110 then
         set spawnDiff=32
     endif
     if counter==1140 then
         set spawnDiff=33
     endif
     if counter==1170 then
         set spawnDiff=34
     endif
     if counter==1200 then
         set spawnDiff=35
     endif
     if counter==1220 then
         set spawnDiff=36
     endif
     if counter==1260 then
         set spawnDiff=37
     endif
     if counter==1290 then
         set spawnDiff=38
     endif
     if counter==1320 then
         set spawnDiff=39
     endif
     if counter==1350 then
         set spawnDiff=40
     endif
     if counter==1380 then
         set spawnDiff=41
     endif
     if counter==1410 then
         set spawnDiff=42
     endif
     if counter==1440 then
         set spawnDiff=43
     endif
     if counter==1470 then
         set spawnDiff=44
     endif
     if counter==1500 then
         set spawnDiff=45
     endif
     if counter==1520 then
         set spawnDiff=46
     endif
     if counter==1560 then
         set spawnDiff=47
     endif
     if counter==1590 then
         set spawnDiff=48
     endif
     if counter==1620 then
         set spawnDiff=49
     endif
     if counter==1650 then
         set spawnDiff=50
     endif
     if counter==1680 then
         set spawnDiff=51
     endif
     if counter==1710 then
         set spawnDiff=52
     endif
     if counter==1740 then
         set spawnDiff=53
     endif
     if counter==1770 then
         set spawnDiff=54
     endif
     if counter==1800 then
         set spawnDiff=55
     endif
     if counter==1820 then
         set spawnDiff=56
     endif
     if counter==1860 then
         set spawnDiff=57
     endif
     if counter==1890 then
         set spawnDiff=58
     endif
     if counter==1920 then
         set spawnDiff=59
     endif
     if counter==1950 then
         set spawnDiff=60
     endif
     if counter==1980 then
         set spawnDiff=61
     endif
     if counter==2010 then
         set spawnDiff=62
     endif
     if counter==2040 then
         set spawnDiff=63
     endif
     if counter==2070 then
         set spawnDiff=64
     endif
     if counter==2100 then
         set spawnDiff=65
     endif
     if counter == 2120 then
         set spawnDiff=66
     endif
     if counter-(counter/5)*5==0 then
         call income()
     endif
     if counter-(counter/20)*20==0 then
         set tmpInt= 'h01Y'
         call GroupEnumUnitsOfPlayer(g, Player(10), Filter(function GenFilter))
         loop
             set first=FirstOfGroup(g)
             exitwhen first==null
             call spawn(first)
             call GroupRemoveUnit(g,first)
         endloop
         set tmpInt= 'h01L'
         call GroupEnumUnitsOfPlayer(g, Player(10), Filter(function GenFilter))
         loop
             set first=FirstOfGroup(g)
             exitwhen first==null
             call spawnPlus(first)
             call GroupRemoveUnit(g,first)
         endloop
     endif
     call GroupEnumUnitsOfPlayer(g, Player(10), Filter(function spawnFilter))
     loop
         set first=FirstOfGroup(g)
         exitwhen first==null
         call Order(first)
         call GroupRemoveUnit(g,first)
     endloop
     call RemoveAllGuardPositions(Player(10))
     set counter=counter+1
     call DestroyGroup(g)
     set g=null
     set first=null
endfunction

//===========================================================================
function InitTrig_Gametime takes nothing returns nothing
     set gg_trg_Gametime = CreateTrigger(  )
     call TriggerRegisterTimerEvent( gg_trg_Gametime, 1.00, true )
     call TriggerAddAction( gg_trg_Gametime, function Trig_Gametime_Actions )
endfunction

However, it doesn't crash very often with only these triggers enabled, however, if I enable more triggers it crashes more often.
JASS:
function stud takes unit u returns nothing
    call UnitSetBonus(u, 0, 1)
endfunction
function bronze takes unit u returns nothing
    call UnitSetBonus(u, 0, 2)
endfunction
function iron takes unit u returns nothing
    call UnitSetBonus(u, 0, 4)
endfunction
function steel takes unit u returns nothing
    call UnitSetBonus(u, 0, 6)
endfunction
function mason takes unit u returns nothing
    call UnitSetBonus(u, 0, 1)
endfunction
function work takes unit u returns nothing
    call UnitSetBonus(u, 0, 3)
endfunction
function blast takes unit u returns nothing
    call UnitSetBonus(u, 0, 6)
endfunction

function Trig_Upgrade_Actions takes nothing returns nothing
    local group g = CreateGroup()
    local unit first
    if GetResearched()=='R009' then
        call GroupEnumUnitsOfPlayer(g, GetOwningPlayer(GetResearchingUnit()), Condition(function Unit))
        loop
            set first=FirstOfGroup(g)
            exitwhen first==null
            call stud(first)
            call GroupRemoveUnit(g,first)
        endloop
    endif
    if GetResearched()=='R00B' then
        call GroupEnumUnitsOfPlayer(g, GetOwningPlayer(GetResearchingUnit()), Condition(function Unit))
        loop
            set first=FirstOfGroup(g)
            exitwhen first==null
            call bronze(first)
            call GroupRemoveUnit(g,first)
        endloop
    endif
    if GetResearched()=='R00A' then
        call GroupEnumUnitsOfPlayer(g, GetOwningPlayer(GetResearchingUnit()), Condition(function Unit))
        loop
            set first=FirstOfGroup(g)
            exitwhen first==null
            call iron(first)
            call GroupRemoveUnit(g,first)
        endloop
    endif
    if GetResearched()=='R00C' then
        call GroupEnumUnitsOfPlayer(g, GetOwningPlayer(GetResearchingUnit()), Condition(function Unit))
        loop
            set first=FirstOfGroup(g)
            exitwhen first==null
            call steel(first)
            call GroupRemoveUnit(g,first)
        endloop
    endif
    if GetResearched()=='R00D' then
        call GroupEnumUnitsOfPlayer(g, GetOwningPlayer(GetResearchingUnit()), Condition(function Structure))
        loop
            set first=FirstOfGroup(g)
            exitwhen first==null
            call mason(first)
            call GroupRemoveUnit(g,first)
        endloop
    endif
    if GetResearched()=='R00E' then
        call GroupEnumUnitsOfPlayer(g, GetOwningPlayer(GetResearchingUnit()), Condition(function Structure))
        loop
            set first=FirstOfGroup(g)
            exitwhen first==null
            call work(first)
            call GroupRemoveUnit(g,first)
        endloop
    endif
    if GetResearched()=='R00F' then
        call GroupEnumUnitsOfPlayer(g, GetOwningPlayer(GetResearchingUnit()), Condition(function Structure))
        loop
            set first=FirstOfGroup(g)
            exitwhen first==null
            call blast(first)
            call GroupRemoveUnit(g,first)
        endloop
    endif
    call DestroyGroup(g)
    set g = null
    set first = null
endfunction

//===========================================================================
function InitTrig_Upgrade takes nothing returns nothing
    set gg_trg_Upgrade = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEvent(gg_trg_Upgrade, Player(0), EVENT_PLAYER_UNIT_RESEARCH_FINISH, null)
    call TriggerAddAction( gg_trg_Upgrade, function Trig_Upgrade_Actions )
endfunction
JASS:
function Trig_Newunit_Actions takes nothing returns nothing
    local group g = CreateGroup()
    if GetTriggerEventId()==EVENT_PLAYER_UNIT_TRAIN_FINISH then
        call GroupEnumUnitsOfPlayer(g, GetTriggerPlayer(), Condition(function Unit))
        call GroupRemoveUnit(g, GetTrainedUnit())
        call UnitSetBonus(GetTrainedUnit(), 0, UnitGetBonus(FirstOfGroup(g), 0))
    endif
    if GetTriggerEventId()==EVENT_PLAYER_UNIT_CONSTRUCT_FINISH then
        call GroupEnumUnitsOfPlayer(g, GetTriggerPlayer(), Condition(function Structure))
        call GroupRemoveUnit(g, GetConstructedStructure())
        call UnitSetBonus(GetConstructedStructure(), 0, UnitGetBonus(FirstOfGroup(g), 0))
    endif
    call DestroyGroup(g)
    set g = null
endfunction

//===========================================================================
function InitTrig_Newunit takes nothing returns nothing
    set gg_trg_Newunit = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEvent(gg_trg_Newunit, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_Newunit, Player(0), EVENT_PLAYER_UNIT_CONSTRUCT_FINISH, null)
    call TriggerAddAction( gg_trg_Newunit, function Trig_Newunit_Actions )
endfunction

JASS:
library HealWave
    globals
        public unit boss
        private integer casts = 0
        private timer ltimer = CreateTimer()
        private lightning array lt
    endglobals
    
    private function destroy takes nothing returns nothing
        local integer i = 0
        loop
            exitwhen lt[i] == null
            call DestroyLightning(lt[i])
            set lt[i] = null
            set i = i+1
        endloop
    endfunction
    
    private function life takes nothing returns boolean
        if casts == 0 and GetUnitState(boss, UNIT_STATE_LIFE) < GetUnitState(boss, UNIT_STATE_MAX_LIFE)*.75 then
            return true
        endif
        if casts == 1 and GetUnitState(boss, UNIT_STATE_LIFE) < GetUnitState(boss, UNIT_STATE_MAX_LIFE)*.5 then
            return true
        endif
        if casts == 2 and GetUnitState(boss, UNIT_STATE_LIFE) < GetUnitState(boss, UNIT_STATE_MAX_LIFE)*.25 then
            return true
        endif
        return false
    endfunction

    private function order takes nothing returns nothing
        local effect target
        local group g = CreateGroup()
        local unit u
        local integer count = 0
        call SetUnitAnimation(boss, "Spell")
        set target = AddSpecialEffectTarget("Abilities\\Spells\\Orc\\HealingWave\\HealingWaveTarget.mdl", boss, "origin")
        call DestroyEffect(target)
        call SetUnitState(boss, UNIT_STATE_LIFE, GetUnitState(boss, UNIT_STATE_LIFE)+600)
        call GroupEnumUnitsInRange(g, GetUnitX(boss), GetUnitY(boss), 400, Filter(function HordeFilter))
        call GroupRemoveUnit(g, boss)
        loop
            set u = FirstOfGroup(g)
            exitwhen u == null
            set lt[count] = AddLightning("HWPB", false, GetUnitX(boss), GetUnitY(boss), GetUnitX(u), GetUnitY(u))
            set count = count+1
            set lt[count] = AddLightning("HWSB", false, GetUnitX(boss), GetUnitY(boss), GetUnitX(u), GetUnitY(u))
            set count = count+1
            set target = AddSpecialEffectTarget("Abilities\\Spells\\Orc\\HealingWave\\HealingWaveTarget.mdl", u, "chest")
            call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE)+100)
            call DestroyEffect(target)
            call GroupRemoveUnit(g, u)
        endloop
        call TimerStart(ltimer, 1, false, function destroy)
        set casts=casts+1
        call DestroyGroup(g)
        set target=null
        set g = null
        set u = null
    endfunction

    public function init takes nothing returns nothing
        local trigger trig = CreateTrigger()
        call TriggerRegisterUnitEvent(trig, boss, EVENT_UNIT_ATTACKED)
        call TriggerAddCondition(trig, Condition(function life))
        call TriggerAddAction( trig, function order )
    endfunction
endlibrary
JASS:
scope Firebolt initializer init
    private function mage takes nothing returns boolean
        if GetUnitTypeId(GetAttacker()) == 'o00A' then
            call IssueTargetOrder(GetAttacker(), "firebolt", GetTriggerUnit())
        endif
        return false
    endfunction
    
    private function init takes nothing returns nothing
        local trigger cast = CreateTrigger()
        call TriggerRegisterPlayerUnitEvent(cast, Player(0), EVENT_PLAYER_UNIT_ATTACKED, null)
        call TriggerAddCondition(cast, Condition(function mage))
    endfunction
endscope
library ShieldofFrost initializer init
private function IK takes nothing returns boolean
if GetUnitTypeId(GetTriggerUnit()) == 'h026' then
return true
endif
return false
endfunction
private function slow takes nothing returns nothing
local unit u=CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'n002', GetUnitX(GetAttacker()), GetUnitY(GetAttacker()), 0)
call IssueTargetOrder(u, "slow", GetAttacker())
call RemoveUnit(u)
set u=null
endfunction
private function init takes nothing returns nothing
local trigger SoFTrg = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(SoFTrg, Player(0), EVENT_PLAYER_UNIT_ATTACKED, null)
call TriggerAddCondition(SoFTrg, Condition(function IK))
call TriggerAddAction(SoFTrg, function slow)
endfunction
endlibrary

Thanks to anyone who can help. Here is an example of one of the errors that I get. I have been struggling with this for a while and have been unable to find an answer. I have noticed one thing that I think may be responsible for it crashing, sometimes. I used a glitch in the object editor that allows units to upgrade like a building would, however, it seems that when I a unit finishes its upgrade and there is a target in range, it may cause it to crash sometimes? I have seen it happen a couple times but it could be coincidence.

Edit: added the map and a replay explaining how to play. If anyone else wants to try it and sees why it might be crashing, that would be a huge help. Or if you just want to try it that would be great too. Thanks all

http://www.hiveworkshop.com/forums/...040d1434150252-memory-leak-problems-error.jpg
 

Attachments

  • defense map 1.w3x
    90.3 KB · Views: 71
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,223
JASS:
local unit u=CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'n002', GetUnitX(GetAttacker()), GetUnitY(GetAttacker()), 0)
 call IssueTargetOrder(u, "slow", GetAttacker())
 call RemoveUnit(u)
Probably not a good idea to remove a unit at the same time you give it an order to instantly cast an ability. Try giving it a timed life of like 1 second and making sure it cannot decay (so instantly is removed). Sure it persists a little while but the game will automatically remove it eventually.
 
Level 3
Joined
Jun 2, 2015
Messages
45
ok that definitely makes more sense I will do that. however, it still crashes even with this disabled. sometimes the addresses are different but its the same error every time.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,223
If the address is different it means that the cause is likely something that is dynamically allocated is being dereferenced after it has been de-allocated or the reference replaced with null.

Make sure that you are not processing "null" handles by mistake (such as if a unit was removed, or lighting destroyed etc). Although the game should be checking for this and handle them safely, some natives do not as they only expect valid input. For example Player(16) will usually crash the game since it does not check for validity of its arguments. As a general rule avoid performing any unit operation on null since not only does it logically make no sense (what are you expecting to achieve?) but it can cause crashes.
 
Level 3
Joined
Jun 2, 2015
Messages
45
implemented your suggestion but it still crashes. im not sure how to make sure there aren't null handles being processed.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,223
Add checks to the triggers that if the handle from something like triggering unit or other unit sources is null then it prints out a warning message and then calls TriggerSleepAction for a few seconds (enough time to read the message). This is not intended to be permanent but at least allows you to know what is going on inside the triggers and discover if/when null is being processed unintentionally.
 
I double checked your code and there seems nothing wrong with it.

Can you add another PauseTimer call before the TimerStart here? I recall reading that there is a bug when you restart a running timer which causes it to execute multiple times... which shouldn't be a problem in your case as you aren't using this timer for anything; but at this point, I'm completely out of ideas so you might try it anyway.
JASS:
call TimerStart(gameTimer, counter, false, null)
call PauseTimer(gameTimer)


What DSG said makes sense... the error message looks like you try to remove an uninitialized object. However, I checked your code for these cases and if I haven't missed anything, there's no chance for a double free in your code... unless you aren't showing us the whole thing.


Here is one thing to try out, though:
Make your "A unit is attacked" triggers global and disable all of them each time you issue an order via script, then enable them again... Just to make sure you are not creating an infinine loop here.
 
Level 3
Joined
Jun 2, 2015
Messages
45
tried both of your suggestions zwieb, still the same thing =/

edit: I did notice though when it crashed that it seemed like 2 enemies were attacking the ice knight at the exact same time. could that cause a problem?
 
Level 5
Joined
May 6, 2013
Messages
125
sometimes the addresses are different but its the same error every time.

Seems rather unusual. The error in the pic tried to execute code at 0x00000000, which would mean that the program tried to call a function-nullpointer, which should only happen when operating on incorrect functions (code, filter etc) or calling virtual methods from an invalid object (removed unit etc, possibly a null-handle). Having the address change in such an error might be a sign that there are 2 different errors involved (or a removed unit is used that sometimes does not have its virtual table nulled yet).

As for finding the error itself, errors usually create a log file in your warcraft 3 folder. It might give you some additional information. If map tinkering fails, you might try to put a breakpoint at the instruction that failed and try to find out when that breakpoint is triggered (by stripping down the map or adding additional conditions to it). If you find out when its called, or even better, can relate it to a certain native, it might help you track down the error.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,223
Seems rather unusual. The error in the pic tried to execute code at 0x00000000, which would mean that the program tried to call a function-nullpointer, which should only happen when operating on incorrect functions (code, filter etc) or calling virtual methods from an invalid object (removed unit etc, possibly a null-handle). Having the address change in such an error might be a sign that there are 2 different errors involved (or a removed unit is used that sometimes does not have its virtual table nulled yet).
The errors are some times wrong. You need to run WC3 with a debugger to find the truth. You then get the actual interrupt which caused the error and that some times does not reflect the error reported (different addresses or different cause).
 
Level 3
Joined
Jun 2, 2015
Messages
45
how would I go about getting a debugger?

edit: couple weird things about the errors...
Code:
==============================================================================
Warcraft III (build 6401)

Exe:      c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\War3.exe
Time:     Jul 30, 2015 11:16:44.149 PM
User:     Philip
Computer: PHIL
------------------------------------------------------------------------------

This application has encountered a critical error:

FATAL ERROR!

Program:	c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\War3.exe
Exception:	0xC0000005 (ACCESS_VIOLATION) at 0023:6F931934

The instruction at '0x6F931934' referenced memory at '0x6F931934'.
The memory could not be 'written'.


War3Build: 1.26.0.6401
Played Maps\Test\WorldEditTestMap.w3x
Player  0 WorldEdit         	Race Human	StartLoc  0
Player  1 <Unused>          	Race Orc	StartLoc -1
Player  2 <Unused>          	Race Orc	StartLoc -1
Player  3 <Unused>          	Race Orc	StartLoc -1
Player  4 <Unused>          	Race Undead	StartLoc -1
Player  5 <Unused>          	Race Orc	StartLoc -1
Player  6 <Unused>          	Race NightElf	StartLoc -1
Player  7 <Unused>          	Race Orc	StartLoc -1
Player  8 <Unused>          	Race NightElf	StartLoc -1
Player  9 <Unused>          	Race Undead	StartLoc -1
Player 10 Player 11         	Race Undead	StartLoc  1
Player 11 <Unused>          	Race NightElf	StartLoc -1
------------------------------------------------------------------------------

----------------------------------------
    x86 Registers
----------------------------------------

EAX=0C8A7784  EBX=0985B4B4  ECX=0018F96C  EDX=6F931934  ESI=00000000
EDI=00000000  EBP=13E1924C  ESP=0018FAD0  EIP=6F931934  FLG=00210257
CS =0023      DS =002B      ES =002B      SS =002B      FS =0053      GS =002B


----------------------------------------
    Stack Trace (Manual)
----------------------------------------

Address  Frame    Logical addr  Module

6F931934 13E1924C 0002:000C4934 c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\Game.dll

----------------------------------------
    Stack Trace (Using DBGHELP.DLL)
----------------------------------------

6F931934 Game.dll     GameMain+9601252 (0x16E25548,0x09850234,0x0D087478,0x0C6BBB84)


----------------------------------------
    Loaded Modules
----------------------------------------

0x00400000 - 0x0047D000  c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\War3.exe
0x10000000 - 0x1015C000  C:\WINDOWS\system32\nvspcap.dll
0x15000000 - 0x15061000  c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\Storm.dll
0x21100000 - 0x2115F000  c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\mss32.dll
0x22600000 - 0x22616000  c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\redist\miles\Mssfast.m3d
0x22700000 - 0x22717000  c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\redist\miles\Mssdolby.m3d
0x22C00000 - 0x22C18000  c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\redist\miles\Msseax2.m3d
0x24600000 - 0x24611000  c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\redist\miles\Reverb3.flt
0x26F00000 - 0x26F2A000  c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\redist\miles\Mp3dec.asi
0x60000000 - 0x6005D000  c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\ijl15.dll
0x68F60000 - 0x6906D000  C:\WINDOWS\SYSTEM32\d3d8.dll
0x69930000 - 0x6A6FE000  C:\WINDOWS\SYSTEM32\nvd3dum.dll
0x6F000000 - 0x6FBB5000  c:\program files (x86)\warcraft iii reign of chaos & the frozen throne\Game.dll
0x70F10000 - 0x70F79000  C:\WINDOWS\system32\dxgi.dll
0x713F0000 - 0x715D4000  C:\WINDOWS\SYSTEM32\WININET.dll
0x71730000 - 0x71962000  C:\WINDOWS\SYSTEM32\iertutil.dll
0x71970000 - 0x71C42000  C:\WINDOWS\system32\nvapi.dll
0x71E60000 - 0x71F4C000  C:\WINDOWS\SYSTEM32\DDRAW.dll
0x71F50000 - 0x71F75000  C:\WINDOWS\SYSTEM32\GLU32.dll
0x71FF0000 - 0x72129000  C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvSCPAPI.dll
0x726B0000 - 0x727F1000  C:\WINDOWS\SYSTEM32\dbghelp.dll
0x728E0000 - 0x728E7000  C:\WINDOWS\SYSTEM32\d3d8thk.dll
0x728F0000 - 0x728F7000  C:\WINDOWS\SYSTEM32\DCIMAN32.dll
0x72900000 - 0x729DE000  C:\WINDOWS\SYSTEM32\OPENGL32.dll
0x72C70000 - 0x72C96000  C:\WINDOWS\SYSTEM32\cryptnet.dll
0x73060000 - 0x730C0000  C:\WINDOWS\SYSTEM32\AUDIOSES.DLL
0x730C0000 - 0x73113000  C:\WINDOWS\System32\MMDevApi.dll
0x73120000 - 0x73143000  C:\WINDOWS\SYSTEM32\WINMMBASE.dll
0x73150000 - 0x731D1000  C:\WINDOWS\SYSTEM32\DSOUND.DLL
0x732D0000 - 0x73359000  C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9600.17810_none_7c5b6194aa0716f1\COMCTL32.dll
0x73C70000 - 0x73D0B000  C:\WINDOWS\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.8428_none_d08a11e2442dc25d\MSVCR80.dll
0x73D10000 - 0x73D18000  C:\WINDOWS\SYSTEM32\WSOCK32.dll
0x73D30000 - 0x73D53000  C:\WINDOWS\SYSTEM32\WINMM.dll
0x73DD0000 - 0x73DF0000  C:\WINDOWS\SYSTEM32\gpapi.dll
0x73EF0000 - 0x73EFA000  C:\WINDOWS\SYSTEM32\avrt.dll
0x74190000 - 0x741AB000  C:\WINDOWS\SYSTEM32\USERENV.dll
0x748E0000 - 0x7492B000  C:\WINDOWS\SYSTEM32\mswsock.dll
0x74930000 - 0x7493F000  C:\WINDOWS\SYSTEM32\profapi.dll
0x74940000 - 0x74980000  C:\WINDOWS\system32\powrprof.dll
0x749A0000 - 0x74A8D000  C:\WINDOWS\system32\uxtheme.dll
0x74A90000 - 0x74AB9000  C:\WINDOWS\SYSTEM32\NTASN1.dll
0x74AC0000 - 0x74ADF000  C:\WINDOWS\SYSTEM32\ncrypt.dll
0x74AE0000 - 0x74AFE000  C:\WINDOWS\SYSTEM32\bcrypt.dll
0x74B00000 - 0x74B30000  C:\WINDOWS\system32\rsaenh.dll
0x74B30000 - 0x74B49000  C:\WINDOWS\SYSTEM32\CRYPTSP.dll
0x74B50000 - 0x74B6A000  C:\WINDOWS\SYSTEM32\dwmapi.dll
0x74C60000 - 0x74CEB000  C:\WINDOWS\SYSTEM32\SHCORE.DLL
0x74CF0000 - 0x74CF8000  C:\WINDOWS\SYSTEM32\WINNSI.DLL
0x74D00000 - 0x74D9F000  C:\WINDOWS\SYSTEM32\WINHTTP.dll
0x74DA0000 - 0x74DC0000  C:\WINDOWS\SYSTEM32\IPHLPAPI.DLL
0x74DC0000 - 0x74DC9000  C:\WINDOWS\SYSTEM32\kernel.appcore.dll
0x74F50000 - 0x74F78000  C:\WINDOWS\SYSTEM32\ntmarta.dll
0x74F80000 - 0x74FA1000  C:\WINDOWS\SYSTEM32\DEVOBJ.dll
0x75020000 - 0x75028000  C:\WINDOWS\SYSTEM32\VERSION.dll
0x75030000 - 0x75084000  C:\WINDOWS\SYSTEM32\bcryptPrimitives.dll
0x75090000 - 0x7509A000  C:\WINDOWS\SYSTEM32\CRYPTBASE.dll
0x750A0000 - 0x750BE000  C:\WINDOWS\SYSTEM32\SspiCli.dll
0x750C0000 - 0x750FD000  C:\WINDOWS\SYSTEM32\WINTRUST.dll
0x75270000 - 0x752C0000  C:\WINDOWS\SYSTEM32\WS2_32.dll
0x752C0000 - 0x75383000  C:\WINDOWS\SYSTEM32\msvcrt.dll
0x75390000 - 0x754B9000  C:\WINDOWS\SYSTEM32\ole32.dll
0x754C0000 - 0x754FC000  C:\WINDOWS\SYSTEM32\cfgmgr32.dll
0x75510000 - 0x75517000  C:\WINDOWS\SYSTEM32\NSI.dll
0x75520000 - 0x75547000  C:\WINDOWS\SYSTEM32\IMM32.dll
0x75550000 - 0x75591000  C:\WINDOWS\SYSTEM32\sechost.dll
0x755A0000 - 0x756F3000  C:\WINDOWS\SYSTEM32\USER32.dll
0x75760000 - 0x75872000  C:\WINDOWS\SYSTEM32\MSCTF.dll
0x75880000 - 0x759C0000  C:\WINDOWS\SYSTEM32\KERNEL32.DLL
0x759C0000 - 0x75A7A000  C:\WINDOWS\SYSTEM32\RPCRT4.dll
0x75A80000 - 0x75A86000  C:\WINDOWS\SYSTEM32\PSAPI.DLL
0x75A90000 - 0x75AD5000  C:\WINDOWS\SYSTEM32\SHLWAPI.dll
0x75AF0000 - 0x76D9D000  C:\WINDOWS\SYSTEM32\SHELL32.dll
0x76DA0000 - 0x76F28000  C:\WINDOWS\SYSTEM32\CRYPT32.dll
0x76F50000 - 0x77027000  C:\WINDOWS\SYSTEM32\KERNELBASE.dll
0x770C0000 - 0x7714D000  C:\WINDOWS\SYSTEM32\clbcatq.dll
0x77150000 - 0x771CC000  C:\WINDOWS\SYSTEM32\ADVAPI32.dll
0x771D0000 - 0x771DE000  C:\WINDOWS\SYSTEM32\MSASN1.dll
0x771E0000 - 0x7735D000  C:\WINDOWS\SYSTEM32\combase.dll
0x77360000 - 0x773FB000  C:\WINDOWS\SYSTEM32\comdlg32.dll
0x77400000 - 0x7750F000  C:\WINDOWS\SYSTEM32\GDI32.dll
0x77510000 - 0x775A5000  C:\WINDOWS\SYSTEM32\OLEAUT32.dll
0x775B0000 - 0x77604000  C:\WINDOWS\SYSTEM32\WLDAP32.dll
0x77610000 - 0x777C1000  C:\WINDOWS\SYSTEM32\SETUPAPI.dll
0x778A0000 - 0x77A0E000  C:\WINDOWS\SYSTEM32\ntdll.dll


----------------------------------------
    Memory Dump
----------------------------------------

Code: 16 bytes starting at (EIP = 6F931934)

6F931934: 70 1F 00 6F  70 B6 28 6F  A0 A9 62 6F  60 7E 2A 6F  p..op.(o..bo`~*o


Stack: 1024 bytes starting at (ESP = 0018FAD0)

* = addr  **                                                  *               
0018FAD0: 2D A3 62 6F  48 55 E2 16  34 02 85 09  78 74 08 0D  -.boHU..4...xt..
0018FAE0: 84 BB 6B 0C  64 21 83 09  00 00 00 00  4F AA 62 6F  ..k.d!......O.bo
0018FAF0: 84 BB 6B 0C  6E C3 46 6F  48 55 E2 16  00 00 00 00  ..k.n.FoHU......
0018FB00: FB C3 46 6F  B9 15 48 6F  00 00 00 00  2C 4E 4A 6F  ..Fo..Ho....,NJo
0018FB10: 01 00 00 00  1C FB 18 00  00 00 00 00  32 1A 00 00  ............2...
0018FB20: C9 24 02 00  00 00 00 00  83 5A 4A 6F  00 00 00 00  .$.......ZJo....
0018FB30: 53 8D 97 42  48 55 E2 16  C6 69 4A 6F  00 00 00 00  S..BHU...iJo....
0018FB40: 78 74 08 0D  14 01 C9 05  98 E4 46 6F  78 74 08 0D  xt........Foxt..
0018FB50: CC 00 C9 05  54 E9 46 6F  0C 01 C9 05  CC 00 C9 05  ....T.Fo........
0018FB60: 53 8D 97 42  21 EA 46 6F  B8 00 C9 05  6C 02 83 09  S..B!.Fo....l...
0018FB70: 64 FC 18 00  53 8D 97 42  84 FC 18 00  00 00 A0 0F  d...S..B........
0018FB80: 9B F3 46 6F  97 0C 47 6F  64 FC 18 00  E4 40 84 09  ..Fo..God....@..
0018FB90: 34 02 85 09  58 49 2F 6F  BE 75 53 6F  FD A6 62 6F  4...XI/o.uSo..bo
0018FBA0: 50 FC 18 00  16 1D D0 BC  50 FC 18 00  BC 00 7D 09  P.......P.....}.
0018FBB0: 05 00 00 00  00 00 00 00  00 00 00 00  42 00 00 00  ............B...
0018FBC0: E4 40 84 09  14 51 85 09  94 01 85 09  94 01 85 09  [email protected]..........
0018FBD0: 60 F1 5D 75  00 00 00 00  FE FF FF FF  68 FC 18 00  `.]u........h...
0018FBE0: 88 0A 84 6F  00 00 00 00  D0 A7 62 6F  92 00 09 40  ...o......bo...@
0018FBF0: 50 FC 18 00  50 FC 18 00  80 07 97 6F  A1 9A 62 6F  P...P......o..bo
0018FC00: 92 00 09 40  50 FC 18 00  B8 00 7D 09  F7 78 53 6F  ...@P.....}..xSo
0018FC10: 50 FC 18 00  04 00 00 00  B0 00 7D 09  B8 00 7D 09  P.........}...}.
0018FC20: 85 37 55 6F  50 FC 18 00  92 1A D0 BC  C8 FC 18 00  .7UoP...........
0018FC30: B0 00 7D 09  00 00 00 00  20 01 D4 03  02 00 00 00  ..}..... .......
0018FC40: 00 00 00 00  00 00 00 00  00 00 00 00  10 00 00 00  ................
0018FC50: E4 80 95 6F  00 00 00 00  92 00 09 40  00 00 00 00  ...o.......@....
0018FC60: 00 00 00 00  0A D7 A3 3B  B0 FC 18 00  38 75 83 6F  .......;....8u.o
0018FC70: 00 00 00 00  13 39 55 6F  19 00 00 00  48 01 D6 03  .....9Uo....H...
0018FC80: 3D 25 63 6F  36 1A D0 BC  88 00 D4 03  88 00 D4 03  =%co6...........
0018FC90: CA 85 BC 01  05 00 00 00  48 01 D6 03  E8 00 D6 03  ........H.......
0018FCA0: 98 00 D4 03  88 00 D4 03  00 00 00 00  01 00 00 00  ................
0018FCB0: 70 FF 18 00  38 11 84 6F  00 00 00 00  8B D7 62 6F  p...8..o......bo
0018FCC0: C8 FC 18 00  6F 12 83 3C  6F 12 83 3C  CA 85 BC 01  ....o..<o..<....
0018FCD0: 7C 03 63 6F  80 8F 89 75  00 00 00 6F  90 A7 89 75  |.co...u...o...u
0018FCE0: 50 7B 89 75  00 00 00 00  00 00 00 00  45 6E 67 69  P{.u........Engi
0018FCF0: 6E 65 20 31  64 36 34 00  18 FD 18 00  0E 71 F6 76  ne 1d64......q.v
0018FD00: 0C FD 18 00  80 8F 89 75  00 00 00 6F  00 00 00 00  .......u...o....
0018FD10: 00 00 00 00  BE 1A D0 BC  5C C5 8D 77  60 12 F6 76  ........\..w`..v
0018FD20: A4 41 00 00  00 00 00 00  90 A7 89 75  5A 1A D0 BC  .A.........uZ...
0018FD30: 51 04 63 6F  01 00 00 00  C4 98 00 6F  63 3A 5C 70  Q.co.......oc:\p
0018FD40: 72 6F 67 72  61 6D 20 66  69 6C 65 73  20 28 78 38  rogram files (x8
0018FD50: 36 29 5C 77  61 72 63 72  61 66 74 20  69 69 69 20  6)\warcraft iii 
0018FD60: 72 65 69 67  6E 20 6F 66  20 63 68 61  6F 73 20 26  reign of chaos &
0018FD70: 20 74 68 65  20 66 72 6F  7A 65 6E 20  74 68 72 6F   the frozen thro
0018FD80: 6E 65 5C 4C  6F 67 73 00  65 78 65 00  FE FF FF FF  ne\Logs.exe.....
0018FD90: E0 FD 18 00  AA 1E 8E 77  00 00 00 00  B0 C2 65 00  .......w......e.
0018FDA0: 50 99 8E 77  1C FE 18 00  50 7B 89 75  00 00 00 00  P..w....P{.u....
0018FDB0: B0 C2 65 00  01 00 00 00  80 A0 65 00  18 94 65 00  ..e.......e...e.
0018FDC0: 04 FE 18 00  76 31 F6 76  01 00 00 00  E8 FD 18 00  ....v1.v........
0018FDD0: F8 FD 18 00  EC FD 18 00  80 8F 89 75  00 00 40 1C  ...........u..@.
0018FDE0: F4 FD 18 00  68 99 8E 77  00 00 65 00  D3 DD 32 58  ....h..w..e...2X
0018FDF0: B0 C2 65 00  28 FE 18 00  60 2F F6 76  00 00 00 6F  ..e.(...`/.v...o
0018FE00: 1C FE 18 00  00 00 00 00  24 FE 18 00  00 00 00 00  ........$.......
0018FE10: F9 13 40 00  00 00 00 6F  50 7B 89 75  08 00 09 00  [email protected]{.u....
0018FE20: 70 6B 45 00  50 98 00 6F  3C FE 18 00  64 7B 89 75  pkE.P..o<...d{.u
0018FE30: 00 00 00 6F  70 6B 45 00  F9 13 40 00  90 A7 89 00  ...opkE...@.....
0018FE40: 82 1B D0 BC  19 14 40 00  00 00 00 6F  10 0E 47 00  [email protected].
0018FE50: 02 37 65 00  80 FF 18 00  00 00 00 00  10 00 2E 00  .7e.............
0018FE60: 00 00 00 00  00 40 09 00  00 02 4A 00  00 00 00 00  [email protected].....
0018FE70: 77 4E 90 AD  5C 78 0D 4C  D7 3B F3 F2  E8 25 D3 C9  wN..\x.L.;...%..
0018FE80: DE EE FC 6A  80 00 00 00  00 00 00 00  00 00 00 00  ...j............
0018FE90: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
0018FEA0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
0018FEB0: 00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
0018FEC0: 00 4A 00 00  D8 FE 18 00  AD 90 4E 77  4C 0D 78 5C  .J........NwL.x\


------------------------------------------------------------------------------
So what does it mean? thanks guys =S
 
Last edited:
Here's one more thing to try out:

JASS:
private function destroy takes nothing returns nothing
         local integer i = 0
         loop
             exitwhen lt[i] == null
             call DestroyLightning(lt[i])
             set lt[i] = null
             set i = i+1
         endloop
     endfunction

-->

JASS:
private function destroy takes nothing returns nothing
         local integer i = 0
         loop
             exitwhen lt[i] == null
             if lt[i] != null then
                 call DestroyLightning(lt[i])
             endif
             set lt[i] = null
             set i = i+1
         endloop
     endfunction

Also, try to avoid uninitialized variables:

-->
JASS:
    //To hold spawned units, to be filled later.
     integer spawnDiff = 0
     //Income per building, the unit types of the buildings, and each players income.
     integer array incAmountPer
     integer array incBuildings
     integer playerInc = 0
     //Timers
     timer gameTimer = null
     timer endTimer = null
     timerdialog GameTime = null
     //Counter for game time counter that counts up.
     integer counter = 0
     leaderboard P_Income = null
     unit builder = null
     integer tmpInt = 0

     public unit boss = null


On a side note... how many units do you have on the map when the game crashes? What are the death types of these units?

Remember that WC3 can only handle a limited amount of units before the game becomes instable.
 
Level 5
Joined
May 6, 2013
Messages
125
how would I go about getting a debugger

There are no wc3 specific debuggers; you would just get a normal one, such as the one coming with visual studio, or a standalone one like ollydb or cheat engine. You would then have to put a breakpoint at the instruction that crashes and reverse engineer from there. Plus points if you allready reversed some parts of wc3 sometime. (Im sure there are people that did, else we wouldnt see things like sharpcraft, but ive never found someone documenting his finds). Its really a last resort for when one is totally out of ideas, since it its not an easy thing to do, largely luck/intuitivity depended and usually takes very long to find the bug.

So what does it mean? thanks guys =S

Unfortunately not too much (it suggest a virtual call using edx though), it seems like part of the crash report is missing, most importantly the stack information. I would go ahead and guess that the first 4 numbers on the stack have been 87 49 CE 6F, though that would be bad since it might suggests a more general error not directly created by triggers (since that function is called 24/7).

I tried to recreate the error myself to get my hands on a full log file. Unfortunately, i could not play the replay (it didnt find the map file, even though im 100% sure that its there). So i tried to play the map a bit myself; i never got past the 15 minutes mark (everything becomes so expensive and my soldiers stay shit T.T), so i cheated myself infinite gold and turtled up for over 1 hour - no crash occured. Is the crash really that rare?
 
Level 3
Joined
Jun 2, 2015
Messages
45
Perhaps changing everything to cant raise doesn't decay would help. However, I cant see that there are that many units, it spawns about 8 every 20 seconds and most die almost immediately. The crash almost always happens when the ice knight is being attacked, most of the times by multiple units at once. Also, if I use any way to "cheat" by creating a super strong unit in the world editor or turtling with towers causes it wont crash. It only happens when I play the game as it is supposed to be played, which makes it all the more frustrating.
I wouldn't expect anyone to get past the beginning right now without seeing how to play, I plan to make a tutorial intro eventually. That was why I included the replay. V.V There are still many bonuses I need to add to the player, which are gained over many games, so I purposefully made it harder in anticipation of the boost from a player.

edit: one more question, kind of off topic, do any of you guys know of a way to record Warcraft 3 replays?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,223
Debugging WC3 is not something I recommend anyone do. Since there is no source code (available outside Blizzard) and the debug symbol file for the particular build is missing you literally have to process through 500,000 lines of x86 assembly. Unless you are a real hacker and willing to dedicate several days worth of time to this, you will get nowhere.

The debugger can reveal the true source of the error. It records actual processor exception and where it occurs allowing you to see how the value came about (including its register states).

I recommend OllyDbg as although it is called shareware it is free. I have had some success with it in the past, including finding out why JASS is so slow (it resolves named signatures during runtime rather than linking them at compile time).

Do be aware that this is considered reverse engineering so is technically a violation of the terms of use of Warcraft III. As such you could get yourself into trouble doing it. However as long as you do not do it for malicious or commercial purposes I am pretty sure Blizzard will not care. Sill you should do it at your own discretion as I will not accept responsibility if you get into trouble (which I have never head of anyone getting into with WC3).
 
Have you tried replacing the iceknight for a default editor unit like a footman or grunt?

Just to go sure it isn't any corrupt object editor data.

From your triggers, there is nothing that only applies specifically to the Ice knight that could cause a crash.


Also, the dummy that casts the slow spell: does it have an attack? You might run into problems with the "Unit gets attacked" event if you build a recursion that creates dummy units with attacks; make sure all your dummies have no attacks to avoid this.

- a unit is attacked
- spawns a dummy because of that
- dummy casts a spell, finishes instantly, starts attacking a unit in range immediately afterwards
- the attack fires the event again

When using the attacked event, make sure to be extra careful for any cases of recursion. Especially if you order a unit within the same trigger (you do that in your frost shield and firebolt triggers). An order might instantly fire the attack event again if a valid order target is already within range, creating an infinite cycle.
For example, in case of your firebolt trigger, it would create an infinite cycle if firebolt is an instant cast ability and the unit unit has a cast point of "0" and a cast backswing point of "0".
 
Level 3
Joined
Jun 2, 2015
Messages
45
I don't see how the dummy recursion could happen because there is conditions where only if the ice knight is being attacked or only if the mage is attacking, will it actually fire the trigger. Dummy is ward so no attack anyways. Would deleting the ice knight and remaking a new one fix it if it is corrupt?
 
I don't see how the dummy recursion could happen because there is conditions where only if the ice knight is being attacked or only if the mage is attacking, will it actually fire the trigger. Dummy is ward so no attack anyways. Would deleting the ice knight and remaking a new one fix it if it is corrupt?
Ward doesn't prevent a unit from attacking. You need to set it's attack index to "none".

Also, here is how recursion can happen in your code:
JASS:
scope Firebolt initializer init
     private function mage takes nothing returns boolean
         if GetUnitTypeId(GetAttacker()) == 'o00A' then
             call IssueTargetOrder(GetAttacker(), "firebolt", GetTriggerUnit())
             //unit will use firebolt, then instantly resume to attacking, firing the trigger once more, and so on
         endif
         return false
     endfunction
     
     private function init takes nothing returns nothing
         local trigger cast = CreateTrigger()
         call TriggerRegisterPlayerUnitEvent(cast, Player(0), EVENT_PLAYER_UNIT_ATTACKED, null)
         call TriggerAddCondition(cast, Condition(function mage))
     endfunction
endscope
It depends on your OE data settings, though. If cast-point is non-zero, this can not happen. Also, if firebolt is a cooldown ability, it shouldn't happen aswell.
 
Level 3
Joined
Jun 2, 2015
Messages
45
both of those are true actually. and Ice knight should not have recursion because it only triggers when the ice knight is attacked, and even if the dummy had an attack, which it doesn't, it still shouldn't have recursion because according to the condition it only does the order if the unit under attack is the ice knight. Which leads me to suggest that maybe it is multiple triggers corresponding with each other. Anyways, I put together a short list of all the attack events and orders on my map

Events
Ice knight is attacked
Enemy Mage attacks anything
Something attacks healing wave boss below a certain percentage

Orders
All enemy units are ordered to attack move around the map, when they don't have order.
When the ice knight is attacked, a dummy is ordered to use a slow on the enemy.
The healing wave boss's animation is set when the event fires, don't know if that counts.
Enemy mage is ordered to firebolt targets when attacking.

The only one I can see here is that the mage's firebolt may count as an attack and will trigger again, however, firebolt will then be on cooldown...
 
Level 3
Joined
Jun 2, 2015
Messages
45
without any of the ordering stuff the game doesn't even work, so I couldn't get it to crash. this is my problem unless I play the game how it is supposed to be played it wont crash...
 
I read this:
http://www.thehelper.net/threads/crash-logs.131227/
so and after reading through many of my memory dumps only one thing stands out: "7UoP" is always in it. Sometimes there is "opkE" as well. Neither of these correspond to anything that I know of. posting an example.
I know this tutorial. Basicly, this only works for crashes caused directly via object data. It won't help much if it's a coding error, unless the native that caused the crash had a rawcode as input data.

Tbh, I'm out of ideas. Have you actually checked out the map on a different machine?

Also, do you have any custom imports in your map? Have you tried removing them all?
 
Level 3
Joined
Jun 2, 2015
Messages
45
Nothing custom. Tried it on my friends comp but I think it was an old copy I had lieing around because it wouldn't start. not sure why. He didn't have newgen though... is Newgen required just to play it?
 
Status
Not open for further replies.
Top