Product Chat / Steam Question: I have a question about the player speed.

Author
Message
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 27th Apr 2018 20:37
Q: I have a question about the player speed. Is there any way to make a trigger with a script setting the speed to 0, and another trigger resetting the speed to 100 ?

A: Now that we have moved the player mechanics to a LUA script, you can view the "gameplayercontrol.lua" script and look for the command "SetGamePlayerControlBasespeed(x)". This controls the players base speed at all times, and the script uses it often. You can override the above script with your own logic to freeze the player in their tracks, and then restore the previous behavior as needed. Remember to backup your custom version of this script as when the Steam auto-update happens, it may erase your changes with the latest from the build.
PC SPECS: Windows 8.1 Pro 64-bit, Intel Core i7-5930K (PASSMARK:13645), NVIDIA Geforce GTX 980 GPU (PASSMARK:9762) , 32GB RAM

Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 27th Apr 2018 20:50 Edited at: 27th Apr 2018 20:54
Hey looks like I wasnt too far off. Gave him the same information over on the discord about the SetGamePlayerControlBasespeed(x) command and/or instead using Freezing commands to prevent the movement. Though he wants a mouse-look (I believe gun fire ability as well). So player controls may indeed need to be altered here.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Caracc
6
Years of Service
User Offline
Joined: 16th Apr 2018
Location: Nova Scotia
Posted: 27th Apr 2018 21:09
LeeBamber wrote: "Remember to backup your custom version of this script as when the Steam auto-update happens, it may erase your changes with the latest from the build."


Is this true for most of the scripts or unique to only a few? If common, is it possible to create a child script with unique edits and a call to the original? Something like gameplayercontrol-child.lua, set a flag in another file to use the -child version, then add an include call at the top of gameplayercontrol-child.lua; thus preserving unique settings while ensuring engine-necessary files are updating promptly.

Sorry, I've been knee-deep in fixing abandoned WordPress websites lately. I've probably got tunnel vision.
Intel i7 3700, Nvidia GeForce GTX 950 (2GB), 16 GB DDR3 RAM
...and some mediocre MSI motherboard holding it all together. It's a bit of a franken-build but it's good enough for me.
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 27th Apr 2018 21:13 Edited at: 27th Apr 2018 21:24
Whenever a new update of Game Guru comes out, sometimes there are updates to the existing scripts (player controls, global.lua and the AI ones mostly). When you get these updates from Steam they will overwrite the scripts and you will lose any changes you might have made with them.

What I do is I make a back up folder that has the originally scripts in them and another folder within that has all my modified versions of those same scripts.

Quote: "if common, is it possible to create a child script with unique edits and a call to the original? Something like gameplayercontrol-child.lua, set a flag in another file to use the -child version, then add an include call at the top of gameplayercontrol-child.lua; thus preserving unique settings while ensuring engine-necessary files are updating promptly."


I noticed some include scripts are being used now for parts of character AI. The scripts seem to borrow from each other. But that's mostly to ease up the work load of editing many scripts for small changes related to AI.

While I'm no expert, any modifications engraved inside of the player controls would be hard to isolate from the rest of the code. So I don't know if an include would work in that manner. I see there is a third person player folder and script? Wondering if there were plans to isolate all third person functions off?

AI: Biter Behavior Example:
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 27th Apr 2018 22:10 Edited at: 28th Apr 2018 12:50
SetGamePlayerControlTopspeed( value )

(if you need to see how to use this look in the pickuppables.lua script where I use it to cap the player speed depending on how much is being carried. I also disable jumping when carrying objects so you can see how that is done as well)
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-11-24 06:54:21
Your offset time is: 2024-11-24 06:54:21