wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Spells
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 09-12-2007, 09:36 AM   #16
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

I have a weird bug that I cannot figure out. The spell works fine for the first two casts. On the 3rd and all subsequent casts, the callback loop exits immediately; the units retain the buffs and are still alive; the dummy is alive but is simply not being moved because the callback seems to think it's finished.

Normally this would be an easy to spot error... but this is so strange because it works for the first two casts (it's always 2), and then it gets wonky. Here's the code:
Collapse JASS:
//*****************************************************************************************\\
//                            Spell Name: Chains of Solidarity                             \\
//                                 Spell Author: Pyrogasm                                  \\
//                                                                                         \\
//                                Follows the JESP Standard                                \\
//*****************************************************************************************\\

constant function ChainsOfSolidarity_AbilityId takes nothing returns integer
    return 'A000' //Rawcode of the spell itself
endfunction

constant function ChainsOfSolidarity_DummyUnitId takes nothing returns integer
    return 'h000' //This unit MUST have a "cast backswing point" of 0.00
endfunction       //And CANNOT have negative regeneration

constant function ChainsOfSolidarity_DummyLightningSpellId takes nothing returns integer
    return 'A001' //The "CoS Dummy Lightning spell" determines the lightning effect
endfunction

constant function ChainsOfSolidarity_DummyBuffSpellId takes nothing returns integer
    return 'A002' //The "CoS Dummy Buff Spell" spell
endfunction

constant function ChainsOfSolidarity_BuffId takes nothing returns integer
    return 'B000' //The "Chains of Solidarity (Buff)" buff
endfunction

constant function ChainsOfSolidarity_CrowFormAbilityId takes nothing returns integer
    return 'Amrf' //Medivh's Crow form ability; you don't need to change this rawcode unless
endfunction       //you modified it in your map. If you have, copy it, reset the copied one,
                  //and use its rawcode here.

constant function ChainsOfSolidarity_IsChanneling takes integer Level returns boolean
    return false  //This spell may be channeling
endfunction

constant function ChainsOfSolidarity_OrderString takes nothing returns string
    return "transmute" //If you use another spell as the base spell and the spell is then
endfunction            //Channeling, make sure to change this field to the base orderid of
                       //The new spell.

constant function ChainsOfSolidarity_BreakDistance takes integer Level returns real
    return 1500.00 //If the two units are farther than this distance apart, the spell
endfunction        //Will end.

constant function ChainsOfSolidarity_DummyFlyHeight takes integer Level returns real
    return 30.00 //If you want the lightning effect on the caster to be higher or lower.
endfunction      //It will always go directly to the target.

constant function ChainsOfSolidarity_Duration takes integer Level returns real
    return 10.00 + (1.00*Level) //Duration of the lightning effect is changed in the Object Editor
endfunction

constant function ChainsOfSolidarity_HealthPerSecond takes integer Level returns real
    return 20.00 + (15.00*Level) //In Health per Second
endfunction

constant function ChainsOfSolidarity_LineWidth takes integer Level returns real
    return 145.00 //Distance from center to outer edge of line
endfunction

constant function ChainsOfSolidarity_CircleOptions takes integer Level returns integer
     return 3 //0 = no circles; 1 = only around target; 2 = only around caster; 3 = around both
endfunction

constant function ChainsOfSolidarity_CircleRadius takes integer Level, integer WhichCircle returns real
     if WhichCircle == 1 then     //Radius of the circle(s) around the caster/target
         return 75.00             //This might conceivably be the same as the LineWidth.
     elseif WhichCircle == 2 then //To make it only affect the caster/target, simply put 10.00
         return 75.00             //Or something.
     endif
     return 0.00                  //Just a safety return; don't change this
endfunction

constant function ChainsOfSolidarity_MinHeight takes integer Level returns real
    return 0.00 //No units below this height will be affected
endfunction

constant function ChainsOfSolidarity_MaxHeight takes integer Level returns real
    return 500.00 //No units above this height will be affected
endfunction

constant function ChainsOfSolidarity_TimerInterval takes integer Level returns real
    return 0.04 //Interval that the timer runs at; this affects the lightning effect
endfunction

constant function ChainsOfSolidarity_HealAllies takes integer Level returns boolean
    return true
endfunction

constant function ChainsOfSolidarity_HealEnemies takes integer Level returns boolean
    return false
endfunction

constant function ChainsOfSolidarity_HealOnCast takes integer Level returns boolean
    return false
endfunction

constant function ChainsOfSolidarity_EffectPath takes nothing returns string
    return "Abilities\\Weapons\\WingedSerpentMissile\\WingedSerpentMissile.mdl"
endfunction

constant function ChainsOfSolidarity_EffectAttach takes nothing returns string
    return "chest"
endfunction

constant function ChainsOfSolidarity_EffectInterval takes nothing returns real
    return 0.48 //This should probably be a multiple of the timer interval
endfunction



//*****************************************************************************************\\
//                                Start External Functions                                 \\
//*****************************************************************************************\\

//=============================
// Function by grim001
//=============================
function GroupEnumUnitsInQuad takes group g, real x1, real y1, real x2, real y2, real x3, real y3, real x4, real y4, real minHeight, real maxHeight, boolexpr f returns nothing
    local real maxx
    local real minx
    local real maxy
    local real miny
    local unit u
    local real ux
    local real uy
    local group g2 = CreateGroup()
    local rect r

    if x1 >= x2 and x1 >= x3 and x1 >= x4 then
        set maxx = x1
    elseif x2 >= x1 and x2 >= x3 and x2 >= x4 then
        set maxx = x2
    elseif x3 >= x1 and x3 >= x2 and x3 >= x4 then
        set maxx = x3
    else
        set maxx = x4
    endif

    if x1 <= x2 and x1 <= x3 and x1 <= x4 then
        set minx = x1
    elseif x2 <= x1 and x2 <= x3 and x2 <= x4 then
        set minx = x2
    elseif x3 <= x1 and x3 <= x2 and x3 <= x4 then
        set minx = x3
    else
        set minx = x4
    endif

    if y1 >= y2 and y1 >= y3 and y1 >= y4 then
        set maxy = y1
    elseif y2 >= y1 and y2 >= y3 and y2 >= y4 then
        set maxy = y2
    elseif y3 >= y1 and y3 >= y2 and y3 >= y4 then
        set maxy = y3
    else
        set maxy = y4
    endif

    if y1 <= y2 and y1 <= y3 and y1 <= y4 then
        set miny = y1
    elseif y2 <= y1 and y2 <= y3 and y2 <= y4 then
        set miny = y2
    elseif y3 <= y1 and y3 <= y2 and y3 <= y4 then
        set miny = y3
    else
        set miny = y4
    endif

    set r = Rect(minx, miny, maxx, maxy)
    call GroupEnumUnitsInRect(g2, r, f)
    loop
        set u = FirstOfGroup(g2)
        exitwhen u == null
        call GroupRemoveUnit(g2, u)
        if GetUnitFlyHeight(u) <= maxHeight and GetUnitFlyHeight(u) >= minHeight then
            set ux = GetUnitX(u)
            set uy = GetUnitY(u)
            if (uy - y1)*(x2 - x1) - (ux - x1)*(y2 - y1) <= 0. then
                if (uy - y2)*(x3 - x2) - (ux - x2)*(y3 - y2) <= 0. then
                    if (uy - y3)*(x4 - x3) - (ux - x3)*(y4 - y3) <= 0. then
                        if (uy - y4)*(x1 - x4) - (ux - x4)*(y1 - y4) <= 0. then
                            call GroupAddUnit(g, u)
                        endif
                    endif
                endif
            endif
        endif
    endloop
    call DestroyGroup(g2)
    call RemoveRect(r)
    set g2 = null
    set r = null
endfunction
//*****************************************************************************************\\
//                                 End External Functions                                  \\
//*****************************************************************************************\\


function ChainsOfSolidarity_CastConditions takes nothing returns boolean
    return GetSpellAbilityId() == ChainsOfSolidarity_AbilityId()
endfunction

function ChainsOfSolidarity_HealFilter takes nothing returns boolean
    local unit U = GetFilterUnit()
    local boolean Ally = bj_slotControlUsed[95] and IsUnitAlly(U, bj_forceRandomCurrentPick)
    local boolean Enemy = bj_slotControlUsed[96] and IsUnitEnemy(U, bj_forceRandomCurrentPick)
    set U = null
    return Ally or Enemy
endfunction

function ChainsOfSolidarity_Callback takes nothing returns nothing
    local timer T = GetExpiredTimer()
    local integer ArrayIndex = GetCSData(T)
    local unit U = GetArrayUnit(ArrayIndex, 1)
    local unit U2 = GetArrayUnit(ArrayIndex, 2)
    local integer Level = GetArrayInt(ArrayIndex, 4)
    local real X = GetUnitX(U)
    local real Y = GetUnitY(U)
    local real X2 = GetUnitX(U2)
    local real Y2 = GetUnitY(U2)
    local unit Dummy = GetArrayUnit(ArrayIndex, 3)
    local real Duration = ChainsOfSolidarity_Duration(Level)
    local real TimerInterval = ChainsOfSolidarity_TimerInterval(Level)
    local group G
    local unit U3
    local real HealAmount
    local real Angle = ChainsOfSolidarity_BreakDistance(Level)
    local real Width
    local string EffectPath
    local string EffectAttach
    local real Elapsed = GetArrayReal(ArrayIndex, 5)
    local boolean Effects
    local integer CircleOptions
    local group G2

    local real Side1X
    local real Side1Y
    local real Side2X
    local real Side2Y
    local real RX1
    local real RY1
    local real RX2
    local real RY2
    local real RX3
    local real RY3
    local real RX4
    local real RY4

    call BJDebugMsg("Callback")
    if Elapsed > Duration or GetWidgetLife(U) < 0.406 or GetWidgetLife(U2) < 0.406 or (X-X2)*(X-X2)+(Y-Y2)*(Y-Y2) > Angle*Angle or (GetUnitCurrentOrder(U) != OrderId(ChainsOfSolidarity_OrderString()) and ChainsOfSolidarity_IsChanneling(Level)) then
        call BJDebugMsg("Then")
        set Level = ChainsOfSolidarity_BuffId()
        call RemoveUnit(Dummy)
        call UnitRemoveAbility(U, Level)
        call UnitRemoveAbility(U2, Level)

        call PauseTimer(T)
        call DestroyArray(ArrayIndex)
        call DestroyTimer(T)
    else
        call BJDebugMsg("Else")
        call SetArrayReal(ArrayIndex, 5, Elapsed+TimerInterval)
        set Width = ChainsOfSolidarity_LineWidth(Level)
        set HealAmount = ChainsOfSolidarity_HealthPerSecond(Level)*TimerInterval
        set CircleOptions = ChainsOfSolidarity_CircleOptions(Level)
        set Effects = ModuloReal(Elapsed, ChainsOfSolidarity_EffectInterval()) <= TimerInterval
        if Effects then
            set EffectPath = ChainsOfSolidarity_EffectPath()
            set EffectAttach = ChainsOfSolidarity_EffectAttach()
        endif

        call SetUnitX(Dummy, X)
        call SetUnitY(Dummy, Y)
        set Angle = Atan2((Y2-Y),(X2-X))

        set Side1X = X2 - X
        set Side1Y = Y2 - Y
        set Side2X = Width*Cos(Angle-1.5708)
        set Side2Y = Width*Sin(Angle-1.5708)

        set RX4 = X + Side2X*0.5
        set RY4 = Y + Side2Y*0.5
        set RX3 = RX4 + Side1X
        set RY3 = RY4 + Side1Y
        set RX2 = RX3 - Side2X
        set RY2 = RY3 - Side2Y
        set RX1 = RX2 - Side1X
        set RY1 = RY2 - Side1Y

        set bj_slotControlUsed[95] = ChainsOfSolidarity_HealAllies(Level)
        set bj_slotControlUsed[96] = ChainsOfSolidarity_HealEnemies(Level)
        set bj_forceRandomCurrentPick = GetOwningPlayer(U)
        set G = CreateGroup()
        call GroupEnumUnitsInQuad(G, RX1, RY1, RX2, RY2, RX3, RY3, RX4, RY4, ChainsOfSolidarity_MinHeight(Level), ChainsOfSolidarity_MaxHeight(Level), Condition(function ChainsOfSolidarity_HealFilter))

        if CircleOptions > 0 then
            set G2 = CreateGroup()
            set bj_groupAddGroupDest = G
            if CircleOptions == 1 or CircleOptions == 3 then
                call GroupEnumUnitsInRange(G2, X2, Y2, ChainsOfSolidarity_CircleRadius(Level, 1), Condition(function ChainsOfSolidarity_HealFilter))
                call ForGroup(G2, function GroupAddGroupEnum)
                call GroupClear(G2)
            endif
            if CircleOptions == 2 or CircleOptions == 3 then
                call GroupEnumUnitsInRange(G2, X, Y, ChainsOfSolidarity_CircleRadius(Level, 2), Condition(function ChainsOfSolidarity_HealFilter))
                call ForGroup(G2, function GroupAddGroupEnum)
            endif
            call DestroyGroup(G2)
            set G2 = null
        endif

        loop
            set U3 = FirstOfGroup(G)
            exitwhen U3 == null

            call SetWidgetLife(U3, GetWidgetLife(U3)+HealAmount)
            if Effects then
                call DestroyEffect(AddSpecialEffectTarget(EffectPath, U3, EffectAttach))
            endif

            call GroupRemoveUnit(G, U3)
        endloop

        call DestroyGroup(G)
        set G = null
    endif

    set U = null
    set U2 = null
    set Dummy = null
    set T = null
endfunction

function ChainsOfSolidarity_Cast takes nothing returns nothing
    local unit U = GetTriggerUnit()
    local unit U2 = GetSpellTargetUnit()
    local integer Level = GetUnitAbilityLevel(U, ChainsOfSolidarity_AbilityId())
    local real X = GetUnitX(U)
    local real Y = GetUnitY(U)
    local real X2
    local real Y2
    local integer DummySpellId = ChainsOfSolidarity_DummyLightningSpellId()
    local unit Dummy
    local real Duration = ChainsOfSolidarity_Duration(Level)
    local real TimerInterval = ChainsOfSolidarity_TimerInterval(Level)
    local group G
    local unit U3
    local timer T = CreateTimer()
    local real HealAmount
    local real Angle
    local real Width
    local string EffectPath
    local string EffectAttach
    local integer CircleOptions
    local group G2
    local integer ArrayIndex = NewArray(5, true)

    local real Side1X
    local real Side1Y
    local real Side2X
    local real Side2Y
    local real RX1
    local real RY1
    local real RX2
    local real RY2
    local real RX3
    local real RY3
    local real RX4
    local real RY4

    call BJDebugMsg("Cast")
    set bj_forceRandomCurrentPick = GetOwningPlayer(U)
    set Dummy = CreateUnit(bj_forceRandomCurrentPick, ChainsOfSolidarity_DummyUnitId(), X, Y, 0.00)
    call UnitAddAbility(Dummy, DummySpellId)
    call SetUnitAbilityLevel(Dummy, DummySpellId, Level)
    call IssueTargetOrder(Dummy, "fingerofdeath", U2)
    call UnitApplyTimedLife(Dummy, 'BTLF', Duration+TimerInterval)

    call SetArrayObject(ArrayIndex, 1, U)
    call SetArrayObject(ArrayIndex, 2, U2)
    call SetArrayObject(ArrayIndex, 3, Dummy)
    call SetArrayInt(ArrayIndex, 4, Level)
    call SetCSData(T, ArrayIndex)

    set DummySpellId = ChainsOfSolidarity_CrowFormAbilityId()
    call UnitAddAbility(Dummy, DummySpellId)
    call UnitRemoveAbility(Dummy, DummySpellId)
    call SetUnitFlyHeight(Dummy, ChainsOfSolidarity_DummyFlyHeight(Level), 10000.00)

    set DummySpellId = ChainsOfSolidarity_DummyBuffSpellId()
    set Dummy = CreateUnit(bj_forceRandomCurrentPick, ChainsOfSolidarity_DummyUnitId(), X, Y, 0.00)
    call UnitAddAbility(Dummy, DummySpellId)
    call SetUnitAbilityLevel(Dummy, DummySpellId, Level)
    call IssueTargetOrder(Dummy, "unholyfrenzy", U)
    call IssueTargetOrder(Dummy, "unholyfrenzy", U2)
    call UnitApplyTimedLife(Dummy, 'BTLF', 1.00)

    if ChainsOfSolidarity_HealOnCast(Level) then
        set HealAmount = ChainsOfSolidarity_HealthPerSecond(Level)*TimerInterval
        set Width = ChainsOfSolidarity_LineWidth(Level)
        set EffectPath = ChainsOfSolidarity_EffectPath()
        set EffectAttach = ChainsOfSolidarity_EffectAttach()
        set CircleOptions = ChainsOfSolidarity_CircleOptions(Level)

        set X2 = GetUnitX(U2)
        set Y2 = GetUnitY(U2)
        set Angle = Atan2((Y2-Y),(X2-X))

        set Side1X = X2 - X
        set Side1Y = Y2 - Y
        set Side2X = Width*Cos(Angle-1.5708)
        set Side2Y = Width*Sin(Angle-1.5708)

        set RX1 = X + Side2X*0.5
        set RY1 = Y + Side2Y*0.5
        set RX2 = RX1 + Side1X
        set RY2 = RY1 + Side1Y
        set RX3 = RX2 - Side2X
        set RY3 = RY2 - Side2Y
        set RX4 = RX3 - Side1X
        set RY4 = RY3 - Side1Y

        set bj_slotControlUsed[95] = ChainsOfSolidarity_HealAllies(Level)
        set bj_slotControlUsed[96] = ChainsOfSolidarity_HealEnemies(Level)
        set G = CreateGroup()
        call GroupEnumUnitsInQuad(G, RX1, RY1, RX2, RY2, RX3, RY3, RX4, RY4, ChainsOfSolidarity_MinHeight(Level), ChainsOfSolidarity_MaxHeight(Level), Condition(function ChainsOfSolidarity_HealFilter))

        if CircleOptions > 0 then
            set G2 = CreateGroup()
            set bj_groupAddGroupDest = G
            if CircleOptions == 1 or CircleOptions == 3 then
                call GroupEnumUnitsInRange(G2, X2, Y2, ChainsOfSolidarity_CircleRadius(Level, 1), Condition(function ChainsOfSolidarity_HealFilter))
                call ForGroup(G2, function GroupAddGroupEnum)
                call GroupClear(G2)
            endif
            if CircleOptions == 2 or CircleOptions == 3 then
                call GroupEnumUnitsInRange(G2, X, Y, ChainsOfSolidarity_CircleRadius(Level, 2), Condition(function ChainsOfSolidarity_HealFilter))
                call ForGroup(G2, function GroupAddGroupEnum)
            endif
            call DestroyGroup(G2)
            set G2 = null
        endif

        loop
            set U3 = FirstOfGroup(G)
            exitwhen U3 == null

            call SetWidgetLife(U3, GetWidgetLife(U3)+HealAmount)
            call DestroyEffect(AddSpecialEffectTarget(EffectPath, U3, EffectAttach))

            call GroupRemoveUnit(G, U3)
        endloop

        call DestroyGroup(G)
        set G = null
    endif

    call TimerStart(T, TimerInterval, true, function ChainsOfSolidarity_Callback)

    set U = null
    set U2 = null
    set Dummy = null
    set T = null
endfunction

//===========================================================================
function InitTrig_ChainsOfSolidarity takes nothing returns nothing
    set gg_trg_ChainsOfSolidarity = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_ChainsOfSolidarity, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_ChainsOfSolidarity, Condition(function ChainsOfSolidarity_CastConditions))
    call TriggerAddAction(gg_trg_ChainsOfSolidarity, function ChainsOfSolidarity_Cast)

    call Preload(ChainsOfSolidarity_EffectPath())
