Whoa, Math is cool.

Zanderist

New Member
Reaction score
5
So in my attempts to make a circle I ended up with this really weird effect.

Try it out in a random map.

Trigger:
  • Speical Effect
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set center_point = (Center of (Playable map area))
      • Set x = (x + 1.00)
      • Set y = (y + 1.00)
      • Set z = ((Power(x, 2.00)) + (Power(y, 2.00)))
      • Set z = (Power(z, 2.00))
      • Special Effect - Create a special effect at (center_point offset by x towards z degrees) using Doodads\Cityscape\Props\MagicRunes\MagicRunes0.mdl
      • Custom script: call RemoveLocation (udg_center_point)
 

Teelo

New Member
Reaction score
2
Uhh. Can you post a map with that code on it? Its annoying to recreate GUI :p

EDIT:
JASS:
library circle initializer init

    globals
        real x = 0
        real y = 0
        real z = 0
        location center_point
        trigger t = CreateTrigger()
    endglobals

    private function draw takes nothing returns nothing
        set x = x + 1
        set y = y + 1
        set z = (x * x) + (y * y)
        set z = z * z
        set center_point = GetRectCenter(bj_mapInitialPlayableArea)
        call DestroyEffect(AddSpecialEffectLoc("Doodads\\Cityscape\\Props\\MagicRunes\\MagicRunes0.mdl", (PolarProjectionBJ(center_point, x, z))))
    endfunction
    
    private function init takes nothing returns nothing
        call FogEnable(false)
        call FogMaskEnable(false)
        call TriggerRegisterTimerEvent(t, 1, true)
        call TriggerAddAction(t, function draw)
    endfunction
    
endlibrary

What is that pattern anyway? Randomness?
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
math is cool

now go pass calculus 1
 

Zanderist

New Member
Reaction score
5
Sure,

Now at one point the circle cuts in half, but trust me those special effects are still there, and yes it lags a little.

It's not random, it moves in a pattern.
math is cool

now go pass calculus 1

Does this mean you hang out on the 'Math Help Forum' too?

When you download the map, open up the special effect trigger.

And turn off:

Trigger:
  • Actions
    • Set z = (Power(z, 2.00))


To get a fire work effect.
 

Teelo

New Member
Reaction score
2
So the angle is the distance of the hypotenuse of x,y squared then the real value used as an angle?
Whats the pattern?
 

Zanderist

New Member
Reaction score
5
Did you see it?

It's starts out first as a star in the middle...wait I'll take a screen.

Anyways, I wish I could get rid of the middle part and just have the circle.

What I'm doing is using the circle formula.

x^2+y^2=r^2

However in this case 'r'='z'.

In reality I should be getting a circle but I'm not...but I think that's because I'm doing it wrong.

Use this to get half a parabola in place of the original.

Trigger:
  • Special Effect - Create a special effect at (center_point offset by ((Degrees(x)), (Radians(z)))) using Doodads\Cityscape\Props\MagicRunes\MagicRunes0.mdl
 

Attachments

  • Circle.jpg
    Circle.jpg
    73 KB · Views: 389

Zanderist

New Member
Reaction score
5
I call this one Dr. Manhattan from Watchmen.
 

Attachments

  • Dr Manhattan.jpg
    Dr Manhattan.jpg
    60.9 KB · Views: 400

Zanderist

New Member
Reaction score
5
Okay I just realized that's not Dr.Manhattan's symbol at all lol.

# Set z = (Power(z, 2.00))

Shouldn't that be 0.5?

No that would be square route z.

.5 is the same as 1/2 with something raised to the 1/2 power is square route that something.
 

HydraRancher

Truth begins in lies
Reaction score
197
Channel. I don't understand the purpose of this thread, are you just showing us a new trick?
 

foodflare

You can change this now in User CP.
Reaction score
32
i think this
Set z = (Square root(((Power(x, 2.00)) + (Power(y, 2.00)))))
should work, but idk can't test atm
 

Zanderist

New Member
Reaction score
5
Channel. I don't understand the purpose of this thread, are you just showing us a new trick?
Yes and at the same time trying to get some feedback on creating different shapes.

Right now I have created a spiral shape.

I'm still looking to make a circle.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Yes and at the same time trying to get some feedback on creating different shapes.

Right now I have created a spiral shape.

I'm still looking to make a circle.

