Page 1 of 1

Weapon destroys after trying of change state duration

PostPosted: Mon Feb 04, 2019 7:07 am
by Apeirogon
Load example, type in console give boom_stick, choose it at number one, shot several times, release fire button, weapon disappear without any message.
Comment line 25 to prevent this to happening.

Re: Weapon destroys after trying of change state duration

PostPosted: Mon Feb 04, 2019 7:16 am
by Graf Zahl
You are setting the duration of the item itself, not the HUD sprite!

As long as an inventory item is owned it is displaying the 'held' state which has infinite duration. This state still gets ticked, though, and if its duration expires without a follow-up state the item will vanish.

Re: Weapon destroys after trying of change state duration

PostPosted: Mon Feb 04, 2019 12:04 pm
by Arctangent
Graf Zahl wrote:As long as an inventory item is owned it is displaying the 'held' state which has infinite duration. This state still gets ticked, though, and if its duration expires without a follow-up state the item will vanish.

Is this intentional behavior, or more just an aftereffect that might get unintentionally changed later on?

Could be a simple way to do time-limited weapons or such if it is reliable, which is an interesting thought.

Re: Weapon destroys after trying of change state duration

PostPosted: Mon Feb 04, 2019 12:08 pm
by Rachael
The problem is, it leaves the player with a null weapon, which historically hasn't always proven stable in the game. But maybe I am wrong - maybe it's intentional to allow that.

Re: Weapon destroys after trying of change state duration

PostPosted: Mon Feb 04, 2019 12:23 pm
by Graf Zahl
The main issue here is that what he did qualifies as 'Don't do that'. There are legitimate reasons to allow owned weapons to run through their normal states, but mucking around with their duration is something the code cannot deal with.

I far more suspect a case of user error here, i.e. he wanted to alter the PSprite's duration - and for that it was just dead wrong.