Burning Slash v2

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: gaby-boy
Burning Slash
An Ultimate Spell of Trunks from DBZ Budokai Project .
Information :
Code:
Trunks slashes the opponent multiple times, chopping them up into bits. Finally, Future Trunks draws his hand back and brings it forward to fire a yellow energy wave at the opponent, inflicting a high amount of damage .

It's MUI and leakless , i hope .

Thanks valkemiere for helping me
Credit to people who made these models which i used in my map :)

JASS:
/// HOW TO IMPORT THIS SPELL :
// COPY TRIGGER BURNINGSLASH AND SYSTEM FOLDER
// COPY THE ABILITY "BURNING SLASH" AND COPY THE DUMMIES "BURNING SLASH" INTO YOUR MAP
// THEN CHANGE THE RAW CODE TO THE ABILITY AND THE DUMMIES THAT YOU'VE COPIED
// YOU NEED INSTALL JASSNEWGENPACK 1.5D AND JASSHELPER
// THIS SPELL REQUIRES TIMERUTILS AND XYLIBRARY
// CREDIT TO PEOPLE WHO MADE THESE MODELS THAT I'M USING IN BURNING SLASH MAP

scope burningslash initializer Init

globals
    private constant integer Slash = 'A000' // Ability Code
    private constant integer slash1 = 'h000' // Dummy Code
    private constant integer slash2 = 'h001' // Dummy Code
    private constant integer slash3 = 'h002' // Dummy Code
    private constant integer slash4 = 'h003' // Dummy Code
    private constant string a1 = "attack"
    private constant string a2 = "spell slam swim"
    private constant string a3 = "spell"
    private constant string a4 = "death"
    private constant string at1 = "weapon" // Attachment point
    private constant string at2 = "chest" // Attachment point
    private constant string at3 = "origin"
    private constant string SFX = "HolyPhoenixFire.mdx" // SFX on weapon
    private constant string SFX2 = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdx" // SFX on target
    private constant string SFX3 = "RandomSlash.mdl" // SFX on dummy
    private constant string SFX4 = "poweraura.MDX" // SFX on caster
    private constant attacktype ATT = ATTACK_TYPE_NORMAL
    private constant damagetype DAT = DAMAGE_TYPE_NORMAL
    private constant weapontype WEP = WEAPON_TYPE_WHOKNOWS
    private constant real DummyScale = 3
    private constant real CasterSpeed = 5 // Caster's Speed
    private constant real Period = 0.04 // Timer
    private integer TEMPINT
endglobals

private struct bs
    unit trunks
    unit target
    real angle
    real damage
    real fdamage
    real time
    real scale
    effect e
    effect e2
    integer random
    integer tick
    integer lvl
endstruct

private struct bs2
    unit trunks
    unit target
    unit s2
    unit s3
    real angle
    real damage
    real fdamage
    integer tick
    integer lvl
endstruct

private function SlashC takes nothing returns boolean // Check the ability
    return GetSpellAbilityId() == Slash
endfunction

private function SlashD takes integer lvl returns real // Damage per slash
    return lvl * 16.
endfunction

private function SlashF takes integer lvl returns real // Damage at last
    return lvl * 40.
endfunction

private function SlashK takes nothing returns nothing
    local timer ti2 = GetExpiredTimer()
    local bs2 data = GetTimerData(ti2)
    local unit s2
    local unit s4
    local real x = GetUnitX(data.s2)
    local real y = GetUnitY(data.s2)
    local real xx = GetPPX(x,80,data.angle)
    local real yy = GetPPY(y,80,data.angle)
    call SetUnitX(data.s2,xx)
    call SetUnitY(data.s2,yy)
    set s2 = CreateUnit(GetOwningPlayer(data.trunks),slash2,x,y,data.angle)
    call SetUnitZ(s2,150)
    call SetUnitScale(s2,DummyScale,DummyScale,DummyScale)
    call SetUnitPathing(s2,false)
    call UnitApplyTimedLife(s2,'BLTF',2)
    set s4 = CreateUnit(GetOwningPlayer(data.trunks),slash4,x,y,data.angle)
    call SetUnitScale(s4,DummyScale,DummyScale,DummyScale)
    call SetUnitPathing(s4,false)
    call UnitApplyTimedLife(s4,'BLTF',2)
    
    call UnitDamageTarget(data.trunks,data.target,data.fdamage,false,false,ATT,DAT,WEP)
    
    set data.tick = data.tick - 1
    if data.tick <= 0 or IsUnitType(data.trunks,UNIT_TYPE_DEAD) or IsUnitType(data.target,UNIT_TYPE_DEAD) then
        call KillUnit(data.s2)
        call KillUnit(data.s3)
        call ShowUnit(data.s3,false)
        call PauseUnit(data.trunks,false)
        call PauseUnit(data.target,false)
        call ReleaseTimer(ti2)
        call data.destroy()
    endif
    
    set s2 = null
    set s4 = null
