Thread: SpellEvent
View Single Post
Old 07-17-2009, 12:57 PM   #40
Procrastination Incarnate

Development Director
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner


Originally Posted by Litany
One suggestion Ani: you really should initialize some of the struct variables to null or 0. If I target, say, an item or destructable with one ability, then that event instance gets recycled by another ability that targets a unit, the unit-targeted ability will still return the previous target item or destructable. This probably won't matter for the ability's registered event--after all, why would someone check the target item of an ability that targets units?--but events registered to id 0, which run for all abilities, might make such checks.
Ouch, that's what I get for maintaining two copies of the script during early development. I definitely fixed this bug before (I even posted about it) but somehow the fix got lost between updates. Will correct this immediately.

It might also be worth initializing TargetX/Y to the caster for abilities that take no target, although in the case of summons they should really be initialized to the summoned unit.
I noticed during my testing that some no-target abilities (like thunder clap) actually do give the caster's coordinates as the target point, while others don't (they return a null location which then translates into coordinates 0,0; I wonder how the new natives in 1.24 work in such situations; I should eventually port this to use them), so maybe this distinction would represent meaningful information to events registered to id 0. That and the problem with summons are the reasons why I didn't bother implementing something like this.
Anitarf is offline   Reply With Quote