endfunction

And the testmap is attached.
Attached Files
File Type: w3x Chains of Solidarity v1.20.w3x (81.2 KB, 4 views)
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 09-25-2007, 12:58 AM   #17
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,727

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Did you ever figure out your problem? I don't have access to a computer with WE/WC3 right now so I can't test and look for myself, but it sort of stands in the way of approval. If you did figure it out, any chance of an update?
__________________
Rising_Dusk is offline   Reply With Quote
Old 09-25-2007, 02:11 AM   #18
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

No. I posted a fatty thread about it here.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 09-25-2007, 09:01 AM   #19
blu_da_noob
Nonchalant
 
blu_da_noob's Avatar


Respected User
 
Join Date: Mar 2006
Posts: 1,933

Submissions (2)

blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)

[Quicksilver #2] - 2nd Place[Quicksilver#1] 1st place

Send a message via MSN to blu_da_noob
Default

Fix posted in the other thread.
__________________
blu_da_noob is offline   Reply With Quote
Old 09-26-2007, 06:10 AM   #20
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Thank you enormously, blu. That suggestion did the trick.

Map updated on the first page.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 09-28-2007, 01:12 PM   #21
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,266

Submissions (17)

moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Good :)

I'll check it out this night.
moyack is offline   Reply With Quote
Old 09-28-2007, 01:58 PM   #22
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,061

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

