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

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

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.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      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