Tutorial How to make a Non-target Omni Slash

Prometheus

Everything is mutable; nothing is sacred
Reaction score
590
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
590
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
590
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
590
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
590
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
590
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
590
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
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    Sticking with the desserts for now the latest recipe is Fried Apple Pies - https://www.thehelper.net/threads/recipe-fried-apple-pies.194297/
  • The Helper The Helper:
    Finally finding about some of the bots that are flooding the users online - bytespider apparently is a huge offender here - ignores robots.txt and comes in from a ton of different IPs
  • Monovertex Monovertex:
    @The Helper I'm really not seeing the "Signature" link in the sidebar on that page. Here's a screenshot:
  • The Helper The Helper:
    I have reported it - I was wondering why nobody I have given sigs to over the last few years have used them
  • The Helper The Helper:
    Ghan has said he has fixed this. Monovertex please confirm this fix. This was only a problem with people that had signatures in the upper levels like not the special members but the respected members.
  • The Helper The Helper:
    Here is a better place to manage this stuff https://www.thehelper.net/account/account-details which I think should be way more visible
  • The Helper The Helper:
    I am hoping that online user count drop is finally that TikTok bot banned

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top