Monday, April 16, 2012

4x stat dmg

Hey! How do you make your skills do damage based on a stat. Like i wanna make a dwarf with thunderclap that does 4x str instead of base dmg.|||Set the damage to 0 in the object editor, then use the following trigger.


Code:
function Trig_Trigger_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'AHtc' )
endfunction

function TCFilter takes nothing returns boolean
return ( not IsUnitAlly( GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()) ) )
endfunction

function TCCallback takes nothing returns nothing
call UnitDamageTarget( GetTriggerUnit(), GetEnumUnit(), 4.00 * GetHeroStr(GetTriggerUnit(), true), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
endfunction

function Trig_Trigger_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local group g = CreateGroup()
call GroupEnumUnitsInRange( g, GetUnitX(u), GetUnitY(u), 300.00, Condition( function TCFilter ) )
call ForGroup( g, function TCCallback )
call DestroyGroup(g)
set u = null
set g = null
endfunction

//===========================================================================
function InitTrig_Trigger takes nothing returns nothing
set gg_trg_Trigger = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Trigger, Condition( function Trig_Trigger_Conditions ) )
call TriggerAddAction( gg_trg_Trigger, function Trig_Trigger_Actions )
endfunction

Replace 'AHtc' with the id of Thunder Clap, and replace 300.00 with the area of effect of Thunder Clap.

If you want, you could also check whether the unit is an air unit.|||Hey man thnx u once again

No comments:

Post a Comment