HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit Within Range Event

08-28-2006, 03:09 AM#1
EveningStar
Is there a way to refer to the reference unit? GetTriggerUnit() refers to the unit that is coming within range with the reference unit.

Of course, I can always use a global or handle variable =\
08-28-2006, 03:34 AM#2
Wyvernoid
Why, you've already USED that unit while registering the event... then why bother referring to it using a function? Just use the variable.

Err.. or if you are registering bunches of events to one trigger? Then just... don't do that ;-P
08-28-2006, 03:41 AM#3
EveningStar
Here's a part of the code:

Collapse JASS:
function oracle_burden_learned_action takes nothing returns nothing
  local trigger t = CreateTrigger()
  local unit c = GetTriggerUnit()
  
  call SetHandleHandle(t, "c", c)
  call TriggerRegisterUnitInRange(t, c, Oracle_Burden_Radius(), Condition(function oracle_burden_cond))
  call TriggerAddAction(t, function oracle_burden_action)
  
  set c = null
  set t = null
endfunction

2nd question about the trigger; why is there a built-in filter within that trigger, and do you refer to entering unit with GetTriggerUnit() within that filter? or GetFilterUnit() ?
08-28-2006, 06:59 AM#4
The)TideHunter(
Can you post the filter function please, i cant know what its for if i dont know what it is.
08-28-2006, 07:21 AM#5
BertTheJasser
There is no way to attach it the unit whose rannge is entered without a workaround.
If it is a filter, why do u use then a
Collapse JASS:
Condition()
?

And yes, you must refer via
Collapse JASS:
GetfilterUnit()
to the entering unit in the filter.
08-28-2006, 07:25 AM#6
EveningStar
Collapse JASS:
function oracle_burden_cond takes nothing returns boolean
  return GetUnitState(GetFilterUnit(), UNIT_STATE_MAX_MANA) > 0  
endfunction

Thanks Bert.
09-01-2006, 02:16 AM#7
PandaMine
I had the same problem, i just handles i.e. AttachObject(trigger, "label",unit) and use GetTriggeringTrigger() to get the trigger thats being fired
This is using Vex's Cache