Prometheus
Everything is mutable; nothing is sacred
- Reaction score
- 590
Omni Slash in JASS
Feel free to copy this spell into your map but please give me credit.
Just goto your spell (has to be a target unit spell) and hit ctrl
+ d. Look at its name and get the 1st 4 letters. replace A001 with those letters. If you press ctrl + d it'll go back to normal. I know it isin't exactly optimized a lot but it works and looks really good.
Feel free to copy this spell into your map but please give me credit.
Just goto your spell (has to be a target unit spell) and hit ctrl
+ d. Look at its name and get the 1st 4 letters. replace A001 with those letters. If you press ctrl + d it'll go back to normal. I know it isin't exactly optimized a lot but it works and looks really good.
JASS:
function Trig_Omni_Slash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A001039;
endfunction
//======================================================================
function Trig_Omni_Slash_UnitIsDead takes nothing returns boolean
return (IsUnitAliveBJ(GetFilterUnit()) == true) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false) and (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true)
endfunction
//======================================================================
function ABU takes unit a, unit b returns real
return bj_RADTODEG * Atan2(GetUnitY( b ) - GetUnitY( a ) , GetUnitX( b ) - GetUnitX( a ) )
endfunction
// Function ABU is a courtesy of emjir3. Thanks!
//======================================================================
function Trig_Omni_Slash_Actions takes nothing returns nothing
local unit Caster = GetSpellAbilityUnit()
local integer LevelofAbility = GetUnitAbilityLevelSwapped(039;A001039;, Caster)
local unit Target = GetSpellTargetUnit()
local real X = GetUnitX(Target)
local real Y = GetUnitY(Target)
local group NearbyUnits = CreateGroup()
local real X_C = GetUnitX(Caster)
local real Y_C = GetUnitY(Caster)
local boolexpr blah = Condition( function Trig_Omni_Slash_UnitIsDead )
local integer Increment = 1
local player Owner = GetOwningPlayer(Caster)
local real eff1
local real eff2
local real eff3
local real eff4
local effect SP
local effect SP2
call UnitAddAbility(Caster, 039;A005039;)
call SetCameraTargetControllerNoZForPlayer( Owner, Caster, 0, 0, false )
call PauseUnit(Caster, true)
call SetUnitInvulnerable( Caster, true )
call SetUnitVertexColor(Caster, 255, 255, 255, 50)
loop
exitwhen Increment > LevelofAbility * 3
set eff1 = GetUnitX(Caster)
set eff2 = GetUnitY(Caster)
call SetUnitPosition(Caster, X, Y)
set eff3 = GetUnitX(Caster)
set eff4 = GetUnitY(Caster)
set SP = AddSpecialEffect("Abilities\\Spells\\Items\\AIil\\AIilTarget.mdx" , eff1, eff2)
set SP2 = AddSpecialEffect("Abilities\\Spells\\Items\\AIil\\AIilTarget.mdx" , eff3, eff4)
call ABU(Caster, Target)
call SetUnitFacingToFaceUnitTimed( Caster, Target, 0 )
call SetUnitAnimation(Caster, "slam" )
call UnitDamageTargetBJ( Caster, Target, ( 50.00 * LevelofAbility ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL )
call TriggerSleepAction(0.65)
set Target = null
set X_C = GetUnitX(Caster)
set Y_C = GetUnitY(Caster)
call GroupEnumUnitsInRange( NearbyUnits, X_C, Y_C, 600, blah)
set Target = GroupPickRandomUnit(NearbyUnits)
set X = GetUnitX(Target)
set Y = GetUnitY(Target)
call DestroyEffect(SP)
call DestroyEffect(SP2)
if (IsUnitGroupEmptyBJ(NearbyUnits) == true) then
set Increment = 99
endif
call GroupClear(NearbyUnits)
set Increment = Increment + 1
endloop
call DestroyGroup(NearbyUnits)
set NearbyUnits = null
call SetUnitVertexColor(Caster, 255, 255, 255, 500)
call DestroyBoolExpr(blah)
set blah = null
call ResetToGameCameraForPlayer( Owner, 0.01 )
call PauseUnit(Caster, false)
call SetUnitInvulnerable( Caster, false )
set Caster = null
set Target = null
endfunction
//======================================================================
function InitTrig_Omni_Slash takes nothing returns nothing
set gg_trg_Omni_Slash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Omni_Slash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Omni_Slash, Condition( function Trig_Omni_Slash_Conditions ) )
call TriggerAddAction( gg_trg_Omni_Slash, function Trig_Omni_Slash_Actions )
endfunction