setting a flag for each unit (not unit type)

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
BadPractice
Posts: 4
Joined: Mon Oct 20, 2014 11:59 am

setting a flag for each unit (not unit type)

Post by BadPractice »

I know i am currently flooting the forum and i am sorry but i have questions :(

Is there any way to set a condition to a character?

For example any character has a 25% chanche of getting sick unless some Tech is researched. Asuming the poor fellow hit the checkpot and got sick, i would like to save it in a way like

Code: Select all

unit:setTag('herpes')
it would be perfect if i can acess this flag/tag/memo/whatever through effects and reduce hp there but i would also work iterating through characters via script i guess... (assuming i can fire up an effect type via script)
sveinung
Elite
Posts: 548
Joined: Wed Feb 20, 2013 4:50 pm

Re: setting a flag for each unit (not unit type)

Post by sveinung »

BadPractice wrote:Is there any way to set a condition to a character?
Storing data in the unit is self isn't possible. What I did (back in 2011, haven't worked on it since): Create a data structure in Lua. Use the unit as the key. Limits of this approach: It won't be visible in the client or to the AI. (You can notify the player with a message but not add the extra field to the unit when clicked in the client) Adding support for a general area in Freeciv data structures like unit, city, unit type and terrain were ruleset authors can add custom fields with custom values (sent to the client and to the AI) could solve this. That would be a big project.
Post Reply