• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] How to refer to the TriggerRegisterUnitInRange event's unit?

Status
Not open for further replies.
Level 17
Joined
Apr 13, 2008
Messages
1,597
Okay, thank you. (I have given out too much reputation in the last 24 hours)

Okay, updatetime:
I miserably failed doing the "use the event's unit in the actions" part. I don't know how to do this. Would someone please help me out with a short example code or hints?
 
Last edited by a moderator:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
To use that event properly, you need to attach the unit to the actual trigger. You can eithor use some advanced array system to do this (probably with JNGP). Or for you normal WE users, use handlevars or other such handles used with game cache systems.

If you really are desparate you can even use a O(n) methond where you loop though all instances of a spell, or trigger stored in an array system which although not recomended, is easy to use allows spells to keep full MUI.

Also double post rule is 48 hours between posts.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Ex, using Handle Vars (configure to your own method).

JASS:
function Actions takes nothing returns nothing
    local unit u = GetHandleUnit(GetTriggeringTrigger(),"subject") //the unit you wanted
    //etc
endfunction

function InitTrig_Something takes nothing returns nothing
    set gg_trg_Something = CreateTrigger()
    call TriggerRegisterUnitInRange(gg_trg_Something,someone,filter)
    call TriggerAddActions(gg_trg_Something,function Actions)
    call SetHandleHandle(gg_trg_Something,"subject",someone)
endfunction
 
Status
Not open for further replies.
Top