Making Barbarians nations appear only a specific tech discovery

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
sc0ttj
Posts: 10
Joined: Wed Dec 09, 2020 3:56 pm

Making Barbarians nations appear only a specific tech discovery

Post by sc0ttj »

Is making Barbarian nations appear only a specific tech discovery possible?

I'd like to have 2 or 3 Barbarians nations in the game (a custom civ2civ3 ruleset),
each with unique nations, flags, names and unit graphic, etc..

I'd like them to appear only after certain techs have been discovered by the World.

Is this possible?
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Making Barbarians nations appear only a specific tech discovery

Post by Ignatus »

Only one nation can be land barbarians or sea barbarians at time. Their appearing mechanism is hardcoded but it's possible to set barbarian rate to "only from huts" and produce them by scripting engine. Actually, you can just take any AI nation and make a script to place its units randomly each turn, they won't be true barbarians but there is little difference.
sc0ttj
Posts: 10
Joined: Wed Dec 09, 2020 3:56 pm

Re: Making Barbarians nations appear only a specific tech discovery

Post by sc0ttj »

you can just take any AI nation and make a script to place its units randomly each turn, they won't be true barbarians but there is little difference
Do u have some example code?
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Making Barbarians nations appear only a specific tech discovery

Post by Ignatus »

sc0ttj wrote:Do u have some example code?
Not particulary for this task but much of it is in standard */script.lua files. The API doc is on Wikia.
Wahazar
Elite
Posts: 362
Joined: Mon Jul 02, 2018 1:49 pm

Re: Making Barbarians nations appear only a specific tech discovery

Post by Wahazar »

Another issue with barbarians is lack of sea unit flag, which guarantee spawning such unit if certain tech level i achieved by any player.
Such flag exists for land units, but not sea ones.
Augmented2 ruleset/modpack for freeciv2.6: http://forum.freeciv.org/f/viewtopic.php?f=11&t=91047
nef
Elite
Posts: 324
Joined: Mon Jun 25, 2018 5:01 pm

Re: Making Barbarians nations appear only a specific tech discovery

Post by nef »

Ignatus wrote:Only one nation can be land barbarians or sea barbarians at time. Their appearing mechanism is hardcoded but it's possible to set barbarian rate to "only from huts" and produce them by scripting engine.
The barb nations actually persist for some substantial period of time after the "is_alive" criteria becomes false. (Human and AI players are permanent.) You can tell (during ordinary game play) the difference; when the server wants to create new units and the nation/player does not exist it will announce the new leader. A script, of course, can know all the time. (Use the player.is_alive field or the equivalent combo methods of :num_cities and :num_units) I haven't tried it but if the barb player exists you should be able to use edit.create_unit as you can for any other player (at any time).

What I have NOT been able to do is to get edit.create_player to work. If someone can tell me what the arguments are really meant to be I would very much appreciate it.
nef
Elite
Posts: 324
Joined: Mon Jun 25, 2018 5:01 pm

Re: Making Barbarians nations appear only a specific tech discovery

Post by nef »

Wahazar wrote:Another issue with barbarians is lack of sea unit flag, which guarantee spawning such unit if certain tech level i achieved by any player.
Such flag exists for land units, but not sea ones.
What flag are you referring to? What appears to be missing is a distinction between "BarabarianBoat" and "BarbarianBoatTech" since the latter is not a flag. Land units ON the boat appear to be covered.
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: Making Barbarians nations appear only a specific tech discovery

Post by Ignatus »

nef wrote:
Wahazar wrote:Another issue with barbarians is lack of sea unit flag, which guarantee spawning such unit if certain tech level i achieved by any player.
Such flag exists for land units, but not sea ones.
What flag are you referring to? What appears to be missing is a distinction between "BarabarianBoat" and "BarbarianBoatTech" since the latter is not a flag. Land units ON the boat appear to be covered.
Likely yes, that's what was spoken about. Actually, it's not good to have barbarian caravels when nobody has a trireme yet, a nation with a single diplomat and a small amount of gold may bribe one at their coast and get a huge expansion boost by almost sheer random. That may be avoided if you put pirates with edit.create_unit_full() callback into a boat that you also put by Lua previously (the function to select it for world's tech level has to be written manually though).
Post Reply