• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Position Comparison

Status
Not open for further replies.
Level 27
Joined
Dec 3, 2018
Messages
896
I want to make a Paladin automated. The biggest problem I ran into is the Holy Light. I want to make that if the paladin is close to the attacked low HP unit, he will heal the unit.
Pls show me the position comparison trigger.(If paladin is close enough to cast the spell and the unit is under 20% hp) Thanks!!!
 
Level 6
Joined
Dec 31, 2017
Messages
138
  • Events
    • Generic unit event - A unit is attacked
  • Conditions
    • Real comparison - Health percentage of (Event Response - Attacked unit) is less or equal to 20
  • Actions
    • Set TempPoint1 = Position of Paladin
    • Set TempPoint2 = Position of (Attacked unit)
    • If (Real comparison - Distanse between TempPoint1 and TempPoint2 is less than 600) Order Paladin to Human Paladin - Holy Light (Attacked unit) else Do nothing
    • Custom script: call RemoveLocation(udg_TempPoint1)
    • Custom script: call RemoveLocation(udg_TempPoint2)
 
Then you'll have to pick every unit around the attacked unit and check if picked unit is equal to a Paladin. Then I'll pick a random unit from that unit group and heal the attacked unit. In fact I do this in one of my own triggers:
  • Druid of the Claw Rejuvenation
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) has buff Rejuvenation) Equal to False
      • (Percentage life of (Triggering unit)) Less than or equal to 20.00
    • Actions
      • Set VariableSet Point = (Position of (Triggering unit))
      • Set VariableSet UnitGroup = (Units within 400.00 of Point matching (((Unit-type of (Matching unit)) Equal to Druid of the Claw (Night Elf Form)) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit)).) Equal to False)).)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in UnitGroup) Greater than 0
        • Then - Actions
          • Set VariableSet Unit = (Random unit from UnitGroup)
          • Unit - Order Unit to Night Elf Druid Of The Claw - Rejuvenation (Triggering unit)
        • Else - Actions
      • Custom script: RemoveLocation(udg_Point)
      • Custom script: DestroyGroup(udg_UnitGroup)
In your case you'd want to replace the Druid with the Paladin and Rejuvenation with Holy Light.
(I just added the 20% health condition to match your case)

NOTE: be aware that I use Lua in my custom scripts, so if you're on JASS need to replace those with this:
  • Custom script: call RemoveLocation(udg_Point)
  • Custom script: call DestroyGroup(udg_UnitGroup)
 
Last edited:

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
Why not use a loop instead? surely a paladin should heal any unit when found, not just when attacking.

every 0.03 seconds
pick all units of type paladin
set p = picked unit
pick all units within 400 of p
if % health of picked unit is lower than 20%
order p to cast holy light on picked unit

Would also need to check if found unit is an ally and so on, but this is the short version
 
Level 27
Joined
Dec 3, 2018
Messages
896
Custom script: RemoveLocation(udg_Point)
Custom script: DestroyGroup(udg_UnitGroup)



[/trigger]

In your case you'd want to replace the Druid with the Paladin and Rejuvenation with Holy Light.
(I just added the 20% health condition to match your case)

NOTE: be aware that I use Lua in my custom scripts, so if you're on JASS need to replace those with this:
  • Custom script: call RemoveLocation(udg_Point)
  • Custom script: call DestroyGroup(udg_UnitGroup)
[/QUOTE]

The last 2 lines must include the variables, right?
 
Status
Not open for further replies.
Top