Joker(Div)
Always Here..
- Reaction score
- 86
Aerial Strike:
Summons a great bird that fuses with your current energy (mana), which smashes itself into the target location.
The spell is very flexible, MUI, leakless (better be), and easily implemented. It is also pretty close to a JESP.
Credit to Tinki3 for the map.
How To Implement:
Requires:
Screenies:
Code:
Summons a great bird that fuses with your current energy (mana), which smashes itself into the target location.
The spell is very flexible, MUI, leakless (better be), and easily implemented. It is also pretty close to a JESP.
Credit to Tinki3 for the map.
How To Implement:
- Create a Trigger
- Name it: AerialStrike
- Copy the script (Or just copy the entire trigger)
- Make/Copy a spell based on channel
- Make/Copy a flying dummy unit
Requires:
- TT
- Recycler
- NewGen
- Vex's Dummy Model
Screenies:
Code:
JASS:
//===========================================================================
// Aerial Strike: By Joker(Div) Credits: NewGen - PitzerMike/Vexorian
// TT - Cohadar
// Recycler - Cohadar, Vexorian (CSSafety)?
// Requires: TT, Recycler, NewGen Dummy Model - Vexorian
//===========================================================================
scope AerialStrike initializer Init
globals
private constant integer ABILITY_ID = 039;A000039; //ID of spell
private constant integer BIRD_ID = 039;n000039; //ID of bird
private constant integer DUMMY_ID = 039;n001039; //ID of Dummy (used to attach sfx)
private constant real DUMMY_SIZE = 1.0 //Size of sfx in case you increase base AoE
private constant real BIRD_START = 500. //# of units behind the caster, where the bird spawns
private constant real BIRD_SPEED = 750. //The bird's Units/Sec
private constant real BIRD_HEIGHT = 1500. //The bird's starting height
private constant real BIRD_DESCEND = 1500. //The bird's Units/Sec for descending
private constant real BIRD_MINHEIGHT = 5. //Minimun height of bird
private constant real BIRD_SIZE_BASE = 3.5 //Make this w/e you have it as in Object Editor
private constant real BIRD_MANA2SIZE = 0.003 //The size increment per mana
private constant real BIRD_ANIMATION = 4.0 //The rate the bird animates
private constant real EXPLOSION_RADIUS = 250. //Self-Explanatory
private constant real BASE_DAMAGE = 50. //This will be muliplied by the lvl (set it to 0 if you dont want any)
private constant real MANA_IMPUT = 0.5 //The % of mana put into dmg (in this case, 50%)
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_CHAOS //Self-Explanatory
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL //Self-Explanatory
//The Explosion models (You can remove and add as you wish)
private constant string IMPACT_EXPLOSION = "Objects\\Spawnmodels\\NightElf\\NECancelDeath\\NECancelDeath.mdl"
private constant string IMPACT_EXPLOSION2 = "Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl"
private constant string IMPACT_EXPLOSION3 = "Units\\NightElf\\Wisp\\WispExplode.mdl"
//The Teleport model
private constant string TELEPORT = "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl"
//The crow ability, incase you have edited yours.
private constant integer CROW_ABILITY = 039;Arav039;
//This is here if you want the bird to explode once it collides with any unit.
//Just set it you true if you want it.
private boolean CONTACT_EXPLODE = true
endglobals
//========================================================================================
// You should not have to touch anything under here.
// (Unless specified)
//========================================================================================
private struct Aerial
unit caster
unit bird
real dspeed
real ddescend
real dx
real dy
real x
real y
real angle
real mana
real endx
real endy
integer ticks
integer lvl
boolean have
group g
static method start takes unit caster, unit bird, real x, real y, real angle, real range returns nothing
local Aerial dat = Aerial.create()
set dat.caster = caster
set dat.bird = bird
set dat.x = x
set dat.y = y
set dat.have = false
set dat.mana = GetUnitState(caster, UNIT_STATE_MANA)
set dat.lvl = GetUnitAbilityLevel(caster, ABILITY_ID)
set dat.g = NewGroup() //Recycler
set dat.dspeed = BIRD_SPEED * TT_PERIOD
set dat.ddescend = BIRD_DESCEND * TT_PERIOD
set dat.dx = dat.dspeed * Cos(angle)
set dat.dy = dat.dspeed * Sin(angle)
set dat.ticks = R2I( ( (range+BIRD_START) / dat.dspeed ) + 0.5 )
call SetUnitTimeScale( bird, BIRD_ANIMATION)
call TT_Start(function Aerial.callback, dat ) //TT
endmethod
static method callback takes nothing returns boolean
local Aerial dat = TT_GetData() //TT
local real birdX = GetUnitX(dat.bird)
local real birdY = GetUnitY(dat.bird)
local real f = GetUnitFacing(dat.caster)
local real x = dat.x
local real y = dat.y
local real fly = GetUnitFlyHeight(dat.bird)
local real scale = BIRD_SIZE_BASE + dat.mana * BIRD_MANA2SIZE
if dat.ticks > 0 then
call SetUnitPosition(dat.bird, birdX + dat.dx, birdY + dat.dy )
set dat.ticks = dat.ticks - 1
if fly > BIRD_MINHEIGHT then
call SetUnitFlyHeight(dat.bird, fly - dat.ddescend, 0)
endif
if IsUnitInRange(dat.bird, dat.caster, 100.) and not dat.have then
call SetUnitScale( dat.bird, scale, scale, scale )
call DestroyEffect( AddSpecialEffect(TELEPORT, GetUnitX(dat.caster), GetUnitY(dat.caster)) )
call SetUnitState( dat.caster, UNIT_STATE_MANA, dat.mana * MANA_IMPUT )
call ShowUnit(dat.caster, false)
call PauseUnit(dat.caster, true)
set dat.have = true
endif
if CONTACT_EXPLODE then
if dat.have then
call GroupEnumUnitsInRange(dat.g, birdX, birdY, EXPLOSION_RADIUS, Condition(function Aerial.filter) )
if FirstOfGroup(dat.g) != null and IsUnitInRange(FirstOfGroup(dat.g), dat.bird, 50.) then
set dat.endx = birdX
set dat.endy = birdY
call dat.destroy()
return true
endif
endif
endif
else
set dat.endx = birdX
set dat.endy = birdY
call dat.destroy()
return true
endif
return false
endmethod
//===============================================================================================================================
//===============================================================================================================================
private static method filter takes nothing returns boolean
//Change the conditions to w/e you want here.
return IsUnitEnemy( GetTriggerUnit(), GetOwningPlayer(GetFilterUnit())) and GetWidgetLife(GetFilterUnit()) > 0.405
endmethod
//===============================================================================================================================
//===============================================================================================================================
method onDestroy takes nothing returns nothing
local unit first
local unit dummy
if .have then
call GroupEnumUnitsInRange(.g, .endx, .endy, EXPLOSION_RADIUS, Condition(function Aerial.filter) )
call PauseUnit(.caster, false)
call SetUnitPosition(.caster, .endx, .endy)
debug call ClearTextMessages()
debug call BJDebugMsg("Aerial Strike: max damage: |cFFC0C000" + R2S(.lvl*BASE_DAMAGE + .mana*MANA_IMPUT) )
loop
set first = FirstOfGroup(.g)
exitwhen first == null
call UnitDamageTarget(.caster, first, .lvl*BASE_DAMAGE + .mana*MANA_IMPUT, false, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE_WHOKNOWS )
call GroupRemoveUnit(.g, first)
endloop
if GetLocalPlayer() == GetOwningPlayer(.caster) then
call SelectUnit(.caster, true)
endif
set dummy = CreateUnit(GetOwningPlayer(.caster), DUMMY_ID, .endx, .endy, bj_UNIT_FACING)
call SetUnitScale(dummy, DUMMY_SIZE, DUMMY_SIZE, DUMMY_SIZE)
//=================================================================================
//============= Incase you added or removed an effect(s) ==========================
call DestroyEffect( AddSpecialEffectTarget(IMPACT_EXPLOSION, dummy, "origin" ) )
call DestroyEffect( AddSpecialEffectTarget(IMPACT_EXPLOSION2, dummy, "origin" ) )
call DestroyEffect( AddSpecialEffectTarget(IMPACT_EXPLOSION3, dummy, "origin" ) )
//==================================================================================
//==================================================================================
call ShowUnit(.caster, true)
endif
call RemoveUnit(.bird)
call KillUnit(dummy)
call ReleaseGroup(.g)
set first = null
set dummy = null
endmethod
endstruct
//===========================================================================
private function Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local real casterX = GetUnitX(caster)
local real casterY = GetUnitY(caster)
local real x = GetLocationX(loc)
local real y = GetLocationY(loc)
local real rangex = x - casterX
local real rangey = y - casterY
local real range = SquareRoot(rangex*rangex + rangey*rangey)
local real angle = Atan2(rangey, rangex)
local real X = casterX- BIRD_START * Cos(angle)
local real Y = casterY- BIRD_START * Sin(angle)
local unit bird
if not RectContainsCoords(bj_mapInitialPlayableArea, X, Y) then
set bird = CreateUnit( GetOwningPlayer(caster), BIRD_ID, casterX, casterY, bj_RADTODEG*angle )
else
set bird = CreateUnit( GetOwningPlayer(caster), BIRD_ID, X, Y, bj_RADTODEG*angle )
endif
call UnitAddAbility(bird, CROW_ABILITY)
call UnitRemoveAbility(bird, CROW_ABILITY)
call SetUnitFlyHeight(bird, BIRD_HEIGHT, 0)
call Aerial.start(caster, bird, x, y, angle, range)
call RemoveLocation(loc)
set loc = null
set caster = null
set bird = null
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILITY_ID
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent( t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, BOOLEXPR_TRUE ) //Recycler
exitwhen i >= 15
set i = i+1
endloop
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
endfunction
endscope
Code:
//---11/8/08---\\
*Uses Vex's model so that the sfx size is alterable
*Small Clean up
//---10/26/08---\\
*Clean up coding (much easier to follow)
//---3/5/08----\\
* Fixed struct leak
* Fixed a little config error
* Made the "How to Implement" a bit more detailed.
** Got rid of Camera pan
** Added a error msg (Now needs SimError also)
** Does not use GetUnitFacing anymore
//---3/4/08----\\
* Took more of Cohadar's advise and changed more some coding
* Fix the target location, thx to Cohadar
* Little more optimization here and there
* Forgot that the bird takes half your mana, fixed that
* Added a "how to implement" in the map. (dunno how to get more detailed than that...)
//---3/3/08----\\
* Took some of Cohadar's advise and changed some coding
* Changed some other coding myself
* Made it easier for you to turn on Collision explosion
* Made nothing happen if bird does not pick you up.
* Made you level 1 on test map to show better the bird size.
* Test it in debug mode to see the damage dealt.