• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[GUI] Parabola equations 1.1 (+Examples)

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Parabola Equations Tutorial By KnnO
This tutorial is useful for beginners, you can make your own toss ability (throw a unit to a point) or a bouncing ball map game!!!

The map contains 4 things so far:
1. A Parabola equation application that starts from point with 0 height, range or width of the parabola is <distance> and the max height (at the center of the distance) is <height>
2. A Parabola equation application that starts from point with <height>, range or width of the parabola is <distance> (this one looks like water coming out of a tap [faucet] )
3. Example Spell that is built from this tutorial.
4. Example of a ball mini game that bounces off boundaries and bounces off the ground
(click on the ball to move it)


Note: everything explained in the triggers.


Thanks for reading, If you see any leak in the triggers (excluding MapOnly category) please reply, also suggestions are welcomed.


There are 4 <regions> in the area, Top region, Bottom region, Left region, Right region.
When you click the ball, randomly the Throw trigger sets values, and prepare the equation.
When the ball touches the ground a new equation is generated, with a new starting point which is the land point, but with smaller distance and height.
When the ball enters the boundary regions, the direction the ball is moving is reflected, and moved one step backwards so it is not in the region,
also at this point a new equation is generated, the starting height which is the current flying height of the ball, and the new angle which is the direction the ball is moving.
When the distance is getting more less to reach zero, the trigger turns off and reset the ball to its place.
2h5o1ty.png




It is like any other spell on the hiveworkshop, MUI, GUI, no-leaks, easy to config... etc

The hero throws a rock at a target point out of nowhere, dealing (100,150,200,250) damage and stun enemies for 2 seconds.

the spell also kills trees


The first parabola is from a point with 0 height:
Modifiers:
- you can change what is the distance to intercept the parabola with the ground.
- you can change the max height the parabola can reach.

nch03.png


The second parabola is from a point with a height:
Modifiers:
- you can change what is the distance to intercept the parabola with the ground.
- you can change the starting height of the point.

57401.png




In these triggers I used a factor variable to modify X so the time it will take to intercept the ground is already defined.

For example, the factor is increased by 0.02 in a periodic event (0.02 ms)
so the interception is after 1 second


  • Set _pPos = <factor between 0.0 and 1.0>
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • _pPos Greater than or equal to 1.00
    • Then - Actions
      • -------- If the factor is over 1.0 (parabola intercepts) then do something --------
    • Else - Actions
  • -------- Arguments for the equation. --------
  • Set _pDistance = <distance to travel>
  • Set _pA = <max height>
  • -------- X is factor * distance so it can be substituted in the formula --------
  • Set _pX = (_pPos x _pDistance)
  • Set _pReal = (((-4.00 x _pX) x (_pX - _pDistance)) x (_pA / (Power(_pDistance, 2.00))))
  • -------- Now we apply <the position> and <the flying height> --------
  • Set TempPoint = (<origin point> offset by _pX towards <direction you want> degrees)
  • Animation - Change <unit> flying height to _pReal at 0.00
  • Unit - Move <unit> instantly to TempPoint
  • Custom script: call RemoveLocation (udg_TempPoint)


  • Set _pPos = <factor between 0.0 and 1.0>
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • _pPos Greater than or equal to 1.00
    • Then - Actions
      • -------- If the factor is over 1.0 (parabola intercepts) then do something --------
    • Else - Actions
  • -------- Arguments for the equation. --------
  • Set _pDistance = <distance to travel>
  • Set _pA = <starting height (origin height)>
  • -------- X is factor * distance so it can be substituted in the formula --------
  • Set _pX = (_pPos x _pDistance)
  • Set _pReal = (((_pX + _pDistance) x (_pX - _pDistance)) x ((-1.00 x _pA) / (Power(_pDistance, 2.00))))
  • -------- Now we apply <the position> and <the flying height> --------
  • Set TempPoint = (<origin point> offset by _pX towards <direction you want> degrees)
  • Animation - Change <unit> flying height to _pReal at 0.00
  • Unit - Move <unit> instantly to TempPoint
  • Custom script: call RemoveLocation (udg_TempPoint)




These are the things I am going to do:

[ ] Make 3 spells (I already though of them) that make use of XY plane of the game
[ ] Fix some stuff
[ ] Add a command to hide dummy units for less lag


Keywords:
parabola, toss, bounce, math, equation, tutorial
Contents

