HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Dispelling Abilities and A Slew of Other Things

05-15-2009, 12:00 AM#1
Forerunner
As the title implies, this is just a slew of things my noob GUI skills are not able to figure out, and so I come to you, the gods of Triggers. I bask in your glory.

1. The first issue I have is with a couple of Triggered Spells I have that work fine, I have no way of dispelling them. The Spell and Buff associated with the Triggered spell would be dispelled fine, but the meat of the spell is the addition of other spells onto the unit to do things such as rapid health loss and healing my nearby units (that's one example of one of my un-dispellable spells). Let me show you the code first, so you can see the mess that you're up against.
Hidden information:
Hidden information:

Trigger:
Events
Unit - A unit Is attacked
Conditions
(Unit-type of (Attacking unit)) Equal to Fel Seeker
Actions
Set Consumption[1] = (Mana of (Attacked unit))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Consumption[1] Less than 25.00
Collapse Then - Actions
Set Consumption[2] = (Mana of (Attacked unit))
Collapse Else - Actions
Set Consumption[2] = 25.00
Unit - Set mana of (Attacked unit) to (Consumption[1] - Consumption[2])
Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) + Consumption[2])
Reals don't leak, correct?
Hidden information:

Trigger:
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Bloodlust
Actions
Custom script: local unit udg_Bloodlust
Set Bloodlust = (Target unit of ability being cast)
Unit - Add Bloodlustheal to Bloodlust
Wait 60.00 seconds
Unit - Remove Bloodlustheal from Bloodlust
Hidden information:

Trigger:
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Surge
Actions
Set Surge[1] = (Max mana of (Target unit of ability being cast))
Set Surge[2] = (Mana of (Target unit of ability being cast))
Set Surge[3] = (Mana of (Triggering unit))
Set Surge[4] = (Surge[1] - Surge[2])
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Surge[3] Greater than or equal to Surge[4]
Collapse Then - Actions
Unit - Set mana of (Target unit of ability being cast) to Surge[1]
Set Surge[5] = (Surge[3] - Surge[4])
Unit - Set mana of (Triggering unit) to Surge[5]
Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) - (Surge[4] / 2.00))
Collapse Else - Actions
Unit - Set mana of (Target unit of ability being cast) to (Surge[2] + Surge[3])
Unit - Set mana of (Triggering unit) to 0.00
Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) - (Surge[3] / 2.00))
Special Effect - Create a special effect attached to the origin of (Target unit of ability being cast) using Abilities\Spells\Other\Doom\DoomDeath.mdl
Special Effect - Destroy (Last created special effect)


So as you can see, I've got these abilities that are adding stat modifiers (or whatever you want to call them) and then they only come off after the timer. I was hoping for someway to detect when a dispel was cast, and then check if the unit (Priests AoE dispel doesn't target a certain unit...) had a certain buff before it being dispelled and then I could remove abilities from said unit as needed, but that's only in my perfect world.

2. Localizing Unit Groups?
My custom script is typed out as follows, but can't localize a unit group.
Hidden information:
Trigger:
Custom script: local unit group udg_Bloodlust


3. Renewing Triggered Abilities. I have no idea how to even start to explain without showing you the code.
Hidden information:
Trigger:
Events
Unit - A unit Dies
Conditions
(Unit-type of (Killing unit)) Equal to Ravager
Actions
Custom script: local unit group udg_Bloodlust
Unit Group - Pick every unit in (Units within 500.00 of (Position of (Killing unit))) and do (If ((Owner of (Picked unit)) Equal to (Owner of (Killing unit))) then do (Unit Group - Add (Picked unit) to WarCry) else do (Do nothing))
Special Effect - Create a special effect attached to the overhead of (Killing unit) using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
Set SFX = (Last created special effect)
Collapse Unit Group - Pick every unit in WarCry and do (Actions)
Collapse Loop - Actions
Set Point = (Position of (Picked unit))
Unit - Create 1 Dummty for (Owner of (Killing unit)) at Point facing Default building facing degrees
Set WarCryCaster = (Last created unit)
Unit - Add War Cry (Spell Ravager) to WarCryCaster
Unit - Add a 5.00 second Generic expiration timer to WarCryCaster
Unit - Order WarCryCaster to Human Priest - Inner Fire (Picked unit)
Unit - Add War Cry (Ravager Speed Bonus) to (Picked unit)
Wait 15.00 seconds
Collapse Unit Group - Pick every unit in WarCry and do (Actions)
Collapse Loop - Actions
Unit - Remove War Cry (Ravager Speed Bonus) from (Picked unit)
Custom script: call RemoveLocation( udg_Point )
Custom script: call DestroyGroup( udg_WarCry )
Special Effect - Destroy SFX


So you can see here that whenever a Ravager kills something, all his nearby friends will get an attack speed increase for 15 seconds, works fine at the minute. What I'm hoping is somehow possible is to be able to renew the timer on it for the group of units. So...

Ravager 1 kills a unit; he and Ravagers 3 and 4 get the buff.
Ravager 3 and 4 go off on their own and kill a unit. They SHOULD be able to refresh their attack speed buff for another 15 seconds, but it will still end the same time as Ravagers 1 and 2.

So you see what I am saying hopefully (if you want, I can try to explain it again), and now I have to ask you if there is any way to do this?

4. Leaks. I don't believe I missed any, but did you notice any?

And that's my mass of trigger questions. I appreciate any wisdom that could be added to my coding.
05-15-2009, 11:38 PM#2
Anitarf
Quote:
Originally Posted by Forerunner
2. Localizing Unit Groups?
My custom script is typed out as follows, but can't localize a unit group.
It's just group, not unit group.

Quote:
3. Renewing Triggered Abilities. I have no idea how to even start to explain without showing you the code.
I really really suggest you don't try to do this with GUI triggers, because it's only possible to do in theory, not in practice. Even in vJass we have to write long systems to handle triggered buff spells if we want to do them right.

Quote:
4. Leaks. I don't believe I missed any, but did you notice any?
I see a couple. Can't be helped, though, you're using GUI.