What is the eventid for TriggerRegisterUnitInRange?

chobibo

Level 1 Crypt Lord
extract the common.j from your warcraft MPQ or you could look at Jass New Gen's function list.
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Try making a Trigger using TriggerRegisterUnitInRange to fire it and then use GetTriggerEventId() in the action?
 

Magoiche

Member
No because my trigger have an initial event to run.
When the first event run. It add another event. In this case TriggerRegisterUnitInRange.
So i have a if. If the eventid = to the TriggerRegisterUnitInRange event id i do something, else i do other things.

JASS:
scope EmoBomb initializer Initial

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A002' or GetTriggerEventId() == EVENT_UNIT_TARGET_IN_RANGE
endfunction

private function KillConditions takes nothing returns boolean
    return IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( GetTriggerUnit() ) ) == true and GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) <= 300
endfunction

private function ExplodeConditions takes nothing returns boolean
    return IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( GetTriggerUnit() ) ) == true and GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) > 0
endfunction

private function Kill takes nothing returns nothing
    call KillUnit( GetEnumUnit() )
endfunction

private function Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local real x
    local real y
    local unit Dummy
    local real Dummyx
    local real Dummyy
    local group UnitsNear
    local integer NOfUnitsNear
    local integer NOfUnitsToExplode = 7 - ( GetUnitAbilityLevel( Caster, 'A002' ) )
    if GetTriggerEventId() == EVENT_UNIT_TARGET_IN_RANGE then
        set UnitsNear = GetUnitsInRangeOfLocMatching( 400, GetUnitLoc( Dummy ) , Condition( function ExplodeConditions ) )
        set NOfUnitsNear = CountUnitsInGroup2( UnitsNear )
            if NOfUnitsNear == NOfUnitsToExplode then
                set Dummyx = GetUnitX( Dummy )
                set Dummyy = GetUnitY( Dummy )
                call KillUnit( Dummy )
                set Dummy = CreateUnit( GetOwningPlayer( Caster ), 'u000', Dummyx, Dummyy, 0 )
                call SetUnitAnimation( Dummy, 'birth' )
                call UnitApplyTimedLife( Dummy, 'BTLF', 5.00 )
                call UnitAddAbility( Dummy, 'A001' )
                call IssueTargetOrder( Dummy, "selfdestruct", Dummy )
                set UnitsNear = GetUnitsInRangeOfLocMatching( 400, GetUnitLoc( Dummy ) , Condition( function KillConditions ) )
                call ForGroup( UnitsNear, function Kill )
            endif
    else
        set Dummy = CreateUnitAtLoc( GetOwningPlayer( Caster ), 'u000', GetSpellTargetLoc(), 0.00 )
        call TriggerRegisterUnitInRange( GetTriggeringTrigger(), Dummy, 400.00, BoolexprTrue )
    endif
endfunction

private function Initial takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
    set trig = null
endfunction

endscope


So i want to know exactly what is the eventid for TriggerRegisterUnitInRange.
 

Magoiche

Member
No, its not it.
It dont work.

The EVENT_UNIT_TARGET_IN_RANGE its for GetEventTargetUnit events.
So says the commom.j
=]
 

Magoiche

Member
Yeah T.T
Maybe there is no eventid for this event(lol?)
So i will have to give up my emo bomb spell.
T.T

Thanks to everyone anyway.
 

Troll-Brain

You can change this now in User CP.
EVENT_UNIT_TARGET_IN_RANGE is the right event, i've tested, put some BJDebugMsg to know what it happens.
 

Magoiche

Member
It do not worked. =/

This is the trigger:
JASS:
scope EmoBomb initializer Initial

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A002' or GetTriggerEventId() == ConvertUnitEvent( 61 )
endfunction

private function KillConditions takes nothing returns boolean
    return GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) <= 300 and IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( GetTriggerUnit() ) ) == true
endfunction

private function ExplodeConditions takes nothing returns boolean
    return GetUnitState( GetFilterUnit(), UNIT_STATE_LIFE ) > 0 and IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( GetTriggerUnit() ) ) == true
endfunction

private function Kill takes nothing returns nothing
    call KillUnit( GetEnumUnit() )
endfunction

