HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Abilities that target dead units

12-27-2006, 06:17 AM#1
Moss
Are there any abilities that can target dead units at a specific location? All the ones I know of just automatically pick a dead unit nearby. I want to have an ability that the player has to select a location for to explode the corpse at that location and if there aren't any corpses there it will say you must target a corpse.

I suspect I will have to just trigger a simulated error message.
12-27-2006, 07:41 AM#2
Pyrogasm
Make a dummy hero ability based off of silence or flare that you would use to target the area where you would want to have the ability take place, then either use single-target dummy abilities or (if you're making a corpse explosion spell) trigger the rest.

The trigger would look something like this:
Trigger:
Collapse Events
Unit - A unit starts the effect of an ability
Collapse Condtions
Ability being cast equal to (Corpse Explosion)
Collapse Actions
Custom Script: local group udg_Explode_Group
Set Temp_Point equal to (Target point of (Ability being cast))
Set Explode_Group equal to units within <AoE of dummy hero ability divided by 2> of Temp_Point matching ((Matching unit is dead) equal to true)
Custom Script: call RemoveLocation( udg_Temp_Point )
Collapse If (All conditions are true) then do (Actions), else do (Actions)
Collapse If - Conditions
Unit group - number of units in Explode_Group greater than 0
Collapse Then - Actions
Set Explode_Unit equal to (Random unit from (Explode_Group))
Set Temp_Point equal to (Unit - Position of (Explode_Unit))
Create a Special Effect at Temp_Point using <whatever your file path is>
Unit - Remove Explode_Unit from the game
Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius <AoE of dummy hero ability divided by 2> at Temp_Point, dealing <damage amount> damage of attack type Spells and damage type Normal
Custom Script: call RemoveLocation( udg_Temp_Point )
Collapse Else - Actions
Unit - Pause (Triggering Unit)
Unit - Order (Triggring Unit) to Stop
Unit - Unpause (Triggering Unit)
Custom Script: call DisplayTimedTextToPlayer(GetOwningPlayer(GetTriggerUnit()), 1.00, 0, 3.00, "|cffffcc00Invalid Cast.")
Custom Script: if GetLocalPlayer() == GetTriggerPlayer() then
Custom Script: call StartSound( gg_snd_Error )
Custom Script: endif
Custom Script: call DestroyGroup( udg_Explode_Group )
Custom Script: set udg_Explode_Group = null
That should do it, providing that the Explode_Unit variable leaks (if it does, I don't know how to fix it, though).
12-27-2006, 09:29 AM#3
rulerofiron99
if you want the 'must target dead' part, try making another dummy unit there to cast raise dead or something
12-27-2006, 05:25 PM#4
Moss
Thanks Pyrogasm, I already made that trigger pretty much how you did just without the if statement and error message. Which I will make if that's all I can do. I just prefer to avoid it because a proper spell casting error would keep the ability activated and the hero doing whatever they were doing, not stop them.
12-27-2006, 11:58 PM#5
Pyrogasm
Oh. That's the best you can do to counteract invalid casts, though. Glad I may have been of some service to you.