• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Crash] My map has bugs

Status
Not open for further replies.
Level 24
Joined
Jun 26, 2020
Messages
1,852
I made a map in the 1.26, but I played it in a 1.27 server and has bugs and the disconects, I don't know if its for desyncs or is for the version, because I also tested it in the 1.26 and the game just crashes and they happen randomly and not in a moment that I know I used "GetLocalPlayer", what is happening?
Link: Mi mapa | HIVE
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
first off if you dont know where the problem is no one can help you because we dont see all of your triggers
I shared my map to you can look up.
try to open wc3 two times open a local game and then try to find when the second player 2 desync
You said that as that was easy, I looked for methods time ago and they didn't work.
Before posting this somehow I can do that when I couldn't before.
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
After testing I noticed someone disconnect if a hero dies, so there is the triggers that implies that (I have to modes):
JASS:
library Revive initializer Init requires TimerUtils

globals
    integer array Revive_Instance
endglobals

struct Revive
  
    unit hero
    timer revive
    timerdialog clock
  
    static method create takes unit hero returns thistype
        local thistype this=thistype.allocate()
        set this.hero=hero
        set this.revive=NewTimerEx(this)
        call TimerStart(this.revive,15.00+5.00*I2R(R2I(SquareRoot(I2R(GetHeroLevel(hero))))),false,function thistype.end_revive)
        set this.clock=CreateTimerDialog(this.revive)
        call TimerDialogSetTitle(this.clock,"You revive in: ")
        if GetLocalPlayer()==GetOwningPlayer(hero) then
            call TimerDialogDisplay(this.clock,true)
        endif
        return this
    endmethod
  
    static method end_revive takes nothing returns nothing
        local Revive this=GetTimerData(GetExpiredTimer())
        call this.destroy()
    endmethod
  
    method destroy takes nothing returns nothing
        local location l
        call DestroyTimerDialog(this.clock)
        call ReleaseTimer(this.revive)
        if IsPlayerInForce(GetOwningPlayer(this.hero),udg_Grupo_Draeneanos) then
            set l=GetRandomLocInRect(udg_Draeneanos)
        else
            set l=GetRandomLocInRect(udg_Demonios)
        endif
        call ReviveHeroLoc(this.hero,l,true)
        call RemoveLocation(l)
        set l=null
        set this.hero=null
        set this.revive=null
        set this.clock=null
        call this.deallocate()
    endmethod
endstruct

private function Conditions_borrar takes nothing returns boolean
    return IsUnitType(udg_UDexUnits[udg_UDex],UNIT_TYPE_HERO)
endfunction

private function Actions_borrar takes nothing returns nothing
    local Revive t=Revive_Instance[udg_UDex]
    call t.destroy()
endfunction

//-- --

private function Conditions takes nothing returns boolean
    return IsUnitType(GetDyingUnit(),UNIT_TYPE_HERO)
endfunction

private function Actions takes nothing returns nothing
    set Revive_Instance[GetUnitUserData(GetDyingUnit())]=Revive.create(GetDyingUnit())
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterVariableEvent(t,"udg_UnitIndexEvent",EQUAL,2.00)
    call TriggerAddCondition(t,Condition(function Conditions_borrar))
    call TriggerAddAction(t,function Actions_borrar)
    set t=null
    //-- --
    set gg_trg_Si_mueres_Heroe=CreateTrigger()
    call DisableTrigger(gg_trg_Si_mueres_Heroe)
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Si_mueres_Heroe,EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(gg_trg_Si_mueres_Heroe,Condition(function Conditions))
    call TriggerAddAction(gg_trg_Si_mueres_Heroe,function Actions)
endfunction
endlibrary
JASS:
function Trig_Heroes_Actions takes nothing returns nothing
    local integer i=1
    local location l
    set i=1
    loop
        exitwhen i>5
        if IsUnitDeadBJ(udg_Hero[i]) then
            set l=GetRandomLocInRect(udg_Draeneanos)
            call ReviveHeroLoc(udg_Hero[i],l,true)
            call RemoveLocation(l)
        endif
        set i=i+1
    endloop
    loop
        exitwhen i>10
        if IsUnitDeadBJ(udg_Hero[i]) then
            set l=GetRandomLocInRect(udg_Demonios)
            call ReviveHeroLoc(udg_Hero[i],l,true)
            call RemoveLocation(l)
        endif
        set i=i+1
    endloop
    set l=null