You have a lot of duplicate code in there because you want the spell to be able to work both periodicaly and on cast. You should put that code into a seperate function.

Also, I'd like to see a calibration function for units that can be affected. Right now you have 4 functions and all they allow you is to choose is if it can target friends/enemies and what height above terrain does it affect (that kind of semi-3d is particularly silly; being able to choose if it can affect flyers or not would be enough).

Instead, a single function that takes the caster and the potentialy affeted unit and returns a boolean which determines if the unit is to be affected or not, would be much better. Of course, editing such a function requires better Jass knowledge, so you could still have that function call other, simpler functions like the ones you have now, but having such a function would be useful for anyone who wants to better calibrate the spell's targets.
__________________
Anitarf is offline   Reply With Quote
Old 09-29-2007, 01:01 AM   #23
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

If someone wanted such specific calibration, couldn't one simply modify the code him-/herself? To be able to do anything useful in such a function, one would have to have at an understanding of JASS anyway.

I think having one filtering function would just be too damn confusing for people who don't know JASS and would be much less appealing than flagging "Yes/No" on if it affects allies/enemies.

I don't see how putting the effects into a separate function would be better.... It would have a fuckload of arguments and be an extra function call in a callback that runs 25+ times a second.

Last, I like the height detection because it's a different way of choosing the targets instead of it just saying that it affects flying/non-flying units. The other thing is that the spell can be modified to not affect, say, a unit that is jumping over the beam. If you suddenly were healed by some little blue line way below your unit whilst you were jumping, wouldn't that be a bit odd?

