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
396
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
634
> 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
396
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
396
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.
  • jonas jonas:
    Oh, I see. I thought Chinese version of A-levels :D
  • jonas jonas:
    I've been using the translate app a lot on my phone. take a photo, translate. take another photo, translate again :D
  • jonas jonas:
    it also has voice translation, my colleagues sometimes use that
  • jonas jonas:
    You came during the 0 covid policy right? How'd you get through quarantine? Did you have some help with the apps and green codes?
  • tom_mai78101 tom_mai78101:
    If you have any Chinese you need help with, let me know.
    +1
  • vypur85 vypur85:
    @jonas Those were the things I did too. Translate app and VPN are always the most important things to have to survive. Lol.
  • vypur85 vypur85:
    Yea I came last year. I was quarantined for about 30 days. Fml. The first day of my quarantine was the eve of Chinese new year last year. Fml again... Lol.
  • vypur85 vypur85:
    @tom_mai78101 IIRC you're from Taiwan right.
  • The Helper The Helper:
    I thought China had cracked down on having any foreign teachers?
  • vypur85 vypur85:
    Yeah I've heard of the news before. My school is still actively hiring foreign teachers. Not sure how things work now.
  • The Helper The Helper:
    yeah it is hard to get reliable information about that kind of stuff
  • The Helper The Helper:
    but you are doing it so it is still doable
  • vypur85 vypur85:
    I think it doesn't affect existing foreign teachers. Then again, its still weird that my school is hiring.
  • The Helper The Helper:
    Happy Monday people hope everyone has a fantastic week!
  • Ghan Ghan:
    Happy Monday?! That's a contradiction.
  • jonas jonas:
  • jonas jonas:
    please put this in the news section, it's crazy
  • tom_mai78101 tom_mai78101:
    Technically, you can post in the Headline News. Just posted your news there.
  • tom_mai78101 tom_mai78101:
    I'm not aware of you not being able to post news.
  • jonas jonas:
    I think technically I can I just forget how
    +1
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    Happy Friday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday night!
    +1
  • vypur85 vypur85:
    Happy Sunday. Sigh. Work day tomorrow.
    +1

    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