Spell Omnislash v1.02

emjlr3

Change can be a good thing
Reaction score
395
Omnislash v1.03

A DotA-like Omnislash, made in vJASS. Given the recent increased activity in Tinkis dated Omnislash thread, I figured I would dust off this old favorite, give it an overhall, and release it to the public.

Contains two versions. The Classic Omnislash, and an OnDamage Omnislash, which uses the heroes actual attack to deal the damage, as opposed to triggering it.

Import Difficulty: Low

Units Affected:
Enemy, ground, non-structure, non-magic immune, visible

Target Type: Single unit - Enemy, ground, organic

Spell Info
:

Quickly move around the battlefield, slashing many enemies. You are invulnerable for the duration. Deals between 150 and 250 damage per slash.

Level 1 - Attacks 3 times.
Level 2 - Attacks 5 times.
Level 3 - Attacks 8 times.

The Classic Omnislash requires only Timer Utils to function. The OnDamage Omnislash requires Timer Utils and IDDS (which requires Table 3.0). It also makes use of an attack speed modifying item ability, which can make the hero attack much faster when attacking during the Omnislash.

Classic:
JASS:
scope Omnislash initializer Init

globals
    private constant integer AbilId = 'A000'
    private constant real TimerInterval = .4
    private constant string BlinkFX = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
    private constant string CasterAttachPoint = "weapon"
    private constant string CasterFX = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl"
    private constant string SlashAnimation = "attack"
endglobals
private constant function MaxSlashes takes integer lvl returns integer
    if lvl<3 then
        return 1+2*lvl
    else
        return 8
    endif
endfunction
private function SlashDamage takes integer lvl returns real
    return GetRandomReal(150.,250.) // This can be changed to a constant function if you update it to use an equation
endfunction
private constant function TargetAoE takes integer lvl returns real
    return 475.
endfunction
private constant function TargetBoolean takes unit caster, unit target returns boolean
    return true
endfunction

//== No touching past this point ==\\
globals
    private group G = CreateGroup()
    private group OmniGroup = CreateGroup()
    private unit Targ
    private boolexpr B
    private integer I
endglobals
private struct data
    unit u
    unit targ
    player p
    effect fx
    timer t
    integer lvl
    integer count = 1
    integer max
    real aoe
    
    method onDestroy takes nothing returns nothing
        call DestroyEffect(.fx)
        call ReleaseTimer(.t)
        call SetUnitInvulnerable(.u,false)
        call SetUnitVertexColor(.u,255,255,255,255)
        call GroupRemoveUnit(OmniGroup,.u)
        call SelectUnit(.u, GetLocalPlayer()==.p)
    endmethod
endstruct

private function Filt takes nothing returns boolean
    local data d = I
    
    set Targ = GetFilterUnit()    
    if TargetBoolean(d.u,Targ) and IsUnitEnemy(Targ,d.p) and GetWidgetLife(Targ)>.405 and IsUnitType(Targ,UNIT_TYPE_STRUCTURE)==false and IsUnitType(Targ,UNIT_TYPE_MAGIC_IMMUNE)==false and not IsUnitHidden(Targ) then
        return true
    endif
    return false
