Spell Nontarget OmniSlash

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
Omni Slash - Nontarget​

MUI: Yes
JESP: Yes
Comments/Implement Inst: Yes
Easily Editable: Yes
Import Difficulty: 2/10
Awesome Level: 2/1

WC3ScrnShot_052707_130905_02.jpg


JASS:
scope OmniSlash initializer Init
//Config Header
globals
    private constant integer SpellID = 'A001' //This is the spell code, replace this with your spell's ID.
    private constant real Damage = 50.00 //This is the base amount of damage done to the target.
    private constant real Pause = 0.32 //This is the duration of the pause before the hero teleports again.
    private constant real LockOn = 700.00 //This is the range in which the hero will acquire a target.
    private constant string Anim = "slam" //This is the animation that will be used each time the hero teleports.
endglobals
//At the bottom of this trigger there are a few more things you can customize.
//EndConfigHeader

globals
    private string array Effects
    private integer array AbilLvl
endglobals

private function Living takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0
endfunction

private function OSC takes nothing returns boolean
    return GetSpellAbilityId() == SpellID
endfunction

private function OSA takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local unit target
    
    local integer loopd = 0
    local integer splvl = GetUnitAbilityLevel(caster, SpellID)
    
    local location tarloc
    local location casloc
    local location temp
    
    local group randtarget = CreateGroup()
    
    call PauseUnit(caster, true)
    call SetUnitInvulnerable(caster, true)
    
    loop
    exitwhen loopd == AbilLvl[GetUnitAbilityLevel(caster, SpellID)]
        set casloc = GetUnitLoc(caster)
        
        call GroupEnumUnitsInRangeOfLoc(randtarget, casloc, LockOn, Condition(function Living))
        set target = FirstOfGroup(randtarget) //This picks the unit to attack.
        
        if (target == null) then
            call RemoveLocation(casloc) //Stops the spell if there are no targets around.
            call GroupClear(randtarget)
        endif
        exitwhen target == null
        
        set tarloc = GetUnitLoc(target)
        set temp = PolarProjectionBJ(tarloc, 0.00, GetRandomInt(1, 360))
        
        call SetUnitPositionLoc(caster, temp) //Sets the unit position.
        call SetUnitFacing(caster, AngleBetweenPoints(temp, tarloc)) //Makes the caster face the target.
        call SetUnitAnimation( caster, Anim ) //This is just the attack animation
        call DestroyEffect(AddSpecialEffectTarget(Effects[GetRandomInt(1, 6)], caster, "origin")) //Effect shown on the caster at teleport.
        call DestroyEffect(AddSpecialEffectTarget(Effects[GetRandomInt(1, 6)], target, "origin")) //Effect shown on the target.
        call UnitDamageTarget(caster, target, splvl*Damage, false, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS) //This is what does the damage.
        
        call RemoveLocation(casloc)
        call RemoveLocation(tarloc)
        call RemoveLocation(temp)
        call GroupClear(randtarget)
        call PW(Pause)
        set loopd = loopd + 1
    endloop
    
    call PauseUnit(caster, false)
    call SetUnitInvulnerable(caster, false)
    call DestroyGroup(randtarget)
    
    set caster = null
    set target = null
    set temp = null
    set casloc = null
    set tarloc = null
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    local integer i = 0
    
    set Effects[1] = "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdx" //Model 1 to be displayed.
    set Effects[2] = "Abilities\\Spells\\Human\\Invisibility\\InvisibilityTarget.mdx" //Model 2 to be displayed.
    set Effects[3] = "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdx" //Model 3 to be displayed.
    set Effects[4] = "Abilities\\Spells\\Demon\\ReviveDemon\\ReviveDemon.mdx" //Model 4 to be displayed.
    set Effects[5] = "Abilities\\Spells\\Demon\\DarkPortal\\DarkPortalTarget.mdx" //Model 5 to be displayed.
    set Effects[6] = "Abilities\\Spells\\Human\\Resurrect\\Resurrecttarget.mdx" //Model 6 to be displayed.
    set AbilLvl[1] = 3 //Number of units level one of the spell hits.
    set AbilLvl[2] = 5 //Number of units level two of the spell hits.
    set AbilLvl[3] = 8 //Number of units level three of the spell hits.
    
    loop
    exitwhen i > 15
        call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,Condition(function FailSafe))
        set i = i + 1
    endloop
    
    call TriggerAddCondition(t, Condition( function OSC))
    call TriggerAddAction(t, function OSA)
endfunction

endscope


Code:
Change Log:
1.00 - Released.
1.1 - Code Improved.
1.15 - Accepted.
1.2 - Added Dummies that have a 1 Jump OmniSlash.
1.4 - Implemented Constants.
2.0 - Upgraded to work with globals. Code Improvements. Dummys have been removed. Constants cycled out.
2.2 - Code has been improved. Added new implementation instructions. Cleaned up some useless object data. Updated the tooltip.
2.3 - More errors cleaned out. Got rid of the "Double Free" bug.
3.0 - Further updated code, improved a lot of things.
 

Attachments

  • Omni Slash.w3x
    37.7 KB · Views: 532

elmstfreddie

The Finglonger
Reaction score
203
No time to actually look at it, but I scrolled over the text and noticed something:
a) no constants
b) You said "MUI: I have a wait of about 0.32 seconds, I don't think so.", well you use only locals so that doesn't matter. It is.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
> Numb Encore - Lincoln Park & Jay-Z

