Weapon and changing its state from DoEffect

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.

Re: Weapon and changing its state from DoEffect

Thu Jan 13, 2022 11:44 am

Use Player.SetPSprite for that:
Code:
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.

Re: Weapon and changing its state from DoEffect

Thu Jan 13, 2022 12:46 pm

Thanks!