Scripts / Is there a way to simulate first person limping via scripting?

Author
Message
FearlessKing
7
Years of Service
User Offline
Joined: 9th Mar 2017
Location:
Posted: 6th Jul 2017 06:04 Edited at: 8th Jul 2017 16:49
I'm working on a walking simulator story game where I'd like the player view to appear injured with a limp for a chapter/level. I haven't been able to find a thread on this already via the search tool, nor a google search so I apologize if this is something that has already been tackled within the community (if so I'll take this down right away).

The idea is something along the lines of player speed being decreased significantly for a moment in 2-3 second cycles with an increased camera bob and/or player height being reduced. Maybe sudden stops that last a few seconds? Is this even doable?

I'm VERY new to coding and still new to this engine so any help or a nudge in the right direction would be fantastic.

---

Hmmm, I'm starting to wonder if maybe there is a better way than a player script. Maybe just a LOT of zones in a row that slow player speed or set player to crouch? As the player walks through them they'd be slowed down briefly, until they leave that zone (being put back to a regular speed), just to walk right into the next sliver of zone that would slow them again? I only need this for 1 level so I might use this as a work around as the scripting would almost definitely be much more basic. I could almost certainly get by with CharacterControlDucked and SetCharacterToWalk right? Maybe even throw in a couple HurtPlayer pings to make it seem like it is causing the character pain just to simply be moving?

BUT for the sake of edification, would this type of script be possible in this engine? Some sort of loop that changes the player speed and height for some time and then cycles as the player moves ? Or is this just too complex? Maybe I'm just overthinking this XD
PM
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 7th Jul 2017 07:13
This kind of update is possible now that Lee has exported the player control to lua. It could be triggered by a zone or drop below a health value or anything really.

Those commands you listed are for the NPCs though not the player.

These changes would be more difficult for third person as would likely need the corresponding animations in the character entity.

I'll have a look and see if there is something simple to do for first person.

Cheers.
FearlessKing
7
Years of Service
User Offline
Joined: 9th Mar 2017
Location:
Posted: 8th Jul 2017 02:20
Oh shoot, those only work with npcs huh? I will be creating this in 1st person for simplicity's sake so the 3rd person view doesn't really matter to me. Is there a resource for the player control functions?
PM
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 8th Jul 2017 09:32
Yes it's in gameplayercontrol.lua in the scriptbank folder.

Think this can de done, could emphasize the walk wobble, put the player cam on an angle, play a hurt sound, slow the speed, prevent running - something like that OK?

Cheers.
FearlessKing
7
Years of Service
User Offline
Joined: 9th Mar 2017
Location:
Posted: 9th Jul 2017 04:59
Awesome! I didn't realize the commands are just listed in the .lua XD Convenient!

If you want to take a crack at it I'd love to see how you put it all together! .lua is so cool. Ideally the limp would err on the side of being almost too slow if that's possible. The level is just a long, slow, drawn out pensive walk to sad yet beautiful string music as his past appears in front of him and then fades out as spectres. The player is essentially walking to their honorable death in this level/scene as they come to terms on the morality of what they are doing.
PM
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 9th Jul 2017 13:45
Here you go, as mentioned there are a few ways to do this, but this should give you a start.

Back-up your original gameplayercontrol.lua and replace it with the one attached (in scriptbank folder)

Place playerlimpinzone.lua (attached) in scriptbank folder and attach it to a trigger zone in a game. Tweak the parameters below in this script.



May not be a slow pensive walk effect but hopefully you get the idea of what to change to make it suit.

Cheers.

Attachments

Login to view attachments
FearlessKing
7
Years of Service
User Offline
Joined: 9th Mar 2017
Location:
Posted: 10th Jul 2017 04:49
Wow! That is really cool! I will probably tweak it a little bit but that is almost exactly what I had in mind! Also I really appreciate your notations the .lua file. This definitely gives me a much better idea of how to create/edit my own scripts in the future. Cheers!
PM

Login to post a reply

Server time is: 2024-12-23 00:20:32
Your offset time is: 2024-12-23 00:20:32