Cant cast spell if its to close?

Status
Not open for further replies.
Level 6
Joined
May 20, 2014
Messages
228
  • spell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Banish
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Distance between (Position of (Triggering unit)) and (Position of (Target unit of ability being cast))))) Less than or equal to 300
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
        • Else - Actions
 
Level 3
Joined
Feb 20, 2015
Messages
39
  • spell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Banish
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Distance between (Position of (Triggering unit)) and (Position of (Target unit of ability being cast))))) Less than or equal to 300
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
        • Else - Actions
+ Rep!
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
If you want to do it as a real pro, then catch the event "A unit is issued an order targeting a unit".
Then make a 0 second timer and make the caster stop if necessary.

If you have an order tracking system, you could also make it continue the order that it had before it actually wanted to start casting.

But who the hell cares about perfection :D
The one that Alright showed works too. (Make sure that you will remove the leak though.)
 
Level 6
Joined
May 20, 2014
Messages
228
The condition
  • (Integer((Distance between (Position of (Triggering unit)) and (Position of (Target unit of ability being cast))))) Less than or equal to 300
leaks locations. You should store locations beforehand, refer to them in the condition and then destroy them after the check.

Thanks for the reminder, updated.

  • spell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Banish
    • Actions
      • Set Caster = (Position of (Triggering unit))
      • Set Target = (Position of (Target unit of ability being cast))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Distance between Caster and Target))) Less than or equal to 300
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Caster)
      • Custom script: call RemoveLocation(udg_Target)
Both variables are points.
 
Level 3
Joined
Feb 20, 2015
Messages
39
Thanks for the reminder, updated.

  • spell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Banish
    • Actions
      • Set Caster = (Position of (Triggering unit))
      • Set Target = (Position of (Target unit of ability being cast))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer((Distance between Caster and Target))) Less than or equal to 300
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Caster)
      • Custom script: call RemoveLocation(udg_Target)
Both variables are points.
Everything is fine except the variable part,i know what is variable but I dont really know how to make it work,do the variable name need to be specified?how do i even add something to variable?
 
Level 6
Joined
May 20, 2014
Messages
228
You can press X on the top in trigger editor which allows you to make variables. As I stated, both variables are point variables, which you should be making to determine the positions of both units. I named one Caster and one Target, but you can use something like TempPoint1 and TempPoint2, whichever tickles your fancy.

If you want to set a variable, you need to use an action called Set Variable, which then you add the triggering unit to the caster and the target being targeted by a spell to the target variables. Then use custom scripts to destroy the point leaks after check.
 
Level 3
Joined
Feb 20, 2015
Messages
39
You can press X on the top in trigger editor which allows you to make variables. As I stated, both variables are point variables, which you should be making to determine the positions of both units. I named one Caster and one Target, but you can use something like TempPoint1 and TempPoint2, whichever tickles your fancy.

If you want to set a variable, you need to use an action called Set Variable, which then you add the triggering unit to the caster and the target being targeted by a spell to the target variables. Then use custom scripts to destroy the point leaks after check.
Well explained panda guy:goblin_yeah:!
 
Status
Not open for further replies.
Top