Adding a kick state that's decoupled from weapons

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
Boondorl
Posts: 138
Joined: Wed Jul 11, 2018 10:57 pm

Adding a kick state that's decoupled from weapons

Post by Boondorl »

Question is super specific, but I'm wondering if there's a way to add a kick state to the player themselves so that it doesn't rely on the player having a weapon to do it. Ideally it'd be used so that players can't cancel mid animation by dropping their weapon. Right now I have it set up so that a parent actor has all the kicking states and the child weapons inherit from it. ZScripting unfortunately can't be used for compatibility reasons, but ACS is allowed.
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

Re: Adding a kick state that's decoupled from weapons

Post by m8f »

Maybe this can be used as a reference: BD Kick Attack as individual wad
User avatar
Boondorl
Posts: 138
Joined: Wed Jul 11, 2018 10:57 pm

Re: Adding a kick state that's decoupled from weapons

Post by Boondorl »

Indeed it can. It uses a script to give the player a kick weapon and a kicking item, does the kick and removes the kick item at the end which the script then sees and removes the kick weapon and swaps you back to the weapon you were using. I was actually thinking of doing something similar but didn't know how to save which weapon the player had so it knew what to switch back to. Knowing GetWeapon() is a thing is pretty helpful.

Will using stop at the end of the final state completely remove the weapon from the player's inventory? If so, you could even skip the kicking item and just detect if the player has the weapon.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Adding a kick state that's decoupled from weapons

Post by Nash »

[wiki]CustomInventory[/wiki] can run [wiki]A_Overlay[/wiki] so theoretically it's possible to have the kick execute without even taking your gun weapon away. You'd need to script the weapon to hide/be disabled when the CI is active, then remove the CI when the kick animation is done and restore normal weapon function.
User avatar
Boondorl
Posts: 138
Joined: Wed Jul 11, 2018 10:57 pm

Re: Adding a kick state that's decoupled from weapons

Post by Boondorl »

That's a pretty interesting solution. I find the above script works well, however (especially for Zandronum since state management is a nightmare when programming for online play), mainly because it lets me add the mighty foot as its own weapon that players can select (it's not something you'll normally be able to do, but it is a fun easter egg).
Post Reply

Return to “Scripting”