Player crouch
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
- Posts: 12
- Joined: Fri Sep 09, 2022 6:45 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
Player crouch
Is there a way to uncrouch the player with ACS? I have a cutscene where I want the player to stand up.
-
-
- Posts: 1651
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
Re: Player crouch
I'm not aware of a way to do this with pure ACS, but provided ZScript is available to you, you can use the following code and then leverage the ACS ScriptCall feature to call it:
How to call the above code from ACS (assuming the player is the activator):
Note that you will need to freeze the player beforehand; otherwise, if the crouch key is still being held, the player will switch to the crouch state again immediately after ScriptCall.
Code: Select all
class Uncroucher : Object
{
static void Uncrouch(int playerNumber)
{
if (playerNumber >= 0 && playerNumber < MAXPLAYERS && playeringame[playerNumber])
{
players[playerNumber].Uncrouch();
}
}
}
Code: Select all
script "UncrouchScript" (void)
{
ScriptCall("Uncroucher", "Uncrouch", PlayerNumber());
}
-
- Posts: 12
- Joined: Fri Sep 09, 2022 6:45 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
Re: Player crouch
I get this error when I try this:
Code: Select all
Script error, "ozzy.pk3:zscript.txt" line 226:
Can't call play function Uncrouch from data context
-
-
- Posts: 1651
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
Re: Player crouch
Sorry, my bad. If you're already using ZScript in your project, you have probably added a version specifier in the beginning of your ZScript lump. Starting from a certain version, the default scope changed from play to data, so you need to explicitly specify that the Uncroucher class has play scope. Simply add play after class Uncroucher : Object, and it should work.
-
- Posts: 12
- Joined: Fri Sep 09, 2022 6:45 am
- Operating System Version (Optional): Windows 10
- Graphics Processor: nVidia with Vulkan support
Re: Player crouch
Now it works! Thank you!