endfunction

private function SlashT takes nothing returns nothing
    local timer ti = GetExpiredTimer()
    local timer ti2
    local bs d = GetTimerData(ti)
    local bs2 data
    local real x = GetUnitX(d.target)
    local real y = GetUnitY(d.target)
    local unit s1
    local unit s2
    local unit s3
    set d.scale = GetRandomReal(0.2,1.2)
    set s1 = CreateUnit(GetOwningPlayer(d.trunks),slash1,x,y,GetRandomReal(0,360))
    call UnitApplyTimedLife(s1,'BLTF',1.)
    call SetUnitScale(s1,d.scale,d.scale,d.scale)
    call SetUnitZ(s1,GetRandomReal(0,100))
    call DestroyEffect(AddSpecialEffectTarget(SFX3,s1,at2))
    call SetUnitAnimation(d.target,a4)
    call DestroyEffect(AddSpecialEffectTarget(SFX2,d.target,at2))
    call UnitDamageTarget(d.trunks,d.target,d.damage,false,false,ATT,DAT,WEP)
    
    set d.random = GetRandomInt(1,3) + 1
    if d.random == 1 then
        call SetUnitAnimation(d.trunks,a1)
    else
        if d.random == 2 then
            call SetUnitAnimation(d.trunks,a2)
        else
            if d.random == 3 then
                call SetUnitAnimation(d.trunks,a1)
            endif
        endif
    endif
    
    set d.time = d.time + Period
    if d.time >= 3 then
        set s2 = CreateUnit(GetOwningPlayer(d.trunks),slash2,GetUnitX(d.target),GetUnitY(d.target),d.angle)
        set s3 = CreateUnit(GetOwningPlayer(d.trunks),slash3,GetUnitX(d.target),GetUnitY(d.target),d.angle-180)
        call SetUnitZ(s2,150)
        call SetUnitZ(s3,200)
        call SetUnitPathing(s2,false)
        call SetUnitPathing(s3,false)
        call SetUnitScale(s2,DummyScale,DummyScale,DummyScale)
        call SetUnitScale(s3,DummyScale,DummyScale,DummyScale)
        call SetUnitAnimation(d.trunks,a3)
        call SetUnitTimeScale(d.trunks,1)
        call DestroyEffect(d.e)
        call DestroyEffect(d.e2)
        set data = bs2.create()
        set data.trunks = d.trunks
        set data.target = d.target
        set data.s2 = s2
        set data.s3 = s3
        set data.angle = d.angle
        set data.tick = d.tick
        set data.lvl = d.lvl
        set data.damage = d.damage
        set data.fdamage = d.fdamage
        set ti2 = NewTimer()
        call SetTimerData(ti2,data)
        call TimerStart(ti2,Period,true,function SlashK)
        call ReleaseTimer(ti)
        call d.destroy()
    endif
    
    if IsUnitType(d.trunks,UNIT_TYPE_DEAD) or IsUnitType(d.target,UNIT_TYPE_DEAD) then
        call PauseUnit(d.trunks,false)
        call PauseUnit(d.target,false)
        call SetUnitTimeScale(d.trunks,1)
        call DestroyEffect(d.e)
        call DestroyEffect(d.e2)
        call ReleaseTimer(ti)
        call d.destroy()
    endif
    
    set s1 = null
    set s2 = null
    set s3 = null
endfunction