I do think, however, that for most normal spells a simple true/false for affecting air units should be all that's required.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 09-29-2007, 02:16 AM   #24
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,266

Submissions (17)

moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

I did a quick review, and that's what I found so far.
  • I agree with Anitarf about the height calibration, IMO its useless to have that setting when you just can add a boolean setting that allows air units or not. Besides, it's not common to see units jumping in a map :P. As a suggestion, this part should be simplified, but if you want to keep it, its ok for me.
  • You forgot to remove the debug messages in the code, please remove them.

Fix that and this spell gets ready for my approval.

Last edited by moyack : 09-29-2007 at 02:16 AM.
moyack is offline   Reply With Quote
Old 09-29-2007, 06:33 AM   #25
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Debug messages? Where?!
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 09-29-2007, 06:50 AM   #26
The Elite
For External Use Only
 
The Elite's Avatar
 
Join Date: Jun 2007
Posts: 672

Submissions (6)

The Elite will become famous soon enough (60)The Elite will become famous soon enough (60)The Elite will become famous soon enough (60)

Default

Collapse JASS:
function ChainsOfSolidarity_Callback takes nothing returns nothing
    local timer T = GetExpiredTimer()
    local integer ArrayIndex = GetCSData(T)
    local unit U = GetArrayUnit(ArrayIndex, 1)
    local unit U2 = GetArrayUnit(ArrayIndex, 2)
    local integer Level = GetArrayInt(ArrayIndex, 4)
    local real X = GetUnitX(U)
    local real Y = GetUnitY(U)
    local real X2 = GetUnitX(U2)
    local real Y2 = GetUnitY(U2)
    local unit Dummy = GetArrayUnit(ArrayIndex, 3)
    local real Duration = ChainsOfSolidarity_Duration(Level)
    local real TimerInterval = ChainsOfSolidarity_TimerInterval(Level)
    local group G
    local unit U3
    local real HealAmount
    local real Angle = ChainsOfSolidarity_BreakDistance(Level)
    local real Width
    local string EffectPath
    local string EffectAttach
    local real Elapsed = GetArrayReal(ArrayIndex, 5)
    local boolean Effects
    local integer CircleOptions
    local group G2

    local real Side1X
    local real Side1Y
    local real Side2X
    local real Side2Y
    local real RX1
    local real RY1
    local real RX2
    local real RY2
    local real RX3
    local real RY3
    local real RX4
    local real RY4

    call BJDebugMsg("Callback") //<= right here
    if Elapsed > Duration or GetWidgetLife(U) < 0.406 or GetWidgetLife(U2) < 0.406 or (X-X2)*(X-X2)+(Y-Y2)*(Y-Y2) > Angle*Angle or (GetUnitCurrentOrder(U) != OrderId(ChainsOfSolidarity_OrderString()) and ChainsOfSolidarity_IsChanneling(Level)) then
        call BJDebugMsg("Then") // <= and here
        set Level = ChainsOfSolidarity_BuffId()
        call RemoveUnit(Dummy)
        call UnitRemoveAbility(U, Level)
        call UnitRemoveAbility(U2, Level)

        call PauseTimer(T)
        call DestroyArray(ArrayIndex)
        call DestroyTimer(T)
    else
        call BJDebugMsg("Else") //<= and here
        call SetArrayReal(ArrayIndex, 5, Elapsed+TimerInterval)
        set Width = ChainsOfSolidarity_LineWidth(Level)
        set HealAmount = ChainsOfSolidarity_HealthPerSecond(Level)*TimerInterval
        set CircleOptions = ChainsOfSolidarity_CircleOptions(Level)
        set Effects = ModuloReal(Elapsed, ChainsOfSolidarity_EffectInterval()) <= TimerInterval
        if Effects then
            set EffectPath = ChainsOfSolidarity_EffectPath()
            set EffectAttach = ChainsOfSolidarity_EffectAttach()
        endif

        call SetUnitX(Dummy, X)
        call SetUnitY(Dummy, Y)
        set Angle = Atan2((Y2-Y),(X2-X))

        set Side1X = X2 - X
        set Side1Y = Y2 - Y
        set Side2X = Width*Cos(Angle-1.5708)
        set Side2Y = Width*Sin(Angle-1.5708)

        set RX4 = X + Side2X*0.5
        set RY4 = Y + Side2Y*0.5
        set RX3 = RX4 + Side1X
        set RY3 = RY4 + Side1Y
        set RX2 = RX3 - Side2X
        set RY2 = RY3 - Side2Y
        set RX1 = RX2 - Side1X
        set RY1 = RY2 - Side1Y
