Scripts / [SOLVED] Jump pad

Author
Message
SOLO DESIGN
15
Years of Service
User Offline
Joined: 30th Jul 2008
Location: Kent, England
Posted: 23rd Jan 2019 12:17
Hi,
Is there a script available or is it possible to have the player when he/she walks on an entity or marker that he/she is launched into the air?

The idea is to gain access to higher points in a level, the player still can fall and die if they do not position themselves properly before walking on the entity (jump pad, column of air, anti gravity pad etc)

Thanks for your help.

The author of this post has marked a post as an answer.

Go to answer
PM
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 23rd Jan 2019 12:34 Edited at: 23rd Jan 2019 12:44
Yes it is possible, i've seen a game demo (i think it was unfamilia on here that made the game) which does a similar thing (except horizontally), i have no idea how it would work though, hopefully someone else can help you with it.

Edit: It was in his game "Steve" that he entered into a gamedevfort competition, check it here: https://forum.game-guru.com/thread/212963

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 23rd Jan 2019 18:25 Edited at: 23rd Jan 2019 18:27
I spent a few minutes looking at this but didn't quite crack it. It would be cool to create Quake-style jump pads for multiplayer arenas. Sadly, the Forceplayer (y,f) command only works in the horizontal (y = angle, f = force).

The closest I got was using the JetpackThrust command, but it only lifts the player very slowly and can't be set to more than 1.0.


Then there's this variations that temporarily changes the jump height of the player, but they physically have to jump:



I can't seem to forcibly fire the jump command using SetGamePlayerControlJumpMode(1), presumably because it clashes with a command in gameplayercontrol.lua that means you have to press space to jump at all times.

AE
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Jan 2019 19:30 Edited at: 23rd Jan 2019 19:40
Transport the player, i.e. calculate the next point on the trajectory per frame and use SetFreezePosition(x,y,z) followed by TransportToFreezePositionOnly().

The tricky part is to know when to stop doing this, probably by ray casting directly down a few units from the point calculated and stopping when you get either terrain or an entity detected. Plus ray casting forward from the point and stopping when something is detected (so you don't try to 'super jump' through walls!).

(btw you can get the ballistic maths equations from google )
Been there, done that, got all the T-Shirts!
PM
Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 23rd Jan 2019 20:15
Quote: "calculate the next point on the trajectory per frame"


Won't this require v-sync to be switched on to get reliable results?

AE
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 23rd Jan 2019 21:29
Quote: "Yes it is possible, i've seen a game demo (i think it was unfamilia on here that made the game) which does a similar thing (except horizontally), i have no idea how it would work though, hopefully someone else can help you with it.

Edit: It was in his game "Steve" that he entered into a gamedevfort competition, check it here: https://forum.game-guru.com/thread/212963"

yh i remember making that, it was before we had access to the player / camera controls so we used a barrel as a temporary player and moved that then repositioned the player using the TransportToIfUsed(e) command, you would definitely want to do it the way amen is suggesting now that we have access to real camera controls though.

for stopping the catapults had an actual target on the map so stopping was simply a distance check, you could still do that or a timer or indeed use the ray casts to determine a stopping point.

isn't it always a good idea to have vsync on? personally i never play a game without it, nothing worse than having a game feel inconsistent because it keeps making me move faster or slower etc due to the frame rate fluctuations.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Jan 2019 22:03 Edited at: 26th Jan 2019 12:48
Nope, you can calculate how long each frame takes and adjust accordingly, I do it all the time in many of my scripts to make sure that they behave the same at any frame rate.

(although I second what synchromesh said, vsync on is always a good idea if you are moving stuff around in GG)

Here is a really simple version:



Simply doing a linear 'jump' rather than proper ballistic trajectory just to demonstrate the principle.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 26th Jan 2019 12:58
Bump, as I edited the last post and no one will realise if I don't.
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 26th Jan 2019 16:27
This post has been marked by the post author as the answer.
Slight improvements to the script.

1) Name of entity passes parameters. e.g. 'jumppad,12,4,2000' means initial jump vector is 12 units Up and 4 units forward, time period of jump is 2000 milliseconds or 2 seconds iow.

2) Simple collision detection added.

3) Pseudo gravity added to make the jump more ballistic like.

Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 26th Jan 2019 17:04
Noice!

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
granada
Forum Support
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 26th Jan 2019 20:01
Nice work mr A

Dave
Windows 10 Pro 64 bit
GeForce GTX 1050 Ti
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
1920x1080,60 Hz
PM
=VX=Doggy
14
Years of Service
User Offline
Joined: 29th Nov 2009
Location: USA NC
Posted: 27th Jan 2019 04:19
Very cool !
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 27th Jan 2019 19:48
Having fun with this great script.
Thank you !
PM
SOLO DESIGN
15
Years of Service
User Offline
Joined: 30th Jul 2008
Location: Kent, England
Posted: 28th Jan 2019 13:21
Thanks AmenMoses, this will do the trick I think.

I am not a Lua programmer, could you let me know what values you would change in this script for height and length of the jump??

Thanks again
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Jan 2019 18:49
i mean that was step 1
Quote: "1) Name of entity passes parameters. e.g. 'jumppad,12,4,2000' means initial jump vector is 12 units Up and 4 units forward, time period of jump is 2000 milliseconds or 2 seconds iow."
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-04-26 10:45:06
Your offset time is: 2024-04-26 10:45:06