[SCRIPT] SetPlayerCrouching(true); not working while LShift is pressed - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [SCRIPT] SetPlayerCrouching(true); not working while LShift is pressed (/thread-35350.html) |
SetPlayerCrouching(true); not working while LShift is pressed - Wili - 12-23-2015 Hi, I'm trying to make the player force crouch using "SetPlayerCrouching(true);" It works if the player is walking but if the player keeps running pressing Left Shift button when "SetPlayerCrouching(true);" command is called the player won't crouch. There is any way to send "Left Shift" key to the game so I can release "Left Shift" key just before "SetPlayerCrouching(true);" command is sent? I tried this with the same result: SetPlayerMoveSpeedMul(0.0); SetPlayerRunSpeedMul(0); If the player keeps pressing "Left Shift" the player won't crouch anyway, even if the player is not moving at all. Any ideas? Thank you in advance! RE: SetPlayerCrouching(true); not working while LShift is pressed - Neelke - 12-23-2015 But if you hold in the Left-Shift that just means you're attempting to run. There's no script from what I know that can disable that. Where in this level are you using this script? RE: SetPlayerCrouching(true); not working while LShift is pressed - Wili - 12-23-2015 Thanks for the answer!, well I hope there is a way, I'm just trying to make a crush trap where the ceiling goes down and crush the player, It works pretty well if the player is walking but if the player keeps running the "SetPlayerCrouching(true);" command won't work and the player clips trough the ceiling and starts bouncing. Here is my problem: https://youtu.be/35SR5gPfujI The first part where the player only walks works perfect, the problem is the second part of the video where the player keeps running and "SetPlayerCrouching(true);" is not working. Any ideas on getting this trap to work? Thank you! RE: SetPlayerCrouching(true); not working while LShift is pressed - Neelke - 12-23-2015 Why don't you make that last section of the crush sequence where the player cannot move? Just disable the player controls and script the last part of the sequence. RE: SetPlayerCrouching(true); not working while LShift is pressed - Wili - 12-23-2015 I tried SetPlayerMoveSpeedMul(0.0); and SetPlayerRunSpeedMul(0); for disabling player controls but if the player keeps pressing Left Shift "SetPlayerCrouching(true);" won't work and the player will clip anyway. There is any other way for disabling player controls? SetPlayerActive(false); seems to work, it feels a bit odd because the player stops responding and the player can't look around anymore, but if there is no other way I could make it using that command. Thanks a lot for the help Neelke!!! RE: SetPlayerCrouching(true); not working while LShift is pressed - 7heDubz - 12-23-2015 (12-23-2015, 02:20 PM)Wili Wrote: I tried SetPlayerMoveSpeedMul(0.0); and SetPlayerRunSpeedMul(0); for disabling player controls but if the player keeps pressing Left Shift "SetPlayerCrouching(true);" won't work and the player will clip anyway. Only a way to completely take away control, Code: void SetPlayerActive(bool abActive); I can't test it on my end but you could give that a go. RE: SetPlayerCrouching(true); not working while LShift is pressed - Wili - 12-23-2015 Quote: taking away all control, then forcing them into a crouch, but my assumption is that that wouldn't stop them from being able to uncrouch. That somewhat works, I took away all control, then force to crouch, and when the ceiling is low enough to not let the player stand up again I recovered the controls. I didn't test the loop yet, I don't really know how to do it, I don't know much of scripting, I will study how to do it and I will try. Thanks a lot for the help 7heDubz I'm more happy with the result now! RE: SetPlayerCrouching(true); not working while LShift is pressed - 7heDubz - 12-24-2015 Well, are they unable to uncrouch once you force them to crouch? If not then you don't need to worry about any kind of loop. Glad to be of service. RE: SetPlayerCrouching(true); not working while LShift is pressed - Wili - 12-24-2015 (12-24-2015, 04:28 AM)7heDubz Wrote: Well, are they unable to uncrouch once you force them to crouch? Yes, the player is able to uncrouch, the only way the player is unable to uncrouch is when the trap ceiling is low enough, so I took player controls away, force the player to crouch and when the ceiling is low enough the player recover controls. Player crouches and only looses control over the character like 1 second so is not that bad. RE: SetPlayerCrouching(true); not working while LShift is pressed - FlawlessHappiness - 12-25-2015 (12-24-2015, 01:49 PM)Wili Wrote:(12-24-2015, 04:28 AM)7heDubz Wrote: Well, are they unable to uncrouch once you force them to crouch? Good work-around! |