Forcing Unit to cast Spell on target Unit

xAnaMorphine

Active Member
Reaction score
43
Hey,
I want a creep to cast a spell with a random chance when attacked on the unit who is being targeted by the creep.
Imagine 3 units attack the creep. Unit 1 is being attacked by the creep, while firing the trigger it might happen that Unit 2 or 3 attack and Unit 1 has his "attack-cooldown".

So I came up with this (ignore that there are no chances for spells because I only got 1 at the time and that spell should be cast at 100%)

Trigger:
  • Creep Poison
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacked unit)) Equal to Creep
      • (Life of (Attacked unit)) Less than 50
    • Actions
      • Set TEMP_UnitGroup = (Units in Area <gen> matching ((Matching unit) Equal to (Attacking unit)))
      • Unit - Order (Attacked unit) to Night Elf Warden - Shadow Strike (Random unit from TEMP_UnitGroup)
      • Custom script: call DestroyGroup(udg_TEMP_UnitGroup)
 

TomTTT

New Member
Reaction score
44
Well... is there a problem?
The trigger seems fine to me. Thought if there is a problem maybe the creep just dont have the ability, or that he is being attacked with more than 50 hitpoints every hit, so he usually just can't react cause he's dying right away.
 

vypur85

Hibernate
Reaction score
803
> Set TEMP_UnitGroup = (Units in Area <gen> matching ((Matching unit) Equal to (Attacking unit)))

This line seems redundant. You might as well set 'Set TempUnit = (Attacking unit)'.


You probably want this:
Code:
Set TEMP_UnitGroup = (Units in within 600.00 area of (Triggering unit) matching ((Current order of (Matching unit) Equal to Attack)) and (Matching unit) belongs to an enemy of (Triggering unit) Equal to True.....etc
 

xAnaMorphine

Active Member
Reaction score
43
> Set TEMP_UnitGroup = (Units in Area <gen> matching ((Matching unit) Equal to (Attacking unit)))

This line seems redundant. You might as well set 'Set TempUnit = (Attacking unit)'.


You probably want this:
Code:
Set TEMP_UnitGroup = (Units in within 600.00 area of (Triggering unit) matching ((Current order of (Matching unit) Equal to Attack)) and (Matching unit) belongs to an enemy of (Triggering unit) Equal to True.....etc

First of all, thanks for the help.
I have tried that before, the following result is that the creep might jump around through targets, that means if Unit 1 is not attacking at the moment when the creep is able to cast a spell Unit 2 gets hit by the spell while Unit 1 is still focused and attacked by the creep just not by his spell. So I want my System to force the creep to cast everything on the Unit he targets.
 
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