Spell Burning Slash

tuantai120

Cool Member
Reaction score
1
An Ultimate Spell of Trunks from DBZ Budokai Project .

Type : vJass - MUI - leakless
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 requires JNGP 1.5d and Jasshelper

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

Screenshot :

Code :
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'
    private constant integer slash1 = 'h000'
    private constant integer slash2 = 'h001'
    private constant integer slash3 = 'h002'
    private constant integer slash4 = 'h003'
    private constant string a1 = "attack"
    private constant string a2 = "spell slam swim"
    private constant string SFX = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdx"
    private constant string SFX2 = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdx"
    private constant string SFX3 = "RandomSlash.mdl"
    private constant real Period = 0.04
    private integer TEMPINT
endglobals

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

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

private function SlashC takes nothing returns boolean
    return GetSpellAbilityId() == Slash
endfunction

private function SlashD takes integer lvl returns real
    return lvl * 16.
endfunction

private function SlashF takes nothing returns boolean
    local unit f = GetFilterUnit()
    local bs2 data = TEMPINT
    local boolean ok = false
    if  not IsUnitType( f, UNIT_TYPE_DEAD ) /*
  */and     IsUnitType( f, UNIT_TYPE_GROUND ) /*
  */and not IsUnitType( f, UNIT_TYPE_MAGIC_IMMUNE ) /*
  */and not IsUnitType( f, UNIT_TYPE_STRUCTURE ) /*
  */and     IsUnitVisible( f, GetOwningPlayer( data.trunks ) ) /*
  */and not IsUnitInGroup(f,data.g) /*
  */and     IsUnitEnemy( f, GetOwningPlayer( data.trunks ) ) then
        set ok = true
    endif
    set f = null
    return ok
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,3,3,3)
    call SetUnitPathing(s2,false)
    call UnitApplyTimedLife(s2,'BLTF',2)
    set s4 = CreateUnit(GetOwningPlayer(data.trunks),slash4,x,y,data.angle)
    call SetUnitScale(s4,3,3,3)
    call SetUnitPathing(s4,false)
    call UnitApplyTimedLife(s4,'BLTF',2)
    
    call UnitDamageTarget(data.trunks,data.target,40 * data.lvl,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
    set TEMPINT = data
    call GroupAddUnit(data.g,data.target)
    
    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 DestroyGroup(data.g)
        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 s1 = CreateUnit(GetOwningPlayer(d.trunks),slash1,x,y,GetRandomReal(0,360))
    call UnitApplyTimedLife(s1,'BLTF',1.)
    call SetUnitScale(s1,GetRandomReal(0.1,1.3),GetRandomReal(0.1,1.3),GetRandomReal(0.1,1.3))
    call SetUnitZ(s1,GetRandomReal(0,100))
    call DestroyEffect(AddSpecialEffectTarget(SFX3,s1,"chest"))
    call SetUnitAnimation(d.target,"death")
    call DestroyEffect(AddSpecialEffectTarget(SFX2,d.target,"chest"))
    call UnitDamageTarget(d.trunks,d.target,d.damage,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null)
    
    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,3,3,3)
        call SetUnitScale(s3,3,3,3)
        call SetUnitAnimation(d.trunks,"spell")
        call SetUnitTimeScale(d.trunks,1)
        call DestroyEffect(d.e)
        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.g = CreateGroup()
        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 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,3)
    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,"weapon")
    set d.lvl = GetUnitAbilityLevel(d.trunks,Slash)
    set d.damage = SlashD(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
 

Attachments

  • Burning Slash.w3x
    170 KB · Views: 340

Laiev

Hey Listen!!
Reaction score
188
JASS:
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)
    local real angle = AngleXY(cx,cy,tx,ty)
    local effect e = AddSpecialEffectTarget(SFX,c,"weapon")
    call PauseUnit(c,true)
    call PauseUnit(target,true)
    call SetUnitTimeScale(c,3)
    set d = bs.create()
    set d.trunks = c
    set d.target = target
    set d.angle = angle
    set d.time = 0
    set d.random = 0
    set d.tick = 25
    set d.e = e
    set d.lvl = GetUnitAbilityLevel(d.trunks,Slash)
    set d.damage = SlashD(d.lvl)
    set ti = NewTimer()
    call SetTimerData(ti,d)
    call TimerStart(ti,Period,true,function SlashT)
    set c = null
    set target = null
