Double Respawn

ArmyOfFrogs

New Member
Reaction score
20
I have a respawn trigger set up to pick every unit, put their custom value in an array, as well as their location (InitPos). It seperates them by first setting the custom value (InitInt) for all units outside of dungeons (BanditCave), then once it reaches the end, sets DungeonStart to that value, adds all units in dungeon then sets DungeonEnd to that value.

Then when a unit dies, it starts a Respawn[InitInt], for 90 seconds. Once that expires, it creates a new unit-type equal to (InitInt), at (InitPos). There's 3 conditions for it to pass, value is > than 0, is < dungeon start, and is not in Bandit Cave. Yet occassionally there will be double spawns inside the bandit cave and I cannot find out why o_O

Here's the triggers for normal respawn and the dungeon respawn

Code:
function Trig_Normal_Respawn_Conditions takes nothing returns boolean
    if ( not ( GetOwningPlayer(GetTriggerUnit()) == Player(10) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Normal_Respawn_Func001Func002001 takes nothing returns boolean
    return ( TimerGetRemaining(udg_Respawn[GetUnitUserData(GetTriggerUnit())]) == 0.00 )
endfunction

function Trig_Normal_Respawn_Func001C takes nothing returns boolean
    if ( not ( GetUnitUserData(GetTriggerUnit()) >= 1 ) ) then
        return false
    endif
    if ( not ( GetUnitUserData(GetTriggerUnit()) < udg_DungeonStart ) ) then
        return false
    endif
    if ( not ( RectContainsUnit(gg_rct_BanditCave, GetTriggerUnit()) == false ) ) then
        return false
    endif
    return true
endfunction

function Trig_Normal_Respawn_Actions takes nothing returns nothing
    if ( Trig_Normal_Respawn_Func001C() ) then
        call StartTimerBJ( udg_Respawn[GetUnitUserData(GetTriggerUnit())], false, 90.00 )
        loop
            exitwhen ( Trig_Normal_Respawn_Func001Func002001() )
            call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 1))
        endloop
        call CreateNUnitsAtLoc( 1, GetUnitTypeId(GetTriggerUnit()), Player(10), udg_InitPos[GetUnitUserData(GetTriggerUnit())], bj_UNIT_FACING )
        call SetUnitUserData( GetLastCreatedUnit(), GetUnitUserData(GetTriggerUnit()) )
    else
    endif
endfunction

//===========================================================================
function InitTrig_Normal_Respawn takes nothing returns nothing
    set gg_trg_Normal_Respawn = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Normal_Respawn, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Normal_Respawn, Condition( function Trig_Normal_Respawn_Conditions ) )
    call TriggerAddAction( gg_trg_Normal_Respawn, function Trig_Normal_Respawn_Actions )
endfunction

Code:
function Trig_Dungeon_Respawn_Func002C takes nothing returns boolean
    if ( ( GetUnitTypeId(GetTriggerUnit()) == 'H00B' ) ) then
        return true
    endif
    return false
endfunction

function Trig_Dungeon_Respawn_Conditions takes nothing returns boolean
    if ( not Trig_Dungeon_Respawn_Func002C() ) then
        return false
    endif
    return true
endfunction

function Trig_Dungeon_Respawn_Actions takes nothing returns nothing
    set bj_forLoopAIndex = udg_DungeonStart
    set bj_forLoopAIndexEnd = ( udg_DungeonEnd - 1 )
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call TriggerSleepAction( 2 )
        call CreateNUnitsAtLoc( 1, udg_InitType[GetForLoopIndexA()], Player(10), udg_InitPos[GetForLoopIndexA()], bj_UNIT_FACING )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Dungeon_Respawn takes nothing returns nothing
    set gg_trg_Dungeon_Respawn = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Dungeon_Respawn, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Dungeon_Respawn, Condition( function Trig_Dungeon_Respawn_Conditions ) )
    call TriggerAddAction( gg_trg_Dungeon_Respawn, function Trig_Dungeon_Respawn_Actions )
endfunction

Thanks, any help is greatly appreciated.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Before anything, put that code in
JASS:
 tags instead of 
	
	


<div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code">
	<div class="bbCodeBlock-title">
		Code:
	</div>
	<div class="bbCodeBlock-content" dir="ltr">
		<pre class="bbCodeCode" dir="ltr" data-xf-init="code-block" data-lang=""><code>... Looks much better :D
And as whelp_ said, it&#039;s just cinverted GUI... Why not just use GUI then ??? S:</code></pre>
	</div>
</div>
 

ArmyOfFrogs

New Member
Reaction score
20
Because I was learning jass and converting some of my triggers.. accidentally clicked this one too :[ But I found it out anyways :)
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top