private function SlashA takes nothing returns nothing
    local timer ti
    local bs d
    local unit c = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()
    local real cx = GetUnitX(c)
    local real cy = GetUnitY(c)
    local real tx = GetUnitX(target)
    local real ty = GetUnitY(target)
    call PauseUnit(c,true)
    call PauseUnit(target,true)
    call SetUnitTimeScale(c,CasterSpeed)
    set d = bs.create()
    set d.trunks = c
    set d.target = target
    set d.angle = AngleXY(cx,cy,tx,ty)
    set d.time = 0
    set d.random = 0
    set d.tick = 25
    set d.e = AddSpecialEffectTarget(SFX,c,at1)
    set d.e2 = AddSpecialEffectTarget(SFX4,c,at3)
    set d.lvl = GetUnitAbilityLevel(d.trunks,Slash)
    set d.damage = SlashD(d.lvl)
    set d.fdamage = SlashF(d.lvl)
    set ti = NewTimer()
    call SetTimerData(ti,d)
    call TimerStart(ti,Period,true,function SlashT)
    set c = null
    set target = null
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(t,function SlashA)
    call TriggerAddCondition(t,Condition(function SlashC))
endfunction    

endscope

Keywords:
DBZ , Budokai , Burning Slash
Contents

Spell Temple (Map)

Reviews
12th Dec 2015 IcemanBo: Too long time as NeedsFix. Rejected. 15:48, 12th Jul 2010 TriggerHappy: Please make all your constant variables in all caps (LIKE_THIS) and give them more descriptive names (or comments).

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long time as NeedsFix. Rejected.

15:48, 12th Jul 2010
TriggerHappy:

Please make all your constant variables in all caps (LIKE_THIS) and give them more descriptive names (or comments).
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
Please use the
PHP:
 [code=jass] [/code]

tags instead of code tags for your code.

Also imports are STRICTLY forbidden in the spell section unless they are really needed.

Edit:

The damage is 2 high, please use normal units and normal damage for testing purposes.
You should use TriggerRegisterAnyUnitEventBj() it no longer leaks.
 
Level 17
Joined
Jun 17, 2007
Messages
1,433
In your Init function, you should initialize a variable and then set it to 0 the next line. Just do it in the same line. However, just use the BJ.
JASS:
local integer index = 0
It's unnecessary to null your local trigger variable.

Almost everything is awkwardly named, which is even more of a problem than it should be, because there is no documentation. Rather than using multiple dummy unit types, use a single dummy unit from xe (http://www.wc3c.net/showthread.php?t=101150). It is also worthwhile to use xefx.

The same initialization problem occurs with your time variable in your SlashA function. Also, you needlessly store the x and y of the caster and target. Instead, just them directly in the parameters.

A similar problem is present in the SlashT function. Instead of
JASS:
set d.random = GetRandomInt(1,4)
set d.random = d.random + 1
use
JASS:
set d.random = GetRandomInt(1,4) + 1
You could preload the effects (and again, the effects need better naming). Use GroupUtils (http://www.wc3c.net/showthread.php?t=104464). The XYLibrary is pretty much useless, and you needlessly convert from degrees to radians.

The SlashD function performs an unneeded operation. It looks like this was intended, but I don't really see a purpose for it.
JASS:
return 400. * lvl * 0.04
can be replaced with
JASS:
return lvl * 16
A bit more configuration would be nice (as well as the much needed documentation). The UnitDamageTarget parameters, the scale, and attachment points could all be configurable.

Much of the spell is awkwardly coded, and it is mainly special effect spam. For now, I will rate it 2/5 (lacking), and vote for disapproval.
 
Last edited:
Level 3
Joined
Nov 13, 2008
Messages
14
Hey, how come the spell is not working for me?

Whenever I ty to save a map with this spell on it I get a syntax error, making the map unplayable, why is this happening?

Am I doing it wrong or what?

you need install Jassnewgenpack 1.5d and jasshelper to save this map and try it

@kingz : i cant get rid all imports because there were many models i needed to make my spell more beautiful
 
Level 2
Joined
Oct 28, 2008
Messages
14
I already have them, I'll provide you with the error so (hopefully) you can help me.

Edit:

//It is dependent on jasshelper's recent inlining optimization in order to perform correctly.
function SetTimerData takes timer t, integer value returns nothing
static if(TimerUtils__USE_HASH_TABLE) then
// new blue
call SaveInteger(TimerUtils__ht,0,GetHandleId(t), value)

Apparently it's a syntax error, it happens when I try to save a map with the "system" folder, what's wrong?
 
Comeon THW users! I haven't seen any good spell this week.... What have happenend to everyone? Make something MUI & LEAKLESS & NICE SFX & REALISTIC! This one had nice SFX but i still dont like the name, and the propose of it.

well it might be good looking and mui and leakless but they want the code to be as clean as possible and the globals to be easily editable/understandable... if you're just a user you won't care about those things but for triggerers those points are important...
 
Top