Spell Kamikaze Slash

Magoiche

Member
Reaction score
20
Kamikaze Slash v1.3
by Magoiche



GUI/JASS: vJASS
MUI/MPI: MUI and MPI
Leakless?: Yep
Lagless?: Yep
Requirements: NewGen
Import Difficult: Medium

Description: The caster enters in a milesecond of frenzy hiting the enemy with all its power. The hit is so powerfull that even the caster receives damage.

Level 1 - The caster receives 15% of the target current HP in damage and the target receives the same damage plus 5% of the caster current HP.
Level 2 - The caster receives 30% of the target current HP in damage and the target receives the same damage plus 10% of the caster current HP.
Level 3 - The caster receives 45% of the target current HP in damage and the target receives the same damage plus 15% of the caster current HP.
Level 4 - The caster receives 60% of the target current HP in damage and the target receives the same damage plus 20% of the caster current HP.


Screenshots:
kamikazeslashuv0.jpg

Code:
JASS:

//////////////////////////////////////////////
////            Kamikaze Slash            ////
////          by Magoiche Saika           ////
//////////////////////////////////////////////
////NOTE: Everything that you can't change////
////       in this script you can in the  ////
////              Object Editor.          ////
//////////////////////////////////////////////

scope KamikazeSlash initializer Initial

globals
    private constant integer KamikazeSlashRawData = 'A000'
    // Raw Data of the Kamikaze Slash spell
    private constant real TargetHPPercentage = 0.15
    // Percentage of HP per Spell Level that damages the Caster
    private constant real CasterHPPercentage = 0.05
    // Percentage of the Caster current HP that is added to the Damage for the Caster
    private constant attacktype KamikazeSlashAttackType = ATTACK_TYPE_HERO
    // Attack Type of the spell
    private constant damagetype KamikazeSlashDamageType = DAMAGE_TYPE_NORMAL
    // Damage Type of the spell
    private constant weapontype KamikazeSlashWeaponType = null
    // Weapon Type of the spell
    private constant string KamikazeSlashEffectsAttachmentPoint = "chest"
    // Attachment Point for the effects
    private constant integer KamikazeSlashNumberOfEffects = 4
    // Number of Active Effects
    private string array KamikazeSlashEffects
    // Dont Change the Line Above please
endglobals

private function Effects takes nothing returns nothing
    set KamikazeSlashEffects[0] = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
    set KamikazeSlashEffects[1] = "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl"
    set KamikazeSlashEffects[2] = "Objects\\Spawnmodels\\Other\\BeastmasterBlood\\BeastmasterBlood.mdl"
    set KamikazeSlashEffects[3] = "Objects\\Spawnmodels\\Orc\\Orcblood\\BattrollBlood.mdl"
endfunction

// To change an effect just change the path. The path is the text
// between the ""
// To implement new effects you have to make a line bellow the line 37,
// the line should be like this: set Effects[4] = "Patch to the Effect"
// then put the number of effects in the Line 27
// REMEMBER: There must be two "\\". If you jsut copy the patch from the
// object editor there will be only one "\" so remember to put two '\\'

// Dont change anything after this line if don't know what you are doing.

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == KamikazeSlashRawData
endfunction

private function Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local unit Target = GetSpellTargetUnit()
    local integer LoopAIndex = 0
    local real HPDamage = TargetHPPercentage * GetUnitAbilityLevel( Caster, KamikazeSlashRawData ) * GetWidgetLife( Target )
    call UnitDamageTarget( Caster, Caster, HPDamage, true, false, KamikazeSlashAttackType, KamikazeSlashDamageType, KamikazeSlashWeaponType )
    set HPDamage = HPDamage + ( CasterHPPercentage * GetUnitAbilityLevel( Caster, KamikazeSlashRawData ) ) * GetWidgetLife( Caster )
    call UnitDamageTarget( Caster, Target, HPDamage, true, false, KamikazeSlashAttackType, KamikazeSlashDamageType, KamikazeSlashWeaponType )
    loop
        exitwhen LoopAIndex > KamikazeSlashNumberOfEffects
        call DestroyEffect( AddSpecialEffectTarget( KamikazeSlashEffects[LoopAIndex], Caster, KamikazeSlashEffectsAttachmentPoint ) )
        call DestroyEffect( AddSpecialEffectTarget( KamikazeSlashEffects[LoopAIndex], Target, KamikazeSlashEffectsAttachmentPoint ) )
        set LoopAIndex = LoopAIndex + 1
    endloop
    set Caster = null
    set Target = null
