HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Random game crushes caused by a trigger.

08-09-2006, 01:26 PM#1
DioD
Collapse JASS:
function Bounty_Main_Action takes nothing returns nothing
    local unit    Dead_U_1 = GetDyingUnit()
    local unit    Kill_U_1 = GetKillingUnit()
    local unit    Temp_U_1
    local integer Base_I_1 = GetRandomInt(1,6)
    local integer Gold_I_1
    local integer Crys_I_1
    local integer Expr_I_1
    local integer Temp_I_1 = IMaxBJ(GetUnitLevel(Dead_U_1),GetHeroLevel(Dead_U_1))
    local integer Temp_I_2 = IMaxBJ(1,Temp_I_1)
    local string  Text_S_1
    local string  Temp_S_1
    local string  Temp_S_2
    local player  Owne_P_1 = GetOwningPlayer(Kill_U_1)
    local texttag TTag_T_1 = CreateTextTag()
    local real    Xcoo_R_1 = GetUnitX(Dead_U_1)
    local real    Ycoo_R_1 = GetUnitY(Dead_U_1)
    local group   Grou_G_1 = CreateGroup()
    local force   Forc_F_1 = CreateForce()
    local boolean Bool_B_1 = GetPlayerSlotState(Owne_P_1) == PLAYER_SLOT_STATE_PLAYING
    local boolean Bool_B_2 = GetPlayerController(Owne_P_1) == MAP_CONTROL_USER
    
    if IsUnitType(Dead_U_1,UNIT_TYPE_STRUCTURE) then
        set Gold_I_1 = Base_I_1*Temp_I_2*6
        set Crys_I_1 = 18
        set Expr_I_1 = 40*Temp_I_2
        set Temp_S_1 = "+"
        set Temp_S_2 = "|n|c0000FF00+"
        set Text_S_1 = Temp_S_1+I2S(Gold_I_1)+Temp_S_2+I2S(Crys_I_1)
        call SetUnitTimeScalePercent(Dead_U_1,100)
        call PauseUnit(Dead_U_1,false)
    elseif IsUnitType(Dead_U_1,UNIT_TYPE_ANCIENT) then
        set Gold_I_1 = Base_I_1*Temp_I_2*3
        set Crys_I_1 = 12
        set Expr_I_1 = 4*Temp_I_2
        set Temp_S_1 = "+"
        set Temp_S_2 = "|n|c0000FF00+"
        set Text_S_1 = Temp_S_1+I2S(Gold_I_1)+Temp_S_2+I2S(Crys_I_1)
        call SetUnitTimeScalePercent(Dead_U_1,100)
        call PauseUnit(Dead_U_1,false)
    elseif IsUnitType(Dead_U_1,UNIT_TYPE_HERO) then
        set Gold_I_1 = Base_I_1*Temp_I_2*2
        set Crys_I_1 = 6
        set Expr_I_1 = 8*Temp_I_2
        set Temp_S_1 = "+"
        set Temp_S_2 = "|n|c0000FF00+"
        set Text_S_1 = Temp_S_1+I2S(Gold_I_1)+Temp_S_2+I2S(Crys_I_1)
        call SetUnitTimeScalePercent(Dead_U_1,25)
        call PauseUnit(Dead_U_1,false)
    else
        set Gold_I_1 = Base_I_1*Temp_I_2*1
        set Crys_I_1 = 1
        set Expr_I_1 = 4*Temp_I_2
        set Temp_S_1 = "+"
        set Temp_S_2 = "|n|c0000FF00+"
        set Text_S_1 = Temp_S_1+I2S(Gold_I_1)+Temp_S_2+I2S(Crys_I_1)
        call SetUnitTimeScalePercent(Dead_U_1,100)
        call PauseUnit(Dead_U_1,false)
    endif
    
    if Bool_B_1 and Bool_B_2 then
        set Temp_U_1 = CreateUnit(Owne_P_1,'hpea',-12288,-12288,0)
        call SetUnitExplodedBJ (Temp_U_1, true)
        call UnitApplyTimedLife(Temp_U_1, 'BTLF',60)
        call SetUnitUseFood    (Temp_U_1, true)
        set Temp_I_1 = GetPlayerState ( Owne_P_1, PLAYER_STATE_RESOURCE_FOOD_USED )
        set Temp_I_2 = GetPlayerState ( Owne_P_1, PLAYER_STATE_RESOURCE_FOOD_CAP  )
        call SetPlayerState(Owne_P_1,PLAYER_STATE_RESOURCE_FOOD_CAP,IMaxBJ(Temp_I_1,Temp_I_2))
        call SetPlayerHandicapXP(Owne_P_1,GetPlayerHandicapXP(Owne_P_1)+ 0.2)
        
        call SetPlayerState(Owne_P_1,PLAYER_STATE_RESOURCE_GOLD   , Gold_I_1 + GetPlayerState(Owne_P_1,PLAYER_STATE_RESOURCE_GOLD) )
        call SetPlayerState(Owne_P_1,PLAYER_STATE_GOLD_GATHERED   , Gold_I_1 + GetPlayerState(Owne_P_1,PLAYER_STATE_GOLD_GATHERED) )
        call SetPlayerState(Owne_P_1,PLAYER_STATE_RESOURCE_LUMBER , Crys_I_1 + GetPlayerState(Owne_P_1,PLAYER_STATE_RESOURCE_LUMBER) )
        call SetPlayerState(Owne_P_1,PLAYER_STATE_LUMBER_GATHERED , Crys_I_1 + GetPlayerState(Owne_P_1,PLAYER_STATE_LUMBER_GATHERED) )
        
        if IsUnitType(Kill_U_1,UNIT_TYPE_HERO) and not IsSuspendedXP(Kill_U_1) then
            set Temp_S_1 = "|n|c000000FF+"
            set Text_S_1 = Text_S_1+Temp_S_1+I2S(Expr_I_1)
            call AddHeroXP(Kill_U_1,Expr_I_1,true)
        endif
        set Temp_S_1="Abilities\\Spells\\Other\\Transmute\\PileofGold.mdl"
        if GetLocalPlayer() != Owne_P_1 then
            set Temp_S_1=""
        endif
        call InstantSFX(Temp_S_1,Xcoo_R_1,Ycoo_R_1)
        call FadeTextTag(Text_S_1,Xcoo_R_1,Ycoo_R_1,Owne_P_1)
                
    else
        call GroupEnumUnitsInRange(Grou_G_1,Xcoo_R_1,Ycoo_R_1,600,null)
        set Temp_S_2 = "+"+I2S(Gold_I_1/3+1)
        loop
            set Temp_U_1 = FirstOfGroup (Grou_G_1)
            exitwhen Temp_U_1 == null
            if IsUnitType(Temp_U_1,UNIT_TYPE_HERO) and IsUnitEnemy(Dead_U_1,GetOwningPlayer(Temp_U_1)) then
                call GroupRemoveUnit(Grou_G_1,Temp_U_1)
                if not IsPlayerInForce(GetOwningPlayer(Temp_U_1),Forc_F_1) then
                    call ForceAddPlayer(Forc_F_1,GetOwningPlayer(Temp_U_1))
                    call SetPlayerState(GetOwningPlayer(Temp_U_1),PLAYER_STATE_RESOURCE_GOLD,Gold_I_1/3+1 + GetPlayerState(GetOwningPlayer(Temp_U_1),PLAYER_STATE_RESOURCE_GOLD)  )
                    call SetPlayerState(GetOwningPlayer(Temp_U_1),PLAYER_STATE_GOLD_GATHERED,Gold_I_1/3+1 + GetPlayerState(GetOwningPlayer(Temp_U_1),PLAYER_STATE_GOLD_GATHERED) )
                    call FadeTextTag(Temp_S_2,Xcoo_R_1,Ycoo_R_1,GetOwningPlayer(Temp_U_1))
                    if GetLocalPlayer() == GetOwningPlayer(Temp_U_1) then
                        set Temp_S_1="Abilities\\Spells\\Other\\Transmute\\PileofGold.mdl"
                    else
                        set Temp_S_1=""
                    endif
                endif
            else
                call GroupRemoveUnit(Grou_G_1,Temp_U_1)
            endif
        endloop
        call InstantSFX(Temp_S_1,Xcoo_R_1,Ycoo_R_1)
    endif
    
    
    set Dead_U_1   = null
    set Kill_U_1   = null
    set Temp_U_1 = null
    set Text_S_1   = ""
    set Temp_S_1 = ""
    set Temp_S_2 = ""
    set TTag_T_1   = null
    call DestroyForce(Forc_F_1)
    call DestroyGroup(Grou_G_1)
    set Grou_G_1   = null
    set Forc_F_1   = null