endfunction


>>

JASS:
private function SlashA takes nothing returns nothing
    local timer ti = NewTimer()
    local bs d = bd.create()
    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,3)
    
    set d.trunks = GetTriggerUnit()
    set d.target = GetSpellTargetUnit()
    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,"weapon")
    set d.lvl = GetUnitAbilityLevel(d.trunks,Slash)
    set d.damage = SlashD(d.lvl)
    
    call SetTimerData(ti,d)
    call TimerStart(ti,Period,true,function SlashT)
    
    set c = null
    set target = null
endfunction
 

hgkjfhfdsj

Active Member
Reaction score
55
, fixed the code
still there :p (no need locals in SlashA)

- better to use the [ljass]native UnitAlive[/ljass] than unit type dead
- why is d.random a struct member?
JASS:
    
// --
    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
// ->
    if d.random == 1 or d.random == 3  then
        call SetUnitAnimation(d.trunks,a1)
    else  
        call SetUnitAnimation(d.trunks,a2)
    endif


- 2 struct types with nearly the same members? just add the 4 members from the 2nd to the first then pass the same data rather than creating/transferring a new one etc
- [ljass]local real xx [/ljass] can be inlined. same with yy
- maybe make s2 & s3 an array? (halving the max instances wont hurt). so that you dont need to c&p the exact same thing for both units, + it looks cleaner
- make TEMPINT a global struct rather than integer so that it can use struct syntax and remove the need of that local bs2
-
JASS:
//--
    if data.tick <= 0 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 DestroyGroup(data.g)
        call ReleaseTimer(ti2)
        call data.destroy()
    endif
    
    if 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 DestroyGroup(data.g)
        call ReleaseTimer(ti2)
        call data.destroy()
// ->
    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 DestroyGroup(data.g)
        call ReleaseTimer(ti2)
        call data.destroy()
    endif


ive picked these up so far..as for the aesthetic / overall, looks prettyy neat :thup: perhaps a description of the spell? (had to test the spell to know what the spell actually did)
 

BlackRose

Forum User
Reaction score
239
// HOW TO IMPORT THIS SPELL :
// COPY THE ABILITY "BURNING SLASH" AND COPY THE DUMMIES "BURNING SLASH" INTO YOUR MAP
// THEN CHANGE THE RAW CODE FOR THE ABILITY AND THE DUMMIES THAT YOU'VE COPIED
// YOU NEED INSTALL JASSNEWGENPACK 1.5D AND JASSHELPER
// CREDIT TO PEOPLE WHO MADE THESE MODELS THAT I'M USING IN BURNING SLASH MAP

Capitals are eyeburning to read for the header, also, it's "CHANGE THE RAWCODE TO"... you need the TO.

Why the all lowercase scope name? burningslash? BurningSlash sounds nice.

You use TimerUtils, but I don't see any recognition of it on the post, or on the thread. Link it and place it in the header, or have a commented out [ljass]//requires TimerUtils[/ljass]

Describing globals are nice... what is TEMPINT? Am I mean't to modify it?

JASS:
private function SlashF takes nothing returns boolean
    local unit f = GetFilterUnit()
    local bs2 data = TEMPINT
    local boolean ok = false
    if  not IsUnitType( f, UNIT_TYPE_DEAD ) /*
  */and     IsUnitType( f, UNIT_TYPE_GROUND ) /*
  */and not IsUnitType( f, UNIT_TYPE_MAGIC_IMMUNE ) /*
  */and not IsUnitType( f, UNIT_TYPE_STRUCTURE ) /*
  */and     IsUnitVisible( f, GetOwningPlayer( data.trunks ) ) /*
  */and not IsUnitInGroup(f,data.g) /*
  */and     IsUnitEnemy( f, GetOwningPlayer( data.trunks ) ) then
        set ok = true
    endif
    set f = null
    return ok
endfunction


Why not just a return true/false. Instead of 'return ok'.

I can't seem to find AngleXY, SetUnitZ, PPX, or PPY function's anywhere in the post. I would ditch them and just figure all the functions out yourself in the code or paste them into the script.

I see hardcoded things everywhere, effect strings, integers.

You can inline the conditions with the actions.

Just so you know, this isn't everything. Just what I see.
 

