• 🏆 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!

Simple Gravity Pull System v1.2

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
- This system allows you to handle your unit(s) to be thrown in the air with having reduced speed every 0.03 second (deceleration).
- This will make your jump to be more "realistic".
- You will throw the units into higher grounds if you apply the system while he's in mid-air.


External Instructions
- World Editor ~ File ~ Preferences... ~ General Tab ~ Tick the Automatically create unknown variables while pasting trigger data
- Copy the Simple Gravity Pull System folder.
- After you have copied it, you may have noticed that GP Setup and GP Save has a disabled action, right ? Simply double-click on that action and press Enter.

Internal Instructions
- There are 5 variables which you can manipulate;
GP_FlySpeedPerSecond
GP_PullSpeedPerSecond
GP_Unit
GP_TempGroup
GP_CenterPickedUnitLoc

- To use for single-target-unit, simply;
  • Set GP_FlySpeedPerSecond = XXX
  • Set GP_PullSpeedPerSecond = XXX
  • Set GP_Unit = XXX
  • Trigger - Run GP Save <gen> (ignoring conditions)
- To use for multiple unit picked;
  • Set GP_FlySpeedPerSecond = XXX
  • Set GP_PullSpeedPerSecond = XXX
  • Set GP_CenterPickedUnitLoc = XXX
  • Set GP_TempGroup = XXX
  • Trigger - Run GP Save <gen> (ignoring conditions)
- Make sure after you have set all the variables, run the action Trigger - Run GP Save <gen> (ignoring conditions).

You can also manipulate Events by making the GP_Event as the Event;
1. GP_Event = 1.00 (unit has landed - use GP_Unit as the unit)
2. GP_Event = 2.00 (unit has reached maximum height - use GP_Unit as the unit)

  • GP Event Land
    • Events
      • Game - GP_Event becomes Equal to 1.00
    • Conditions
    • Actions
      • -------- ---------- --------
      • -------- When GP_Event = 1.00, it detects a unit has landed --------
      • -------- Use GP_Unit to refer to the unit that just lands --------
      • -------- ---------- --------
      • Unit - Kill GP_Unit
  • GP Event Max Height
    • Events
      • Game - GP_Event becomes Equal to 2.00
    • Conditions
    • Actions
      • -------- ---------- --------
      • -------- When GP_Event = 2.00, this detects a unit has reached maximum height --------
      • -------- Use GP_Unit to refer to the unit that just reached its maximum height --------
      • -------- ---------- --------
      • Unit - Kill GP_Unit
  • GP Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ---------- --------
      • -------- DATA CONFIGURABLES --------
      • -------- GP_FlySpeedPerSecond sets the speed in which the unit travels upward per second --------
      • -------- GP_PullSpeedPerSecond sets the pulling speed that affects the unit per second --------
      • -------- GP_Unit sets which unit is involved --------
      • -------- GP_CenterPickedUnitLoc sets the origin location of which where it starts to pick for multiple units --------
      • -------- GP_TempGroup sets the unit which is involved --------
      • -------- ---------- --------
      • -------- FORMULA --------
      • -------- The time taken for the unit to fall back to the ground is given by ((GP_FlySpeedPerSecond / GP_PullSpeedPerSecond) * 2) --------
      • -------- ---------- --------
      • Set GP_IntervalPerMove = 0.03
      • Trigger - Add to GP Loop <gen> the event (Time - Every GP_IntervalPerMove seconds of game time)
      • -------- ---------- --------
      • -------- This is to register the variable within this Trigger Folder - so you can easily import it to another map --------
      • -------- If this action is not done, the importing of GP_CenterPickedUnitLoc is failed --------
      • -------- ---------- --------
      • Set GP_CenterPickedUnitLoc = (Center of (Playable map area))
      • Custom script: call RemoveLocation(udg_GP_CenterPickedUnitLoc)
  • GP Save
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (GP_TempGroup is empty) Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in GP_TempGroup and do (Actions)
            • Loop - Actions
              • Set GP_Unit = (Picked unit)
              • Custom script: set udg_GP_Key = GetUnitUserData(udg_GP_Unit)
              • Set GP_FlySpeedPerInterval[GP_Key] = (GP_FlySpeedPerSecond x GP_IntervalPerMove)
              • Set GP_PullSpeedPerInterval[GP_Key] = ((GP_PullSpeedPerSecond x GP_IntervalPerMove) x GP_IntervalPerMove)
              • Set GP_HasMax[GP_Key] = False
              • Unit Group - Add GP_Unit to GP_Group
          • Custom script: call RemoveLocation(udg_GP_CenterPickedUnitLoc)
          • Custom script: call DestroyGroup(udg_GP_TempGroup)
        • Else - Actions
          • Custom script: set udg_GP_Key = GetUnitUserData(udg_GP_Unit)
          • Set GP_FlySpeedPerInterval[GP_Key] = (GP_FlySpeedPerSecond x GP_IntervalPerMove)
          • Set GP_PullSpeedPerInterval[GP_Key] = ((GP_PullSpeedPerSecond x GP_IntervalPerMove) x GP_IntervalPerMove)
          • Set GP_HasMax[GP_Key] = False
          • Unit Group - Add GP_Unit to GP_Group
      • Trigger - Turn on GP Loop <gen>
  • GP Loop
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (GP_Group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in GP_Group and do (Actions)
            • Loop - Actions
              • Set GP_Unit = (Picked unit)
              • Custom script: set udg_GP_Key = GetUnitUserData(udg_GP_Unit)
              • Animation - Change GP_Unit flying height to ((Current flying height of GP_Unit) + GP_FlySpeedPerInterval[GP_Key]) at 0.00
              • Set GP_FlySpeedPerInterval[GP_Key] = (GP_FlySpeedPerInterval[GP_Key] - GP_PullSpeedPerInterval[GP_Key])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Current flying height of GP_Unit) Less than or equal to 1.00
                • Then - Actions
                  • Set GP_Event = 1.00
                  • Set GP_Event = 0.00
                  • Unit Group - Remove GP_Unit from GP_Group
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • GP_FlySpeedPerInterval[GP_Key] Less than or equal to 0.00
                      • GP_HasMax[GP_Key] Equal to False
                    • Then - Actions
                      • Set GP_Event = 2.00
                      • Set GP_Event = 0.00
                      • Set GP_HasMax[GP_Key] = True
                    • Else - Actions
