[Solved] Unit Entering Range of Unit

Status
Not open for further replies.
Level 12
Joined
Feb 11, 2008
Messages
809
Can someone please help me to understand this function;

JASS:
function TriggerRegisterEnterRectSimple takes trigger trig, rect r returns event
    local region rectRegion = CreateRegion()
    call RegionAddRect(rectRegion, r)
    return TriggerRegisterEnterRegion(trig, rectRegion, null)

in terms of using a trigger such as this;

  • Player Revive
    • Events
      • Unit - A unit comes within 70.00 of Circle of Power 0073 <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Not equal to (!=) Dogs
    • Actions
      • Set Temp_Unit = (Entering unit)
      • Set Temp_Player = (Owner of Temp_Unit)
      • Set Temp_Integer = (Player number of Temp_Player)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of Temp_Unit) Equal to (==) |CFF008C9CKitty|r
            • Temp_Player Not equal to (!=) (Owner of Players_Graves[Temp_Integer])
          • Then - Actions
            • Hero - Add 50 experience to Temp_Unit, Show level-up graphics
            • Hero - Instantly revive Players_Heros[1] at (Player 1 (Red) start location), Show revival graphics
            • Unit - Move Players_Graves[1] instantly to (Center of PlayersGraves <gen>)
            • Camera - Pan camera for Player 1 (Red) to (Player 1 (Red) start location) over 1.00 seconds
          • Else - Actions
What i am needing to do is return the unit whos area is being entered not the unit thats entering and i dont understand how to do that?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Unit - A unit comes within 70.00 of Circle of Power 0073 <gen>
In response to this there is no direct way to get the unit who's range was edited, only the unit who entered the range.

An indirect way is to use a hashtable to map the unit to the trigger. One can then get the unit from the triggering trigger. The limit to this is only 1 such event per trigger so many triggers may be nescescary.
 
Level 12
Joined
Feb 11, 2008
Messages
809
In response to this there is no direct way to get the unit who's range was edited, only the unit who entered the range.

An indirect way is to use a hashtable to map the unit to the trigger. One can then get the unit from the triggering trigger. The limit to this is only 1 such event per trigger so many triggers may be nescescary.

Ok thanks for the explanation and im actually having issues regarding the looping trigger but its ugly the way it is rn cant figure out how to get it to work.

  • Kill Runner
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in EnemyUnitGroup and do (Actions)
        • Loop - Actions
          • Player Group - Pick every player in CurrentOnlinePlayers and do (Actions)
            • Loop - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Is Players_Heros[(Player number of (Picked player))] near (Position of (Picked unit)) and within a range of 70.00) Equal to (==) True
                • Then - Actions
                  • Unit - Kill Players_Heros[(Player number of (Picked player))]
                • Else - Actions
 
Level 12
Joined
Feb 11, 2008
Messages
809
Thanks everyone for the replies and ive never played with a system such as this before so im lacking on how to go about doing it ive read the link TriggerRegisterUnitInRange and am slowly starting to understand it im just much more of a GUI user and am slowly trying to learn some JASS/vJASS

EDIT*

Yea not having much luck with the link so far still trying it could anyone post a GUI example of how to enum the units in range of my heros?

EDIT**

Also do you think instead of going through all this is there an easier workaround such as "unit gains buff" and have the enemy units have "said buff" with AOE such as an aura??
 
Last edited:
Status
Not open for further replies.
Top