cr4xzZz
Also known as azwraith_ftL.
- Reaction score
- 51
Meteor Shower
MUI/MPI? - Yes
Leakless? - Yes
Lagless? - Not if cast 20+ times ...
Requires? - NewGen Editor and ABCT v2.0 (or higher)
Causes meteors to fall at random locations around the Hero, leaving circles of fire as they hit the ground. Units that stay in the circles will be damaged.
Level 1 - 3 meteors
Level 2 - 6 meteors
Level 3 - 9 meteors
It's just eyecandy and it's very easy to edit. Meteors are special effects and the fire is Flame Strike. Enjoy
Code:
JASS:
scope MeteorShower
//Created by cr4xzZz (azwraith_ftL)
//Credits to Cohadar for ABCT.
// CONFIGURATION MENU !!!
globals
//Ability raw code
private constant integer ABILITY_RAW = 039;A002039;
//Dummy raw code (I use an edited Footman as a dummy, you can copy him
// and put him in your map or if you already have a dummy unit you can skip
// the copying part and replace this raw code with your dummy raw code)
private constant integer DUMMY = 039;hfoo039;
//Dummy unit ability raw
private constant integer DUMMY_ABILITY = 039;A003039;
//Special effect string (Meteor effect)
private constant string EFFECT = "Units\\Demon\\Infernal\\InfernalBirth.mdl"
//The maximum distance where a meteor can fall, or simply put - AoE
private constant real DISTANCE = 600.00
//The degrees where a meteor falls. It's recommended to be 360, so it can fall everywhere (full circle)
private constant real DEGREES = 360.00
//The time between meteors fall
private constant real TIME = 0.45
endglobals
//Number of meteors
private constant function NUMBER_OF_METEORS takes integer level returns integer
return level * 3
endfunction
// END OF CONFIGURATION MENU !!!
private struct Spell
unit hero
integer ticks
endstruct
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILITY_RAW
endfunction
private function Callback takes nothing returns boolean
local Spell data = ABCT_GetData()
local real deg_real = GetRandomReal(1, DEGREES)
local real dis_real = GetRandomReal(1, DISTANCE)
local real x = GetUnitX(data.hero) + dis_real * Cos(deg_real * bj_DEGTORAD)
local real y = GetUnitY(data.hero) + dis_real * Sin(deg_real * bj_DEGTORAD)
local location loc = Location(x, y)
//Create the dummy unit and make it cast Flame Strike
local unit d = CreateUnitAtLoc(GetOwningPlayer(data.hero), DUMMY, loc, 0.)
call UnitAddAbility(d, DUMMY_ABILITY)
call SetUnitAbilityLevel(d, DUMMY_ABILITY, GetUnitAbilityLevel(data.hero, ABILITY_RAW))
call IssuePointOrderLoc(d, "flamestrike", loc)
call UnitApplyTimedLife(d, 039;BTLF039;, 3.00)
//Meteor special effect
call DestroyEffect(AddSpecialEffectLoc(EFFECT, loc))
//If ticks is 0 then destroy the timer and stop the loop process
set data.ticks = data.ticks - 1
if data.ticks <= 0 then
call data.destroy()
return true
endif
call RemoveLocation(loc)
set loc = null
set d = null
return false
endfunction
private function Actions takes nothing returns nothing
//Create the struct
local Spell data = Spell.create()
local unit c = GetTriggerUnit()
local timer t = CreateTimer()
local integer level = GetUnitAbilityLevel(c, ABILITY_RAW)
//Add the struct components
set data.hero = c
set data.ticks = NUMBER_OF_METEORS(level)
call ABCT_Start(function Callback, data, TIME)
set c = null
set t = null
endfunction
function InitTrig_MeteorShower takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
endfunction
endscope
Screenshot: (looks better in-game)
EDIT: Fixed code leaks and bugs, added more stuff to the configuration menu
EDIT2: Removed a BJ. Simplified a bit.