Sessional's Spell Aids --> Cool Shapes!

Go down

Sessional's Spell Aids --> Cool Shapes!

Post by Sessional on Sat Apr 12, 2008 10:16 am

To use these spell aids, copy and paste them into the header file.

To use these spells in GUI use the Custom Script action and use any of the following lines of code:

Code:
call ArchimedeanGraph(100, 4)
call ButterflyGraph(.14, 6, 500)
call VaseGraph(8, 1000)
call CircleGraph()


Code:
//###########################WARNING!!######################################\\
//#### Modifying this code may cause undesired errors and results, please ##\\
//#### for your own good, do not modify this code unless you understand  ##\\
//#### jass and can figure out how the formulas work.                    ##\\
//#############################CHANGELOG####################################\\
//#### March 17 : Production Started    March 18 : Added Vase Artwork    ##\\
//#### March 19 : Added Circle Artwork                                    ##\\
//##########################################################################\\


//#### Basic Spell Functions ####\\
function SpellDamageGroup takes group DamagedGroup, real Damage returns nothing
    local group DG = DamagedGroup
    local real D = Damage
    local unit CU
   
loop
    exitwhen CountUnitsInGroup(DG) < 1
    set CU = GroupPickRandomUnit(DG)
    call UnitDamageTarget(CU, null, D, false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, null)
    call GroupRemoveUnit(DG, CU)
endloop
    call DestroyGroup(DG)
endfunction

//#### Archimedean Functions ####\\
function ArchimedeanGraph takes integer RelativeRange, integer Revolutions returns nothing
    local real Radian = 57.29
    local integer M = RelativeRange
    local integer R = Revolutions
    local integer J = 1
    local integer K
    local real X
    local real Y
   
    loop
        exitwhen J > (R * 360)
        set K = ((J / R2I(Radian)) * (M / R))
        set X = (SinBJ(I2R(J)) * I2R(K))
        set Y = (CosBJ(I2R(J)) * I2R(K))
       
        call CreateNUnitsAtLoc(1, 'h001', GetOwningPlayer(GetTriggerUnit()), OffsetLocation(GetUnitLoc(GetTriggerUnit()), X, Y), bj_UNIT_FACING)
        set J = J + 1
    endloop
endfunction

//#### Butterfly Functions ####\\
function ButterflyGraph takes real RelativeRange, integer WingLines, real MaxRange returns nothing
    local real Radian = 57.29
    local real M = RelativeRange
    local integer S = WingLines
    local integer J = 1
    local integer K
    local real X
    local real Y
    local location LastUnitPoint
    local location CastPoint = GetUnitLoc(GetTriggerUnit())
    local real LastUnitRange
    local real Z = MaxRange
   
    loop
        exitwhen J > (S * 360)
        set K = ((J / R2I(Radian)) * (R2I(M)+S))
        set X = (TanBJ(I2R(J)) * I2R(K))
        set Y = (SinBJ(I2R(J)) * I2R(K))
       
        call CreateNUnitsAtLoc(1, 'h001', GetOwningPlayer(GetTriggerUnit()), OffsetLocation(CastPoint, X, Y), bj_UNIT_FACING)
        set LastUnitPoint = GetUnitLoc(GetLastCreatedUnit())
        set LastUnitRange = DistanceBetweenPoints(CastPoint, LastUnitPoint)
        if (LastUnitRange > Z) then
            call RemoveUnit(GetLastCreatedUnit())
        endif
        set J = J + 1
    endloop

endfunction

//#### Vase ####\\
function VaseGraph takes integer Lines, real MaxDistance returns nothing
    local real Radian = 57.29
    local real M = 26
    local integer S = (Lines/2)
    local integer J = 1
    local integer K
    local real X
    local real Y
    local real Z = MaxDistance
    local location LastUnitPoint
    local location CastPoint = GetUnitLoc(GetTriggerUnit())
    local real LastUnitRange
   
    loop
        exitwhen J > (S * 360)
        set K = ((J / R2I(Radian)) * (R2I(M)+S))
        set X = (CosBJ(I2R(J)) * I2R(K))
        set Y = (TanBJ(I2R(J)) * I2R(K))
       
        call CreateNUnitsAtLoc(1, 'h001', GetOwningPlayer(GetTriggerUnit()), OffsetLocation(CastPoint, X, Y), bj_UNIT_FACING)
        set LastUnitPoint = GetUnitLoc(GetLastCreatedUnit())
        set LastUnitRange = DistanceBetweenPoints(CastPoint, LastUnitPoint)
        if (LastUnitRange > Z) then
            call RemoveUnit(GetLastCreatedUnit())
        endif
        set J = J + 1
    endloop
