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

[JASS] JASS trigger crashing wc3

Status
Not open for further replies.
Level 11
Joined
Sep 14, 2009
Messages
284
Hi. I can't find why this trigger crashes wc3. My guess is there is something within the loop. But I need someone more experienced to look into it.

JASS:
function CombatLostDialogButton1_Conditions takes nothing returns boolean
    return GetClickedButtonBJ() == udg_Dialog_CombatLostButton[1]
endfunction

function CombatLostDialogButton1_Func01 takes nothing returns nothing
    call RemoveUnit(GetEnumUnit())
endfunction

function CombatLostDialogButton1_Actions takes nothing returns nothing
    local integer i = 1
    local group g
    local location p
    call DialogDisplayBJ(false, udg_Dialog_CombatLost, Player(8))
    if udg_ZoneCurrent != "DaldeunWoods" then
        set udg_ZoneCurrent = "DaldeunWoods"
        call SetSkyModel("Environment\\Sky\\Sky\\SkyLight.mdl")
        call SetTerrainFogExBJ(0, 1100.00, 3700.00, 0, 30.00, 70.00, 50.00)
        set udg_CombatSpawnType[1] = 'n002'
        set udg_CombatSpawnType[2] = 'n002'
        set udg_CombatRect = gg_rct_CRDaldeunWoods
        set udg_CombatRectChar[1] = gg_rct_CRDaldeunWoodsChar01
        set udg_CombatRectChar[2] = gg_rct_CRDaldeunWoodsChar02
        set udg_CombatRectChar[3] = gg_rct_CRDaldeunWoodsChar03
        set udg_CombatRectEnemy[1] = gg_rct_CRDaldeunWoodsEnemy01
        set udg_CombatRectEnemy[2] = gg_rct_CRDaldeunWoodsEnemy02
        set udg_CombatRectEnemy[3] = gg_rct_CRDaldeunWoodsEnemy03
        set udg_CombatRectEnemy[4] = gg_rct_CRDaldeunWoodsEnemy04
        set udg_CombatRectEnemy[5] = gg_rct_CRDaldeunWoodsEnemy05
    endif
    set udg_InArena = false
    set udg_InCinematic = false
    set udg_InCombat = false
    set udg_InPM = false
    set udg_InSanctuary = true
    set udg_InTown = false
    set udg_CombatBossBattle = false
    set p = GetRectCenter(gg_rct_Resurrect)
    call ReviveHeroLoc(udg_PartyMember[1], p, true)
    call RemoveLocation(p)
    set p = GetRectCenter(gg_rct_Resurrect)
    call PanCameraToTimedLocForPlayer(Player(8), p, 0)
    call RemoveLocation(p)
    set p = GetRectCenter(gg_rct_Resurrect)
    call AddSpecialEffectLocBJ(p, "Abilities\\Spells\\Other\\Awaken\\Awaken.mdl")
    call RemoveLocation(p)
    call DestroyEffect(GetLastCreatedEffectBJ())
    call SetUnitFacingTimed(udg_PartyMember[1], 270.00, 0)
    loop
        exitwhen i > 3
        set udg_TempUnitA = udg_PartyMember[i]
        if i > 1 then
            set p = GetRectCenter(gg_rct_PMEnter)
            call ReviveHeroLoc(udg_PartyMember[i], p, true)
            call RemoveLocation(p)
            set p = GetRectCenter(gg_rct_PMEnter)
            call AddSpecialEffectLocBJ(p, "Abilities\\Spells\\Other\\Awaken\\Awaken.mdl")
            call RemoveLocation(p)
            call DestroyEffect(GetLastCreatedEffectBJ())
        endif
        call ConditionalTriggerExecute(gg_trg_CharacterGetColors)
        call SetUnitLifeBJ(udg_PartyMember[i], (0.10 * GetUnitStateSwap(UNIT_STATE_MAX_LIFE, udg_PartyMember[i])))
        call SetUnitManaBJ(udg_PartyMember[i], (0.10 * GetUnitStateSwap(UNIT_STATE_MAX_MANA, udg_PartyMember[i])))
        set i = i + 1
    endloop
    set p = null
    call StopMusicBJ(false)
    call PlayMusicBJ(gg_snd_Music_DaldeunWoods)
    set g =GetUnitsInRectAll(udg_CombatRect)
    call ForGroupBJ(g, function CombatLostDialogButton1_Func01)
    call DestroyGroup(g)
    set g = null
    call SetPlayerAbilityAvailableBJ(true, 'A008', Player(8))
    call SetPlayerAbilityAvailableBJ(true, 'A004', Player(8))
    call CinematicFadeBJ(bj_CINEFADETYPE_FADEIN, 1.50, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0)
endfunction

//===========================================================================
function InitTrig_CombatLostDialogButton1 takes nothing returns nothing
    set gg_trg_CombatLostDialogButton1 = CreateTrigger()
    call TriggerRegisterDialogEventBJ(gg_trg_CombatLostDialogButton1, udg_Dialog_CombatLost)
    call TriggerAddCondition(gg_trg_CombatLostDialogButton1, Condition(function CombatLostDialogButton1_Conditions))
    call TriggerAddAction(gg_trg_CombatLostDialogButton1, function CombatLostDialogButton1_Actions)
endfunction
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
for long triggers like these, the best thing to do is make "checkpoints".

call BJDebugMsg("Checkpoint 1")

Put that thing in your trigger a few times (and at least one inside the loop) and give them all a different number.

Then you can get to the exact line that breaks WC3.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
because if someone has the same problem in future, he doesnt have to ask but can find this, if he takes his time to search for it.

Also you should provide the solution, for the same reason(whats use does thread have when the result is not in it).

Also maybe administration, like posting porn and stuff, and then removing it gives you a chance that no mods will actually see it, but some users will, effectivelly breaking the rules and going unnoticed(this requires hard-deletes tho)
 
Status
Not open for further replies.
Top