HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Circles

07-13-2008, 03:06 PM#1
Flame_Phoenix
Hi guys, I am making a spell, and I need to make a series of circles, like in this image.

Click image for larger version

Name:	Image1.jpg
Views:	28
Size:	114.5 KB
ID:	35620

However, there is a small problem ... that circle had a maximum range of 600, but it has no minimum range (is zero). I need to make a code to have something with a minimal range, like the following image:

Click image for larger version

Name:	Image2.jpg
Views:	22
Size:	108.2 KB
ID:	35621

I am currently using a crappy GUI algorithm for the first image, and I was thinking of changing it, to allow me to choose a minimal range for the circle ...
But I don't know how.. can some one help me please ?

Collapse GUI crappy algorithm:
function Trig_Bullseye_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A006' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Bullseye_Actions takes nothing returns nothing
    set udg_TempPoint = GetUnitLoc(GetTriggerUnit())
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = ( udg_RadiusLength / 10 )
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set udg_TempPoint2 = PolarProjectionBJ(udg_TempPoint, I2R(udg_RadiusLength), ( I2R(GetForLoopIndexA()) * ( 360.00 / ( I2R(udg_RadiusLength) / 10.00 ) ) ))
        call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', GetOwningPlayer(GetTriggerUnit()), PolarProjectionBJ(udg_TempPoint, I2R(udg_RadiusLength), ( I2R(GetForLoopIndexA()) * ( 360.00 / ( I2R(udg_RadiusLength) / 10.00 ) ) )), udg_TempPoint )
        call UnitApplyTimedLifeBJ( 8.00, 'BTLF', GetLastCreatedUnit() )
        call RemoveLocation(udg_TempPoint2)
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set udg_BullseyeInt = ( udg_RadiusLength - ( udg_RadiusLength / 4 ) )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = ( udg_BullseyeInt / 10 )
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set udg_TempPoint2 = PolarProjectionBJ(udg_TempPoint, I2R(udg_RadiusLength), ( I2R(GetForLoopIndexA()) * ( 360.00 / ( I2R(udg_RadiusLength) / 10.00 ) ) ))
        call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', GetOwningPlayer(GetTriggerUnit()), PolarProjectionBJ(udg_TempPoint, I2R(udg_BullseyeInt), ( I2R(GetForLoopIndexA()) * ( 360.00 / ( I2R(udg_BullseyeInt) / 10.00 ) ) )), udg_TempPoint )
        call UnitApplyTimedLifeBJ( 9.00, 'BTLF', GetLastCreatedUnit() )
        call RemoveLocation(udg_TempPoint2)
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set udg_BullseyeInt = ( udg_RadiusLength - ( udg_RadiusLength / 2 ) )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = ( udg_BullseyeInt / 10 )
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set udg_TempPoint2 = PolarProjectionBJ(udg_TempPoint, I2R(udg_RadiusLength), ( I2R(GetForLoopIndexA()) * ( 360.00 / ( I2R(udg_RadiusLength) / 10.00 ) ) ))
        call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', GetOwningPlayer(GetTriggerUnit()), PolarProjectionBJ(udg_TempPoint, I2R(udg_BullseyeInt), ( I2R(GetForLoopIndexA()) * ( 360.00 / ( I2R(udg_BullseyeInt) / 10.00 ) ) )), udg_TempPoint )
        call UnitApplyTimedLifeBJ( 10.00, 'BTLF', GetLastCreatedUnit() )
        call RemoveLocation(udg_TempPoint2)
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set udg_BullseyeInt = ( udg_RadiusLength - ( udg_RadiusLength / 2 ) )
    set udg_BullseyeInt = ( udg_BullseyeInt / 2 )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = ( udg_BullseyeInt / 10 )
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set udg_TempPoint2 = PolarProjectionBJ(udg_TempPoint, I2R(udg_RadiusLength), ( I2R(GetForLoopIndexA()) * ( 360.00 / ( I2R(udg_RadiusLength) / 10.00 ) ) ))
        call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', GetOwningPlayer(GetTriggerUnit()), PolarProjectionBJ(udg_TempPoint, I2R(udg_BullseyeInt), ( I2R(GetForLoopIndexA()) * ( 360.00 / ( I2R(udg_BullseyeInt) / 10.00 ) ) )), udg_TempPoint )
        call UnitApplyTimedLifeBJ( 11.00, 'BTLF', GetLastCreatedUnit() )
        call RemoveLocation(udg_TempPoint2)
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', GetOwningPlayer(GetTriggerUnit()), udg_TempPoint, udg_TempPoint )
    call UnitApplyTimedLifeBJ( 12.00, 'BTLF', GetLastCreatedUnit() )
    call RemoveLocation(udg_TempPoint)
endfunction

//===========================================================================
function InitTrig_Bullseye takes nothing returns nothing
    set gg_trg_Bullseye = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Bullseye, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Bullseye, Condition( function Trig_Bullseye_Conditions ) )
    call TriggerAddAction( gg_trg_Bullseye, function Trig_Bullseye_Actions )
endfunction

Help please ?
Attached Images
File type: jpgImage1.jpg (114.5 KB)
File type: jpgImage2.jpg (108.2 KB)
07-13-2008, 03:40 PM#2
Themerion
Make a proper jass script of it, or submit it with [trigger]-tags. Nobody's going to read it while you have bj_forLoopAIndex instad of... well... i

However, my suggested approach would be something like:

Expand JASS:
07-13-2008, 08:04 PM#3
Flame_Phoenix
Quote:
Make a proper jass script of it, or submit it with [trigger]-tags. Nobody's going to read it while you have bj_forLoopAIndex instad of... well... i
Ok

About your suggestion, you are trying to start the circle from outside and then complete its inner section, can you give me a more detailed example, I think that may be what I am looking for.

I'll give +rep =S
07-13-2008, 08:49 PM#4
Here-b-Trollz
Expand JASS:

EDIT: DAMN MY FAILURE TO READ!!!!
07-13-2008, 09:09 PM#5
Themerion
Very well...

Collapse JASS:
// Made by Themerion
// Requirements: none

// function CreateCircleTimed takes:
//
// forPlayer     -> Create the units for which player?
// innerRadius   -> The radius of the innermost circle
// outerRadius   -> The radius of the outmost circle
// circleCount   -> How many circles will there be?
// x and y       -> Origo of circles
// fxcount       -> How many effects will the @innermost circle@ consist of?
// fxcountinc    -> How many more effects will be used to build up the next cirlce?
// time          -> How long before the units of the circle dies?
// unitid        -> What unit-type does the circle consist of?

// If you set fxcountinc=0, the units will appear to stand in a line.

function CreateCircleTimed takes player forPlayer, real innerRadius, real outerRadius, integer circleCount, real x, real y, integer fxcount, integer fxcountinc, real time, integer unitid returns nothing
  local real r=innerRadius
  local real radiusInc=(outerRadius-innerRadius)/I2R(circleCount-1)

  local real phi=0
  local real phiInc

  loop
    exitwhen r+0.001>=outerRadius

    set phi=0
    set phiInc=2*bj_PI/I2R(fxcount)
    loop
        exitwhen phi+0.001>=2*bj_PI

// We create the unit, and we want it destroyed instantly so...
        call UnitApplyTimedLife(CreateUnit(forPlayer,unitid,x+r*Cos(phi),y+r*Sin(phi),180+Rad2Deg(phi)),'BTLF',time)

        set phi=phi+phiInc
    endloop
    set r=r+radiusInc
    set fxcount=fxcount+fxcountinc
  endloop

endfunction
07-14-2008, 10:56 AM#6
Flame_Phoenix
MMm Thx thermedion, but I won't use effects =S
The circle will be used with dummy units not effects.
Also is there a way to calculate the number of dummy units automatically ?

Please change the code, If you do so, you will get + rep and be credited in the spell I will soon submit (yes, another one).
07-14-2008, 11:11 AM#7
Anitarf
Did you even read the code? He is using units, not effects.
07-14-2008, 11:50 AM#8
Flame_Phoenix
Collapse JASS:
// fxcount       -> How many effects will the @innermost circle@ consist of?
// fxcountinc    -> How many more effects will be used to build up the next cirlce?
I did, but these comments are confusing me =S

EDIT EDIT EDIT

In fact, now I understand he likes units. Thx =)

Just one thing, i don't like creating a unit every time a cicle is repeated. Is there a way to only kill the units from the circle, when do something like "call data.destroy" ??


EDIT EDIT EDIT

Never mind, I am working on changing the code right now =)