//=================================
//AOE STAT BASED ATTACK
//by Gralamin
//
//To implement, Copy the script
//into a converted trigger
//named AoEStatAttack
//
//Give credit if you use this spell
//==================================
function Trig_AoEStatAttack_Conditions takes nothing returns boolean
// Replace A000 with the effects Raw code.
return GetUnitAbilityLevel(GetSpellAbilityUnit() , 'A000') > 0
endfunction
function Trig_AoEStatAttack_Actions takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local unit f
local location loc = GetSpellTargetLoc()
local group g
local real dmg
set g = GetUnitsInRangeOfLocAll(200.00, loc) // Use this if Its like Earthquake;
// If its like warstomp, Simply change loc to GetUnitLoc(c).
// 200.00 is the radius, change as needed.
set dmg = I2R(GetHeroAgi(c,true)) * 5.00 // This line gets a heroes agi, Including
//Bonuses. It then converts it to a real, and and is multipled by 5, or however much
//you wish to increase it. (change 5 to change it)
//If you want Strength, change the Agi to Str
//If you want INT, change Agi to Int
set f = FirstOfGroup(g) // this chooses the first member of the group
loop
exitwhen f==null
set f = FirstOfGroup(g) // Repeated for loops sake
if IsUnitEnemy(f, GetOwningPlayer(a))==true then // Detects if its an enemy
call UnitDamageTarget(c,f,dmg,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
// This tells the Caster to deal damage to the first member of group
// equal to the dmg variable. It then saids this is not an attack
// And not a ranged attack.
// The ATTACK_TYPE_NORMAL means its spell damage
// and the DAMAGE_TYPE_MAGIC means it Deals magic damage, that ignores armor
// And detects if they are magic immune.
// the null just elminates an unused part.
endif
call GroupRemoveUnit(g,f) // At the end of this loop, the current unit is removed
// because of this, when it loops, it'll be a different unit
endloop
set c = null
set f = null
set g = null
// These prevent leaks, making your map work better.
endfunction
//===========================================================================
function InitTrig_AoEStatAttack takes nothing returns nothing
set gg_trg_AoEStatAttack = CreateTrigger( ) // This is how it Creates the Trigger
call TriggerRegisterAnyUnitEventBJ( gg_trg_AoEStatAttack, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_AoEStatAttack, Condition( function Trig_AoEStatAttack_Conditions ) )
call TriggerAddAction( gg_trg_AoEStatAttack, function Trig_AoEStatAttack_Actions )
endfunction
// To rename the Trigger, Simply Replace ALL Instances of AoEStatAttack with Whatever name you wish
// Spaces should be Underscores ( _ )
// I would reccomend using the replace feature to do this easily.