obtaining crouch status in decorate?
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
- |ndußtrial
- Posts: 398
- Joined: Sat Aug 17, 2013 11:39 am
- Graphics Processor: Intel (Modern GZDoom)
- Location: Ivy Mercy Lyons
obtaining crouch status in decorate?
is there a way to identify the player as either crouching or not crouching?
Re: obtaining crouch status in decorate?
Crouching isn't an on/off status, so no. You can grab the viewhight indirectly from ACS, however that's a dynamic value because the player can be halfway crouching in a sector that's only tall enough to let them.
It also doesn't necessarily reflect that you are crouching at all, as it's not the only thing that modifies viewhight.
It also doesn't necessarily reflect that you are crouching at all, as it's not the only thing that modifies viewhight.
- |ndußtrial
- Posts: 398
- Joined: Sat Aug 17, 2013 11:39 am
- Graphics Processor: Intel (Modern GZDoom)
- Location: Ivy Mercy Lyons
Re: obtaining crouch status in decorate?
would it make sense to somehow track the player's pressing the crouch key and store the status apparent in a user variable? i apologize if i sound as if i am regurgitating half-researched ideas (i am)
Re: obtaining crouch status in decorate?
That doesn't confirm if the player is actually crouching, as that doesn't return if they could crouch (although that's technically confirmable), if they are forced to (low ceiling, as stated above) or if they have toggled it (crouch toggle, self explanatory).
- |ndußtrial
- Posts: 398
- Joined: Sat Aug 17, 2013 11:39 am
- Graphics Processor: Intel (Modern GZDoom)
- Location: Ivy Mercy Lyons
Re: obtaining crouch status in decorate?
alright, thank you dude
Re: obtaining crouch status in decorate?
Here's how I did it.
DECORATE:
ACS:
If you're being crushed by a ceiling then this might trigger the crouch check, so depending on what you're trying to do, this may or may not solve your problem.
DECORATE:
Code: Select all
//===========================================================================
//
// Player Flags
//
//===========================================================================
Actor Z_PlayerFlag_Base : Inventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
+INVENTORY.QUIET
+INVENTORY.UNDROPPABLE
+INVENTORY.HUBPOWER
+INVENTORY.PERSISTENTPOWER
-INVENTORY.INVBAR
-INVENTORY.PICKUPFLASH
States
{
Spawn:
TNT1 A 1
Loop
}
}
Actor Z_PlayerFlag_IsCrouching : Z_PlayerFlag_Base
{
}
Code: Select all
// player view height
#libdefine PLAYER_VIEWHEIGHT 45
// check for crouching
function bool CheckIsPlayerCrouching(void)
{
if (GetActorViewHeight(0) <= PLAYER_VIEWHEIGHT / 2 << 16)
GiveInventory("Z_PlayerFlag_IsCrouching", 1);
else
TakeInventory("Z_PlayerFlag_IsCrouching", 1);
return CheckInventory("Z_PlayerFlag_IsCrouching");
}
