[Contest] Official Spell Contest #1

Reaction score
456
>The Hero goes invisible and searchs for an unsuspecting enemy to kill for 5 seconds.
Meaning that the unsuspecting enemy is dead for 5 seconds? :p

Hmm.. I have a problem..
A question infact..
Am I allowed to ask that here..?
It's question about leaks when destroying structures..
So am I still not allowed to ask this question..?
Also when I get the answer, I am able to submit my spell real soon..
Am I allowed to ask it..?

Answer is needed only for the last question by the way.

EDIT://Do not ask me why I wrote it that way..
 

2-P

I will work hard tomorrow
Reaction score
325
>"Can we not just give it an extended cast time and add effects with triggers?"

I doubt it, that's an, well... extended cast time. But not channeling...
 
K

Kibawolf

Guest
Spell Complete
Boomerang
Made in GUI

Changelog
- Boomerang will "bounce" off of unplayable map area.

WOW, I kid you not - This is the COOLEST spell I have ever seen!!

Lol, can you teach me how to do that? I'd love to put that spell in my game. It's freakin' awesome!
 

hell_knight

Playing WoW
Reaction score
126
WOW, I kid you not - This is the COOLEST spell I have ever seen!!

Lol, can you teach me how to do that? I'd love to put that spell in my game. It's freakin' awesome!

In world editor preferences, check Create Unknown Variables, Copy and paste the trigger, copy the dummy unit , copy the ability. Just like any other spell when importing into your map.
 
Reaction score
456
Okay then.. this is quite noobish question, but what ever.

When I destroy structure by .destroy() does it automatically null the variables?
 

emjlr3

Change can be a good thing
Reaction score
395
they are globals, they get re-used, no need to null anything
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>they are globals, they get re-used, no need to null anything
Hm, then I got another stupid questions.
  • I dont need to null every variable(member) in struct?
  • All variable stated in a struct is being converted to global?
  • So to clean structs leak, we just need to remove those loc leak, group leak and etc by RemoveLocation and DestroyGroup. Thats it?
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
And any other local variable leaks you may have occured from that struct's methods.
 

Darkchaoself

What is this i dont even
Reaction score
106
Just saying i'll actually finish my submission, unlike the other 2 contest...heres a teaser of my spell

Lightning
spellcontestfy3.png

Ice
spellcontest2pb3.png

Ice closer
spellcontest3gv7.png

My Spell said:
The Caster will create 2 spheres made of a random element- Fire, Ice, Lightning, Darkness, or Light. The two spheres will circle around the caster for a few seconds, damaging any units they come into contact with. They slowly get closer to the caster, and when the meet, they explode, and do different effects depending on which element they are. There also have been myths about an incredibly strong "Chaos" Sphere, but it is still unknown.

Q&A time!
Q: Can i see the...
A: No
Q: Ur spell sucks d00d
A: I did ask for your opinion?
Q: No...
A: then stfu ;)
Q: *cries*
A: All right that concludes that.

And i just started making about yesterday, and only worked on for around...2 hours. Expect more.


And sorry for dull terrain, its the last of my worries :p
 

Sevion

The DIY Ninja
Reaction score
413
Just saying i'll actually finish my submission, unlike the other 2 contest...heres a teaser of my spell
spellcontestfy3.png



Q&A time!
Q: Can i see the...
A: No
Q: Ur spell sucks d00d
A: I did ask for your opinion?
Q: No...
A: then stfu ;)
Q: *cries*
A: All right that concludes that.

And i just started making about yesterday, and only worked on for around...2 hours. Expect more.


And sorry for dull terrain, its the last of my worries :p

Lolz. That's a lot like my spell (Ion Tempest). :/ Infact.... it's almost exactly like my spell. Only differences is that mine has 6 small spheres that gradually go in and get bigger. When they meet they combine into an atom bomb and totally superwtfpwnage creeps >=D

Also: 1 question
  • Is the "No custom models" rule restricted only to the spell?
Like. Can I use a custom model for the caster? Or is that a big "No, no."
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
Sevion said:
Also: 1 question
  • Is the "No custom models" rule restricted only to the spell?
Like. Can I use a custom model for the caster? Or is that a big "No, no."
That'd be a "No, no".
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
Double-post-code-update. I totally rewrote from scratch:
JASS:
//*******************************************************************
//*                       Start Configuration                       *
//*******************************************************************

constant function GrislyBarrage_AbilityId takes nothing returns integer
    return 'A001'
endfunction

constant function GrislyBarrage_ChannelOrderString takes nothing returns string
    return "stampede" //The base orderstring of the Grisly Barrage spell
endfunction

