How to use counters correctly?

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
leo.priori
Posts: 22
Joined: Mon Jan 01, 2024 3:22 am

How to use counters correctly?

Post by leo.priori »

This may be a question that has already been answered, but I couldn't find anything that explains how to use the 'counters'. I only found it on whislist.
I don't know if this is right, but is this a counter that starts when you create an extra on the terrain? If so, does it reset after loading the game?
How do I work with it in ruleset and in LUA?

Thanks
cazfi
Elite
Posts: 3335
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to use counters correctly?

Post by cazfi »

Currently there are only city counters (counting things related to a city). Typical use of a counter is that it works as an requirement for an effect, but there's some lua support too: https://www.freeciv.org/wiki/Lua_refere ... al#Counter

Counters are defined in game.ruleset, and supplied rulesets have documentary comments.
leo.priori
Posts: 22
Joined: Mon Jan 01, 2024 3:22 am

Re: How to use counters correctly?

Post by leo.priori »

cazfi wrote: Sat Jan 18, 2025 3:26 pm Currently there are only city counters (counting things related to a city). Typical use of a counter is that it works as an requirement for an effect, but there's some lua support too: https://www.freeciv.org/wiki/Lua_refere ... al#Counter

Counters are defined in game.ruleset, and supplied rulesets have documentary comments.
Great! Found it! Thanks!
Lachu
Elite
Posts: 473
Joined: Sat May 04, 2013 2:19 pm

Re: How to use counters correctly?

Post by Lachu »

There are city counters currently, such like how many turns owner owned city (reset, when city change owner), how many turn city celebrates and how many turn city is in disorder state. Counters are connected with triggers - you define checkpoint value, which told, when trigger connected to counter is activated. It is active, when counter is at least checkpoint value. In req list, you define which counter/trigger will activate effect. And counters are preserved between game save/load.

Sorry for my English - I still learning.
Post Reply