endfunction


//#### Circle ####\\
function CircleGraph takes nothing returns nothing
    local integer R = 400
    local integer R2 = 80
    local integer J = 1
    local integer J2 = 1
    local real X2
    local real Y2
    local real X
    local real Y
    local real N = 1
    local unit LastUnit
    local unit CastUnit = GetTriggerUnit()
   
    loop
        exitwhen J > (360)
        set X = (SinBJ(I2R(J)) * I2R(R))
        set Y = (CosBJ(I2R(J)) * I2R(R))
       
        call CreateNUnitsAtLoc(1, 'h001', GetOwningPlayer(GetTriggerUnit()), OffsetLocation(GetUnitLoc(CastUnit), X, Y), bj_UNIT_FACING)
        set LastUnit = GetLastCreatedUnit()
       
        if (N > 19) then
            loop
              exitwhen J2 > (361)
              set X2 = (SinBJ(I2R(J2)) * I2R(R2))
              set Y2 = (CosBJ(I2R(J2)) * I2R(R2))
              call CreateNUnitsAtLoc(1, 'h001', GetOwningPlayer(GetTriggerUnit()), OffsetLocation(GetUnitLoc(LastUnit), X2, Y2), bj_UNIT_FACING)
              set J2 = J2 + 6
            endloop
            set J2 = 1
            set N = 0
        endif
        set J = J + 1
        set N = N + 1 
    endloop
endfunction

Any shapes or suggestions, just ask. This Spell Aid system is incomplete, and I will continue to work on it, as long as people find it useful.
avatar
Sessional
Shaman
Shaman

Number of posts : 19
Age : 25
Clan : Clan MapZ
Registration date : 2008-04-12

View user profile http://moonshade.servegame.org/news.php

Back to top Go down

Re: Sessional's Spell Aids --> Cool Shapes!

Post by ZeroX2)Fire on Sat Apr 12, 2008 10:30 am

Nice, you know JASS.
avatar
ZeroX2)Fire
Peon
Peon

Number of posts : 30
Location : South Korea
Clan : Clan WoD
Registration date : 2008-04-12

View user profile http://www.ClanWoD.quickbb.net

Back to top Go down

Re: Sessional's Spell Aids --> Cool Shapes!

Post by Sessional on Sat Apr 12, 2008 11:01 am

Yeah, Jass lets me have some fun with triggers.

>>With the custom script lines, feel free to change the numbers. Some numbers might cause the engine to lag, so be careful with what you do. Also, more likely then not, I'll update the circle to make it changeable without knowing jass.
avatar
Sessional
Shaman
Shaman

Number of posts : 19
Age : 25
Clan : Clan MapZ
Registration date : 2008-04-12

View user profile http://moonshade.servegame.org/news.php

Back to top Go down

Re: Sessional's Spell Aids --> Cool Shapes!

Post by TriggerHappy187 on Sat Apr 12, 2008 12:12 pm

Nice , i wish i could write jass i can only edit it but im learning
avatar
TriggerHappy187
Admin
Admin

Number of posts : 85
Age : 24
Clan : Mapz
Registration date : 2008-04-09

View user profile http://clanmapz.aforumfree.com

Back to top Go down

Re: Sessional's Spell Aids --> Cool Shapes!

Post by Sessional on Sat Apr 12, 2008 4:33 pm

Just a pointer, best way to start is simple. Jass is a language that I found easier to learn from taking someone else project, and morphing it to do something different.
avatar
Sessional
Shaman
Shaman

Number of posts : 19
Age : 25
Clan : Clan MapZ
Registration date : 2008-04-12

View user profile http://moonshade.servegame.org/news.php

Back to top Go down

Re: Sessional's Spell Aids --> Cool Shapes!

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum