wild animals disappear

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

wild animals disappear

Post by Dino the Dinosore »

I'm playing with the new wild animal feature and found they all disappear pretty quickly after the game starts. Not what I want, and I expect most folks would agree they should stick around until they're killed, since, unlike human pirates and barbarians, animals can survive and reproduce in their native tiles. I'm dubious that this behavior was intended when the wild animal feature was introduced. It's possible new animals get generated once barbarians start appearing, if so, that's OK.
Figured out they are subject to the same "retirement" that happens to other barbarian units. Tech details - ".../share/freeciv/nation/animals.ruleset" has the line -
groups="Core", "Barbarian"
just like ".../share/freeciv/nation/barbarian.ruleset" and ".../share/freeciv/nation/pirate.ruleset". This behavior must be hard-coded, I can't find any way for ruleset files to configure it. Maybe there should be some way added to allow a ruleset to control barbarian behavior.
Meanwhile I have a work-around, adding code in the "script.lua" file to catch when an animal gets retired, and re-spawn a replacement

Code: Select all

function unit_lost_callback(unit, loser, reason)
  nation = loser.nation:name_translation()
  if nation == "Animal Kingdom" and reason == "retired" then
    edit.create_unit(loser, unit.tile, unit.utype, 0, unit.homecity, -1)
  end

  -- continue processing
  return false
end

signal.connect("unit_lost", "unit_lost_callback")
Only problem: have to set the "veteran_level" param to 0 (= "green") because there's no way to get a unit's veteran_level value. I would prefer to use, e.g. "edit.create_unit(loser, unit.tile, unit.utype, unit.veteran_level, unit.homecity, -1)" if I could. In addition to the missing "unit.veteran_level", there's also no corresponding "edit.unit_veteran_level".
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: wild animals disappear

Post by Ignatus »

This is likely because of Retire_Pct effect (effect_barb_disappear in effects.ruleset), try just put there a requirement like

Code: Select all

"Nation", "Animal Kingdom", "Local", FALSE
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: wild animals disappear

Post by Dino the Dinosore »

Thanx - I missed that Retire_Pct effect.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: wild animals disappear

Post by Dino the Dinosore »

It doesn't like range "Local". Have now verified what works is

Code: Select all

 "Nation", "Animal Kingdom", "World", FALSE
cazfi
Elite
Posts: 3077
Joined: Tue Jan 29, 2013 6:54 pm

Re: wild animals disappear

Post by cazfi »

Dino the Dinosore wrote:It doesn't like range "Local". Have now verified what works is

Code: Select all

 "Nation", "Animal Kingdom", "World", FALSE
That prevents retirement of also normal barbarians when Animal Kingdom exist. What you want is "Player" range.
Dino the Dinosore
Hardened
Posts: 171
Joined: Sun Dec 31, 2017 3:41 am

Re: wild animals disappear

Post by Dino the Dinosore »

Not sure I fully understand how ranges work, but I believe you. Tested

Code: Select all

"Nation", "Animal Kingdom", "Player", FALSE
and it appears to work OK. Thanks.
Post Reply