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: 386

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: 397

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: 305

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.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top