• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Death Unit Buff Trigger

Status
Not open for further replies.
Level 8
Joined
Mar 23, 2007
Messages
302
hi,

Whats about:

A simple Spell that entangles a Unit for 50 dmg til it dies. Heroes only for 4 sec.
If this Unit dies then all otheru nits within 300 range will be affected with the same spell. If those unit dies, all unit in 300 range for each died unit will be affected too. And so on.... til no unit is in the range of 300 of any dying unit.


What i need:
How do i detect if a unit has a buff when it dies?
Or is there an ability that does not show up if a unit has it?
(usualy even if u cant see the ability it can move other Icons randomly, so how to preven this then?)
OR is there any way to check this? I mean the Sand King in Dota for example
has an orb that only stays 0.2 sec but if the unit dies with this buff (somting happens) it explodes.

I thougt about:

Adding a empty Spell book, placing there a dummy ability, remove spell bock so that ability stays absolutly invisible for player. When the unit dies check for this ability and cause the Trigger to work. This is realy hard to do, so if ther is any other way to do that , I would be very happy if someone would help me.

Here is what i got so far.
JASS:
function Trig_Painroots_Conditions takes nothing returns boolean
return (GetUnitAbilityLevel(GetDyingUnit(), 'B004') > 0) == true
endfunction

function Trig_Painroots_Actions takes nothing returns nothing
local unit u = GetDyingUnit()
local unit b
local unit u2 
local player P = GetOwningPlayer(u)
local location L = GetUnitLoc(u)
local real X = GetUnitX(u)
local real Y = GetUnitY(u)
local group G = GetUnitsInRangeOfLocAll(300.00, L)
call DisplayTimedTextToPlayer(Player(0),0,0,60,"Spell: Start")
call RemoveLocation(L)
set L = null
call DisplayTimedTextToPlayer(Player(0),0,0,60,"Spell: Location Removed + Start Loop")
loop
    set u2 = FirstOfGroup(G)
    exitwhen u2 == null
    if (((GetUnitState(u2, UNIT_STATE_LIFE) > 0 )==true)and( u2 != GetDyingUnit())and(IsUnitType(u2,UNIT_TYPE_STRUCTURE )== false)) then
    set b = CreateUnit(P,'n00I',X,Y,0 )
    call DisplayTimedTextToPlayer(Player(0),0,0,60,"Spell: Unit Created")
    call IssueTargetOrder( b, "entanglingroots",u2)
    call UnitApplyTimedLife(  b, 'BTLF',2.00 )
    endif
    call GroupRemoveUnit(G, u2)
endloop
call DisplayTimedTextToPlayer(Player(0),0,0,60,"Spell: End Spell + End Loop")
call DestroyGroup(G)
set P = null
set G = null
set b = null
set u = null
set u2 = null
set L = null
endfunction
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
You asked exacly the same question about a month ago...

Buffs are automaticly removed the moment the unit dies, so YOU CAN'T check for buffs on a dead unit.
You'll need to make a local for him and check when he dies...

You can also try to give the unit the "Goblin Mine" ability that makes him explode on death with the damage you want and shown effects that you can set in the object manager.
 
Status
Not open for further replies.
Top