in that section, i dont know how to highlight so i didnt but they're in that section and i didnt post it all so you can spot them easier
__________________

Goths are nerds that dress like vampires. -Dominant-Male
Oh, and wc3c wasn't dying back in 2007 and it isn't now. Our secret is simple: you can't kill the undead ... - Vexorian

We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft. - Chris Metzen on the Warcraft Movie
Man, we're considered elitist all over the internet. This makes me feel nice and warm inside. - ghenjis
Please help! I'll provide no information, you must guess! - Whitehorn

Last edited by moyack : 09-29-2007 at 11:30 AM.
The Elite is offline   Reply With Quote
Old 09-29-2007, 11:33 AM   #27
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,266

Submissions (17)

moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)moyack is a splendid one to behold (661)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

I edited The_Elite post point out the debug messages, but I remember that you have more in your code (actually, everytime I cast the spell, it shows me the number 2). use a find tool and remove those commands, and ready to go.

Actually this is the debug message in your spell:
Collapse JASS:
function ChainsOfSolidarity_Callback takes nothing returns nothing
//...
    local real RX4
    local real RY4

    call BJDebugMsg("ArrayIndex: "+I2S(ArrayIndex))

    if Elapsed > Duration or GetWidgetLife(U) < 0.406 or GetWidgetLife(U2) < 0.406 or (X-X2)*(X-X2)+(Y-Y2)*(Y-Y2) > Angle*Angle then
        set Level = ChainsOfSolidarity_BuffId()
        call RemoveUnit(Dummy)
        call UnitRemoveAbility(U, Level)
        call UnitRemoveAbility(U2, Level)