Bribe - Unit Indexer
Magtheridon96 - AutoFly


v1.0
- Initial release

v1.1
- Added 2 Events; Unit has landed / Unit has reached maximum height
- GP_CenterPickedUnitLoc can now be imported correctly

v1.2
- Uses Unit Indexer


Keywords:
simple, gravity, pull, system, defskull, hashtable, unit, indexer, unit indexer, AutoFly, Z-fly, z, fly, height.
Contents

Just another Warcraft III map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 18:10, 2nd Sep 2012 Magtheridon96: Seems like a fine system, but I would recommend fixing up the terminology. Better variable names would be nice : / Currently, it's hard for me to read...

Moderator

M

Moderator

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

18:10, 2nd Sep 2012
Magtheridon96: Seems like a fine system, but I would recommend fixing up the terminology.

Better variable names would be nice : /
Currently, it's hard for me to read the system because it's not Physics-person-friendly D:

Acceleration should be the only thing configurable for a unit and maybe terminal velocity. (Max fall speed)
And it should be called Acceleration, not Pull speed :p
FlySpeedPerInterval can simply be FallSpeed
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
hmmm.Maybe putting some documentations in every actions so its easy to understand
I'll try later :)
Also, you should use it, not to understand the core system of it ^_^.

That is what we called as "Examples".

How do you make custom intervals?
1. Set Real variable to your value of interval
2. Create another trigger
3. Use this;
  • Trigger - Add to 2nd Trigger <gen> the event (Time - Every YourRealVariable seconds of game time)
units are supposed to accelerate when they fall not decelerate
What I really want to say was, the "deceleration" occurs to the GP_FlySpeed, not the "actual" speed felt by the unit.

