Scripts / Which way is up

Author
Message
Tater
1
Years of Service
User Offline
Joined: 30th Mar 2023
Location:
Posted: 16th May 2023 17:15 Edited at: 16th May 2023 17:16
I'm trying to boost a player's jump between 2 actions. What I want to do is between the tl.state=="fired" and tl.state=="hit" is to be able to jump higher but only at that time. I've found no way to set a "jump height" for that time period so am trying ForcePlayer so that it will "boost" my jump when needed. Problem is that I can't find how to force player up, player will only go horizontally.


A double jump would be optimal but that doesn't look like it's going to be anytime soon. Can "forceplayer" work vertically and if so which way is up or is there a better way of doing this, (which I'm sure there is).
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th May 2023 19:01
Up is Y but you are fighting the gameplayercontrol.lua script which is trying to keep the player on the ground (it is a ground based FPS after all!).

You also have the issue of the physics on the player capsule which is also applying gravity so unless you take over control of the player position yourself and reposition every frame (and apply your own physics calculations within that positioning) you are fighting a battle you are unlikely to win.

Start by going through the gameplayercontrol.lua script and figuring out all the places it does any player positioning logic, figure out what it is doing and either comment it out or figure out how to override it externally.
Been there, done that, got all the T-Shirts!
PM
Tater
1
Years of Service
User Offline
Joined: 30th Mar 2023
Location:
Posted: 16th May 2023 19:17


I don't suppose that there is any way to manipulate the jump height for the "fired" state or shut the grav off to the player for that time?

BTW, I changed the name of the script because there were a lot of different files under the other name.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th May 2023 13:02
ForcePlayer only works horizontally.
there is GetGamePlayerControlJumpmax() & SetGamePlayerControlJumpmax() which is likely to be what you need
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Tater
1
Years of Service
User Offline
Joined: 30th Mar 2023
Location:
Posted: 17th May 2023 15:39 Edited at: 17th May 2023 16:10
thanks smallG, I saw that in the gameplayercontrol yesterday and tried it some. I'll work with it more today.

Out of curiousity what does this do? Is there an actual "power jump"; g_gameplayercontrol_powerjump=0
PM
Tater
1
Years of Service
User Offline
Joined: 30th Mar 2023
Location:
Posted: 18th May 2023 15:43 Edited at: 18th May 2023 19:58
So it's almost working. Right now I'm working with this and it seems that it's close.



Right now though it doesn't go back to the default setting of 215 all of the time and if I'm in "fired" state and let it "return" then the 800 stays the same for ever. It seems kind of "dirty".

[edit]
I take it that this means that I can't do anything with this?
-- command used by the default player control mechanism
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th May 2023 12:26
depends where you put the code, if you put it in the "fired" state and were still holding space then the SetGamePlayerControlJumpmax(215) line would never be run so it wouldn't reset, you should reset the height in the next stage too to cover such cases.

Quote: "I take it that this means that I can't do anything with this?
-- command used by the default player control mechanism"

no, it means it is in use by the default logic so might not work as expected depending on if the logic there is also trying to overwrite it... it's also just lazy documentation
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Tater
1
Years of Service
User Offline
Joined: 30th Mar 2023
Location:
Posted: 19th May 2023 16:53 Edited at: 19th May 2023 16:56
SetGamePlayerControlJumpmax: SetGamePlayerControlJumpmax() -- command used by the default player control mechanism

That it the whole line from the global.lua and there is no
GetGamePlayerControlJumpmax: GetGamePlayerControlJumpmax()

There is a
tplayerjumpnow=GetGamePlayerControlJumpmax()*ttjumpmodifier
listed in the gameplayercontrol.lua but this is the only line that it's in.

I grabbed a bigger hunk of the script here. I'm working in between the two sets of double hyphens and that's all that's changed of now.

but that's still a nogo
PM
Tater
1
Years of Service
User Offline
Joined: 30th Mar 2023
Location:
Posted: 19th May 2023 21:22
It's amazing what it turned out to be, good "push in the right direction" smallg and AM

was all that was needed for the "fired" state. The only next 2 available states are "hit" and "return" so I added the same line under both of them only setting the 500 to 215
PM
Tater
1
Years of Service
User Offline
Joined: 30th Mar 2023
Location:
Posted: 20th May 2023 19:31 Edited at: 21st May 2023 19:09
Is there a way to "throw" the entity or to make it like a weapon that can be stored and chosen. Once this is picked up it can't be put down so it's always in your hands.
PM
Tater
1
Years of Service
User Offline
Joined: 30th Mar 2023
Location:
Posted: 24th May 2023 16:45
I don't know if dropping the held entity can even be done so I switched to just hiding it and then showing the other. That way I can have 2 entities in my hands but only 1 is visible and functioning. This is what I'm working with,


With the '--if g_KeyPressR == 1 then'
commented out then it works as it reads. If I pick up the entity it is immediately destroyed or hidden. But as soon as 'if g_KeyPressR == 1 then' is not commented out then it won't even pick the entity up. Is this something that cannot even be done and if so am I going about it in the right way?
is not
PM
Tater
1
Years of Service
User Offline
Joined: 30th Mar 2023
Location:
Posted: 24th May 2023 21:14 Edited at: 24th May 2023 21:15
I finally got it to drop with a button press. This was it....
PM

Login to post a reply

Server time is: 2024-05-28 12:47:44
Your offset time is: 2024-05-28 12:47:44