twhl-community / halflife-unified-sdk

Half-Life Updated SDK with Opposing Force and Blue Shift merged in, along with other improvements. Check README.md for more information.
Other
143 stars 24 forks source link

item_battery is not being given on game_player_equip #547

Open HezusNL opened 6 months ago

HezusNL commented 6 months ago

On a game_player_equip, if you add the item_suit keyvalue first and the item_battery second, the battery will not be picked up. Only when the item_battery is added to the list ABOVE the item_suit, the battery is actually used.

The battery will be picked up if you trigger the setup from the first scenary a second time, but not initially.

SamVanheer commented 6 months ago

That's intended behavior dating back to the original Half-Life. Players can't pick up batteries if they don't have the HEV suit: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/items.cpp#L226

Keyvalue order can change if tools code changes things around so you shouldn't depend on that. I'd suggest using multiple game_player_equip entities triggered with delays to ensure the player is given the suit first.