constant function GrislyBarrage_DummyAbilityId takes nothing returns integer
    return 'A003' //The Dummy Raise Dead ability
endfunction

constant function GrislyBarrage_DummyUnitId takes nothing returns integer
    return 'h000' //The rawcode of the dummy unit
endfunction

constant function GrislyBarrage_CrowFormId takes nothing returns integer
    return 'Amrf' // Medivh's Crow form ability; you don't need to change this rawcode unless you
                  //Modified the ability in your map. In that case copy it, reset the copied one,
                  //And use its rawcode here
endfunction

constant function GrislyBarrage_Duration takes integer Level returns real
    return 11.00+Level //How long the channeling lasts
endfunction

constant function GrislyBarrage_ThrowInterval takes integer Level returns real
    return 1.00 //How often a new corpse is looked for to be thrown
endfunction

constant function GrislyBarrage_Radius takes integer Level returns real
    return 275.00 //The radius of the area at which corpses are thrown
endfunction

constant function GrislyBarrage_LevitateOnCast takes integer Level returns boolean
    return true //If true, this will levitate a corpse immediately upon casting
endfunction

constant function GrislyBarrage_MinCorpseFlyHeight takes integer Level returns real
    return 350.00 //Minimum height corpses will be levitated to
endfunction

constant function GrislyBarrage_MaxCorpseFlyHeight takes integer Level returns real
    return 475.00 //Maximum height corpses will be levitated to
endfunction

constant function GrislyBarrage_TimeToLevitateCorpse takes integer Level returns real
    return 2.00 //How long it takes a corpse to reach its levitate height
endfunction

constant function GrislyBarrage_TopDelay takes integer Level returns real
    return 0.35
endfunction

constant function GrislyBarrage_TimeToMoveCorpseToTarget takes integer Level returns real
    return 1.15
endfunction

constant function GrislyBarrage_Damage takes integer Level returns real
    return 65.00+(20.00*Level)
endfunction

//*******************************************************************
//*                        End Configuration                        *
//*******************************************************************

function GrislyBarrage_CastConditions takes nothing returns boolean     
    return GetSpellAbilityId() == GrislyBarrage_AbilityId()
endfunction

function GrislyBarrage_RaiseDetectCastConditions takes nothing returns boolean     
    return GetSpellAbilityId() == GrislyBarrage_DummyAbilityId()
endfunction

function GrislyBarrage_ThrowCallback takes nothing returns nothing
    local timer T = GetExpiredTimer()

    set T = null
endfunction

function GrislyBarrage_StartThrowCallback takes nothing returns nothing
    local timer T = GetExpiredTimer()
    local integer ArrayIndex = GetCSData(T)

    call BJDebugMsg("Throw Started")

    set T = null
endfunction

function GrislyBarrage_RaiseDetectCast takes nothing returns nothing     
    local unit U = GetTriggerUnit()
    local unit U2 = GetSpellTargetUnit()
    local location L = GetUnitLoc(U2)
    local unit Corpse = CreatePermanentCorpseLocBJ(bj_CORPSETYPE_FLESH, GetUnitTypeId(U2), GetOwningPlayer(U), L, GetUnitFacing(U2))
    local integer OtherArrayIndex = GetCSData(U)
    local integer Level = GetArrayInt(OtherArrayIndex, 5)
    local real Height = GetRandomReal(GrislyBarrage_MinCorpseFlyHeight(Level), GrislyBarrage_MaxCorpseFlyHeight(Level))
    local integer CrowFormId = GrislyBarrage_CrowFormId()
    local real Time = GrislyBarrage_TimeToMoveCorpseToTarget(Level)
    local timer T = CreateTimer()
    local integer ArrayIndex = NewArray(4, true)
    local real Offset = GetRandomReal(0.00, GrislyBarrage_Radius(Level))
    local real Angle = GetRandomReal(0.00, 6.28318)
    local real X = GetUnitX(Corpse)
    local real Y = GetUnitY(Corpse)
    local real TX = GetArrayReal(OtherArrayIndex, 2)+Offset*Cos(Angle)
    local real TY = GetArrayReal(OtherArrayIndex, 3)+Offset*Sin(Angle)

    set Angle = Atan2((TY-Y), (TX-X))
    call SetArrayObject(ArrayIndex, 1, Corpse)
    call SetArrayReal(ArrayIndex, 2, TX)
    call SetArrayReal(ArrayIndex, 3, TX)
    call SetArrayReal(ArrayIndex, 4, GrislyBarrage_Damage(Level))
    call SetCSData(T, ArrayIndex)
    call TimerStart(T, Time+GrislyBarrage_TopDelay(Level), false, function GrislyBarrage_StartThrowCallback)

    set Time = GrislyBarrage_TimeToLevitateCorpse(Level)
    call UnitAddAbility(Corpse, 'Avul')
    call UnitAddAbility(Corpse, CrowFormId)
    call UnitRemoveAbility(Corpse, CrowFormId)
    call SetUnitFlyHeight(Corpse, Height, Height/Time)

    call RemoveLocation(L)
    set L = null
    set U = null
    set U2 = null
    set Corpse = null
    set T = null
