The Problem
In CZDS, weapon pickups are set up in a strange way. You can have several instances of the same weapon in your inventory, with no sane way of accessing any of them separately. The selection menu slot may also start pointing to a different instance under certain unclear circumstances.
While being manageable with normal weapons, this buggy behaviour can become a serious problem when dealing with RC bombs. The core of the problem is, if you had any bombs already attached but not yet blown up while picking up the new RC kit, you will no longer be able to detonate those old bombs. This can lead to the map breaking and the player ending up in a softlock.
The Solution
Is to only let the player get a new RC kit when they have detonated all of their existing RC bombs. Every
RC bomb site on the map will notify
the global counter when its been blown up. Every
RC bomb supply spot will not use a
weapon_radiocontrolledbomb
directly, but will instead refill the player via
game_player_equip
. The pickup model is mimicked.
Whenever
an RC site is blown up,
the global counter is incremented. Upon reaching 5 (the maximum amount of carried RC bombs),
the global counter will send a signal to turn on every
RC supply spot in the map.
All
RC supply spots are inactive at the start. When
an RC supply spot receives the signal, its
equip area (
trigger_multiple
) is turned on. When the player walks into
the area, the
game_player_equip
will give them 1 instance of
weapon_radiocontrolledbomb
. After that,
the equip area is turned off, the prop model that mimics the RC bomb pickup (
item_generic
) is hidden, and all
RC supply sites are notified that an RC bomb has been picked up, which causes them to be turned off until a new signal is received. Finally, this
RC supply spot is completely disabled, making it impossible to use it in the future.
Notes
game_player_equip
seems to have been fixed in CZDS and does survive save loads.- The setup shows a separate
game_player_equip
being used in each RC supply spot. This is an oversight - you only need one. If you want to save up on the entity count, you're free to replace it with a single global game_player_equip
. - A similar problem is encountered after planting an RC bomb in one map, going through a
trigger_changelevel
, coming back and trying to detonate the bomb. There seems to be no way to make RC bombs usable across maps. - In case the player starts out without an RC bomb kit, to make all kits pickable-up for once, you can simply trigger the global counter's target on map start. It will let the player pick up one fresh RC bomb kit while keeping the system intact.