How change weapon state
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!)
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!)
How change weapon state
What is a correct way to change weapon state, sprite, frame and tick from some script?
- 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
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.
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.
Re: How change weapon state
Poking around findpsprite, for ticks it
player.FindPSprite(PSprite.WEAPON).tics = number
player.FindPSprite(PSprite.WEAPON).tics = number