Tracking +1/-1 Counter Created 1 year ago2023-08-29 13:37:48 UTC by Candle Candle

Created 1 year ago2023-08-29 13:37:48 UTC by Candle Candle

Posted 1 year ago2023-08-29 13:37:48 UTC Post #347804
I’m looking to add one (+1) or remove one (-1) from a counter.

I have a gameplay idea where players need batteries to open doors and power things. Batteries are scarce, but there are lots of places they can be used. So, when a player gets a battery, the counter goes up by one. When they use a battery, the counter goes down by one (so long as they have any).

I've read about the 'game_counter' but what I’ve read is it only works for exact matches (=) and can only count up. Conventional "key"s arn’t suitable here as batteries are not tied to specific doors, and their quantity across the map is arbitrary.

I thought about having two game_counters, one for "found" and one for "used", but I don't know of a way to check the state of found > used.
Posted 1 year ago2023-08-30 15:08:27 UTC Post #347808
On the wiki page of the game_counter entity, it says that you can decrement its value by triggering it with a trigger_relay with Trigger State set to 'off'. I've never used this entity so I'm not sure if this will work, best to try and see for yourself.
Posted 1 year ago2023-08-31 08:58:40 UTC Post #347812
Damn, how'd I mess that? Thank you Mad Carrot, I'll give it a look.
You must be logged in to post a response.