Weapon and changing its state from DoEffect

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!)

Weapon and changing its state from DoEffect

Postby Kzer-Za » Thu Jan 13, 2022 7:18 am

Is it possible to change a weapon state from DoEffect? I have a weapon that has a countdown function, so I wanted to decrement a variable in DoEffect and when it reaches 0, change the weapon state, but neither SetStateLabel, nor ResolveState have any effect.
Kzer-Za
 
Joined: 20 Aug 2017
Operating System: Other Linux 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Weapon and changing its state from DoEffect

Postby Jarewill » Thu Jan 13, 2022 11:44 am

Use Player.SetPSprite for that:
Code: Select allExpand view
owner.Player.SetPSprite(PSP_WEAPON,FindState("State")); 

This code will set the weapon's owner (the player) current HUD state to the state found with FindState.
This was taken straight from the DoEffect override in my mod, so it should work.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Weapon and changing its state from DoEffect

Postby Kzer-Za » Thu Jan 13, 2022 12:46 pm

Thanks!
Kzer-Za
 
Joined: 20 Aug 2017
Operating System: Other Linux 64-bit
Graphics Processor: nVidia (Modern GZDoom)


Return to Scripting

Who is online

Users browsing this forum: boris and 1 guest