tuantai120

Cool Member
Reaction score
1
i'm so sorry :(
because this is the first time i post my map in here :D
thanks for advising me of my code , i will fix it again :)

JASS:
// --
    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
// ->
    if d.random == 1 or d.random == 3  then
        call SetUnitAnimation(d.trunks,a1)
    else  
        call SetUnitAnimation(d.trunks,a2)
    endif


my code is ok :thup:
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
JASS:
library BurningSlash requires T32, GT, KT, optional GroupUtils

    globals
        private constant integer ABIL_ID = 'A000'
        private constant integer DUMMY_ID = 'h000'
        
        private constant string EXPLODE_EFFECT = "Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl"
        
        private constant string CASTER_ANIMATION = "attack"
        
        private constant string CASTER_ATTACHMENT = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdx"
        private constant string CASTER_ATTACHMENT_POINT = "weapon"
        
        private constant string TARGET_ATTACHMENT = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdx"
        private constant string TARGET_ATTACHMENT_POINT = "chest"
        
        private constant string SPIN_EFFECT = "RandomSlash.mdl"
        
        private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL
        private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL
        private constant weapontype WEAPON_TYPE = WEAPON_TYPE_AXE_MEDIUM_CHOP
    endglobals
    
    private function SlashDuration takes integer lv returns integer
        return 3
    endfunction
    
    private function SlashDamage takes integer lv returns real
        return 10.
    endfunction
    
    private function ExplosionDistance takes integer lv returns real
        return 800.
    endfunction
    
    private function ExplosionDamage takes integer lv returns real
        return 20.
    endfunction
    
    static if not LIBRARY_GroupUtils then
        globals
            private group ENUMGROUP = CreateGroup()
        endglobals
    endif
    
    private struct Data
        private unit cs
        private unit target
        private real cx
        private real cy
        private real tx
        private real ty
        private real angle
        private real damage
        private integer lv
        private integer tick
        private effect csAttach
        private integer status
        private real cos
        private real sin
        private player p
        
        private method onDestroy takes nothing returns nothing
            call DestroyEffect(.csAttach)
            call PauseUnit(.cs,false)
            call PauseUnit(.target,false)
            call SetUnitTimeScale(.cs,1.)
        endmethod
        
        private static thistype dat
        private static method pickUnits takes nothing returns boolean
            local thistype this = thistype.dat
            local unit u = GetFilterUnit()
            if  not IsUnitType( u, UNIT_TYPE_DEAD ) /*
          */and     IsUnitType( u, UNIT_TYPE_GROUND ) /*
          */and not IsUnitType( u, UNIT_TYPE_MAGIC_IMMUNE ) /*
          */and not IsUnitType( u, UNIT_TYPE_STRUCTURE ) /*
          */and     IsUnitVisible( u, .p) /*
          */and     IsUnitEnemy(u, .p) then
                call UnitDamageTarget(.cs,u,.damage,false,false,ATTACK_TYPE,DAMAGE_TYPE,WEAPON_TYPE)
            endif
            set u = null
            return false
        endmethod
        
        private static method createExplosion takes nothing returns boolean
            local thistype this = KT_GetData()
            if .tick > 0 then
                set .tx = .tx + .cos
                set .ty = .ty + .sin
                call DestroyEffect(AddSpecialEffect(EXPLODE_EFFECT,.tx,.ty))
                set thistype.dat = this
                call GroupEnumUnitsInRange(ENUMGROUP,.tx,.ty,80.,Condition(function thistype.pickUnits))
                set .tick = .tick - 1
                return false
            endif
            call .destroy()
            return true
        endmethod
        
        private method periodic takes nothing returns nothing
            if .tick > T32_Tick and GetWidgetLife(.target) > .405 then
                call SetUnitAnimation(.cs,CASTER_ANIMATION)
                call DestroyEffect(AddSpecialEffectTarget(TARGET_ATTACHMENT,.target,TARGET_ATTACHMENT_POINT))
                call UnitDamageTarget(.cs,.target,.damage,false,false,ATTACK_TYPE,DAMAGE_TYPE,WEAPON_TYPE)
            else
                set .cos = 80. * Cos(.angle)
                set .sin = 80. * Sin(.angle)
                set .tick = R2I(ExplosionDistance(.lv)/80.)
                set .damage = ExplosionDamage(.lv)
                call KT_Add(function thistype.createExplosion,this,T32_PERIOD)
                call .stopPeriodic()
            endif
        endmethod
        
        implement T32x
        
        private static method start takes nothing returns boolean
            local thistype this = thistype.allocate()
            
            set .cs = GetTriggerUnit()
            set .target = GetSpellTargetUnit()
            set .cx = GetUnitX(.cs)
            set .cy = GetUnitY(.cs)
            set .tx = GetUnitX(.target)
            set .ty = GetUnitY(.target)
            set .angle = Atan2(.ty-.cy,.tx-.cx)
            set .lv = GetUnitAbilityLevel(.cs,ABIL_ID)
            set .tick = R2I(SlashDuration(.lv)/T32_PERIOD) + T32_Tick
            set .damage = SlashDamage(.lv)
            
            call PauseUnit(.cs,true)
            call PauseUnit(.target,true)
            set .csAttach = AddSpecialEffectTarget(CASTER_ATTACHMENT,.cs,CASTER_ATTACHMENT_POINT)
            call SetUnitTimeScale(.cs,3.)
            
            set .p = GetOwningPlayer(.cs)
            call .startPeriodic()
            return false//For GT =(
        endmethod
        
        private static method onInit takes nothing returns nothing
            call GT_AddStartsEffectAction(function thistype.start,ABIL_ID)
        endmethod
    endstruct
    
