obtaining crouch status in decorate?

Archive of the old editing forum
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.
Locked
User avatar
|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?

Post by |ndußtrial »

is there a way to identify the player as either crouching or not crouching?
User avatar
edward850
Posts: 5902
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: obtaining crouch status in decorate?

Post by edward850 »

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.
User avatar
|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?

Post by |ndußtrial »

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)
User avatar
edward850
Posts: 5902
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: obtaining crouch status in decorate?

Post by edward850 »

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).
User avatar
|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?

Post by |ndußtrial »

alright, thank you dude
User avatar
Nash
 
 
Posts: 17505
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: obtaining crouch status in decorate?

Post by Nash »

Here's how I did it.

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
{
}
ACS:

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");
}
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.
Locked

Return to “Editing (Archive)”