endfunction

//===========================================================================
function InitTrig_Heroes takes nothing returns nothing
    set gg_trg_Heroes=CreateTrigger()
    call TriggerRegisterTimerExpireEventBJ(gg_trg_Heroes,udg_Revivir)
    call TriggerAddAction(gg_trg_Heroes,function Trig_Heroes_Actions)
endfunction
  • Si mueres
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A hero) Equal to True
    • Acciones
      • Time - Show Reloj_Revivir for (Owner of (Dying unit))
  • Si mueres
    • Events
      • Unit - A unit Start resurrecting
    • Conditions
      • ((Dying unit) is A hero) Equal to True
    • Acciones
      • Time - Hide Reloj_Revivir for (Owner of (Reviving hero))
JASS:
function Trig_Te_mato_Conditions takes nothing returns boolean
    set udg_Temp_Player=GetOwningPlayer(GetKillingUnit())
    set udg_Temp_Player2=GetOwningPlayer(GetDyingUnit())
    if IsPlayerEnemy(udg_Temp_Player,udg_Temp_Player2)==false then
        return false
    elseif IsUnitType(GetDyingUnit(),UNIT_TYPE_HERO)==false then
        return false
    endif
    return true
endfunction

function NoEsEl takes nothing returns boolean
    return (GetFilterPlayer()!=udg_Temp_Player)
endfunction

function AddAssist takes nothing returns nothing
    if LoadInteger(udg_Assists,CircleNumber(GetEnumPlayer()),CircleNumber(udg_Temp_Player2))>0 then
        call ForceAddPlayer(udg_Asistencias,GetEnumPlayer())
    endif
endfunction

function AssistActions takes nothing returns nothing
    local location l
    local integer Akill=CircleNumber(GetEnumPlayer())
    local unit u
    set udg_Los_que_asistieron=(udg_Los_que_asistieron+(udg_Nombre_Jugador[Akill]+"/"))
    set udg_assists[Akill]=(udg_assists[Akill]+1)
    call MultiboardSetItemValueMejor(udg_Tabla,5,udg_Row[Akill],I2S(udg_assists[Akill]))
    if udg_Modo[3]!="Only consummibles." then
        call AdjustPlayerStateBJ(GetRandomInt(0,1),GetEnumPlayer(),PLAYER_STATE_RESOURCE_LUMBER)
    endif
    if udg_Hero[Akill]==null then
        set l=GetUnitLoc(udg_Circle[Akill])
        set u=CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE),'hfoo',l,bj_UNIT_FACING)
        call RemoveLocation(l)
        call UnitDamageTargetBJ(udg_Circle[Akill],u,9999.00,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL)
        call RemoveUnit(u)
    else
        set l=GetUnitLoc(udg_Hero[Akill])
        set u=CreateUnitAtLoc(Player(PLAYER_NEUTRAL_AGGRESSIVE),'hfoo',l,bj_UNIT_FACING)
        call RemoveLocation(l)
        call UnitDamageTargetBJ(udg_Hero[Akill],u,9999.00,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL)
        call RemoveUnit(u)
    endif
    set u=null
    set l=null
endfunction