endfunction

This is main part of my bounty system for an AoS map. (i exclude sounds and text info from code but it still crush game randomly)
I cant fix this problem, if any one can help, do it plz.
08-09-2006, 01:32 PM#2
PipeDream
Post the error log from Warcraft III\Errors
if you're on 1.20e, run warcraft from the native tracer in my sig
08-09-2006, 01:49 PM#3
DioD
I have no use for native track there is no BJ function.
I will provide error log caused by this trigger alone.
But later, cause it realy random and hard to catch.
08-09-2006, 02:02 PM#4
PipeDream
  • You are using Blizzard.j.
  • Natives are those things prototyped in common.j.
  • The error logs are never deleted; if it crashed once, it's still there.
  • The error log is a stack trace for warcraft at that instant, not really a log. You can't pull out the error from one trigger, there's only one instant of error.
08-09-2006, 02:25 PM#5
DioD
I have a ton of large triggers like this, simply crushes started after i add THIS trigger to the map.

Sry but i know what natives is, there is useless to post error dump, with error caused by an other trigger.

Yes there is 2 BJ functions what calling nothing terreble inside, first call nothing ,second is from GUI.
08-09-2006, 03:15 PM#6
Vexorian
It is not useless, Pipedream can read it. I with no knowledge of dumps whatsoever could also find the failing native that caused a crash on my map as well.
08-09-2006, 10:07 PM#7
PitzerMike
Yeah, seems like you don't want to get help afterall.
08-10-2006, 11:21 AM#8
SentryIII
For this if statement:

Collapse JASS:
if Bool_B_1 and Bool_B_2 then

Can the trigger run through both paths without crashing? Also, can you post the code for the InstantSFX function?