endfunction
private function DoSlash takes data d, real ang, real off returns nothing
    call SetUnitPosition(d.u,GetUnitX(d.targ)+off*Cos(ang),GetUnitY(d.targ)+off*Sin(ang))
    call DestroyEffect(AddSpecialEffectTarget(BlinkFX, d.u, "chest"))
    call UnitDamageTarget(d.u,d.targ,SlashDamage(d.lvl), false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
    call SetUnitAnimation(d.u,SlashAnimation)
endfunction
private function Effects takes nothing returns nothing
    local data d = GetTimerData(GetExpiredTimer())
    
    set d.count = d.count + 1
    call GroupClear(G)
    set I = d
    call GroupEnumUnitsInRange(G,GetUnitX(d.u),GetUnitY(d.u),d.aoe,B)
    set d.targ = FirstOfGroup(G)
    if d.targ!=null then
        call DoSlash(d,GetRandomReal(1., 360.)*bj_DEGTORAD,GetRandomReal(0., 85.)+100.)
    endif
    
    if d.count>=d.max or d.targ==null then 
        call d.destroy()
    endif
endfunction
private function Actions takes nothing returns nothing
    local data d = data.create()
    local real ang = GetRandomReal(1., 360.)*bj_DEGTORAD
    local real off = GetRandomReal(0., 85.)+100.
    
    set d.u = GetTriggerUnit()
    set d.targ = GetSpellTargetUnit()
    set d.p = GetOwningPlayer(d.u)
    set d.fx = AddSpecialEffectTarget(CasterFX, d.u, CasterAttachPoint)
    set d.lvl = GetUnitAbilityLevel(d.u,AbilId)
    set d.max = MaxSlashes(d.lvl)
    set d.aoe = TargetAoE(d.lvl)
    set d.t = NewTimer()

    call SetUnitInvulnerable(d.u, true)
    call SetUnitVertexColor(d.u, 255, 255, 255, 100)
    if GetLocalPlayer()==d.p then
        call SelectUnit(d.u, false)
    endif
    call GroupAddUnit(OmniGroup,d.u)
    call DoSlash(d,ang,off)

    call SetTimerData(d.t,d)
    call TimerStart(d.t, TimerInterval, true, function Effects)
endfunction

private function SpellConditions takes nothing returns boolean
    if GetSpellAbilityId() == AbilId then
        call Actions()
    endif
    return false
endfunction
private function SelectConditions takes nothing returns boolean
    if IsUnitInGroup(GetTriggerUnit(),OmniGroup) and GetLocalPlayer()==GetOwningPlayer(GetTriggerUnit()) then
        call SelectUnit(GetTriggerUnit(),false)
    endif
    return false
endfunction
private function Init takes nothing returns nothing
    local trigger t1 = CreateTrigger()
    local trigger t2 = CreateTrigger()
    local integer i = 0
    
    loop
        exitwhen i>bj_MAX_PLAYERS
        call TriggerRegisterPlayerUnitEvent(t1,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
        call TriggerRegisterPlayerUnitEvent(t2,Player(i),EVENT_PLAYER_UNIT_SELECTED,null)
        set i = i + 1
    endloop
    call TriggerAddCondition(t1, Condition( function SpellConditions ))
    call TriggerAddCondition(t2, Condition( function SelectConditions ))
    set B = Condition(function Filt)
    call Preload(BlinkFX)
    call Preload(CasterFX)
endfunction

endscope

OnDamage:
JASS:
scope OnDamageOmnislash initializer Init

globals
    private constant integer AbilId = 'A000'
    private constant integer AttackSpeedId = 'A001'
    private constant real TimerInterval = 1.5
    private constant string BlinkFX = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
    private constant string CasterAttachPoint = "weapon"
    private constant string CasterFX = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl"
endglobals
private constant function MaxSlashes takes integer lvl returns integer
    if lvl<3 then
        return 1+2*lvl
    else
        return 8
    endif
endfunction
private constant function TargetAoE takes integer lvl returns real
    return 475.
endfunction
private constant function TargetBoolean takes unit caster, unit target returns boolean
    return true
endfunction

//== No touching past this point ==\\
private keyword data
globals
    private group G = CreateGroup()
    private group OmniGroup = CreateGroup()
    private unit Targ
    private boolexpr B
    private integer I
    private data array D
endglobals
private struct data
    unit u
    unit targ
    player p
    effect fx
    timer t
    integer lvl
    integer count = 1
    integer max
    real aoe
    
    method onDestroy takes nothing returns nothing
        call UnitRemoveAbility(.u,AttackSpeedId)
        call DestroyEffect(.fx)
        call ReleaseTimer(.t)
        call SetUnitInvulnerable(.u,false)
        call SetUnitVertexColor(.u,255,255,255,255)
        call GroupRemoveUnit(OmniGroup,.u)
        call SelectUnit(.u, GetLocalPlayer()==.p)
    endmethod
endstruct

private function Filt takes nothing returns boolean
    local data d = I
    
    set Targ = GetFilterUnit()    
    if TargetBoolean(d.u,Targ) and IsUnitEnemy(Targ,d.p) and GetWidgetLife(Targ)>.405 and IsUnitType(Targ,UNIT_TYPE_STRUCTURE)==false and IsUnitType(Targ,UNIT_TYPE_MAGIC_IMMUNE)==false and not IsUnitHidden(Targ) then
        return true
    endif
    return false
endfunction
private function DoSlash takes data d, real ang, real off returns nothing
    call SetUnitPosition(d.u,GetUnitX(d.targ)+off*Cos(ang),GetUnitY(d.targ)+off*Sin(ang))
    call DestroyEffect(AddSpecialEffectTarget(BlinkFX, d.u, "chest"))
    call IssueTargetOrder(d.u,"attack",d.targ)
endfunction
private function Effects takes nothing returns nothing
    local data d = GetTimerData(GetExpiredTimer())
    
    set d.count = d.count + 1
    call GroupClear(G)
    set I = d
    call GroupEnumUnitsInRange(G,GetUnitX(d.u),GetUnitY(d.u),d.aoe,B)
    set d.targ = FirstOfGroup(G)
    if d.targ!=null then
        call DoSlash(d,GetRandomReal(1., 360.)*bj_DEGTORAD,GetRandomReal(0., 85.)+100.)
    endif
    
    if d.count>=d.max or d.targ==null then 
        call d.destroy()
    endif
endfunction
private function Actions takes nothing returns nothing
    local data d = data.create()
    local real ang = GetRandomReal(1., 360.)*bj_DEGTORAD
    local real off = GetRandomReal(0., 85.)+100.
    
    set d.u = GetTriggerUnit()
    set d.targ = GetSpellTargetUnit()
    set d.p = GetOwningPlayer(d.u)
    set d.fx = AddSpecialEffectTarget(CasterFX, d.u, CasterAttachPoint)
    set d.lvl = GetUnitAbilityLevel(d.u,AbilId)
    set d.max = MaxSlashes(d.lvl)
    set d.aoe = TargetAoE(d.lvl)
    set d.t = NewTimer()

    set D[GetHandleId(d.u)-0x100000] = d
    call UnitAddAbility(d.u,AttackSpeedId)
    call SetUnitInvulnerable(d.u, true)
    call SetUnitVertexColor(d.u, 255, 255, 255, 100)
    if GetLocalPlayer()==d.p then
        call SelectUnit(d.u, false)
    endif
    call GroupAddUnit(OmniGroup,d.u)
    call DoSlash(d,ang,off)

    call SetTimerData(d.t,d)
    call TimerStart(d.t, TimerInterval, false, function Effects)
endfunction

private function DamageDone takes nothing returns nothing
    local data d = D[GetHandleId(GetTriggerDamageSource())-0x100000]
    
    call PauseTimer(d.t)
    call TimerStart(d.t,0.,false,function Effects)
endfunction

private function SpellConditions takes nothing returns boolean
    if GetSpellAbilityId() == AbilId then
        call Actions()
    endif
    return false
endfunction
private function SelectConditions takes nothing returns boolean
    if IsUnitInGroup(GetTriggerUnit(),OmniGroup) and GetLocalPlayer()==GetOwningPlayer(GetTriggerUnit()) then
        call SelectUnit(GetTriggerUnit(),false)
    endif
    return false
endfunction
private function DamageConditions takes nothing returns boolean
    if IsUnitInGroup(GetTriggerDamageSource(),OmniGroup) then
        call DamageDone()
    endif
    return false
endfunction
private function Init takes nothing returns nothing
    local trigger t1 = CreateTrigger()
    local trigger t2 = CreateTrigger()
    local trigger t3 = CreateTrigger()
    local integer i = 0
    
    loop
        exitwhen i>bj_MAX_PLAYERS
        call TriggerRegisterPlayerUnitEvent(t1,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
        call TriggerRegisterPlayerUnitEvent(t2,Player(i),EVENT_PLAYER_UNIT_SELECTED,null)
        set i = i + 1
    endloop
    call TriggerRegisterDamageEvent(t3,1)
    call TriggerAddCondition(t1, Condition( function SpellConditions ))
    call TriggerAddCondition(t2, Condition( function SelectConditions ))
    call TriggerAddCondition(t3, Condition( function DamageConditions ))
    set B = Condition(function Filt)
    call Preload(BlinkFX)
    call Preload(CasterFX)
endfunction

endscope


Updates:
1.03
  • Ported to patch 1.24+
1.02
  • Minor code updates
1.01
  • Changed configurable functions to constants where applicable
 

Attachments

  • omni.jpg
    omni.jpg
    69.3 KB · Views: 470
  • Omnislash v1.03.w3x
    162.9 KB · Views: 281

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Nice i like:D does the ondamage omnislash also take damage bonus as well:confused:
 

emjlr3

Change can be a good thing
Reaction score
395
the hero attacks its targets - any and all bonuses are carried over along with the attack
 

Viikuna

No Marlo no game.
Reaction score
265
That onDamage omnislash looks pretty neat.

Just one thing:

JASS:
set d.targ = FirstOfGroup(G)


I think you should use somekind of get random unit from group function, because FirstOfGroup is not really so random, if I remember correctly.

( There was some thread in wc3c about this, if my memory serves me right. Grouping order is affected by units handle id or something and preplaced units tend to get picked before other and stuff like that )

It would kinda suck, if your hero gets slashed more than some other guys hero, because of some silly stuff like that.
 

emjlr3

Change can be a good thing
Reaction score
395
I think the results were inconclusive - unless you can link to something I haven't read

I clearly stated why I released this - read the damn thread topic post
 

Romek

Super Moderator
Reaction score
964

Jesus4Lyf

Good Idea™
Reaction score
397
JASS:
private function TargetBoolean takes unit caster, unit target returns boolean

I think this one needs a more descriptive name. I don't know what it does.

Also, all the config functions should be constant functions. Constant functions are functions which don't change anything - they state of the game before calling it is the same as the state after. :)

Haven't actually seen the spell, but I do remember where the Omnislash spells are in case I ever want to see what makes them tick. So thanks. Looks good. :)
 

emjlr3

Change can be a good thing
Reaction score
395
I dont think they can be

return 50. can be constant
return lvl*50/3. can't, I think, maybe it can
 

emjlr3

Change can be a good thing
Reaction score
395
added links to required systems

also changed configurable functions to constants where applicable
 

emjlr3

Change can be a good thing
Reaction score
395
BUMP, if no objections, I will approve it
 

Romek

Super Moderator
Reaction score
964
JASS:
 //
        if GetLocalPlayer()==.p then
            call SelectUnit(.u, true)
        endif

Could be:
JASS:
            call SelectUnit(.u, GetLocalPlayer()==.p)


In 'Filt', how about using a global, temporary variable instead of a local? That simple filter function looks horrible because of the nulling. :p

JASS:
private function SelectConditions takes nothing returns boolean
    if IsUnitInGroup(GetTriggerUnit(),OmniGroup) then
        if GetLocalPlayer()==GetOwningPlayer(GetTriggerUnit()) then
            call SelectUnit(GetTriggerUnit(),false)
        endif
    endif
    return false
endfunction

Could be:
JASS:
private function SelectConditions takes nothing returns boolean
    if IsUnitInGroup(GetTriggerUnit(),OmniGroup) and GetLocalPlayer()==GetOwningPlayer(GetTriggerUnit()) then
        call SelectUnit(GetTriggerUnit(),false)
    endif
    return false
endfunction

I don't think inlining the 'if' would work well here. It'd be long, and it'd select the unit if the conditions aren't matched.
 

emjlr3

Change can be a good thing
Reaction score
395
updated and approved
 

emjlr3

Change can be a good thing
Reaction score
395
its been reviewed twice, and Romeks latest was menial, i made the requested changes and approved, whats the problem with removing some of the burden from other mods?
 

DubDub

New Member
Reaction score
0
I can't play the demo-map. Testing it just sends me to the menu screen. Is the problem with TimeUtils? I read that there's a new table (3.0), and I'm wondering if swapping out the old one with the new one will help solve the problem. :) I'm hoping it's that simple.
 

Viikuna

No Marlo no game.
Reaction score
265
Yep. Updating Table and TimerUtils should do the job.

The spell code itself should work in new patch, Its just these data storage utilies that have to be updated.
 

Sim

Forum Administrator
Staff member
Reaction score
534
Thanks!

Naturally, if the author is to fix these spells, they will most probably be approved once again!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • 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

      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