• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Get your art tools and paintbrushes ready and enter Hive's 34th Texturing Contest: Void! Click here to enter!

GetSpellTargetUnit() malfunction in trigger chains

Status
Not open for further replies.
Level 19
Joined
Dec 12, 2010
Messages
2,074
We have common trigger for SPELL_EFFECT, which looks up for any spell and related events.
JASS:
if GetSpellAbilityId()=='AbiA' then

endif
call BJDebugMsg("Spell casted, caster = "+GetUnitName(GetTriggerUnit())+"; target = "+GetUnitName(GetSpellTargetUnit()))

Lets say we use custom spell A. On cast, it created a dummy who orders spell B onto the target.

JASS:
call IssueTargetOrder(dummy,"slow",GetSpellTargetUnit())

Guess what will we see in the end?

I didn't run THIS exact test, but recovering it from my tests on doto:

JASS:
Spell casted, caster = Dummy, target = MyTarget
Spell casted, caster = MyCaster, target =

GetSpellTargetUnit lose it's value once other spell event fires. Unlike (at least I didn't notice any other natives to do so) any other, who keep it's value until the trigger's end, like cached.

That's definitely a bug?
 
That's good to know.
There are some working correctly like GetTriggerUnit(), and some can be overwritten by other triggers like a global variable, and some can't be used after wait.
It seems that this one is one of these that dont work correctly-- here is also an almost filled list with infos about responses. http://www.hiveworkshop.com/threads/event-response-myths.253665/#post2543973
 
Status
Not open for further replies.
Top