Tutorial How to make a Non-target Omni Slash

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;A000&#039;
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;A000&#039;) == 1 ) then
        set a = 3
    else
        if ( GetUnitAbilityLevel(GetTriggerUnit(), &#039;A000&#039;) == 2 ) then
            set a = 5
        else
            if ( GetUnitAbilityLevel(GetTriggerUnit(), &#039;A000&#039;) == 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] = &quot;Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdx&quot;
    set b[2] = &quot;Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdx&quot;
    set b[3] = &quot;Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdx&quot;
    set b[4] = &quot;Abilities\\Spells\\Demon\\ReviveDemon\\ReviveDemon.mdx&quot;
    set b[5] = &quot;Abilities\\Spells\\Demon\\DarkPortal\\DarkPortalTarget.mdx&quot;
    set b[6] = &quot;Abilities\\Spells\\Human\\Resurrect\\Resurrecttarget.mdx&quot;
    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:
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


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 &gt;= 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, &quot;slam&quot; ) //This is just the attack animation
        call DestroyEffect(AddSpecialEffectTarget(modl, caster, &quot;origin&quot;)) //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, &quot;origin&quot;))
        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;A000&#039;
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;A000&#039;) == 1 ) then
        set a = 3
    else
        if ( GetUnitAbilityLevel(GetTriggerUnit(), &#039;A000&#039;) == 2 ) then
            set a = 5
        else
            if ( GetUnitAbilityLevel(GetTriggerUnit(), &#039;A000&#039;) == 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] = &quot;Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdx&quot;
    set b[2] = &quot;Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdx&quot;
    set b[3] = &quot;Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdx&quot;
    set b[4] = &quot;Abilities\\Spells\\Demon\\ReviveDemon\\ReviveDemon.mdx&quot;
    set b[5] = &quot;Abilities\\Spells\\Demon\\DarkPortal\\DarkPortalTarget.mdx&quot;
    set b[6] = &quot;Abilities\\Spells\\Human\\Resurrect\\Resurrecttarget.mdx&quot;
    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 &gt;= 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, &quot;slam&quot; ) //This is just the attack animation
        call DestroyEffect(AddSpecialEffectTarget(modl, caster, &quot;origin&quot;)) //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, &quot;origin&quot;))
        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
 

w00t22

CSS L4D DoD? Steam ID = w00t22
Reaction score
43
isnt omni slash 3 5 8 targets? or is this just one cause its simplified?

anyways good tut :D
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
I didn't know it was ment to be multi target, i'll work on it later. Have homework atm :banghead:
 

wonderpriest

New Member
Reaction score
18
I didn't look at the whole thing, but I noticed one leak (so far). In your bottom script, you use location mP alot. Remove it before you set it again, or you will have a location the game must keep track of that has no use. Then at the end, remove it again, then set the variable to null.

Reminder: A local variable just holds a reference to the object, it isn't the object itself. For example:

Code:
function testlocs takes nothing returns nothing
local location a 
local location b

set a = Location(0,10) //Creates a location at 0,10. a now references to the location we just created

set a = Location(0,20) //Now we make a forget our previous location, and make it reference a new location we just created

set a = Location(0,30) //a forgets the last location and references this new location

set b=a //Now both a and b reference the location a is pointing at

call RemoveLocation(a) //Removes the location a was pointing at, which b was also pointing at, so now both vars=null

--do stuff with b-- //Won't work since we removed the location b referenced

endfunction

The correct usage would be:
Code:
function testlocs takes nothing returns nothing
local location a 
local location b

set a = Location(0,10) //Creates a location at 0,10. a now references to the location we just created

call RemoveLocation(a) //Since we are going to make a reference a new location, we remove this one since it is not needed

set a = Location(0,20) //Now we make a forget our previous location, and make it reference a new location we just created

call RemoveLocation(a)

set a = Location(0,30) //a forgets the last location and references this new location

set b=a //Now both a and b reference the location a was pointing at

set a=null //Since we aren't going to use the variable a anymore, we set it to null

--do stuff with b-- //Will work since b still points at a location

call RemoveLocation(b) //Now we are done with the location b is referencing, so we delete it

set b=null /We are done with b, so we set it to null

endfunction
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
Missile Speed changed so the ablility accually does damage.
 

wonderpriest

New Member
Reaction score
18
Before you go right into the steps, tell people what an Omnislash is, how much time it will take, and what they will learn. If you don't, you might as well just give them the trigger by itself.


EDIT: Ummm, okay... I just saw a tutorial on Omnislash in the repository by someone else. Not cool >_>

EDIT2: Oh, yours is "Simplified". Tell me how it's simplified, or I just say they are the same thing.
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
wonderpriest said:
Before you go right into the steps, tell people what an Omnislash is, how much time it will take, and what they will learn. If you don't, you might as well just give them the trigger by itself.


EDIT: Ummm, okay... I just saw a tutorial on Omnislash in the repository by someone else. Not cool >_>

EDIT2: Oh, yours is "Simplified". Tell me how it's simplified, or I just say they are the same thing.

1. Added in

2. I know, but that looked quite complicated and mine is more "newbie friendly".

3. The triggers are a lot easier to make compared to the other Omni Slash Tutorial.
 

wonderpriest

New Member
Reaction score
18
Please tell me why it's simpler in the beginning, and maybe link to the original for people who don't want a "simpler" one, or they did yours and want to try the other one now that they have experience, Something like that. I think it's good to keep a flow between tutorials and information, maybe talk to the creator of the other one, to link to yours for people who want a simpler one. Then both will be promoted :)
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
I created a second tutorial because when you see a huge block of text that has colors that make it hard to read it really just makes you want to not read it. My tutorial has better colors and has much smaller code.
 

1337moo

New Member
Reaction score
0
I kind of need help with this tutorial... I have everything done here except for the fact that my hero teleports to the target it hits... (i did everything as said in the tutorial)

:edit: [offtopic]
I just noticed how old this thread was....
:edit: [ontopic]
 

AgentPaper

From the depths, I come.
Reaction score
107
3-4 days is not very long at all. Don't worry about how old something is until it gets into the months/years. (yes, it does and has happened)

Anyway, the tutorial, for supposedly being "noob friendly", really doesn't do much to accomidate new mappers. If you really want to make this noob friendly, go over each action, and say what that action does, why you need it, etc. As it is, this basically tells you what to do for seemingly random parts of the trigger, and then just says "now throw in all the rest". The whole point of this is to explain how to do all of that stuff, not to tell them they need to do it.
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
You hero is ment to teleport to the target(s) it hit(s).
 

1337moo

New Member
Reaction score
0
No. What I meant was that the omnislash skill that I got from this site did everything but the teleporting. It would do the damage to random units within the 500 range and everything but I couldn't see the teleportation. (tiny note: when I said this forum was old, i was looking at the guy above me's join date....)
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
Do you have the "move unit instantly" code in your trigger?
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
In your version of the spell with variables, the wait lasts for 0.10 seconds, which is the shortest amount of time that a wait can be, but in your version without variables, it is 0.01, which is too low. You might want to change that. :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top