endfunction

function GrislyBarrage_MainCallback takes nothing returns nothing
    local timer T = GetExpiredTimer()
    local integer ArrayIndex = GetCSData(T)
    local unit U = GetArrayUnit(ArrayIndex, 1)

    if GetUnitCurrentOrder(U) == OrderId(GrislyBarrage_ChannelOrderString()) then
        call IssueImmediateOrder(GetArrayUnit(ArrayIndex, 4), "instant")
    else
        call BJDebugMsg("Destroyed")
        call RemoveUnit(GetArrayUnit(ArrayIndex, 4))

        call PauseTimer(T)
        call DestroyArray(ArrayIndex)
        call DestroyTimer(T)
    endif

    set T = null
    set U = null    
endfunction

function GrislyBarrage_Cast takes nothing returns nothing
    local unit U = GetTriggerUnit()
    local real X = GetUnitX(U)
    local real Y = GetUnitY(U)
    local location L = GetSpellTargetLoc()
    local real X2 = GetLocationX(L)
    local real Y2 = GetLocationY(L)
    local timer T = CreateTimer()
    local integer Level = GetUnitAbilityLevel(U, GrislyBarrage_AbilityId())
    local unit Dummy = CreateUnit(GetOwningPlayer(U), GrislyBarrage_DummyUnitId(), X, Y, 0.00)
    local integer ArrayIndex = GrislyBarrage_DummyAbilityId()

    call UnitAddAbility(Dummy, ArrayIndex)
    call SetUnitAbilityLevel(Dummy, ArrayIndex, Level)
    call UnitRemoveAbility(Dummy, 'Amov')

    set ArrayIndex = NewArray(7, true)
    call SetArrayObject(ArrayIndex, 1, U)
    call SetArrayReal(ArrayIndex, 2, X2)
    call SetArrayReal(ArrayIndex, 3, Y2)
    call SetArrayObject(ArrayIndex, 4, Dummy)
    call SetArrayInt(ArrayIndex, 5, Level)
    call SetArrayObject(ArrayIndex, 6, T)

    call SetCSData(Dummy, ArrayIndex)
    call SetCSData(T, ArrayIndex)
    call TimerStart(T, GrislyBarrage_ThrowInterval(Level), true, function GrislyBarrage_MainCallback)

    if GrislyBarrage_LevitateOnCast(Level) then
        call IssueImmediateOrder(Dummy, "instant")
    endif

    call RemoveLocation(L)
    set L = null
    set U = null
    set T = null
    set Dummy = null
endfunction

