What is the eventid for TriggerRegisterUnitInRange?

chobibo

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

Gwypaas

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

Magoiche

Member
Reaction score
20
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
Reaction score
20
No, its not it.
It dont work.

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

Magoiche

Member
Reaction score
20
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.
Reaction score
85
EVENT_UNIT_TARGET_IN_RANGE is the right event, i've tested, put some BJDebugMsg to know what it happens.
 

Magoiche

Member
Reaction score
20
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.
Reaction score
85
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
Reaction score
20
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 =]
 

Magoiche

Member
Reaction score
20
Yeah... i.i

So... What i have to do? If its not a global i don't know how to make it work.
You know how? x.x
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      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