HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spell: Circle of Fire - Difficulty

01-16-2007, 11:02 PM#1
Fulla
Circle of Fire
Creates a circle of fire around the caster, starting 500 away from his facing angle, going both left/right in a circle until it meets the back.

Ive got most of this spell done, but basically my brain has gone, I just cant think how to do it.

I thought, get x/y of
-Caster
-polarprojection, 350 away from him towards facing angle

Get Angle between points, now with a timer keep making the dummy fire but increase/subtract angle.

The spell is confusing me thou :-(
Perhaps I just need some rest and begin again tomorrow.

Collapse JASS:
      //####################################################################################\\
      //                            Spell Name: Circle of Fire                              \\
      //                            Spell Auth: Fulla                                       \\
      //####################################################################################\\


               //################################################################\\
               //                                                                \\
               //                     Configuration Section                      \\
               //                                                                \\
               //################################################################\\

//Circle of fire hero ability
constant function Circle_of_Fire_AbilId takes nothing returns integer
    return 'A07T'
endfunction

//Dummy immolation
constant function Circle_of_Fire_DummyAbilId takes nothing returns integer
    return 'A05K'
endfunction

//Dummy fire model/unit
constant function Circle_of_Fire_DummyUnitId takes nothing returns integer
    return 'h00L'
endfunction

//Speed flames are created
constant function Circle_of_Fire_Intervals takes integer lvl returns real
    return 0.25
endfunction

//Radius of flame from caster
constant function Circle_of_Fire_Area takes integer lvl returns integer
    return 350.
endfunction


               //################################################################\\
               //                                                                \\
               //                        Spell Section                           \\
               //                                                                \\
               //################################################################\\

function Trig_Circle_of_Fire_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Circle_of_Fire_AbilId()
endfunction

function Circle_of_Fire_Creation takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local string s = GetAttachmentTable(t)
    
    local unit caster = GetTableObject(s,"Caster")
    local real angle1 = GetTableReal(s,"Angle1")
    local real angle2 = GetTableReal(s,"Angle1")
    local real x1 = GetTableReal(s,"X1")
    local real y1 GetTableReal(s,"Y1")
    local real x2 GetTableReal(s,"X2")
    local real y2 GetTableReal(s,"Y2")
    local unit dummy
    local unit owner = GetOwningPlayer(caster)
    
    set dummy = CreateUnit(owner, Circle_of_Fire_DummyUnitId(), x2, y2, 0.)
    call SetUnitAbilityLevel (dummy, Circle_of_Fire_DummyAbilId(), lvl)    
    call UnitApplyTimedLifeBJ(2., 'BTLF', dummy)
    
    set caster = null
    set dummy = null
    set owner = null
    
    if dur <= 0 then
        call ClearTimer(t)
    else
    call SetTableReal(s,"Angle",angle)    
    call SetTableInt(s,"Dur",dur)
    endif
        
    endfunction

function Trig_Circle_of_Fire_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local string s = GetAttachmentTable(t)
        
    local unit caster = GetTriggerUnit()
    local player owner = GetOwningPlayer(caster)
    local integer lvl = GetUnitAbilityLevel(caster, Circle_of_Fire_AbilId())
    local real x1 = GetUnitX(caster)
    local real y1 = GetUnitY(caster)
    local real angle1 = GetUnitFacing(caster)
    local real angle2 = GetUnitFacing(caster)
    local real radius = Circle_of_Fire_Area(lvl)
    local real speed = Circle_of_Fire_Intervals(lvl)
    local integer dur = 12
    
    local location flame = PolarProjectionBJ(Location(x1, y1), radius, angle1)
    local real x2 = GetLocationX(flame)
    local real y2 = GetLocationY(flame)
    
    call SetTableObject(s,"Caster",caster)
    call SetTableReal(s,"Angle1",angle1)
    call SetTableReal(s,"Angle2",angle2)
    call SetTableReal(s,"X1",x1)
    call SetTableReal(s,"Y1",y1)
    call SetTableReal(s,"X2",x2)
    call SetTableReal(s,"Y2",y2)
    call SetTableInt(s,"Dur",dur)
    call TimerStart(t, speed, true, function Circle_of_Fire_Creation)
    set caster = null
    set owner = null
    set flame = null
endfunction

//===========================================================================
function InitTrig_Circle_of_Fire takes nothing returns nothing
    set gg_trg_Circle_of_Fire = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Circle_of_Fire, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Circle_of_Fire, Condition( function Trig_Circle_of_Fire_Conditions))
    call TriggerAddAction(gg_trg_Circle_of_Fire, function Trig_Circle_of_Fire_Actions)
endfunction
01-16-2007, 11:19 PM#2
wyrmlord
I've made a spell similar to this before, only one flame and it spiraled out from the caster. Here's some steps to help you think it through:

1. PolarProjection with the caster's facing angle and your distance (I know you did this already)

2. Start a periodic timer, each time it expires, get the angle between the position the caster was when he started casting and each of the balls.

3. Add or subtract degrees from this angle (depending on which ball it is) and then use PolarProjection to get the new point the ball will move to.

4. Keep doing this until the angle between the balls are equal or almost equal from the caster's starting position.

Hope this helps with thinking, if not I can post some code.

Also, the balls will be very close to each other right when the spell starts being cast, make sure this isn't interfering with anything.