• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Works first time, but after..

Status
Not open for further replies.
Level 2
Joined
Aug 22, 2009
Messages
19
Cant quite figure why is this happening, the spell is simple, but trigger only works the first time, and every other attempt.. nada.

  • Devouring Shadow Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Devouring Shadow
    • Actions
      • Set SP_Hero = (Triggering unit)
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of SP_Hero)) Equal to True))) and do (Actions)
        • Loop - Actions
          • Item - Create Wand of Illusion at (Center of Item <gen>)
          • Set DS_Item = (Last created item)
          • Unit - Create 1 Dummy Caster for (Owner of SP_Hero) at (Position of (Picked unit)) facing (Position of SP_Hero)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Hero - Give DS_Item to (Last created unit)
          • Hero - Order (Last created unit) to use DS_Item on SP_Hero
Devouring Shadow is No Target spell
Wand of Illusion is the unmoded item from Warcraft

Anyway, this is a part of a trigger attempting to replicate the Haunt ability (ultimate ability of Spectre in DotA series)

Any help, opinion or suggestion is appreciated ;) Thank you for your time
 
Level 4
Joined
Oct 9, 2009
Messages
50
So it's been a while since I played DotA, but Spectre was the one who made illusions who would attack every enemy hero on the map, right?

Aside from leaking, there are a few things wrong.

-Wand of Illusion can only be used by Heroes. Is the Dummy a Hero?
-Wand of Illusion has a short range, and the illusion is spawned next to the the unit which you are casting the Illusion of, not the unit using the item.

I don't know if the DotA one uses a Wand of Illusion. It may be based on the actual Mirror Image spell.

I'm not sure why it works the first time (given range and everything) and then breaks, unless there is a range factor that changes between first and second attempts.

If you really didn't modify the Wand of Illusion, this is how that trigger would play out:

You cast ability.
Trigger makes dummies near all enemy heroes, and gives them an item.
They then attempt to use the item on your triggering hero.
If your Hero is in range, they cast it, you get an Illusion (probably near your Hero).
If your Hero is out of range, and the dummy cannot move, it sits idle for 2 seconds and expires.
If your Hero is in out of range, and the dummy can move, it then tries to reach the location of your Hero and use the Wand upon it.

When it works the first time, does it work exactly as you want? How many enemy Heroes are there? And how close/far away are they?
 
Level 5
Joined
Nov 30, 2010
Messages
184
This should be simple
When spell is used, create a unit that looks like your hero, add a expiration timer to it and instantly move it to enemy heroes and order them to attack the enemy hero.
 
Level 2
Joined
Aug 22, 2009
Messages
19
I just redid whole spell on new map so i could post it and it worked fine all the time, so i redid it on original map and it also works fine..
Dont know what problem was tho, but anyway thx for helping me out ;)
 
Level 5
Joined
Nov 30, 2010
Messages
184
What's there for you to lol so badly about. What's wrong with my comment. I'm just suggesting to tugvar that he can use the method I stated to simplify the trigger and get rid of the problem...

I didn't like what you posted
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
Set group = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to
True) and (((Matching unit) belongs to an enemy of (Owner of SP_Hero)) Equal to True)))
Then Pick every group in blah..

Else you'll create a leak.. unless if you want to keep the dynamic group, do a Custom script: set bj_wantDestroyGroup = true before your pick action.

Also, there's no need to store Triggering Unit as the spell's cast instantly and furthermore, Triggering Unit is the only paramenter which can be used over time.
This also partly applies for 'Last created item' - spell's cast instantly therefore no need for a var. Also, you will have lots of location leaks for this spell.
Do 'set temppoint = Pos. of Triggering Unit'
Create 1 unit at temppoint..
Custom script: call RemoveLocation(udg_temppoint)

Do the same for (Center of Item <gen>).
Set temppoint2 = Center of Item <gen> and create the item at temppoint2.

Alternatively, you can create the item at temppoint to avoid the usage of a region and save a line of triggering.

  • Devouring Shadow Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Devouring Shadow
    • Actions
      • Set group = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Triggering Unit)) Equal to True)))
      • Unit Group - Pick every unit in group and do (Actions)
        • Loop - Actions
          • Set temppoint1 = (Center of Item <gen>)
          • Set temppoint2 = (Position of (Picked unit))
          • Item - Create Wand of Illusion at temppoint
          • Unit - Create 1 Dummy Caster for (Owner of Triggering Unit) at temppoint2 facing (temppoint1)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Hero - Give (Last created item) to (Last created unit)
          • Hero - Order (Last created unit) to use DS_Item on Triggering Unit
          • Custom script: call RemoveLocation(udg_temppoint1)
          • Custom script: call RemoveLocation(udg_temppoint2)
        • Custom script: call DestroyGroup(udg_group)
Actual trigger might vary a bit, I did this without we ^.^
 
Status
Not open for further replies.
Top