endlibrary

This is much better. LOL.
 

tuantai120

Cool Member
Reaction score
1
JASS:

library BurningSlash requires T32, GT, KT, optional GroupUtils

    globals
        private constant integer ABIL_ID = 'A000'
        private constant integer DUMMY_ID = 'h000'
        
        private constant string EXPLODE_EFFECT = "Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl"
        
        private constant string CASTER_ANIMATION = "attack"
        
        private constant string CASTER_ATTACHMENT = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdx"
        private constant string CASTER_ATTACHMENT_POINT = "weapon"
        
        private constant string TARGET_ATTACHMENT = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdx"
        private constant string TARGET_ATTACHMENT_POINT = "chest"
        
        private constant string SPIN_EFFECT = "RandomSlash.mdl"
        
        private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL
        private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL
        private constant weapontype WEAPON_TYPE = WEAPON_TYPE_AXE_MEDIUM_CHOP
    endglobals
    
    private function SlashDuration takes integer lv returns integer
        return 3
    endfunction
    
    private function SlashDamage takes integer lv returns real
        return 10.
    endfunction
    
    private function ExplosionDistance takes integer lv returns real
        return 800.
    endfunction
    
    private function ExplosionDamage takes integer lv returns real
        return 20.
    endfunction
    
    static if not LIBRARY_GroupUtils then
        globals
            private group ENUMGROUP = CreateGroup()
        endglobals
    endif
    
    private struct Data
        private unit cs
        private unit target
        private real cx
        private real cy
        private real tx
        private real ty
        private real angle
        private real damage
        private integer lv
        private integer tick
        private effect csAttach
        private integer status
        private real cos
        private real sin
        private player p
        
        private method onDestroy takes nothing returns nothing
            call DestroyEffect(.csAttach)
            call PauseUnit(.cs,false)
            call PauseUnit(.target,false)
            call SetUnitTimeScale(.cs,1.)
        endmethod
        
        private static thistype dat
        private static method pickUnits takes nothing returns boolean
            local thistype this = thistype.dat
            local unit u = GetFilterUnit()
            if  not IsUnitType( u, UNIT_TYPE_DEAD ) /*
          */and     IsUnitType( u, UNIT_TYPE_GROUND ) /*
          */and not IsUnitType( u, UNIT_TYPE_MAGIC_IMMUNE ) /*
          */and not IsUnitType( u, UNIT_TYPE_STRUCTURE ) /*
          */and     IsUnitVisible( u, .p) /*
          */and     IsUnitEnemy(u, .p) then
                call UnitDamageTarget(.cs,u,.damage,false,false,ATTACK_TYPE,DAMAGE_TYPE,WEAPON_TYPE)
            endif
            set u = null
            return false
        endmethod
        
        private static method createExplosion takes nothing returns boolean
            local thistype this = KT_GetData()
            if .tick > 0 then
                set .tx = .tx + .cos
                set .ty = .ty + .sin
                call DestroyEffect(AddSpecialEffect(EXPLODE_EFFECT,.tx,.ty))
                set thistype.dat = this
                call GroupEnumUnitsInRange(ENUMGROUP,.tx,.ty,80.,Condition(function thistype.pickUnits))
                set .tick = .tick - 1
                return false
            endif
            call .destroy()
            return true
        endmethod
        
        private method periodic takes nothing returns nothing
            if .tick > T32_Tick and GetWidgetLife(.target) > .405 then
                call SetUnitAnimation(.cs,CASTER_ANIMATION)
                call DestroyEffect(AddSpecialEffectTarget(TARGET_ATTACHMENT,.target,TARGET_ATTACHMENT_POINT))
                call UnitDamageTarget(.cs,.target,.damage,false,false,ATTACK_TYPE,DAMAGE_TYPE,WEAPON_TYPE)
            else
                set .cos = 80. * Cos(.angle)
                set .sin = 80. * Sin(.angle)
                set .tick = R2I(ExplosionDistance(.lv)/80.)
                set .damage = ExplosionDamage(.lv)
                call KT_Add(function thistype.createExplosion,this,T32_PERIOD)
                call .stopPeriodic()
            endif
        endmethod
        
        implement T32x
        
        private static method start takes nothing returns boolean
            local thistype this = thistype.allocate()
            
            set .cs = GetTriggerUnit()
            set .target = GetSpellTargetUnit()
            set .cx = GetUnitX(.cs)
            set .cy = GetUnitY(.cs)
            set .tx = GetUnitX(.target)
            set .ty = GetUnitY(.target)
            set .angle = Atan2(.ty-.cy,.tx-.cx)
            set .lv = GetUnitAbilityLevel(.cs,ABIL_ID)
            set .tick = R2I(SlashDuration(.lv)/T32_PERIOD) + T32_Tick
            set .damage = SlashDamage(.lv)
            
            call PauseUnit(.cs,true)
            call PauseUnit(.target,true)
            set .csAttach = AddSpecialEffectTarget(CASTER_ATTACHMENT,.cs,CASTER_ATTACHMENT_POINT)
            call SetUnitTimeScale(.cs,3.)
            
            set .p = GetOwningPlayer(.cs)
            call .startPeriodic()
            return false//For GT =(
        endmethod
        
        private static method onInit takes nothing returns nothing
            call GT_AddStartsEffectAction(function thistype.start,ABIL_ID)
        endmethod
    endstruct
    
