Prometheus
Everything is mutable; nothing is sacred
- Reaction score
- 589
Tutorial - How to make a Non-target Omni Slash
By kc102
What is Omni Slash?
Omni Slash is a spell that originated in Final Fantasy. You would run up to the target and slash them many times dealing lots of damage. The DotA version was you would attack 3 targets. This is based off of that version. This will probally take you 20 minutes max to make.
1. Create a new spell based off of Channel. You can mess with several things but there are only a few key ones. Give it 3 levels and change the art duration to 0.00. Leave Base Order ID at channel and make the level 2 and 3 ones channel. Set Data - Options to visible, follow through time to 0.00 and Disable Other Abilities to false. Make sure the ability is set on 'Instant(No Target)' <I believe thats the name.
2. Create a trigger with the name Omni Slash and give it the event "A Unit starts the effect of an ability". Give it the condition "Ability being cast = to Omni Slash". Now convert it to JASS(Custom Text).
3. I like to optimize the condition 1st.
Change whats there to...
JASS:
function Omni_Slash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A000039;
endfunction
When you converted it, it listed something like the 'A000', change the 'A000' to what ever it said when you converted it.
4. Before we get to the actions I want to just have all the little extra functions laid out.
JASS:
function deadnoallyno takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()))) and (IsUnitAliveBJ(GetFilterUnit()))
endfunction
function getlevel takes nothing returns integer
local integer a
if ( GetUnitAbilityLevel(GetTriggerUnit(), 039;A000039;) == 1 ) then
set a = 3
else
if ( GetUnitAbilityLevel(GetTriggerUnit(), 039;A000039;) == 2 ) then
set a = 5
else
if ( GetUnitAbilityLevel(GetTriggerUnit(), 039;A000039;) == 3 ) then
set a = 8
else
endif
endif
endif
return a
endfunction
function rm takes nothing returns string
local string array b
set b[1] = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdx"
set b[2] = "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdx"
set b[3] = "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdx"
set b[4] = "Abilities\\Spells\\Demon\\ReviveDemon\\ReviveDemon.mdx"
set b[5] = "Abilities\\Spells\\Demon\\DarkPortal\\DarkPortalTarget.mdx"
set b[6] = "Abilities\\Spells\\Human\\Resurrect\\Resurrecttarget.mdx"
return b[GetRandomInt(1, 6)]
endfunction
5. Allright, lets get down with the actions. We need 9 locals. 2 Integer, 2 Unit, 3 Location, 1 String and 1 Unit Group. Lets lay them down. (I use really unimaginative names)
JASS:
6. Now to make the unit invulnerable, pause it and lay down the loop. (Leaving the comments helps me to explain stuff w/o writing it again.
JASS:
call PauseUnit(caster, true)
call SetUnitInvulnerable( caster, true )
loop
exitwhen loopd >= splvl
set modl = rm() //This line sets the 1st effect you will see, this one goes on your casting unit.
set casloc = GetUnitLoc(caster)
set randtarget = GetUnitsInRangeOfLocMatching(700.00, casloc, Condition(function deadnoallyno)) //700.00 is the range is which this will pick a unit, change for a greater range.
set target = GroupPickRandomUnit(randtarget) //This picks the unit to attack.
set tarloc = GetUnitLoc(target)
set temp = PolarProjectionBJ(tarloc, 0.00, GetRandomInt(1, 360))
call SetUnitPositionLocFacingLocBJ( caster, temp, tarloc ) //This moves the hero and makes the hero face the target.
call SetUnitAnimation( caster, "slam" ) //This is just the attack animation
call DestroyEffect(AddSpecialEffectTarget(modl, caster, "origin")) //This and the code 2 lines below it set the effect you see.
set modl = rm() //This sets the 2nd effect you will see, this one goes on the target unit.
call DestroyEffect(AddSpecialEffectTarget(modl, target, "origin"))
call UnitDamageTargetBJ( caster, target, 200.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL ) //To change the damage, just edit the 200.00 to what ever value you like.
call RemoveLocation(casloc)
call RemoveLocation(tarloc)
call RemoveLocation(temp)
call TriggerSleepAction(0.32) //This sets the wait inbetween each teleport
set loopd = loopd + 1
endloop
7. Now for the ending part, quite simple really; just tying up lose ends.
JASS:
call PauseUnit(caster, false)
call SetUnitInvulnerable(caster, false)
set caster = null
set target = null
set temp = null
set casloc = null
set tarloc = null
endfunction
8. Just gona throw in the event. ^^
JASS:
//===========================================================================
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 Omni_Slash_Conditions ) )
call TriggerAddAction( gg_trg_Omni_Slash, function Omni_Slash_Actions )
endfunction
COMPLETE TRIGGER
JASS:
function Omni_Slash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A000039;
endfunction
function deadnoallyno takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit()))) and (IsUnitAliveBJ(GetFilterUnit()))
endfunction
function getlevel takes nothing returns integer
local integer a
if ( GetUnitAbilityLevel(GetTriggerUnit(), 039;A000039;) == 1 ) then
set a = 3
else
if ( GetUnitAbilityLevel(GetTriggerUnit(), 039;A000039;) == 2 ) then
set a = 5
else
if ( GetUnitAbilityLevel(GetTriggerUnit(), 039;A000039;) == 3 ) then
set a = 8
else
endif
endif
endif
return a
endfunction
function rm takes nothing returns string
local string array b
set b[1] = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdx"
set b[2] = "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdx"
set b[3] = "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdx"
set b[4] = "Abilities\\Spells\\Demon\\ReviveDemon\\ReviveDemon.mdx"
set b[5] = "Abilities\\Spells\\Demon\\DarkPortal\\DarkPortalTarget.mdx"
set b[6] = "Abilities\\Spells\\Human\\Resurrect\\Resurrecttarget.mdx"
return b[GetRandomInt(1, 6)]
endfunction
function Omni_Slash_Actions takes nothing returns nothing
local integer loopd = 0
local integer splvl = getlevel()
local unit caster = GetTriggerUnit()
local unit target
local location tarloc
local location casloc
local location temp
local string modl
local group randtarget
call PauseUnit(caster, true)
call SetUnitInvulnerable( caster, true )
loop
exitwhen loopd >= splvl
set modl = rm() //This line sets the 1st effect you will see, this one goes on your casting unit.
set casloc = GetUnitLoc(caster)
set randtarget = GetUnitsInRangeOfLocMatching(700.00, casloc, Condition(function deadnoallyno)) //700.00 is the range is which this will pick a unit, change for a greater range.
set target = GroupPickRandomUnit(randtarget) //This picks the unit to attack.
set tarloc = GetUnitLoc(target)
set temp = PolarProjectionBJ(tarloc, 0.00, GetRandomInt(1, 360))
call SetUnitPositionLocFacingLocBJ( caster, temp, tarloc ) //This moves the hero and makes the hero face the target.
call SetUnitAnimation( caster, "slam" ) //This is just the attack animation
call DestroyEffect(AddSpecialEffectTarget(modl, caster, "origin")) //This and the code 2 lines below it set the effect you see.
set modl = rm() //This sets the 2nd effect you will see, this one goes on the target unit.
call DestroyEffect(AddSpecialEffectTarget(modl, target, "origin"))
call UnitDamageTargetBJ( caster, target, 200.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL ) //To change the damage, just edit the 200.00 to what ever value you like.
call RemoveLocation(casloc)
call RemoveLocation(tarloc)
call RemoveLocation(temp)
call TriggerSleepAction(0.32) //This sets the wait inbetween each teleport
set loopd = loopd + 1
endloop
call PauseUnit(caster, false)
call SetUnitInvulnerable(caster, false)
set caster = null
set target = null
set temp = null
set casloc = null
set tarloc = 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 Omni_Slash_Conditions ) )
call TriggerAddAction( gg_trg_Omni_Slash, function Omni_Slash_Actions )
endfunction
Credits
SFilip ~ His weird TESH hook thing.Rheias ~ Catching mistakes in my initial trigger.
Duwenbasden ~ Countless stupid little questions ^^ I was asking them
Get Spell