Linkin Park. ;)

Code:
Trig_Untitled_Trigger_001_Conditions
Trig_Untitled_Trigger_001_Actions  
deadnoallyno
rm

This is not JESP, sorry, re-read it's rules.

JASS:


A BJ, just check unit's life.

JASS:
 if ( GetUnitAbilityLevelSwapped('A000', caster) == 1 ) then


Why use this useless BJ? Remove Swapped in the function's name and swtich between the arguements' locations. (Goes to the 2 other if / then / else as well)

JASS:

else
        if


There a function call elseif

JASS:
elseif condition then


Pause caster before the loop, why pasue it 8 times when you can do it only once?

JASS:
set target = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(700.00, casloc, Condition(function deadnoallyno)))


Big leak my friend, you crete an undestroyed group.

JASS:
        
set eff1 = AddSpecialEffectTarget(modl, caster, "origin")
set eff2 = AddSpecialEffectTarget(modl, target, "origin")

... 

call DestroyEffect(eff1)
call DestroyEffect(eff2)


You can just do:

JASS:

call DestroyEffect(AddSpecialEffectTarget(modl, caster, "origin"))
call DestroyEffect(AddSpecialEffectTarget(modl, target, "origin"))


Destroy locations inside the loop.

Nice spell, just fix the notes above...
 

Sim

Forum Administrator
Staff member
Reaction score
534
Upload the map here, on this site.

> MUI: I have a wait of about 0.32 seconds, I don't think so.
> JESP: Yup

That's contradictory. A JESP spell needs to be MUI.

Your wait lasts 0.32 seconds times the number of slashes, which is way longer than just 0.32 seconds :p

Anyways, your spell is MUI so it's fine.

P.S. Shiny, not shiny. What's the difference? Make only 1 spell please :)
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
> Numb Encore - Lincoln Park & Jay-Z

Linkin Park. ;)

Code:
Trig_Untitled_Trigger_001_Conditions
Trig_Untitled_Trigger_001_Actions  
deadnoallyno
rm

This is not JESP, sorry, re-read it's rules.

JASS:


A BJ, just check unit's life.

JASS:
 if ( GetUnitAbilityLevelSwapped('A000', caster) == 1 ) then


Why use this useless BJ? Remove Swapped in the function's name and swtich between the arguements' locations. (Goes to the 2 other if / then / else as well)

JASS:
else
        if


There a function call elseif

JASS:
elseif condition then


Pause caster before the loop, why pasue it 8 times when you can do it only once?

JASS:
set target = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(700.00, casloc, Condition(function deadnoallyno)))


Big leak my friend, you crete an undestroyed group.

JASS:
set eff1 = AddSpecialEffectTarget(modl, caster, "origin")
set eff2 = AddSpecialEffectTarget(modl, target, "origin")

... 

call DestroyEffect(eff1)
call DestroyEffect(eff2)


You can just do:

JASS:
call DestroyEffect(AddSpecialEffectTarget(modl, caster, "origin"))
call DestroyEffect(AddSpecialEffectTarget(modl, target, "origin"))


Destroy locations inside the loop.

Nice spell, just fix the notes above...
Done

Upload the map here, on this site.

> MUI: I have a wait of about 0.32 seconds, I don't think so.
> JESP: Yup

That's contradictory. A JESP spell needs to be MUI.

Your wait lasts 0.32 seconds times the number of slashes, which is way longer than just 0.32 seconds :p

Anyways, your spell is MUI so it's fine.

P.S. Shiny, not shiny. What's the difference? Make only 1 spell please :)

Shiny is for people with faster computers as there is a load of effects I threw in for fun.

@Joker(Div)
I can recode it with constants.
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
They all have to be constants to comply with the JESP standard.
 

elmstfreddie

The Finglonger
Reaction score
203
Ah, okay, thanks Daxtreme.
I guess I never saw that since I NEVER go into the spells forum xD

>Shiny is for people with faster computers as there is a load of effects I threw in for fun.
Uhh a part of JESP is to be easily able to edit the effects of the spell, so really it's not required to have a shiny and non shiny version ;)
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
No, shiny version has terran effects, not spell related.
non shiny is just some plain dirt =/
 

Sim

Forum Administrator
Staff member
Reaction score
534
Then your official spell map is the not-shiny one, and upload it as an attachment.
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
Hence the song, its over 3mb.
Removing song for a totally non shiny version, adding on in a min or 2.
 

Sim

Forum Administrator
Staff member
Reaction score
534
Well, there are already 2 other omni-slash spells in the section.

Even if yours is different again, it would be a bit redundant to have 3 in there.

Also, that camera lock is bad. Remove it, doesn't fit in a spell imo :p
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
Okay
Fixed up the trigger some.
Updated the uploaded file.
Bump
2Qs
1. Could you change the title from [JESP] to [Spell] because it seems my spell isin't JESP.
2. Could you delete my omni slash tutorial?
 

Sim

Forum Administrator
Staff member
Reaction score
534
Approved.

> 1. Could you change the title from [JESP] to [Spell] because it seems my spell isin't JESP.

Done.

> 2. Could you delete my omni slash tutorial?

Just because you made this spell? It can still help people.
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
I needa redue it actually.
Could you change the "Simplified" in that to nontarget?
 

Sim

Forum Administrator
Staff member
Reaction score
534
Well then just refer people to this spell :)
 
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