private function Actions takes nothing returns nothing
    local unit Caster
    local unit Dummy
    local real Dummyx
    local real Dummyy
    local group UnitsNear
    local integer NOfUnitsToExplode = 2//7 - ( GetUnitAbilityLevel( Caster, 'A002' ) )
    if GetTriggerEventId() == ConvertUnitEvent( 61 ) then
        set UnitsNear = GetUnitsInRangeOfLocMatching( 400, GetUnitLoc( Dummy ) , Condition( function ExplodeConditions ) )
        if CountUnitsInGroup( UnitsNear ) == NOfUnitsToExplode then
            call BJDebugMsg( "Test" )
            set Dummyx = GetUnitX( Dummy )
            set Dummyy = GetUnitY( Dummy )
            call KillUnit( Dummy )
            set Dummy = CreateUnit( GetOwningPlayer( Caster ), 'u001', Dummyx, Dummyy, 0 )
            call SetUnitAnimation( Dummy, "birth" )
            call UnitApplyTimedLife( Dummy, 'BTLF', 10.00 )
            set Dummy = CreateUnit( GetOwningPlayer( Caster ), 'u001', Dummyx, Dummyy, 0 )
            call UnitAddAbility( Dummy, 'A001' )
            call IssueTargetOrder( Dummy, "selfdestruct", Dummy )
            set UnitsNear = GetUnitsInRangeOfLocMatching( 400, GetUnitLoc( Dummy ) , Condition( function KillConditions ) )
            call ForGroup( UnitsNear, function Kill )
        endif
    else
        set Caster = GetTriggerUnit()
        set Dummy = CreateUnitAtLoc( GetOwningPlayer( Caster ), 'u000', GetSpellTargetLoc(), 0.00 )
        call TriggerRegisterUnitInRange( GetTriggeringTrigger(), Dummy, 400.00, BoolexprTrue )
    endif
endfunction

private function Initial takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
    set trig = null
endfunction

endscope


This is the part that don't work:
JASS:
        if CountUnitsInGroup( UnitsNear ) == NOfUnitsToExplode then
            call BJDebugMsg( "Test" )
            set Dummyx = GetUnitX( Dummy )
            set Dummyy = GetUnitY( Dummy )
            call KillUnit( Dummy )
            set Dummy = CreateUnit( GetOwningPlayer( Caster ), 'u001', Dummyx, Dummyy, 0 )
            call SetUnitAnimation( Dummy, "birth" )
            call UnitApplyTimedLife( Dummy, 'BTLF', 10.00 )
            set Dummy = CreateUnit( GetOwningPlayer( Caster ), 'u001', Dummyx, Dummyy, 0 )
            call UnitAddAbility( Dummy, 'A001' )
            call IssueTargetOrder( Dummy, "selfdestruct", Dummy )
            set UnitsNear = GetUnitsInRangeOfLocMatching( 400, GetUnitLoc( Dummy ) , Condition( function KillConditions ) )
            call ForGroup( UnitsNear, function Kill )
        endif


I still can't figure what is the problem.
Everything seens just fine.
 

Troll-Brain

You can change this now in User CP.
if CountUnitsInGroup( UnitsNear ) == NOfUnitsToExplode

I guess there are more or less than 2 units in the group, so the if is false.
And use the constant event to keep the readability of your code.
 

Magoiche

Member
Are you saying that locals only exists in that same trigger run?
I didn't know that. x.x

So i made it a global. And it worked! *-*

Thanks everyone i.i

+rep =]
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • tom_mai78101 tom_mai78101:
    Would like to get some annual forum statistics report.
  • The Helper The Helper:
    there are stats in the xenforo forum admin section and we have matomo stats we started collecting beginning of the year so we will not have annual on that until next year
  • The Helper The Helper:
    I thought you had keys to the bathroom Tom? Ghan does Tom have access to the stats thread in the bathroom
  • The Helper The Helper:
    since I started jacking with the bots on the site we doubled our page views on the site in a week lol
  • The Helper The Helper:
    I have been having lots of fun
  • The Helper The Helper:
    we have had like 6000 views of the American Airlines economy class thread in the last week
  • The Helper The Helper:
    I ought to stick a travel affiliate link or something on that page to try and monetize that they are just going there and leaving it might even be bots I am not sure
  • The Helper The Helper:
    I just got into it with the Atari VCS Facebook Moderator I started trolling him and almost got banned
  • The Helper The Helper:
    They deleted one of my posts one time so I was trolling him on a help post I put up because I am evil I guess and bored and the guy handled it well I loved his attitude Atari has a good social media presence even if they do not have many games.
  • The Helper The Helper:
    The French Atari they call them even though they are like totally based in America they just have French Money coming in. Gotta love it
  • Ghan Ghan:
    Microsoft buying Activision Blizzard holy crap!
  • The Helper The Helper:
    I know right holy cow
  • Accname Accname:
    Thats not going to save it.
  • The Helper The Helper:
    It might
  • The Helper The Helper:
    They are going to use alot of that IP in the Metaverse
  • The Helper The Helper:
    I found a new section of the stats that is freaking interesting!
  • The Helper The Helper:
    oh yeah this is what I was looking for good job matomo! These are some sweet stats I am learning the interface on it too!
  • The Helper The Helper:
    If anyone ever asks later how I found out about it was watching the site bots but not watching what they were doing but asking myself why they were here?
  • The Helper The Helper:
    there must be a reason and ok that is it
  • The Helper The Helper:
    the past and the future all come together into one
  • The Helper The Helper:
    the search engines are what built thehelper.net the search engines will make it big again maybe
  • The Helper The Helper:
    the real question is are 5 million links better than 60 real good links?
  • The Helper The Helper:
    the answer is 60 lol
  • The Helper The Helper:
    unless you put 100k links on it lol then you get something

    Staff online

    Members online

    Affiliates

    Hive Workshop NUON Dome
    Top