darth-yoda
New Member
- Reaction score
- 15
Wow thanks alot Steel. Fixed everything you showed, including the tooltips.
Now I just need to make it MUI. Shouldn't be too hard.
Now I just need to make it MUI. Shouldn't be too hard.
//=============================================================================\\
//>>>>>>>>>>>>>>>>>>>>>>Arcane Explosion<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\\
// made by \\
// darthyoda \\
// with help from Steel \\
//Things you'll need for this spell to work in your map from the Object Editor \\
// 1. Copy'n'paste the spell 'Arcane Explosion' into your map \\
// 2. Copy'n'paste the buff 'Arcane Explosion' into your map \\
// \\
//Things you'll need for this spell to work in your map from the Trigger Editor\\
// 1. Copy'n'paste the trigger named 'Set Arcane Explosion' \\
// 2. Copy'n'paste the trigger named 'Arcane Explosion' \\
// 3. Set the First 2 functions named 'buffid' and 'abilityid' to the id \\
// codes of your spell and buff. Note press 'CTRL+D' to view them in the\\
// Object Editor \\
//And now it should be working!! Edit the first set of functions to make the \\
//spell just how you want it. \\
//=============================================================================\\
constant function ArcaneExplosion_buffid takes nothing returns integer
return 039;B000039; //Set this to your Custom Buffs ID
endfunction
constant function ArcaneExplosion_abilityid takes nothing returns integer
return 039;A000039; //Set this to Arcanes Explosions ID
endfunction
constant function ArcaneExplosion_chance takes integer lvl returns real
return lvl * 10. //Sets the chance of the spell activating
endfunction
constant function ArcaneExplosion_damage takes integer lvl returns real
return lvl * 25. + 25. //How much damage each explosion deals
endfunction
constant function ArcaneExplosion_AOE_explosionMAX takes nothing returns real
return 350. //The Max Distants the explosions can be made from the triggering unit
endfunction
constant function ArcaneExplosion_AOE_explosionMIN takes nothing returns real
return 100. // The Min Distants the explosions can be made from the triggering unit
endfunction
constant function ArcaneExplosion_AOE_area takes nothing returns integer
return 200 //The area around each explosion that takes damage
endfunction
constant function ArcaneExplosion_AOE_aura takes nothing returns integer
return 1000 //This should be set to your base spells AOE (Checks units in range with buff)
endfunction
constant function ArcaneExplosion_AOE_group takes nothing returns integer
return 500 //Counts the number of enemy units around the triggering unit
endfunction
constant function ArcaneExplosion_unitmultiplier takes integer lvl returns integer
return lvl * 0 + 2 //Set the number of explosions. For example the Math currently is set to; number of nearby units x2
endfunction
constant function ArcaneExplosion_waittime takes nothing returns real
return 0.20 //Ammount of time between each explosion
endfunction
constant function ArcaneExplosion_SFX takes nothing returns string
return "Units\\NightElf\\Wisp\\WispExplode.mdl" //The explosions Model path name. Note: Path name must written as, Unit\\MyUnit\\Footman instead of Unit\MyUnit\Footman.
endfunction
//=========================================================================================================
//========================DO NOT EDIT PAST HERE UNLESS YOU KNOW WHAT YOUR DOING============================
//=========================================================================================================
function Trig_Arcane_Explosion_Conditions takes unit hero returns boolean
local integer lvl = GetUnitAbilityLevel(hero, ArcaneExplosion_abilityid())
local integer c = GetRandomInt(1,100)
local boolean bool = ((GetUnitAbilityLevel(GetTriggerUnit(), ArcaneExplosion_buffid()) > 0))
if c <= ArcaneExplosion_chance(lvl) then
return (bool)
endif
return false
endfunction
function Arcane_Explosion_Check takes unit hero returns boolean
local boolean bool1 = not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE))
local boolean bool2 = IsUnitAliveBJ(GetFilterUnit())
local boolean bool3 = IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(hero))
return (bool1 and bool2 and bool3)
endfunction
function ArcaneExplosion_Hero takes nothing returns boolean
return (GetUnitAbilityLevel(GetFilterUnit(), ArcaneExplosion_abilityid()) > 0 == true)
endfunction
function Trig_Arcane_Explosion_damage takes unit hero returns nothing
local integer lvl = GetUnitAbilityLevel(hero, ArcaneExplosion_abilityid())
call UnitDamageTarget(hero, GetEnumUnit(), ArcaneExplosion_damage(lvl), true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
endfunction
function Trig_Arcane_Explosion_Actions takes nothing returns nothing
local location cast = GetUnitLoc(GetTriggerUnit())
local location targ
local group g = CreateGroup()
local group h = CreateGroup()
local integer a = 1
local integer b
local boolexpr gethero = (Condition(function ArcaneExplosion_Hero))
local group randomhero = GetUnitsInRangeOfLocMatching(ArcaneExplosion_AOE_aura(), cast,gethero)
local unit hero = FirstOfGroup(randomhero)
local integer lvl = GetUnitAbilityLevel(hero, ArcaneExplosion_abilityid())
local boolexpr bexpr = (Condition(function Arcane_Explosion_Check))
set g = GetUnitsInRangeOfLocMatching(ArcaneExplosion_AOE_group(), cast, bexpr)
set b = ( CountUnitsInGroup(g) * ArcaneExplosion_unitmultiplier(lvl) )
loop
exitwhen a > b
set targ = PolarProjectionBJ(cast, GetRandomReal(ArcaneExplosion_AOE_explosionMIN(), ArcaneExplosion_AOE_explosionMAX()), GetRandomReal(0, 360.00))
call AddSpecialEffectLoc(ArcaneExplosion_SFX(), targ)
call DestroyEffect( GetLastCreatedEffectBJ() )
call TriggerSleepAction( ArcaneExplosion_waittime() )
set h = GetUnitsInRangeOfLocMatching(ArcaneExplosion_AOE_area(), targ, bexpr)
call ForGroup( h, function Trig_Arcane_Explosion_damage )
call DestroyGroup (h)
call RemoveLocation (targ)
set a = a + 1
endloop
call DestroyGroup (g)
set g = null
call DestroyBoolExpr(bexpr)
set bexpr = null
call RemoveLocation (cast)
set cast = null
set targ = null
set h = null
endfunction
//===========================================================================
function InitTrig_Arcane_Explosion takes nothing returns nothing
set gg_trg_Arcane_Explosion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Arcane_Explosion, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Arcane_Explosion, Condition( function Trig_Arcane_Explosion_Conditions ) )
call TriggerAddAction( gg_trg_Arcane_Explosion, function Trig_Arcane_Explosion_Actions )
endfunction
function...
local group g = CreateGroup()
local unit v
call GroupEnumUnitsInRange(g,somex,somey,100,Condition(function somefunction))
loop
set v = FirstOfGroup(g)
exitwhen v == null
//Do stuff to unit v
call GroupRemoveUnit(g,v)
endloop
endfunction
function GroupFilter takes nothing returns boolean
return GetUnitAbilityLevel(GetFilterUnit(),AuraId) > 0
endfunction
function...
local group g = CreateGroup()
local integer i = 0
local integer a
local unit c = GetTriggerUnit()
local unit tempu
local unit u
local real x = GetUnitX(c)
local real y = GetUnitY(c)
call GroupEnumUnitsInRange(g,x,y,500,Condition(function GroupFilter))
loop
set tempu = FirstOfGroup(g)
exitwhen tempu == null
set a = GetUnitAbilityId(u,AuraId)
if a > i then
set u = tempu
endif
call GroupRemoveUnit(g,tempu)
endloop
//unit u is now the unit with the greatest level of the AuraId spell, and must therefore be the buffing unit.
endfunction
function Arcane_Explosion_Check takes nothing returns boolean
local boolean bool1 = not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE))
local boolean bool2 = IsUnitAliveBJ(GetFilterUnit())
[B]local boolean bool3 = IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_AE_Owner))[/B]
return (bool1 and bool2 and bool3)
endfunction
Why does it activate when an enemy unit casts a spell? Fix that.
Otherwise... neat!
constant function ArcaneExplosion_buffid takes nothing returns integer
return 039;B000039; //Set this to your Custom Buffs ID
endfunction
constant function ArcaneExplosion_abilityid takes nothing returns integer
return 039;A000039; //Set this to Arcanes Explosions ID
endfunction
constant function ArcaneExplosion_chance takes integer lvl returns real
return lvl * 10. //Sets the chance of the spell activating
endfunction
constant function ArcaneExplosion_damage takes integer lvl returns real
return lvl * 25. + 25. //How much damage each explosion deals
endfunction
constant function ArcaneExplosion_AOE_explosionMAX takes integer lvl returns real
return lvl * 0 + 350. //The Max Distants the explosions can be made from the triggering unit
endfunction
constant function ArcaneExplosion_AOE_explosionMIN takes integer lvl returns real
return lvl * 0 + 100. // The Min Distants the explosions can be made from the triggering unit
endfunction
constant function ArcaneExplosion_AOE_area takes integer lvl returns integer
return lvl * 0 + 200 //The area around each explosion that takes damage
endfunction
constant function ArcaneExplosion_AOE_aura takes nothing returns integer
return 1000 //This should be set to your base spells AOE (Checks units in range with buff)
endfunction
constant function ArcaneExplosion_AOE_group takes integer lvl returns integer
return lvl * 0 + 500 //Counts the number of enemy units around the triggering unit
endfunction
constant function ArcaneExplosion_unitmultiplier takes integer lvl returns integer
return lvl * 0 + 2 //Set the number of explosions. For example the Math currently is set to; number of nearby units x2
endfunction
constant function ArcaneExplosion_waittime takes nothing returns real
return 0.20 //Ammount of time between each explosion
endfunction
constant function ArcaneExplosion_SFX takes nothing returns string
return "Units\\NightElf\\Wisp\\WispExplode.mdl" //The explosions Model path name. Note: Path name must written as, Unit\\MyUnit\\Footman instead of Unit\MyUnit\Footman.
endfunction
//=========================================================================================================
//========================DO NOT EDIT PAST HERE UNLESS YOU KNOW WHAT YOUR DOING============================
//=========================================================================================================
function Trig_Arcane_Explosion_Conditions takes nothing returns boolean
local integer lvl = GetUnitAbilityLevel(GetTriggerUnit(), ArcaneExplosion_buffid())
local integer c = GetRandomInt(1,100)
local boolean bool = ((GetUnitAbilityLevel(GetTriggerUnit(), ArcaneExplosion_buffid()) > 0))
if c <= ArcaneExplosion_chance(lvl) then
return (bool)
endif
return false
endfunction
function Arcane_Explosion_Check takes nothing returns boolean
local boolean bool1 = IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()))
local boolean bool2 = not(IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE))
local boolean bool3 = IsUnitAliveBJ(GetFilterUnit())
return (bool1 and bool2 and bool3)
endfunction
function ArcaneExplosion_Hero takes nothing returns boolean
return (GetUnitAbilityLevel(GetFilterUnit(), ArcaneExplosion_abilityid()) > 0 == true)
endfunction
function Trig_Arcane_Explosion_Actions takes nothing returns nothing
local location cast = GetUnitLoc(GetTriggerUnit())
local location targ
local unit u
local group g = CreateGroup()
local integer a = 1
local integer b
local boolexpr gethero = (Condition(function ArcaneExplosion_Hero))
local group randomhero = GetUnitsInRangeOfLocMatching(ArcaneExplosion_AOE_aura(), cast,gethero)
local unit hero = FirstOfGroup(randomhero)
local integer lvl = GetUnitAbilityLevel(hero, ArcaneExplosion_abilityid())
local boolexpr bexpr = (Condition(function Arcane_Explosion_Check))
set g = GetUnitsInRangeOfLocMatching(ArcaneExplosion_AOE_group(lvl), cast, bexpr)
set b = ( CountUnitsInGroup(g) * ArcaneExplosion_unitmultiplier(lvl) )
loop
exitwhen a > b
set targ = PolarProjectionBJ(cast, GetRandomReal(ArcaneExplosion_AOE_explosionMIN(lvl), ArcaneExplosion_AOE_explosionMAX(lvl)), GetRandomReal(0, 360.00))
call AddSpecialEffectLoc(ArcaneExplosion_SFX(), targ)
call DestroyEffect( GetLastCreatedEffectBJ() )
call PolledWait( ArcaneExplosion_waittime() )
call GroupClear(g)
set g = GetUnitsInRangeOfLocMatching(ArcaneExplosion_AOE_area(lvl), targ, bexpr)
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g,u)
call UnitDamageTarget(hero, u, ArcaneExplosion_damage(lvl), true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
endloop
call DestroyGroup (g)
call RemoveLocation (targ)
set a = a + 1
endloop
call DestroyGroup (g)
set g = null
call DestroyBoolExpr(bexpr)
set bexpr = null
call RemoveLocation (cast)
set cast = null
set targ = null
endfunction
//===========================================================================
function InitTrig_Arcane_Explosion takes nothing returns nothing
set gg_trg_Arcane_Explosion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Arcane_Explosion, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Arcane_Explosion, Condition( function Trig_Arcane_Explosion_Conditions ) )
call TriggerAddAction( gg_trg_Arcane_Explosion, function Trig_Arcane_Explosion_Actions )
endfunction