Spell detecting unit nearby within range - Undetect if it dies

Pharaoh_

The epic journey will soon begin... Prepare!
Reaction score
136
Well, i can't make myself clear in a single thread title, so i will explain what i want here.
I have made a spell -well, trying to- that creates a dummy unit at position of Casting unit and then a periodic event runs every 0.03 seconds, moving the dummy unit at the position of casting unit. A countdown timer is also started, to set the actual duration of the effect. If the casting unit is within 1100 range of an enemy hero, then a sound is played, BUT if the enemy hero dies, then the unit starts detecting another hero matching the condition that belongs to an enemy of Owner of Casting unit.​

The problem is that the dummy unit still considers the enemy picked hero as the one to detect and, if another enemy hero comes in range of Casting unit, it doesn't detect it. By detecting i mean this dummy which faces the position of enemy hero. So, i can know whether the dummy still detects the dead hero or another one. How to achieve such an effect? I have made the trigger myself in its biggest part, starting with these:

Code:
Actions
    Countdown Timer - Start TimerEffectDuration as a One-shot timer that will expire in 10.00 seconds
    Set TimerCompassDuration = (Last started timer)
    Set EffectCaster = (Hero manipulating item)
    Set EffectCasterPosition = (Position of EffectCaster)
    Unit Group - Pick every unit in (Random 1 units from (Units within 9000.00 of EffectCasterPosition matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of EffectCaster)) Equal to True)))) and do (Actions)
        Loop - Actions
            Set EffectEnemyUnit = (Picked unit)
            Set EffectEnemyPosition = (Position of CompassEnemyUnit)
            Unit - Create 1 Effectdummy for (Owner of EffectCaster) at EffectCasterPosition facing (Angle from EffectCasterPosition to EffectEnemyPosition) degrees
            Set EffectUnit = (Last created unit)
            Trigger - Turn on Effect1 <gen>

Code:
Events
    Time - Every 0.03 seconds of game time
Conditions
Actions
    Set EffectCasterPosition1 = (Position of EffectCaster)
    Set EffectEnemyPosition1 = (Position of EffectEnemyUnit)
    Unit - Move EffectUnit instantly to EffectCasterPosition1, facing (Angle from EffectCasterPosition1 to EffectEnemyPosition1) degrees

Code:
Events
    Time - TimerEffectDuration expires
Conditions
Actions
    Unit - Kill EffectUnit
    Custom script:   call DestroyTimer (udg_TimerEffectDuration)
    Custom script:   call RemoveLocation (udg_EffectEnemyPosition)
    Custom script:   call RemoveLocation (udg_EffectCasterPosition)
    Custom script:   call RemoveLocation (udg_EffectCasterPosition1)
    Custom script:   call RemoveLocation (udg_EffectEnemyPosition1)

Now, in these triggers i need to set the if the distance from EffectEnemyPosition1 to EffectCasterPosition Less Than or Equal to 1100.00, then Play Sound at EffectCasterPosition, but where to put this? If i put it in the periodic event, it will play the sound every those seconds. Also, i need to detect If EffectEnemyUnit is dead Equal to True, then (what? I need here to start detecting other heroes now, not keeping the dead hero as the target to face...)??
 

Light Alkmst

New Member
Reaction score
20
AFAIK removing the locations might be doing something fishy, as they're globals and reused...

Code:
Unit Group - Pick every unit in (Random 1 units from (Units within 9000.00 of EffectCasterPosition matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of EffectCaster)) Equal to True)))) and do (Actions)

you might want to add if the unit is alive...
 

Jooster

New Member
Reaction score
7
and 9000 is huge...... like very huge

u can also do something like when a unit comes within range of no unit. then in your condition set what you want the triggering unit to be. the triggering unit would be in this case the unit coming into range of the "no unit" or you might be able to run off from unit has buff. and just give off a dummy buff with a dummy aura?
 
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