Detecting a point target ability

Moridin

Snow Leopard
Reaction score
144
Hey. I was wondering if there's any way to detect if an ability cast is a point target ability or not?

For example, you can detect if it's a unit target ability by using the condition:
Code:
(Target unit of ability being cast) Not Equal to No unit
I tried using the Integer condition:
Code:
(Distance between (Position of (Triggering unit)) and (Target point of ability being cast)) Greater than 0
...but that also triggers for an ability that doesn't have a target at all.

------

Another question, would certain passive abilities like critical strike have a unit target on proc?
 

the_ideal

user title
Reaction score
61
Set location_temp to the point of the ability being cast and then create a dummy unit at location_temp. Then check to see if the unit is within 50 of the point. Then remove the unit.

There might be a better way but this should work, and it shouldn't lag.
 

Jedi

New Member
Reaction score
63
If target unit equal to no unit, then it is a point targeted ability.What you want to detect?
 

Moridin

Snow Leopard
Reaction score
144
If target unit equal to no unit, then it is a point targeted ability.What you want to detect?

What about no target abilities? Like Thunderclap or any summon spell.

Set location_temp to the point of the ability being cast and then create a dummy unit at location_temp. Then check to see if the unit is within 50 of the point. Then remove the unit.

There might be a better way but this should work, and it shouldn't lag.
I don't see how this would work because:

What if a unit casts a point target ability at his own position?
What if a unit casts a unit target ability. The call for "Target point of ability being cast" will give the center of the map because there is no target point.
 

Ayanami

칼리
Reaction score
288
Well, you could detect if it's a unit target ability by using:

Trigger:
  • (Target unit of ability being cast) Equal to No unit


Then, if this is true, then it HAS to be a point target spell. Just do a simple If/Then/Else.
 

Bogrim

y hello thar
Reaction score
154
If you're using a spell like Shockwave, you can detect the target unit of ability being cast in addition to the target point. If there is no target unit, it's a point target.
 

Moridin

Snow Leopard
Reaction score
144
Well, you could detect if it's a unit target ability by using:

Trigger:

* (Target unit of ability being cast) Equal to No unit



Then, if this is true, then it HAS to be a point target spell. Just do a simple If/Then/Else.
I don't know if I'm missing something :S. What if I use a spell with no target? Then that condition would return (no unit) just as if I used a point target spell.

Just to clarify, I know how to detect a unit target ability. What I don't know is how to detect a point target ability.

If you're using a spell like Shockwave, you can detect the target unit of ability being cast in addition to the target point. If there is no target unit, it's a point target.
Could you elaborate as to the actions you would use to extract the target point/target unit into a variable?

Can you explain why you need that?
If you look at the resource I submitted Energy Flow, the spell essentially is a meant to be a supplement to other targeted spells. Currently it only works for unit target abilities because that's all I can detect. I need a way to detect if the ability is a point target ability and change all the neccessary variables accordingly.
 

sentrywiz

New Member
Reaction score
25
Do you need this for an ability? Or just a detection system?

Here is what I did now. Tested, works... I'm sure you can tweak it for your needs.

Trigger:
  • Spell Test
    • Events
      • Unit - A unit comes within 999999.00 of Dummy Spell Control <gen>
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Owner of (Entering unit)) controller) Equal to User
    • Actions
      • If (((Playable map area) contains (Target point of ability being cast)) Equal to True) then do (Game - Display to (All players) the text: test) else do (Do nothing)


No point abilities won't count. Unit target abilities won't count. Only point target abilities. I'm sure you understand the trigger :)
 

Bogrim

y hello thar
Reaction score
154
Could you elaborate as to the actions you would use to extract the target point/target unit into a variable?
Very simple:
Trigger:
  • Shockwave Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shockwave
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Target unit of ability being cast) Equal to No unit
        • Then - Actions
          • Game - Display to (All players) the text: point target
        • Else - Actions
          • Game - Display to (All players) the text: unit target

Just set your variable depending on the outcome of the condition.
 

hgkjfhfdsj

Active Member
Reaction score
55
another alternative is to catch the order type on spell cast (begins casting), for example
Trigger:
  • Store Order Type
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: if GetTriggerEventId() == EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER then
      • Set ordertype = target
      • Custom script: elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER then
      • Set ordertype = point
      • Custom script: else
      • Set ordertype = no target
      • Custom script: endif

saving the order type to some unit index then later restoring it on spell effect (starts effect). since units can only be given 1 order at a time, 1D unit index array should work. the saved ordertype will always update itself to the latest order so ordering a unit to stop will not break this. im not sure if this will catch autocast spell (im pretty it does) or passive spells, nor have i fully tested it :p, eg this might break on spells that can target both units and points.

EDIT
not sure if it has been answered, but as for your 2nd question, afaik you cant detect when a passive ability procs so there will not be any event responses (triggering/targeted unit, point etc). most likely you will need to create the passive ability from scratch then fire the event itself, attaching the appropriate unit/location.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top