- Joined
- Feb 11, 2011
- Messages
- 1,860
Hi guys,
I would like to make a system that is like Critical Strike, but deals the damage to an area around the attacked unit. I have a thread here where I got the system right, except:
The event triggers for any damage done by GDD_DamageSource. For example, it will trigger when the unit casts a spell, but I only want it to run when the unit attacks.
How can I do this?
Thanks!
I would like to make a system that is like Critical Strike, but deals the damage to an area around the attacked unit. I have a thread here where I got the system right, except:
The event triggers for any damage done by GDD_DamageSource. For example, it will trigger when the unit casts a spell, but I only want it to run when the unit attacks.
How can I do this?
JASS:
function Thief_Skills_Actions takes nothing returns nothing
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodRifleman.mdl", GetEnumUnit(), "chest"))
call DisableTrigger(gg_trg_Thief_Skills)
if IsUnit(GetEnumUnit(), udg_GDD_DamagedUnit) then
call UnitDamageTarget(udg_GDD_DamageSource, GetEnumUnit(), (((udg_Temp_Real / udg_GDD_Damage) - 1) * udg_GDD_Damage), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
else
call UnitDamageTarget(udg_GDD_DamageSource, GetEnumUnit(), udg_Temp_Real, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
endif
call EnableTrigger(gg_trg_Thief_Skills)
endfunction
function Thief_Skills_Conditions takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_GDD_DamageSource)) == true
endfunction
function Thief_Skills takes nothing returns boolean
local unit u = GetTriggerUnit()
local integer i = GetRandomInt(1, 5)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local texttag t = CreateTextTag()
if (GetUnitTypeId(udg_GDD_DamageSource) == 'H004') and (GetUnitAbilityLevel(udg_GDD_DamageSource, 'A007') > 0) then
if (i == 1) then
set udg_Temp_Real = ((0.25 * (GetUnitAbilityLevel(udg_GDD_DamageSource, 'A007')) + 1) * udg_GDD_Damage)
call GroupEnumUnitsInRange(bj_lastCreatedGroup, x, y, 200, Condition(function Thief_Skills_Conditions))
call ForGroup(bj_lastCreatedGroup, function Thief_Skills_Actions)
call SetTextTagText(t, "|cffFF0000" + I2S(R2I(udg_Temp_Real)) + "!|r", 0.023)
call SetTextTagPosUnit(t, udg_GDD_DamageSource, 50)
call SetTextTagVelocity(t, 0, 64 * 0.071 / 128)
call SetTextTagPermanent(t, false)
call SetTextTagLifespan(t, 2)
call SetTextTagFadepoint(t, 1)
call SetTextTagVisibility(t, true)
endif
endif
set t = null
set u = null
return false
endfunction
function InitTrig_Thief_Skills takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterVariableEvent(t, "udg_GDD_Event", EQUAL, 0)
call TriggerAddCondition(t, Condition(function Thief_Skills))
set t = null
endfunction
ExplanationThe Thief (hero) has a 20% chance per attack to deal 1.25/1.5/1.75/2.0/2.25x normal damage to all enemies within 200 range of the attacked unit.
Last edited: