Respawn trigger not working properly?

Corleone

New Member
Reaction score
44
I've finished my spell for the spell contest ages ago, but when I tried to make a trigger that would make the mobs res after 45 seconds, it won't exactly work. I can't seem to figure out what's wrong.

Code:
function Trig_Unit_Death_Type takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) != GetUnitTypeId(udg_Blademaster)
endfunction

function Trig_Unit_Death_MUI_Actions takes nothing returns nothing
    local location DyingPosition
    local unit DeadUnit
    if ( Trig_Unit_Death_Type() ) then
        set DeadUnit = GetTriggerUnit()
        set DyingPosition = GetUnitLoc(DeadUnit)
        call TriggerSleepAction( 45.00 )
        call CreateNUnitsAtLoc( 1, GetUnitTypeId(DeadUnit), GetOwningPlayer(DeadUnit), DyingPosition, GetRandomDirectionDeg() )
        set DeadUnit = null
        call RemoveLocation ( DyingPosition )
    else
        set DeadUnit = udg_Blademaster
        set DyingPosition = GetRectCenter(GetPlayableMapRect())
        call ReviveHeroLoc( DeadUnit, DyingPosition, true )
        call RemoveLocation ( DyingPosition )
        set DeadUnit = null
    endif
endfunction

//===========================================================================
function InitTrig_Unit_Death_MUI takes nothing returns nothing
    set gg_trg_Unit_Death_MUI = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Unit_Death_MUI, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Unit_Death_MUI, function Trig_Unit_Death_MUI_Actions )
endfunction

The condition works, because it will res the Blademaster. However, it won't go past the 45 second wait. Any idea why?
 

emjlr3

Change can be a good thing
Reaction score
395
what is the problem, looks like it should work from where im sitting

btw ur loc is not nulled

anywho, GetTriggerUnit() in taht function my not work, duno

i reccomend

set bj_ghoul[55] = GetTriggerUnit() , and use that in ur condition function
 

Corleone

New Member
Reaction score
44
what is the problem, looks like it should work from where im sitting

btw ur loc is not nulled

anywho, GetTriggerUnit() in taht function my not work, duno

i reccomend

set bj_ghoul[55] = GetTriggerUnit() , and use that in ur condition function

Well, AceHart couldn't find any problems either, but it still wouldn't work. Triggering Unit works great in GUI, so why exactly wouldn't it work here? Also, could you explain what the bj_ghoul[55] is?
 

SFilip

Gone but not forgotten
Reaction score
633
> what the bj_ghoul[55] is?
An unused global unit variable.
Actually the first couple of indexes are used somewhere at map init I think, but the rest isn't so you can always use it as a temporary variable if you need one.
 

Corleone

New Member
Reaction score
44
> what the bj_ghoul[55] is?
An unused global unit variable.
Actually the first couple of indexes are used somewhere at map init I think, but the rest isn't so you can always use it as a temporary variable if you need one.

Global variable? Wouldn't that mean that it'll only res one unit, because it's not MUI any more?
 

emjlr3

Change can be a good thing
Reaction score
395
the boolexpr would be instant, so it would be done right after u set it, and rdy for another death event
the bj_ghoul is just to trasnfer ur unit to and from another function
 

Corleone

New Member
Reaction score
44
set bj_ghoul[55] = GetTriggerUnit() , and use that in ur condition function

Right, I set the "bj_ghoul[55] = GetTriggeringUnit()" at the start of the condition function, and replaced the "GetUnitTypeId(GetTriggeringUnit())" with "GetUnitTypeId(bj_ghoul[55])" and it made WE crash. I'm guessing I changed something I shouldn't have changed, or pasted the bj_ghoul[55] at the wrong place. Care to show me how it's done right? ( In the trigger I posted, preferably )

EDIT: I also pasted it in the Actions function, of course, but then it 'expected a name' at the GetUnitTypeId(bj_ghoul[55]) and gave me several errors like "expected endif" at a comment line..
 

emjlr3

Change can be a good thing
Reaction score
395
y don't u post your most recent trigger

on second thought, try this

Code:
globals
    trigger gg_trg_Unit_Death_MUI
    unit udg_Blademaster
endglobals



function Trig_Unit_Death_MUI_Actions takes nothing returns nothing    
    local unit DeadUnit = GetTriggerUnit()
    local real x
    local real y
    
    if GetUnitTypeId(DeadUnit) != GetUnitTypeId(udg_Blademaster) then
        set x = GetUnitX(DeadUnit)
        set y = GetUnitY(DeadUnit)
        call PolledWait(45.)
        call CreateUnit(GetOwningPlayer(DeadUnit),GetUnitTypeId(DeadUnit),x,y,GetRandomReal(0,360))
    else
        call ReviveHero(DeadUnit,GetRectCenterX(bj_mapInitialPlayableArea),GetRectCenterY(bj_mapInitialPlayableArea),true)
    endif
    
    set DeadUnit = null
endfunction

//===========================================================================
function InitTrig_Unit_Death_MUI takes nothing returns nothing
    set gg_trg_Unit_Death_MUI = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Unit_Death_MUI, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Unit_Death_MUI, function Trig_Unit_Death_MUI_Actions )
endfunction

much easier then your, no?

note my changes and make sure you understand it all, before you go blindly pasting it into your map

btw, i am assuming all creeps are owned by the same person

so just putting in the player would be better then GetOwningPlayer
 
L

leetslay

Guest
it's not "GetTriggeringUnit()" in JASS, it's "GetTriggerUnit()"
I assume that's what caused your WE to crash.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top