• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Suspect Mass Creep Respawn Causing Desync

Level 21
Joined
Mar 16, 2008
Messages
959
Seems to be pretty consistently desyncing 2-3 players the first time this goes off. Not 100% sure but was wondering if anyone had any comment before I spend more time investigating.

  • New Respawn Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Main Map Region <gen> owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Mark of No Rez Creep (class) for (Picked unit)) Not equal to 1
            • Then - Actions
              • -------- increment counter --------
              • Set VariableSet creep_counter = (creep_counter + 1)
              • -------- unit --------
              • Set VariableSet creep_array[creep_counter] = (Picked unit)
              • -------- point of unit --------
              • Set VariableSet creep_point[creep_counter] = (Position of (Picked unit))
              • -------- unit facing --------
              • Set VariableSet creep_real[creep_counter] = (Facing of (Picked unit))
              • -------- unit type --------
              • Set VariableSet creep_type[creep_counter] = (Unit-type of (Picked unit))
            • Else - Actions
  • Events
  • Skip First Day
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Trigger - Turn on New Respawn Creep <gen>
      • Trigger - Turn off (This trigger)
  • New Respawn Creep
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • For each (Integer creep_A_interger) from 1 to creep_counter, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (creep_array[creep_A_interger] is dead) Equal to True
            • Then - Actions
              • Unit - Create 1 creep_type[creep_A_interger] for Neutral Hostile at creep_point[creep_A_interger] facing creep_real[creep_A_interger] degrees
              • Set VariableSet creep_array[creep_A_interger] = (Last created unit)
              • Special Effect - Create a special effect at creep_point[creep_A_interger] using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions

Also converted to JASS...
JASS:
function Trig_New_Respawn_Init_Copy_Func001Func001C takes nothing returns boolean
    if ( not ( GetUnitAbilityLevelSwapped('A0BD', GetEnumUnit()) != 1 ) ) then
        return false
    endif
    return true
endfunction

function Trig_New_Respawn_Init_Copy_Func001A takes nothing returns nothing
    if ( Trig_New_Respawn_Init_Copy_Func001Func001C() ) then
        // increment counter
        set udg_creep_counter = ( udg_creep_counter + 1 )
        // unit
        set udg_creep_array[udg_creep_counter] = GetEnumUnit()
        // point of unit
        set udg_creep_point[udg_creep_counter] = GetUnitLoc(GetEnumUnit())
        // unit facing
        set udg_creep_real[udg_creep_counter] = GetUnitFacing(GetEnumUnit())
        // unit type
        set udg_creep_type[udg_creep_counter] = GetUnitTypeId(GetEnumUnit())
    else
    endif
endfunction

function Trig_New_Respawn_Init_Copy_Actions takes nothing returns nothing
    call ForGroupBJ( GetUnitsInRectOfPlayer(gg_rct_Main_Map_Region, Player(PLAYER_NEUTRAL_AGGRESSIVE)), function Trig_New_Respawn_Init_Copy_Func001A )
endfunction

//===========================================================================
function InitTrig_New_Respawn_Init_Copy takes nothing returns nothing
    set gg_trg_New_Respawn_Init_Copy = CreateTrigger(  )
    call DisableTrigger( gg_trg_New_Respawn_Init_Copy )
    call TriggerAddAction( gg_trg_New_Respawn_Init_Copy, function Trig_New_Respawn_Init_Copy_Actions )
endfunction

function Trig_Skip_First_Day_Copy_Actions takes nothing returns nothing
    call EnableTrigger( gg_trg_New_Respawn_Creep )
    call DisableTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_Skip_First_Day_Copy takes nothing returns nothing
    set gg_trg_Skip_First_Day_Copy = CreateTrigger(  )
    call DisableTrigger( gg_trg_Skip_First_Day_Copy )
    call TriggerRegisterGameStateEventTimeOfDay( gg_trg_Skip_First_Day_Copy, EQUAL, 6.00 )
    call TriggerAddAction( gg_trg_Skip_First_Day_Copy, function Trig_Skip_First_Day_Copy_Actions )
