Spell Nontarget OmniSlash

Prometheus

Everything is mutable; nothing is sacred
Reaction score
590
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: 540
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.
 
> 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...
 
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 :)
 
> 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.
 
They all have to be constants to comply with the JESP standard.
 
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 ;)
 
No, shiny version has terran effects, not spell related.
non shiny is just some plain dirt =/
 
Then your official spell map is the not-shiny one, and upload it as an attachment.
 
Hence the song, its over 3mb.
Removing song for a totally non shiny version, adding on in a min or 2.
 
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
 
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?
 
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.
 
I needa redue it actually.
Could you change the "Simplified" in that to nontarget?
 
Well then just refer people to this spell :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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