Also, if you want to test out if unit is falling with "acceleration" related to the height where they start to fall back, simply spam the spell and compared it to the unit that is no-spam spell.

You will notice the spammed spell unit falls with great speed, related to the height where they start to fall.


Also, for formula/math/logic geeks out there, don't judge the calculations, it is meant to be simple.

EDIT:
System has been updated, check the changelogs.
 
Last edited:
Level 25
Joined
Jun 5, 2008
Messages
2,572
Also, for formula/math/logic geeks out there, don't judge the calculations, it is meant to be simple.

So you basically are shutting down any help you may get to improve your calculations by getting advice from smarter people than you, not geeks as you put it, by insulting them?

Simpler is not always better, and calculations are at least fast enough not to impede efficency much but can make the system work as it should.

Just an opinion, because i see no reason to be rude in the explanation of formula used, or to excuse yourself of using a possibly bad formula behind the cover of "simplicity".
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
So you basically are shutting down any help you may get to improve your calculations by getting advice from smarter people than you, not geeks as you put it, by insulting them?

Simpler is not always better, and calculations are at least fast enough not to impede efficency much but can make the system work as it should.

Just an opinion, because i see no reason to be rude in the explanation of formula used, or to excuse yourself of using a possibly bad formula behind the cover of "simplicity".
Okay sorry :/
If you have any ideas on how to improve the calculations, do tell ;p
Also, if you can, don't make it as powerful calculation as I want this system to be lightweight as possible.

Heaven't checked the triggers but nice idea!
You should check it first, then say it is nice idea >.>"
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
A user should be able to register a unit and acceleration, and that's it :p
GP_Acceleration and GP_Unit
Are you telling me that I should let the user to specify other variables (CenterPickedLoc,etc) in setup trigger ?
That is like you set those properties and you will follow that properties, whereas I want it like, the user can adjust themselves.

Perhaps Spell A will throw the unit at Speed X while Spell B at Speed Y.

I don't want to globally set the variable, I want freedom for users - they can choose whatever values they want for whatever triggers they have.

  • Set GP_CenterPickedUnitLoc = (Target point of ability being cast)
Look at this variable, what if the user do not want to pick the area at the targetPoint ?
What if the user wants to pick area offset by 500 towards 90.00 ?
It's more freedom to user.

The initial falling speed would be 0.
After each iteration, you would add GP_Acceleration to the current falling speed of the unit.
What's wrong with my current method ?
Positive for going up and Negative for going down - don't tell me this will affect 'efficiency'.

Also, why are you using hashtables if you have unit indexer as a requirement?
This thing is using a hashtable to attach data to units when it could use arrays.
Will turn it to Indexing.

EDIT:
Updated to v1.2
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
Acceleration should be the only thing configurable for a unit and maybe terminal velocity. (Max fall speed)
What do you meant by this ?
Configure acceleration ??
Currently I have;
GP_FlySpeedPerSecond
GP_PullSpeedPerSecond
GP_Unit
GP_TempGroup
GP_CenterPickedUnitLoc

All of these configurables are important to the user, depends on what they need.
I don't want to control/limit their freedom to have complete control over my system.

GP_FlySpeedPerSecond - Determines the speed of the unit travelling on Z-plane per second
GP_PullSpeedPerSecond - Determines the speed of the 'pulling' of the unit travelling on the Z-plane per second
GP_Unit - Determines which unit should the user wants (it could be TargetUnit, it could be TriggerUnit, it could even be LastCreatedUnit, so this is the freedom I was talking about, to configure which unit should the user apply this system
GP_TempGroup - Determines which unit/how big is he AOE/filter unwanted unit(s)/etc
GP_CenterPickedUnitLoc - Determines the center of the point where the picking of units occur

All of these will depend on the user itself therefore it should remain as configurable (I don't want to set standard values per game, I want to set standard values per use).

Also,
And it should be called Acceleration, not Pull speed :p
Currently, it's hard for me to read the system because it's not Physics-person-friendly D:

Lol.
 
Top