Basically, you have to do something like this:
JASS:
function Hooray takes nothing returns nothing
    local unit u       = GetTriggerUnit()
    local real OriginX = GetUnitX(u)
    local real OriginY = GetUnitY(u)
    local real Radius  = 500
    local integer i    = 0
    local integer NumberOfSFX = 15
    local real angle = 360/NumberOfSFX
    local real SFX_X
    local real SFX_Y
    local string FX    = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl"  
        loop
            exitwhen i >= NumberOfSFX
            set SFX_X = OriginX+500*Cos((i*angle)*bj_DEGTORAD)
            set SFX_Y = OriginY+500*Sin((i*angle)*bj_DEGTORAD)
            call DestroyEffect(AddSpecialEffect(FX,SFX_X,SFX_Y))
            set i = i + 1
        endloop
    set u = null
endfunction


The NumberOfSFX tells how many effects there are going to be to form the circle. The origin is the source. The key part is OriginX+500 and OriginY+500. This adds 500 (which is the radius) to the origin. Now, we want to determine at what angle to do it. This loops for 15 times and creates an effect at the point. Each time, i increases by 1. This allows the angle to be modified each time.

So say 360/15 = 24.

On the first loop, it will create an effect at an angle of 0. (since 0*angle = 0)

On the second loop, it will create an effect at an angle of 1*24 = 24.

Third loop, angle of 2*24 = 48..... 14th loop, 14*24 = 336. Then the loop will end. (336 + 24 = 360)

Here is how it would be done in GUI:
Trigger:
  • CreateCircle
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fan of Knives
    • Actions
      • Set Origin = (Position of (Triggering unit))
      • Set NumberOfSFX = 15
      • For each (Integer A) from 1 to NumberOfSFX, do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect at (Origin offset by 500.00 towards ((Real((Integer A))) x (360.00 / NumberOfSFX)) degrees) using Abilities\Weapons\PhoenixMissile\Phoenix_Missile.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Origin)


A lot of equations you'd normally use in stuff like algebra 2 and geometry and all that aren't going to be that usable in here. Usually you have to result to some alternative method.

A lot of other shapes can be made basically by using lines. Kinda the same method. Distance/# of effects. Except the angle is the angle between the two points. Just basically use a loop with polar projection for i*(dist/# of sfx) and towards the angle between the two points and you have a line.
 

Zanderist

New Member
Reaction score
5
I've just made my first custom spell.

Run it and use divine shield.


Here is how it would be done in GUI:
Trigger:
  • CreateCircle
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fan of Knives
    • Actions
      • Set Origin = (Position of (Triggering unit))
      • Set NumberOfSFX = 15.00
      • For each (Integer A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect at (Origin offset by 500.00 towards ((Real((Integer A))) x (360.00 / NumberOfSFX)) degrees) using Abilities\Weapons\PhoenixMissile\Phoenix_Missile.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Origin)


A lot of equations you'd normally use in stuff like algebra 2 and geometry and all that aren't going to be that usable in here. Usually you have to result to some alternative method.

A lot of other shapes can be made basically by using lines. Kinda the same method. Distance/# of effects. Except the angle is the angle between the two points. Just basically use a loop with polar projection for i*(dist/# of sfx) and towards the angle between the two points and you have a line.

What decides the spacing between the effects?
 

Attachments

  • My First Custom Spell.w3x
    21.9 KB · Views: 309

PurgeandFire

zxcvmkgdfg
Reaction score
509
What decides the spacing between the effects?

The number of SFX determines the spacing between them. Basically, more sfx equals less spacing. Less sfx equals more spacing. More sfx makes it look more circular.

EDIT: This is how'd it look like.
Number of Effects: 7
7phoenix.jpg
Number of Effects: 15
15phoenix.jpg
Number of Effects: 30
30phoenix.jpg
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
That produces lag though right?

It produces lag based on the effect. If it is a very "laggy" effect and you add a lot, it will lag. But if you just use say like a couple it shouldn't lag much. The code itself shouldn't cause any lag.

If you are using for example, the phoenix fire, it will lag for a couple of seconds due to the effect. But then the lag will end. It will reduce fps by about 30 (lol, that is a lot) on my comp, but it is hardly noticeable since the effect only lasts a little while. It is just an example though, if you use some other effect it will probably only reduce by like 5-6 fps if not less. (unless it is a laggy effect like phoenix fire)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top