function Trig_Te_mato_Actions takes nothing returns nothing
    local integer k=CircleNumber(udg_Temp_Player)
    local integer d=CircleNumber(udg_Temp_Player2)
    local integer extra
    local force f
    local boolean fk
    local boolean dk
    local boolean tk
    local boolean uk
    if udg_Modo[3]!="Only consummibles." then
        call AdjustPlayerStateBJ(GetRandomInt(1,2),udg_Temp_Player,PLAYER_STATE_RESOURCE_LUMBER)
    endif
    call SetPlayerState(udg_Temp_Player2,PLAYER_STATE_GOLD_GATHERED,R2I(I2R(GetPlayerState(udg_Temp_Player2,PLAYER_STATE_RESOURCE_GOLD))*GetRandomReal(0.75,0.90)))
    set udg_spree[k]=udg_spree[k]+1
    set udg_kills[k]=udg_kills[k]+1
    call MultiboardSetItemValueMejor(udg_Tabla,3,udg_Row[k],I2S(udg_kills[k]))
    set udg_deaths[d]=udg_deaths[d]+1
    set udg_Sin_repick[d]=0
    call MultiboardSetItemValueMejor(udg_Tabla,4,udg_Row[d],I2S(udg_deaths[d]))
    if udg_Temp_Player==Player(0) then
        set k=11
    elseif udg_Temp_Player==Player(6) then
        set k=12
    endif
    if udg_Temp_Player==Player(PLAYER_NEUTRAL_AGGRESSIVE) then
        if GetKillingUnit()==udg_Golem_de_carne then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,4.00,udg_Nombre_Jugador[d]+" was killed by The Monster")
        else
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,4.00,udg_Nombre_Jugador[d]+" was killed by the Neutral Creeps")
        endif
    else
        if udg_spree[d]>=3 then
            set extra=GetRandomInt(udg_spree[d]*40,udg_spree[d]*60)
            set udg_Asesinato_mensaje=udg_Nombre_Jugador[k]+" has ended the spree of |cffffcc00"+I2S(udg_spree[d])+"|r of "+udg_Nombre_Jugador[d]+" |cffffcc00(+"+I2S(extra)+")|r"
            call AdjustPlayerStateBJ(extra,udg_Temp_Player,PLAYER_STATE_RESOURCE_GOLD)
        else
            set udg_Asesinato_mensaje=udg_Nombre_Jugador[k]+" killed "+udg_Nombre_Jugador[d]
        endif
        set udg_spree[d]=0
        set f=GetPlayersMatching(Condition(function NoEsEl))
        call ForForce(f,function AddAssist)
        call DestroyForce(f)
        if CountPlayersInForceBJ(udg_Asistencias)>0 then
            call ForForce(udg_Asistencias,function AssistActions)
            set udg_Los_que_asistieron=SubString(udg_Los_que_asistieron,0,StringLength(udg_Los_que_asistieron)-1)
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,4.00,(udg_Asesinato_mensaje+(". Assists: "+udg_Los_que_asistieron)))
            set udg_Los_que_asistieron=""
            call ForceClear(udg_Asistencias)
        else
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,4.00,udg_Asesinato_mensaje)
        endif
    endif
    if udg_Temp_Player!=Player(0) and udg_Temp_Player!=Player(6) then
        if udg_spree[k]>=3 then
            call DisplayTextToForce(bj_FORCE_ALL_PLAYERS,udg_Nombre_Jugador[k]+" has a spree of |cffffcc00"+I2S(udg_spree[k])+"|r")
        endif
        set fk=udg_first_kill[k]==0
        set dk=udg_double_kill[k]==0
        set tk=udg_triple_kill[k]==0
        set uk=udg_Ultra_kill[k]==0
        if fk and dk and tk and uk then
            set udg_first_kill[k]=10
            return
        elseif not fk and dk and tk and uk then
            set udg_double_kill[k]=10
            set udg_first_kill[k]=0
            call DisplayTextToForce(bj_FORCE_ALL_PLAYERS,udg_Nombre_Jugador[k]+" just got a |cff00ffffDouble kill|r!")
            return
        elseif fk and not dk and tk and uk then
            set udg_triple_kill[k]=10
            set udg_double_kill[k]=0
            call DisplayTextToForce(bj_FORCE_ALL_PLAYERS,udg_Nombre_Jugador[k]+" just got a |cff00ffffTriple kill|r!")
            return
        elseif fk and dk and not tk and uk then
            set udg_Ultra_kill[k]=10
            set udg_triple_kill[k]=0
            call DisplayTextToForce(bj_FORCE_ALL_PLAYERS,udg_Nombre_Jugador[k]+" just got a |cff00ffffUltra kill|r!")
            return
        elseif fk and dk and tk and not uk then
            set udg_Ultra_kill[k]=10
            call DisplayTextToForce(bj_FORCE_ALL_PLAYERS,udg_Nombre_Jugador[k]+" is on a |cff00ffffRampage|r!")
            return
        endif
    endif
    set f=null
endfunction

//===========================================================================
function InitTrig_Te_mato takes nothing returns nothing
    set gg_trg_Te_mato=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Te_mato,EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(gg_trg_Te_mato,Condition(function Trig_Te_mato_Conditions))
    call TriggerAddAction(gg_trg_Te_mato,function Trig_Te_mato_Actions)
endfunction
JASS:
function Trig_Me_mato_un_aliado_Conditions takes nothing returns boolean
    if IsPlayerAlly(GetOwningPlayer(GetKillingUnit()),GetOwningPlayer(GetDyingUnit()))==false then
        return false
    elseif IsUnitType(GetDyingUnit(),UNIT_TYPE_HERO)==false then
        return false
    endif
    return true
endfunction

function Trig_Me_mato_un_aliado_Actions takes nothing returns nothing
    local integer k=CircleNumber(GetOwningPlayer(GetKillingUnit()))
    local integer d=CircleNumber(GetOwningPlayer(GetDyingUnit()))
    set udg_deaths[d]=udg_deaths[d]+1
    set udg_Sin_repick[d]=0
    call MultiboardSetItemValueMejor(udg_Tabla,4,udg_Row[d],I2S(udg_deaths[d]))
    if GetOwningPlayer(GetKillingUnit())==GetOwningPlayer(GetDyingUnit()) then
        call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,4.00,(udg_Nombre_Jugador[d]+" has killed himself."))
    else
        call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,4.00,((udg_Nombre_Jugador[k]+" killed his teammate ")+udg_Nombre_Jugador[d]))
    endif
    call FlushChildHashtable(udg_Assists,d)
    if GetUnitRace(GetKillingUnit())==RACE_UNDEAD and GetUnitRace(GetDyingUnit())==RACE_ORC then
        set udg_Si_lo_mataste[GetConvertedPlayerId(GetOwningPlayer(GetKillingUnit()))]=true
    endif
endfunction

//===========================================================================
function InitTrig_Me_mato_un_aliado takes nothing returns nothing
    set gg_trg_Me_mato_un_aliado=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Me_mato_un_aliado,EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(gg_trg_Me_mato_un_aliado,Condition(function Trig_Me_mato_un_aliado_Conditions))
    call TriggerAddAction(gg_trg_Me_mato_un_aliado,function Trig_Me_mato_un_aliado_Actions)
endfunction
JASS:
function Trig_Seleccion_Actions takes nothing returns nothing
    local location l
    local unit h=GetRevivingUnit()
    local player p=GetOwningPlayer(h)
    if udg_Tengo_a_alguien_seleccionado[GetConvertedPlayerId(p)]==false then
        call SelectUnitForPlayerSingle(h,p)
        set l=GetUnitLoc(h)
        call PanCameraToTimedLocForPlayer(p,l,0)
        call RemoveLocation(l)
    else
        call DisplayTextToPlayer(p,0,0,"|cff61dbffYour hero has resurrected|r")
    endif
    set l=null
endfunction

//===========================================================================
function InitTrig_Seleccion takes nothing returns nothing
    set gg_trg_Seleccion=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Seleccion,EVENT_PLAYER_HERO_REVIVE_FINISH)
    call TriggerAddAction(gg_trg_Seleccion,function Trig_Seleccion_Actions)
endfunction
And also always around the minute 2:45 of the game-time happens a disconnect, I have to look why.
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
Ok I don't get why, but I just edited this trigger:
  • A ver si estas
    • Events
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
      • Player - Player 11 (Dark Green) Selects a unit
      • Player - Player 12 (Brown) Selects a unit
      • Player - Player 2 (Blue) Deselects a unit
      • Player - Player 3 (Teal) Deselects a unit
      • Player - Player 4 (Purple) Deselects a unit
      • Player - Player 5 (Yellow) Deselects a unit
      • Player - Player 6 (Orange) Deselects a unit
      • Player - Player 8 (Pink) Deselects a unit
      • Player - Player 9 (Gray) Deselects a unit
      • Player - Player 10 (Light Blue) Deselects a unit
      • Player - Player 11 (Dark Green) Deselects a unit
      • Player - Player 12 (Brown) Deselects a unit
      • Player - Player 2 (Blue) types a chat message containing <Empty String> as A substring
      • Player - Player 3 (Teal) types a chat message containing <Empty String> as A substring
      • Player - Player 4 (Purple) types a chat message containing <Empty String> as A substring
      • Player - Player 5 (Yellow) types a chat message containing <Empty String> as A substring
      • Player - Player 6 (Orange) types a chat message containing <Empty String> as A substring
      • Player - Player 8 (Pink) types a chat message containing <Empty String> as A substring
      • Player - Player 9 (Gray) types a chat message containing <Empty String> as A substring
      • Player - Player 10 (Light Blue) types a chat message containing <Empty String> as A substring
      • Player - Player 11 (Dark Green) types a chat message containing <Empty String> as A substring
      • Player - Player 12 (Brown) types a chat message containing <Empty String> as A substring
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) skips a cinematic sequence
      • Player - Player 6 (Orange) skips a cinematic sequence
      • Player - Player 8 (Pink) skips a cinematic sequence
      • Player - Player 9 (Gray) skips a cinematic sequence
      • Player - Player 10 (Light Blue) skips a cinematic sequence
      • Player - Player 11 (Dark Green) skips a cinematic sequence
      • Player - Player 12 (Brown) skips a cinematic sequence
      • Player - Player 2 (Blue) changes alliance settings
      • Player - Player 3 (Teal) changes alliance settings
      • Player - Player 4 (Purple) changes alliance settings
      • Player - Player 5 (Yellow) changes alliance settings
      • Player - Player 6 (Orange) changes alliance settings
      • Player - Player 8 (Pink) changes alliance settings
      • Player - Player 9 (Gray) changes alliance settings
      • Player - Player 10 (Light Blue) changes alliance settings
      • Player - Player 11 (Dark Green) changes alliance settings
      • Player - Player 12 (Brown) changes alliance settings
    • Conditions
    • Actions
      • For each (Integer estoy) from 1 to 10, do (Set VariableSet AFK_tiempo[estoy] = 0.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) is in Los_que_estan.) Equal to False
        • Then - Actions
          • Player Group - Add (Triggering player) to Los_que_estan
          • For each (Integer estoy) from 1 to 10, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Triggering player) Equal to (Owner of Circle[estoy])
                • Then - Actions
                  • Multiboard - Set the color for Tabla item in column 0, row (Custom value of Circle[estoy]) to (100.00%, 100.00%, 100.00%) with 0.00% transparency
                  • Multiboard - Set the text for Tabla item in column 2, row (Custom value of Circle[estoy]) to Nombre_Jugador[estoy]
                • Else - Actions
        • Else - Actions
To this:
JASS:
function Trig_A_ver_si_estas_Actions takes nothing returns nothing
    local player p=GetTriggerPlayer()
    local integer i=CircleNumber(p)
    set udg_AFK_tiempo[i]=0.00
    if not IsPlayerInForce(p,udg_Los_que_estan) then
        call ForceAddPlayer(udg_Los_que_estan,p)
        call MultiboardSetItemColorMejor(udg_Tabla,0,udg_Row[i],255,255,255,255)
        call MultiboardSetItemValueMejor(udg_Tabla,2,udg_Row[i],udg_Nombre_Jugador[i])
    endif
    set p=null
endfunction

//===========================================================================
function InitTrig_A_ver_si_estas takes nothing returns nothing
    local integer i=1
    set gg_trg_A_ver_si_estas=CreateTrigger()
    loop
        exitwhen i>11
        if i!=6 then
            call TriggerRegisterPlayerUnitEvent(gg_trg_A_ver_si_estas,Player(i),EVENT_PLAYER_UNIT_SELECTED,null)
            call TriggerRegisterPlayerUnitEvent(gg_trg_A_ver_si_estas,Player(i),EVENT_PLAYER_UNIT_DESELECTED,null)
            call TriggerRegisterPlayerChatEvent(gg_trg_A_ver_si_estas,Player(i),"",false)
            call TriggerRegisterPlayerEvent(gg_trg_A_ver_si_estas,Player(i),EVENT_PLAYER_END_CINEMATIC)
            call TriggerRegisterPlayerEvent(gg_trg_A_ver_si_estas,Player(i),EVENT_PLAYER_ALLIANCE_CHANGED)
        endif
        set i=i+1
    endloop
    call TriggerAddAction(gg_trg_A_ver_si_estas,function Trig_A_ver_si_estas_Actions)
endfunction
And the disconnects stopped until I tested, I'm not sure if the problem is solved, but its too strange.
 
Status
Not open for further replies.
Top