How change weapon state

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
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

How change weapon state

Post by Apeirogon »

What is a correct way to change weapon state, sprite, frame and tick from some script?
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: How change weapon state

Post by Matt »

To jump to a state:

Player.SetPSprite(PSP_WEAPON,invoker.FindState("____"));

(where "____" is a statelabel and "invoker" is whatever your actual pointer for the weapon is - I grabbed this from a weapon function)



To set the sprite:

Player.GetPSprite(PSP_WEAPON).sprite=GetSpriteIndex(____);

(where "____" is a TextureID)


Not sure how to set tics though.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: How change weapon state

Post by Apeirogon »

Poking around findpsprite, for ticks it
player.FindPSprite(PSprite.WEAPON).tics = number
Post Reply

Return to “Scripting”