endlibrary

This is much better. LOL.

wow , your code is too different than my code @@
 

hgkjfhfdsj

Active Member
Reaction score
55
JASS:
 //maybe 
    if d.random == 1 or d.random == 3  then
        call SetUnitAnimation(d.trunks,a1)
    elseif d.random == 2   
        call SetUnitAnimation(d.trunks,a2)
    endif

JASS:
//
    static if not LIBRARY_GroupUtils then
        globals
            private group ENUMGROUP = CreateGroup()
        endglobals
    endif

i remember romek saying that static ifs dont work outside of methods/functions
 

Laiev

Hey Listen!!
Reaction score
188
>> i remember romek saying that static ifs dont work outside of methods/functions

true
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
i remember romek saying that static ifs dont work outside of methods/functions
I have been using it, it works so far.
 

hgkjfhfdsj

Active Member
Reaction score
55
I have been using it, it works so far.
he also said that the static ifs will just be ignored, meaning the global will be initialized anyway.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
he also said that the static ifs will just be ignored, meaning the global will be initialized anyway.
If Romek is correct, but who cares for 1 group creation? LOL.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
imagine one of those in every spell :O
If I'm the map creator, I shall port the spell to systems in map, but not leaving an optional selection for the spell.
 

Romek

Super Moderator
Reaction score
963
> i remember romek saying that static ifs dont work outside of methods/functions
Not for globals. Everything else seems to work fine in static ifs outside of methods/functions. :p

> I have been using it, it works so far.
It compiles. It doesn't 'work'.

> If Romek is correct, but who cares for 1 group creation? LOL.
That's beyond the point of static if's working or not working.

Also, just a note; when posting 'improved' versions of people's code, be sure to comment on what you changed, and why; rather than expecting them to just use your 'improved' code.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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