endfunction

private function Initial takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call Effects()
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
    set trig = null
endfunction

endscope


Changelog
v1.0 - Created and Submited the Spell
v1.1 - Made the spell more configurable
v1.2 - Made the spell even more configurable and removed some leaks
v1.3 - Enhanced the spell. Special thanks to Romek

Instructions of how to import inside the map!​
 

Vestras

Retired
Reaction score
248
The fx should be configurable.
Maybe weapontype too?

Else, good job, can't see anything bad.
 

Magoiche

Member
Reaction score
20
How could i say?...
The spell is based on Storm Bolt and its have the Meat Wagon Missle.
When you cast the spell you will hear something like a "Flesh Explosion"
So it will be weird if there is another sound.
At least i think it will be.
But anyway. I WILL DO IT! ò.ó

EDIT: Added v1.1
 
Reaction score
91
> hiting the enemies
That was a bit misleading - I thought it was an Omnislash-type ability (if you know what I mean).

>
JASS:

    set Effect[0] = FirstEffect
    set Effect[1] = SecondEffect
    set Effect[2] = ThirdEffect
    set Effect[3] = FourthEffect

and
>
JASS:

   private constant integer NumberOfEffects = 4

What if I would want to add two effects more? Then I have to put myself "FifthEffect" and "Sixth Effect" and edit the array Effect to suit my needs. You could add this to the configuration somehow to make things a lot more easier. And, I think you aren't using NumberOfEffects anywhere (or I'm blind).

Other than that, good spell. :) +rep
 

Romek

Super Moderator
Reaction score
963
You could set those 'Effects' at map init, so you don't do it every time the function runs.
And those aren't fully configurable.

> exitwhen LoopAIndex >= NumberOfEffects - 1
exitwhen LoopAIndex > NumberOfEffects

> GetUnitState( Target, UNIT_STATE_LIFE )
GetWidgetLife(Target)

> ...ndex], Caster, "chest" ) )...
Make the "chest" configurable



Also, your variable names don't follow any sort of naming convention.
Constants are usually in ALL CAPS. Locals are usually all small. No caps at all.
 

Magoiche

Member
Reaction score
20
Thanks! +rep

Added v1.2 - Its even more configurable now.

And Romek...

I like the way i call the variables.
I don't have to change its names because one is local and other is global
They all are usefull to the trigger so i name them all the same.
Simple!
 

Romek

Super Moderator
Reaction score
963
I like the way i call the variables.
I don't have to change its names because one is local and other is global
They all are usefull to the trigger so i name them all the same.
Simple!
You'll get muddled up easily like that.
And it's a simple naming convention which people follow for a reason.
It's not just there to annoy people.
When I see a variable in capitals, I assume it's a constant. Same with some capitals (globals) and all lowercase (locals).
Also, if you have 2 variables, a local and global with a common name, the local will get priority, and you might get some annoying bugs. ^_^

Edit:
Why are you setting the Effect array in a different scope?
"Effect" is a very common variable name, and it should definitely be private.

Though this wouldn't be a problem if you just put it into one scope.. o_O
 

Magoiche

Member
Reaction score
20
Searching an translator for muddled.
And... sorry! I didn't say that to botter you. i.i

About the effects.
If i put it in the same scope i will have to set the whole trigger to run on map init.
Or there is no probme about that?

EDIT:

I GET IT!

I just put a call for the stup function on the initializer function.
It worked well. Thanks man!
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      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