HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Turning passive abilities into buffs?

04-10-2004, 05:03 PM#1
Pyrus
Is it possible to turn a passive ability, like bash,evasion,etc, into a buff? For example a spell that gives temporary evasion.
04-10-2004, 05:38 PM#2
Redesh
Quote:
Originally Posted by Pyrus
Is it possible to turn a passive ability, like bash,evasion,etc, into a buff? For example a spell that gives temporary evasion.

Yep pretty easy to do. Have a unit with a target ability. And make a trigger that when it targets the unit it adds an ability. Also have a condition where it confirms what the spell is. Sorry I can't give you triggers. I'm far away from Warcraft right now.
04-11-2004, 01:25 AM#3
Redesh
And you'll probably want to have a trigger that get's rid of the buff too. Well create trigger make it where when that (event) trigger has been activated and a condition where however many seconds or minutes you want to. Then have action to remove the ability
04-11-2004, 11:57 AM#4
AIAndy
Doing that check periodically would be far too expensive since you'd have to check all units very regularly. The easiest way is to put the target unit in a local variable, add the ability, wait as many seconds as the duration lasts and then remove it again.
Or alternatively use the duration spell template in my spell classes system. That would be a bit more accurate since it uses timers and not polled waits.
04-11-2004, 01:58 PM#5
AIAndy
There are usually quite a lot of units at the same time on the average map. Checking all these might not decrease performance much if that is the only spell, but now think that you apply that solution to all similar things and you do cause a lot more lag than necessary.
If the buff should be dispellable, then just either check regularly with shorter waits in between and remove it once the buff is no more there or alternatively add the units that the spell got cast on to a global unit group. Then check regularly all the units in that group if they still have the buff and if not then remove the ability and remove them from that group. That is a lot more efficient than checking all units.
04-11-2004, 04:40 PM#6
Pyrus
Thats all good but the problem I have is that "Remove Ability" is flawed as it sometimes doesnt remove added abilities and when removed, the ability can never be added again.
04-12-2004, 09:13 AM#7
AntoninScalia
Note that if you do as they say, the ability will not disappear when the buff is dispelled; it will persist until the duration of the spell expires.

Here's a way to make it act like a real buff:
- Base your spell on a real buff spell, like Inner Fire. Be sure to create a custom buff if you plan to use the real buff as well.
- Catch the spell being cast, and add the ability you want to be a buff.
- Poll if the unit has the buff every so often. If it does not, remove the ability, end the thread, clean up effects, etc. So long as the buff is still there, add your delta to a counter, and sleep for another delta.

Here's an example:
Code:
set elapsed = 0.0
Call AddSomeAbilityToSomeUnit(u, a)
loop
	exitwhen elapsed >= duration
	if not UnitHasBuffBJ(u, buffid) then
		exitwhen true
	endif
	call PolledWait( delta )
	set elapsed = elapsed + delta
endloop
Call RemoveSomeAbilityFromSomeUnit(u, a)

The polling is, of course, expensive.

I can conceieve of another way, but it's way ugly. You create a trigger which fires on a huge list of spells known to have dispel effects, and check the target of said spell against a global group of units effected with a custom buff. You'd also have a timer count the duration of the spell, and remove the ability on expiration.

Personally, I feel this dispel trigger combined with the cleanup trigger is more expensive than the polling operation, provided you keep your delta reasonable (>= 1.0 seconds). This is not to mention how goddamn ugly the dispel trigger would be. Ickick. So ugly.