Change state when player walks or runs?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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!)
Post Reply
User avatar
R4L
Global Moderator
Posts: 400
Joined: Fri Mar 03, 2017 9:53 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Pro
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Change state when player walks or runs?

Post by R4L »

Hey guys!

I've made a replacement set of sprites for the Doom Fist, and what I would like to achieve sounds simple. Basically, I'd like to have no hands on screen when the player is idle, but when the player moves I'd like to loop through my animation so you can see the hands move. When the player runs I want the animation to move faster, which if I can get the walking part down, its as simple as using lower tic amounts.

Is there a way to check if a player is walking, and then go to a certain state and use that animation? Maybe a way to check if the player is idle and then do no animation?
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Change state when player walks or runs?

Post by Apeirogon »

Look into project msx.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Change state when player walks or runs?

Post by Matt »

Would this work?
Spoiler:
forwardmove and sidemove are integers so you can check to see if they're above or below a certain value, or set your frame duration as a multiple of that integer.
User avatar
R4L
Global Moderator
Posts: 400
Joined: Fri Mar 03, 2017 9:53 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Pro
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: Change state when player walks or runs?

Post by R4L »

Matt wrote:Would this work?
Spoiler:
forwardmove and sidemove are integers so you can check to see if they're above or below a certain value, or set your frame duration as a multiple of that integer.
Sounds useful. Let me make sure I follow this correctly:

Checks to see if the player is on the ground and if the player is moving forward or to the side. If so, then do whatever right? Does this have to get placed into an ACS script that I can load in DECORATE? I apologize for being a noob; I want to learn just not sure exactly how to go about using this.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Change state when player walks or runs?

Post by Matt »

It's ZScript, but an ACS equivalent should be possible with GetPlayerInput and GetActor(Floor)Z.
User avatar
R4L
Global Moderator
Posts: 400
Joined: Fri Mar 03, 2017 9:53 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Pro
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: Change state when player walks or runs?

Post by R4L »

OK, I will play around with some ideas and post back if I truly get stumped lol. Thanks for the help.
Post Reply

Return to “Scripting”