//...

Last edited by moyack : 09-29-2007 at 11:50 AM.
moyack is offline   Reply With Quote
Old 09-29-2007, 07:07 PM   #28
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,727

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

With how long your code is, I can't help but imagine that there exists a more efficient and shorter method to making this spell.
__________________
Rising_Dusk is offline   Reply With Quote
Old 09-29-2007, 10:35 PM   #29
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,061

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by Pyrogasm
If someone wanted such specific calibration, couldn't one simply modify the code him-/herself? To be able to do anything useful in such a function, one would have to have at an understanding of JASS anyway.

I think having one filtering function would just be too damn confusing for people who don't know JASS and would be much less appealing than flagging "Yes/No" on if it affects allies/enemies.
As I said, you could have both. The point is that even for someone who does know Jass, it's a lot easier to modify a seperate function than go searching through the code to find where to modify stuff, especialy in your case when it has to be modified in two places, which brings me to my other point:

Quote:
I don't see how putting the effects into a separate function would be better.... It would have a fuckload of arguments and be an extra function call in a callback that runs 25+ times a second.
If you were really concerned about performance, you wouldn't bother with things that have as little use as flying height limitations. It isn't even proper 3D, since it doesn't take terrain height into account. Two linked units could be standing on two hills so that a flying unit between them would touch the line, but still it wouldn't be affected by the spell because it would be too high above the ground?