__Parabola Equations Tutorial (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 13:59, 17th Jul 2012 Magtheridon96: The flying height of the unit is the distance between the unit and ground. The Z of a unit is equal to the terrain Z + the flying height. Take that...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

13:59, 17th Jul 2012
Magtheridon96:

The flying height of the unit is the distance between the unit and ground.
The Z of a unit is equal to the terrain Z + the flying height.
Take that into account when setting the flying height of a unit.
You need to make it seem like you're setting the Z.
 
you should use co-ordinates as opposed to points, also this doesn't account for hills or walls which it should crash into and stop early on. (Which for a system dedicated to parabolas could be considered an issue, since without it a bouncing ball game wouldn't be so great and wouldn't look as it should)

Your periodic event should run at 0.03 seconds

The tutorial isn't for MPI or MUI usage in the way it's shown (I'd suggest adding a spell example of usage which /is/)

Really if this is a tutorial you should explain the maths to it, rather than just give the maths
 
Level 8
Joined
Sep 18, 2011
Messages
195
Okay, I will improve this map by doing these:
- Add two example spells (with MUI and explained)
- Minigame ball and it will be bouncing with wall (not sure for the hills I don't know how to detect it, because the flying height is relative to the position ground height)

Thanks for comments and suggestions

(I think I am a terrible guide for newbies :( )

----------------------------------------
About the minigame ball, I was wondering if the reflection should be based on custom surfaces normal, or simply just using 4 sides (top left bottom right) surfaces as borders to the minigame area...
(Currently I am doing only 4 sides)
 
Last edited:
Level 8
Joined
Sep 18, 2011
Messages
195
New version uploaded:

-Reduced periodic times
-Added more comments inside the triggers (yes this is where you learn)

Added the examples:

-A ball mini game that bounces on the ground and reflects when hitting on the wall (see screenshot in the description)
-"Throw a rock" Spell, I really think this is self explanatory.
 
The bouncing ball example isn't MUI (obviously) but, try putting a cliffs inside the bouncing ball "arena" Really for a proper bouncing ball game you should be able to throw the ball over these boundaries and it'd only hit into them if the boundaries are higher than the ball

Also you shouldn't be using regions, you just have to check to see if the "boundary" unit or whatever is within a given range of the ball in your example.

You're also still running a loop at 0.02 (the bouncing ball one)

The throw rock example looks fine however how you've done the indexing is extremely, why are you multiplying by 2 and taking away one constantly? just save everything to the same index as the unit is found on, it's only logical.

Still don't like the fact that you're using locations for these parabolas, could cause people to make a lot of laggy spells later on if they do too, Also in your rock throw I recommend you use triggered damage, and adding those to the configurables and suchlike.

I noticed you removed the third slider (which wasn't functioning before) where you planning on making a speed slider there or something?

Eitherway as far as the main tutorial section of it (not the examples) looks fine I guess.
 
Level 8
Joined
Sep 18, 2011
Messages
195
The bouncing ball example isn't MUI (obviously) but, try putting a cliffs inside the bouncing ball "arena" Really for a proper bouncing ball game you should be able to throw the ball over these boundaries and it'd only hit into them if the boundaries are higher than the ball
I can make that, it is very easy, you just check if the current height is more than <specific height> when inside the bouncing region then don't bounce.

Also you shouldn't be using regions, you just have to check to see if the "boundary" unit or whatever is within a given range of the ball in your example.
I noticed there are lags because there are alot of units in the map, I will replace them with something else, so it is not useful.

You're also still running a loop at 0.02 (the bouncing ball one)
Just for the ball :D to make it smooth, you can change that.

The throw rock example looks fine however how you've done the indexing is extremely, why are you multiplying by 2 and taking away one constantly? just save everything to the same index as the unit is found on, it's only logical.
I remember I read once about arrays, so I don't want to use two arrays for units like: ( var_TargetUnit[] ) and ( var_CastingUnit[] ), so I used a 2D array, also my job here is not to explain the spell very much, just showing how to use it.

Still don't like the fact that you're using locations for these parabolas, could cause people to make a lot of laggy spells later on if they do too, Also in your rock throw I recommend you use triggered damage, and adding those to the configurables and suchlike.
-simply the unit is moving on X plane by polar offset with a varying range of the origin, so there must be locations.
-I made the spell very quickly yesterday so perhaps I will work on it

I noticed you removed the third slider (which wasn't functioning before) where you planning on making a speed slider there or something?
lol well yeah, I didn't think of something, it wasn't made in the first place, just tiled the ground, also I reduced the pink pudge periodic trigger time to make it less laggy, also maybe I will add a command to hide the invisible path (alot of dummy units), so it reduces lag

Eitherway as far as the main tutorial section of it (not the examples) looks fine I guess.
Ohh thanks, The equation application is very simplified, so I used it with same simplification for the other spells, I can already make a huge spell with extremely less variables and simpler way, It is just to show you how to get a use on this tutorial.

The conclusion is:
in the near future when I'm free, II have these objectives:
- add some cliffs inside the mini game.
- 0.02 to 0.03 in the mini game periodic trigger
- triggered damage for the spell
 
Level 8
Joined
Sep 18, 2011
Messages
195
Well sorry for that, It is just I don't know a standard way of naming variables according to what they refer to, so I name them as much close, with different prefixes.

Another thing is that there are many languages in my mind with each one's perplexity and involving its syntax, constants and variable names.

The best way is to see each trigger and after reading it, re-read it and understand each variable type.

Sorry again, but I hope you get something useful from this.
 
Top