endfunction

function Trig_New_Respawn_Creep_Copy_Func001Func001C takes nothing returns boolean
    if ( not ( IsUnitDeadBJ(udg_creep_array[udg_creep_A_interger]) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_New_Respawn_Creep_Copy_Actions takes nothing returns nothing
    set udg_creep_A_interger = 1
    loop
        exitwhen udg_creep_A_interger > udg_creep_counter
        if ( Trig_New_Respawn_Creep_Copy_Func001Func001C() ) then
            call CreateNUnitsAtLoc( 1, udg_creep_type[udg_creep_A_interger], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_creep_point[udg_creep_A_interger], udg_creep_real[udg_creep_A_interger] )
            set udg_creep_array[udg_creep_A_interger] = GetLastCreatedUnit()
            call AddSpecialEffectLocBJ( udg_creep_point[udg_creep_A_interger], "Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl" )
            call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        else
        endif
        set udg_creep_A_interger = udg_creep_A_interger + 1
    endloop
endfunction

//===========================================================================
function InitTrig_New_Respawn_Creep_Copy takes nothing returns nothing
    set gg_trg_New_Respawn_Creep_Copy = CreateTrigger(  )
    call DisableTrigger( gg_trg_New_Respawn_Creep_Copy )
    call TriggerRegisterGameStateEventTimeOfDay( gg_trg_New_Respawn_Creep_Copy, EQUAL, 6.00 )
    call TriggerAddAction( gg_trg_New_Respawn_Creep_Copy, function Trig_New_Respawn_Creep_Copy_Actions )
endfunction
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Nothing there should cause a desync, but to be safe you could do this:
  • New Respawn Creep
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
      • (Execution count of (This trigger)) Greater than 1
    • Actions
      • For each (Integer creep_A_interger) from 1 to creep_counter, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Multiple conditions
                • (creep_array[creep_A_integer]) Not equal to No unit
                • (creep_array[creep_A_interger] is dead) Equal to True
            • Then - Actions
              • Unit - Create 1 creep_type[creep_A_interger] for Neutral Hostile at creep_point[creep_A_interger] facing creep_real[creep_A_interger] degrees
              • Set VariableSet creep_array[creep_A_interger] = (Last created unit)
              • Special Effect - Create a special effect at creep_point[creep_A_interger] using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
Now it automatically skips Day 1 by checking how many times the trigger has been executed and it will avoid running unwanted functions on the unit if it's null.

Also, it might be wise to use "Elapsed time is 0.00 seconds" in Init instead of "Map initialization", just to be extra safe.
 
Last edited:
Level 21
Joined
Mar 16, 2008
Messages
959
Nothing there should cause a desync, but to be safe you could do this:
  • New Respawn Creep
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
      • (Execution count of (This trigger)) Greater than 1
    • Actions
      • For each (Integer creep_A_interger) from 1 to creep_counter, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Multiple conditions
                • (creep_array[creep_A_integer]) Not equal to No unit
                • (creep_array[creep_A_interger] is dead) Equal to True
            • Then - Actions
              • Unit - Create 1 creep_type[creep_A_interger] for Neutral Hostile at creep_point[creep_A_interger] facing creep_real[creep_A_interger] degrees
              • Set VariableSet creep_array[creep_A_interger] = (Last created unit)
              • Special Effect - Create a special effect at creep_point[creep_A_interger] using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
Now it automatically skips Day 1 by checking how many times the trigger has been executed and it will avoid running unwanted functions on the unit if it's null.

Also, it might be wise to use "Elapsed time is 0.00 seconds" in Init instead of "Map initialization", just to be extra safe.
Why don't we just use "equal to no unit"
Adding the "or" is doubling the amount of conditions we check?
 
Top