Thread: SpellEvent
View Single Post
Old 04-10-2009, 04:04 PM   #12
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 Vexorian
That's still blizz like stuff. I would wish this used arguments, you know, if you specified what responses you'd like, then arguments would be possible, maybe too hard.
I'm not sure I understand. You mean the functions following the function interface would take the event responses as arguments? That'd be either a very long argument list or you'd need different functions for different types of spells (and a point-or-unit target spell like shockwave would still have a long argument list). I thought you hated long argument lists.

I don't care about speed, it is more about having to remember brand new event response names.
Then how's it being Blizz like a problem? That last example was a Blizzard native with a "." in the middle. It was essentially the same thing, you can even use auto-completion and then add the dot after GetSpell (well, except for the GetSpell.TargetX/Y which wouldn't have a native counterpart). It's as intuitive as it can get.

I actually think it is practical, could use bitflags, well bitflags could be a little slow.

What annoys me the most is thelocation call, the others are in theory not that bad. Also, why store it as location? It could at least be helpful if it converted it to x,y already. It would be nice if you could tell it not to call the location thing.
I don't see why would it annoy you. To get rid of it you need an additional GC call (to get the flag from the spellID in your example) and depending on the map there might be plenty of cases where after that you still need to call GetSpellTargetLoc. So the speed gain from doing it like this is marginal at best and you just said you don't care about speed.

What about something like this:
Collapse JASS:
        set s.targetUnit = GetSpellTargetUnit()
        if s.targetUnit == null then
            set s.targetDest = GetSpellTargetDestructable()
            if s.targetDest == null then
                set s.targetItem = GetSpellTargetItem()
                if s.targetItem == null then
                    set l = GetSpellTargetLoc()
                    set s.targetX = GetLocationX()
                    set s.targetY = GetLocationY()
                    call RemoveLocation(l)
                    set l = null
        else //optional, would also be there for items and destructables but I don't feel like typing it
            set s.targetX = GetUnitX()
            set s.targetY = GetUnitY()
Anitarf is offline   Reply With Quote