Order unit to stop attacking and cast a spell instead.

Juggernaut

I don't know what to change it to
Reaction score
33
So I want to create a sniper unit. And whenever it tries to attack
It should stop attacking and cast a spell on the unit.

I try to do this but it doesn't work at all.
I tried it will "aquires a target" but often the Unit does 1 attack and then starts casting the spell.
And sometimes it just keeps attacking without casting the spell (but the spell icon is highlighted as if it is casting it)

The unit does not posses the spell, I want that whenever he is trying to attack, he gets the spell and then casts it to the target.
As I said, sometimes it works sometimes it does not.
Also I created a trigger so If the unit stops the cast then the spell should disappear. Also this trigger sometimes works and sometimes does not.

Can anyone create a basic trigger for this?
I try it with the rifleman - human.
Thank you, I hope someone can help me


EDIT: It would also be really awesome if after the unit successfully casts the spell he should not be able to attack for 4seconds. (reloading and stuff) and then after that the attack gets re-enabled and soon...
 

Xan_Kriegor

I can change this now in User CP.
Reaction score
12
Just doing the basics, I tested this and it worked perfectly fine:
Trigger:
  • Cast Spell
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Archmage
    • Actions
      • Unit - Order (Attacking unit) to Human Archmage - Blizzard (Position of (Attacked unit))
The event A unit Is attacked fires when the animation starts (e.g. when the attacker is starting the attack), not when damage is dealt. As far as not attacking, you could use Unit - Add ability or Add classification or give it a buff, and then in the same trigger make an If/Then/Else to see if it has the <thing> and if it does order it to stop. Giving it a buff would probably be easiest because the other ways require more work to remove the ability/classification after the 4 seconds are up.
 

Juggernaut

I don't know what to change it to
Reaction score
33
Thats what I tried. But if you use attack move. The spell will cast regardless of the cooldown,

This is the triggers. [i used preset units because i was lazy]
The slow is added for the buff. and i used all preset and no leak prevention (dont need it yet) just need the trigger working.

EDIT: I tried other things. But everytime you stop move alitle and use attack ground. The target will cast the spell. I even made a trigger that when the spell is finished the first trigger goes off for 4sec.
Trigger:
  • Unit is attacked
    • Events
    • Unit - A unit Is attacked
    • Conditions
    • (Attacking unit) Equal to Rifleman 0001 &lt;gen&gt;
    • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Rifleman 0001 &lt;gen&gt; has buff DADA ) Equal to True
    • Then - Actions
    • Unit - Order Rifleman 0001 &lt;gen&gt; to Stop
    • Else - Actions
    • Unit - Add Sniper Sho|cffffd700t|r to Rifleman 0001 &lt;gen&gt;
    • Unit - Order Rifleman 0001 &lt;gen&gt; to Human Mountain King - Storm Bolt (Attacked unit)


AND

Trigger:
  • Finishes casting
    • Events
    • Unit - A unit Finishes casting an ability
    • Conditions
    • (Ability being cast) Equal to Sniper Sho|cffffd700t|r
    • (Triggering unit) Equal to Rifleman 0001 &lt;gen&gt;
    • Actions
    • Unit - Create 1 Shade for Player 12 (Brown) at (Center of (Playable map area)) facing Default building facing degrees
    • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
    • Unit - Add Slow to (Last created unit)
    • Unit - Order (Last created unit) to Human Sorceress - Slow Rifleman 0001 &lt;gen&gt;
    • Unit - Remove Sniper Sho|cffffd700t|r from Rifleman 0001 &lt;gen&gt;
 

kingkwong92

Well-Known Member
Reaction score
25
I was just wondering. Could you use an orb effect and make it cast a spell through that?

EDIT!! You can just move the colour tags into the tooltip only so its not on the ability name but shows up in game.
 

nLike

Member
Reaction score
1
Did you try creating a timer once the trigger runs. For example.

A unit attacks for the first time. You do like you did, stop to attack order to cast a spell. After that turn off the trigger and run a timer. Once the timer expires (the timer should last as the cooldown of the spell) you will reactivate the trigger to cast spell.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top