//==========================================================================================
function InitTrig_GrislyBarrage takes nothing returns nothing
    local trigger RaiseDeadDetect = CreateTrigger()

    set gg_trg_GrislyBarrage = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_GrislyBarrage, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_GrislyBarrage, Condition(function GrislyBarrage_CastConditions))
    call TriggerAddAction(gg_trg_GrislyBarrage, function GrislyBarrage_Cast)

    call TriggerRegisterAnyUnitEventBJ(RaiseDeadDetect, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(RaiseDeadDetect, Condition(function GrislyBarrage_RaiseDetectCastConditions))
    call TriggerAddAction(RaiseDeadDetect, function GrislyBarrage_RaiseDetectCast)

    set RaiseDeadDetect = null
endfunction
 
C

Cookie

Guest
Blood Calling

By Cookie

The blood mage calls the blood of enemies with in the targeted
AoE. The damage is dealt periodically, dealing damage according
to their life at the time of cast. Units under the effect of this spell
will also be stunned! :D

The spell is channeling (Hooray!)

Enjoy :D
 

Attachments

  • Blood Calling Test Map, Cookie.w3x
    66.9 KB · Views: 271

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Here's the 3rd WIP of my spell:
JASS:
//!<--Start of my Spell-->!//
scope BunJeeShotStructed

globals
//===================================================
//==                 Configuration                 ==
//===================================================
//-------------------------------------------------------------------------------------
    //<--RawCode-->//
    
    private constant integer BJS_Id = 'A000'        //Rawcode of the main ability.
    private constant integer BJS_TorchId = 'h001'   //Rawcode of the Torch Unit.
    
    //<--End-->//
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------
    //<--Charging Speed-->//
    
    private constant real    BJS_ChargingSpeed = .07
    //This is the charge speed of the charging period. (Channeling Period)
    //The smaller the number, the faster the unit charge.
    
    //<--End-->//
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------
    //<--Rush Speed-->//
    
    private constant real    BJS_RushSpeed = 100.
    //This is the rush speed of the rushing period. (After Channel)
    //The larger the number, the faster it rush. BEWARE: Do not set it larger than 200 or less than 50, LAG warning.
    
    //<--End-->//
//-------------------------------------------------------------------------------------
    //<--Charge Effect-->//
    
    private constant string  BJS_ChargeEffect = "Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl"
    //This is the special effect that will be view when charging.
    
    //<--End-->//
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------
    //<--Lightning Effect-->//
    
    //These are the lightning effect which is act as an elastic string. The level of it is sort by BJS_Lightning<Level>.
    private constant string  BJS_Lightning1 = "MFPB" //Mana Flare
    private constant string  BJS_Lightning2 = "MBUR" //Mana Burn
    private constant string  BJS_Lightning3 = "HWSB" //Healing Wave (Secondary)
    private constant string  BJS_Lightning4 = "SPLK" //Spirit Link
    private constant string  BJS_Lightning5 = "AFOD" //Finger Of Death
    
    //<--End-->//
//-------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------    
    //<--Rush Effect-->//

    private constant string  BJS_RushEffect = "Abilities\\Spells\\Items\\WandOfNeutralization\\NeutralizationMissile.mdl"
    //This is the effect that will be display at whole caster's body when the channeling had finished.
    
    //<--End-->//
//------------------------------------------------------------------------------------- 
//-------------------------------------------------------------------------------------   
    //<--Channel ID-->//
    
    private constant integer ChannelId = 852600
    //Well, this is the raw id for "Channel". Advised to not change this value.
    
    //<--End-->//
//-------------------------------------------------------------------------------------
//===================================================
//==               End Configuration               ==
//===================================================    
    
    
//===================================
//==        Unrelated Items        ==
//===================================
//Comment: These 3 variable are variable that is needed to pass function. Advised to not take any care of them.

    private group DummyDamaged
    private unit  DummyCaster
    private real  DummyDamage
//===================================
//==      Unrelated Items End      ==
//===================================   

endglobals

//========================================================================================
//==                             WARNING! WARNING! WARNING!                             ==
//==                        DO NOT EDIT ANYTHING UNDER THIS LINE!                       ==
//========================================================================================                                                   

//===================================
//==       BunjeeShot Struct       ==
//===================================
private struct BunjeeShot
unit caster
unit array Torch [3]
real TarAngle
real ChannelTotal = 5
real Charged
real DamageOn
real RushDist
real CX
real CY
real TX
real TY

timer t
timer RushT
lightning array Elastic [3]
string LastLightningEffect
string array LightningEffect[6]
group Damaged
    
    static method create takes unit cast, real TarX, real TarY returns BunjeeShot
    local BunjeeShot BJS = BunjeeShot.allocate()
        set BJS.caster = cast           //set caster
        set BJS.TX     = TarX
        set BJS.TY     = TarY
        set BJS.CX     = GetUnitX(BJS.caster)
        set BJS.CY     = GetUnitY(BJS.caster)
        set BJS.TarAngle = bj_RADTODEG * Atan2(BJS.TY - BJS.CY, BJS.TX - BJS.CX)
        set BJS.t = CreateTimer()       //create timer
        set BJS.RushT = CreateTimer()   //create timer
        set BJS.ChannelTotal = 5
        set BJS.LightningEffect[1] = BJS_Lightning1
        set BJS.LightningEffect[2] = BJS_Lightning2
        set BJS.LightningEffect[3] = BJS_Lightning3
        set BJS.LightningEffect[4] = BJS_Lightning4
        set BJS.LightningEffect[5] = BJS_Lightning5
        set BJS.Damaged = CreateGroup()
    return BJS
    endmethod
    
    method OffSet takes location source, real distance, real angle returns location
        return Location(GetLocationX(source) + distance * Cos(angle * bj_DEGTORAD),GetLocationY(source) + distance * Sin(angle * bj_DEGTORAD))
    endmethod
    
    method offsetX takes real X, real distance, real angle returns real
        return X + distance * Cos(angle * bj_DEGTORAD)
    endmethod
    
    method offsetY takes real Y, real distance, real angle returns real
        return Y + distance * Sin(angle * bj_DEGTORAD)
    endmethod
    
    method SetUnitPos takes unit whichUnit, real X, real Y returns nothing
        call SetUnitX(whichUnit,X)
        call SetUnitY(whichUnit,Y)
    endmethod
    
    method CreLightning takes nothing returns nothing
    local integer start =0
    local integer end = 5
        loop
        exitwhen start>end
            if 5 - .ChannelTotal >start and 5-.ChannelTotal <start+1 then
                call DestroyLightning(.Elastic[1])
                call DestroyLightning(.Elastic[2])
                set .Elastic[1] = AddLightning(.LightningEffect[start+1],true,GetUnitX(.Torch[1]),GetUnitY(.Torch[1]),GetUnitX(.caster),GetUnitY(.caster))
                set .Elastic[2] = AddLightning(.LightningEffect[start+1],true,GetUnitX(.Torch[2]),GetUnitY(.Torch[2]),GetUnitX(.caster),GetUnitY(.caster))
            endif
        set start = start+1
        endloop
    endmethod
    
    method DistBtwPoints takes location locA, location locB returns real
        return SquareRoot(GetLocationX(locB) - GetLocationX(locA) * GetLocationX(locB) - GetLocationX(locA) + GetLocationY(locB) - GetLocationY(locA) * GetLocationY(locB) - GetLocationY(locA))
    endmethod
    
    method AngleBtwPoints takes location locA, location locB returns real
        return bj_RADTODEG * Atan2(GetLocationY(locB) - GetLocationY(locA), GetLocationX(locB) - GetLocationX(locA))
    endmethod
    
    method EndLightning takes nothing returns nothing
    local real array UnitX
    local real array UnitY
    local location array UnitLoc
    local location AimPoint
    set UnitLoc[1] = GetUnitLoc(.Torch[1])
    set UnitLoc[2] = GetUnitLoc(.Torch[2])
        set AimPoint = .OffSet(UnitLoc[1], .DistBtwPoints(UnitLoc[1],UnitLoc[2])/2, .AngleBtwPoints(UnitLoc[1],UnitLoc[2]))
        call DestroyLightning(.Elastic[1])
        call DestroyLightning(.Elastic[2])
        set .Elastic[1] = AddLightning(.LightningEffect[5],true,GetUnitX(.Torch[1]),GetUnitY(.Torch[1]),GetLocationX(AimPoint),GetLocationY(AimPoint))
        set .Elastic[2] = AddLightning(.LightningEffect[5],true,GetUnitX(.Torch[2]),GetUnitY(.Torch[2]),GetLocationX(AimPoint),GetLocationY(AimPoint))
    call RemoveLocation(UnitLoc[1])
    call RemoveLocation(UnitLoc[2])
    call RemoveLocation(AimPoint)
    set UnitLoc[1] = null
    set UnitLoc[2] = null
    set AimPoint = null
    endmethod
    
    method onDestroy takes nothing returns nothing
    set .caster = null
    set .Torch[1] = null
    set .Torch[2] = null
    call DestroyTimer(.t)
    call DestroyTimer(.RushT)
    set .t = null
    set .RushT = null
    call DestroyLightning(.Elastic[1])
    call DestroyLightning(.Elastic[2])
    set .Elastic[1] = null
    set .Elastic[2] = null
    call DestroyGroup(.Damaged)
    set .Damaged = null
    endmethod
    
endstruct
//===================================
//==     End BunjeeShot Struct     ==
//===================================
    private function BJS_DamagedCond takes nothing returns boolean
        return IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0 and IsUnitInGroup(GetFilterUnit(),DummyDamaged) == false and IsUnitAlly(GetFilterUnit(),GetOwningPlayer(DummyCaster))==false
    endfunction
    
    private function BJS_DamagedAct takes nothing returns nothing
        call UnitDamageTarget(DummyCaster,GetEnumUnit(),DummyDamage,true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_NORMAL,null)
        call GroupAddUnit(DummyDamaged,GetEnumUnit())
    endfunction

    private function BJS_RushTEnd takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local BunjeeShot BJS = GetTimerStructB(t)
    local group Damaged = CreateGroup()
    set DummyDamaged = BJS.Damaged
    set DummyCaster  = BJS.caster
    set DummyDamage = BJS.DamageOn
    
        if BJS.RushDist > 0 then
        
            set BJS.CX = BJS.offsetX(BJS.CX,BJS_RushSpeed,BJS.TarAngle)
            set BJS.CY = BJS.offsetY(BJS.CY,BJS_RushSpeed,BJS.TarAngle)
            
            call DestroyEffect(AddSpecialEffectTarget(BJS_RushEffect, BJS.caster,"chest"))
            call DestroyEffect(AddSpecialEffectTarget(BJS_RushEffect, BJS.caster,"hand, left"))
            call DestroyEffect(AddSpecialEffectTarget(BJS_RushEffect, BJS.caster,"hand, right"))
            call DestroyEffect(AddSpecialEffectTarget(BJS_RushEffect, BJS.caster,"foot, left"))
            call DestroyEffect(AddSpecialEffectTarget(BJS_RushEffect, BJS.caster,"foot, right"))
            
            if IsTerrainPathable(BJS.CX,BJS.CY,PATHING_TYPE_WALKABILITY)==false then
                call BJS.SetUnitPos(BJS.caster,BJS.CX,BJS.CY)
            endif
            
            call GroupEnumUnitsInRange(Damaged, BJS.CX,BJS.CY,200, Condition(function BJS_DamagedCond))
            call ForGroup(Damaged, function BJS_DamagedAct)
            
            set BJS.Damaged = DummyDamaged
            set BJS.RushDist = BJS.RushDist - BJS_RushSpeed
            
        elseif BJS.RushDist < 0 then
        
            call PauseTimer(t)
            call DestroyTimer(t)
            call BJS.destroy()
            
        endif
        
    endfunction

private function BJS_TimerEnd takes nothing returns nothing
local timer t = GetExpiredTimer()
local BunjeeShot BJS = GetTimerStructA(t)

    if GetUnitCurrentOrder(BJS.caster) == ChannelId and BJS.ChannelTotal > 0 then
        set BJS.CX = BJS.offsetX(BJS.CX, 5, BJS.TarAngle-180)//new
        set BJS.CY = BJS.offsetY(BJS.CY, 5, BJS.TarAngle-180)//new
        
        
        if IsTerrainPathable(BJS.CX,BJS.CY,PATHING_TYPE_WALKABILITY)==false then
            call DestroyEffect(AddSpecialEffect(BJS_ChargeEffect,BJS.CX,BJS.CY))
            call BJS.SetUnitPos(BJS.caster, BJS.CX,BJS.CY)  //Charge
        endif
        
        call BJS.CreLightning()
        set BJS.ChannelTotal = BJS.ChannelTotal - .08
        
    elseif GetUnitCurrentOrder(BJS.caster) != ChannelId or BJS.ChannelTotal < 0 then
    
        call UnitApplyTimedLife(BJS.Torch[1],'BTLF',.1)
        call UnitApplyTimedLife(BJS.Torch[2],'BTLF',.1)
        set BJS.Charged = 5 - BJS.ChannelTotal
        set BJS.DamageOn = (GetUnitAbilityLevel(BJS.caster,BJS_Id))*(BJS.Charged)*(50) 
        set BJS.RushDist = (GetUnitAbilityLevel(BJS.caster,BJS_Id)) * (100) * (BJS.Charged)
        call SetTimerStructB(t,BJS)
        call BJS.EndLightning()
        call TimerStart(t,.01,true,function BJS_RushTEnd)
    endif
endfunction

//=========================================================
//==                     Main Function                   ==
//=========================================================
private function BJS_Cond takes nothing returns boolean
    return GetSpellAbilityId() == BJS_Id
endfunction

private function BJS_Act takes nothing returns nothing
local location TLoc = GetSpellTargetLoc()
local BunjeeShot BJS = BunjeeShot.create(GetSpellAbilityUnit(),GetLocationX(TLoc),GetLocationY(TLoc))
local integer LoopInt = 1    
local real CreateDummyX
local real CreateDummyY
    
    //<--Creating Torch-->//
    loop
    exitwhen LoopInt>2
    
        if LoopInt == 1 then
        
            set CreateDummyX = BJS.offsetX(BJS.CX,200,BJS.TarAngle+90)
            set CreateDummyY = BJS.offsetY(BJS.CY,200,BJS.TarAngle+90)
            set BJS.Torch[LoopInt] = CreateUnit(GetOwningPlayer(BJS.caster),BJS_TorchId,CreateDummyX,CreateDummyY,BJS.TarAngle)
            
        elseif LoopInt == 2 then
        
            set CreateDummyX = BJS.offsetX(BJS.CX,200,BJS.TarAngle-90)
            set CreateDummyY = BJS.offsetY(BJS.CY,200,BJS.TarAngle-90)
            set BJS.Torch[LoopInt] = CreateUnit(GetOwningPlayer(BJS.caster),BJS_TorchId,CreateDummyX,CreateDummyY,BJS.TarAngle)
            
        endif
        
    set LoopInt = LoopInt + 1
    endloop
    //<--End-->//
    
    
    call SetTimerStructA(BJS.t,BJS)
    call TimerStart(BJS.t,BJS_ChargingSpeed,true,function BJS_TimerEnd)

endfunction
//=========================================================
//==                   End Main Function                 ==
//=========================================================

//===========================================================================
function InitTrig_BunJee_Shot_Structed takes nothing returns nothing
local integer start = 0
local integer end = 15
    set gg_trg_BunJee_Shot_Structed = CreateTrigger()
    
    loop
    exitwhen start>end
        call TriggerRegisterPlayerUnitEvent(gg_trg_BunJee_Shot_Structed,Player(start),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
        set start = start + 1
    endloop
    call TriggerAddCondition(gg_trg_BunJee_Shot_Structed, Condition(function BJS_Cond))
    call TriggerAddAction(gg_trg_BunJee_Shot_Structed, function BJS_Act)
endfunction

endscope

//!<--End of my Spell-->!//


//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


//Thanks to Cohadar for his brilliant ABC system.

//==============================================================================
//  ABC -- STRUCT ATTACHMENT SYSTEM BY COHADAR -- v5.1
//==============================================================================


//------------------------------------------------------------------------------
//  We will use textmacros to create multiple instances of system
//------------------------------------------------------------------------------
//! textmacro ABC takes X, NAME, TYPE

//------------------------------------------------------------------------------
// Global arrays represent our hash tables.
// System is currently using 3 hash tables per handle type. (A, B, C)
//------------------------------------------------------------------------------
globals
    private $TYPE$    array $TYPE$Key$X$
    private integer  array $TYPE$Value$X$
	private integer  $TYPE$maxCollision$X$ = 0
endglobals

//------------------------------------------------------------------------------
// returns the maximum collision so far
//------------------------------------------------------------------------------
function Get$NAME$Collision$X$ takes nothing returns integer
    return $TYPE$maxCollision$X$
endfunction


//------------------------------------------------------------------------------
// initializes hash arrays to prevent lag when ABC is used for the first time
//------------------------------------------------------------------------------
private function Init$NAME$Hash$X$ takes nothing returns nothing
    set $TYPE$Key$X$[HASH_INDEX_LIMIT]   = null
	set $TYPE$Value$X$[HASH_INDEX_LIMIT] = 0
endfunction

//------------------------------------------------------------------------------
// attaches struct to a handle by using hash table
//------------------------------------------------------------------------------
function Set$NAME$Struct$X$ takes $TYPE$ t, integer s returns nothing
	debug local integer collision
	
	// hash using 32-bit integer overflow
    local integer i = (H2I(t) * HASH_UP) / HASH_DOWN + HASH_BIAS

	if $TYPE$Key$X$<i> == null then
	    set $TYPE$Value$X$<i> = s
		set $TYPE$Key$X$<i> = t
		return
	endif

    debug if $TYPE$Key$X$<i> == t then
        debug call BJDebugMsg(&quot;|cFFFF0000ERROR: Hash[$X$] attachment overwrite on $TYPE$ #&quot; +I2S(H2I(t)))
        debug return
    debug endif        
    
	// if function gets below this line we have a collision
    debug set collision = 1
    loop
		debug if collision &gt;= HASH_COLLISION_LIMIT then
            debug call BJDebugMsg(&quot;|cFFFF0000ERROR: Hash[$X$] overflow&quot;)
            debug return
		debug endif    
        debug set collision = collision + 1
    
        set i = i + 1    
	    exitwhen $TYPE$Key$X$<i> == null

        debug if $TYPE$Key$X$<i> == t then
            debug call BJDebugMsg(&quot;|cFFFF0000ERROR: Hash[$X$] attachment overwrite on $TYPE$ #&quot; +I2S(H2I(t)))
            debug return
        debug endif    
	endloop

	debug if collision &gt; $TYPE$maxCollision$X$ then
	debug 	call BJDebugMsg(&quot;|cFFFF4444Warning: Hash[$X$] maximum collision is now: &quot; + I2S(collision))
	debug 	set $TYPE$maxCollision$X$ = collision
	debug endif
	
    set $TYPE$Value$X$<i> = s
    set $TYPE$Key$X$<i> = t

    return
endfunction

//------------------------------------------------------------------------------
// gets stored struct from a handle 
//------------------------------------------------------------------------------
function Get$NAME$Struct$X$ takes $TYPE$ t returns integer
	debug local integer collision
	
	// hash using 32-bit integer overflow
    local integer i = (H2I(t) * HASH_UP) / HASH_DOWN + HASH_BIAS
	
	if $TYPE$Key$X$<i> == t then
		return $TYPE$Value$X$<i>
	endif
	
	// if function gets below this line we have a collision
    debug set collision = 1
    loop
		debug if collision &gt;= HASH_COLLISION_LIMIT then
		debug   call BJDebugMsg(&quot;|cFFFF0000ERROR: Hash[$X$] : get request on unknown handle&quot;)
		debug   return 0
		debug endif		
        debug set collision = collision + 1      
    
        set i = i + 1
	    exitwhen $TYPE$Key$X$<i> == t
	endloop	
	
    return $TYPE$Value$X$<i>
endfunction


//------------------------------------------------------------------------------
// clears stored struct from a handle, also returns cleared value
//------------------------------------------------------------------------------
function Clear$NAME$Struct$X$ takes $TYPE$ t returns integer
	debug local integer collision
    local integer ik
    local integer ret
	
	// hash using 32-bit integer overflow
    local integer i = (H2I(t) * HASH_UP) / HASH_DOWN + HASH_BIAS
	
    // first find the index on witch key is stored
    debug set collision = 0
    loop
		debug if collision &gt;= HASH_COLLISION_LIMIT then
		debug   call BJDebugMsg(&quot;|cFFFF0000ERROR: Hash[$X$] : clear request on unknown handle&quot;)
		debug   return 0
		debug endif        
        debug set collision = collision + 1       
    
        exitwhen $TYPE$Key$X$<i> == t
        set i = i + 1
    endloop
    
    set ik = i
    set ret = $TYPE$Value$X$[ik]
    
    // then find last used key index in bucket
    loop
        set i = i + 1
        // we use the fact bucket borders (mod 8 indexes) are always null
        exitwhen $TYPE$Key$X$<i> == null  
    endloop
    
    // shift last bucket entry to the place of removed one
    set $TYPE$Key$X$[ik] = $TYPE$Key$X$[i-1]
    set $TYPE$Value$X$[ik] = $TYPE$Value$X$[i-1]
    // clear the previous last bucket entry
    set $TYPE$Key$X$[i-1] = null
    
    return ret
endfunction

//! endtextmacro

//==============================================================================
//  Macro execution -- this is where real functions get created
//==============================================================================
library ABC initializer Init

globals
	public constant integer HASH_SIZE = 8192
	public constant integer HASH_INDEX_LIMIT = 8190
	public constant integer HASH_DOWN = 524288     // 2^19	
	public constant integer HASH_UP   = 2134900736 // 2^22 * 509
	public constant integer HASH_BIAS = 4096       // HASH_SIZE / 2
	public constant integer HASH_COLLISION_LIMIT = 7 // ABC v5.0 had limit 8
	// 509 is the prime closest to 512
endglobals


//------------------------------------------------------------------------------
// conversion function used by the system internally
// you will not need to use it directly
//------------------------------------------------------------------------------
public function H2I takes handle h returns integer
    return h
    return 0
endfunction

//! runtextmacro ABC(&quot;A&quot;,&quot;Timer&quot;,&quot;timer&quot;)
//! runtextmacro ABC(&quot;B&quot;,&quot;Timer&quot;,&quot;timer&quot;)
//! runtextmacro ABC(&quot;C&quot;,&quot;Timer&quot;,&quot;timer&quot;)

//! runtextmacro ABC(&quot;A&quot;,&quot;Trigger&quot;,&quot;trigger&quot;)
//! runtextmacro ABC(&quot;B&quot;,&quot;Trigger&quot;,&quot;trigger&quot;)
//! runtextmacro ABC(&quot;C&quot;,&quot;Trigger&quot;,&quot;trigger&quot;)

//! runtextmacro ABC(&quot;A&quot;,&quot;Dialog&quot;,&quot;dialog&quot;)
//! runtextmacro ABC(&quot;B&quot;,&quot;Dialog&quot;,&quot;dialog&quot;)
//! runtextmacro ABC(&quot;C&quot;,&quot;Dialog&quot;,&quot;dialog&quot;)

private function Init takes nothing returns nothing
	call InitTimerHashA()
	call InitTimerHashB()
	call InitTimerHashC()

	call InitTriggerHashA()
	call InitTriggerHashB()
	call InitTriggerHashC()       
    
	call InitDialogHashA()
	call InitDialogHashB()
	call InitDialogHashC()
endfunction


endlibrary
//==============================================================================
//  END OF ABC STRUCT ATTACHMENT SYSTEM
//==============================================================================</i></i></i></i></i></i></i></i></i></i></i></i></i></i>

BunJee Shot v0.03

Everything is done. I just left out those read me and ... yeah, instruction. :p
 

emjlr3

Change can be a good thing
Reaction score
395
talk about a lot of code Gals, good god, its not all that serious, lol
 
Reaction score
456
It still includes ABC system. And alot of comments.

I edit this post soon when I finish my 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