I feel that code readability, maintainability and adaptability are more important in this case than one more function call.

Also, you should remove the no longer needed global variables from your map.

Quote:
Originally Posted by Rising_Dusk
With how long your code is, I can't help but imagine that there exists a more efficient and shorter method to making this spell.
Let's not jump to conclusions so quickly. Efficient and shorter don't always go hand in hand, also, complicated spells often require more code than you would guess at first glance.

This spell, however, is too long due to the duplicate code.
__________________

Last edited by Anitarf : 09-29-2007 at 10:36 PM.
Anitarf is offline   Reply With Quote
Old 09-29-2007, 11:07 PM   #30
The Elite
For External Use Only
 
The Elite's Avatar
 
Join Date: Jun 2007
Posts: 672

Submissions (6)

The Elite will become famous soon enough (60)The Elite will become famous soon enough (60)The Elite will become famous soon enough (60)

Default

off topic.
how do you use the color highlights, it didnt tell me in the vb code list
__________________

Goths are nerds that dress like vampires. -Dominant-Male
Oh, and wc3c wasn't dying back in 2007 and it isn't now. Our secret is simple: you can't kill the undead ... - Vexorian

We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft. - Chris Metzen on the Warcraft Movie
Man, we're considered elitist all over the internet. This makes me feel nice and warm inside. - ghenjis
Please help! I'll provide no information, you must guess! - Whitehorn
The Elite is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 07:00 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services