Development > Newbie Coding
Scriptable character templates
DarkRain:
My second experiment with the code, I wanted to make the templates used to generate the character atributes to be scriptable so I made some changes:
new script header:
--- Code: ---chrtemplate <template-id> {}
--- End code ---
containing a list of attributes (speed, mind, sniper... etc.) with min and max values and a rate: the chance of this template to be used for character generation.
and a new section for the team def:
--- Code: ---templates {}
--- End code ---
with a simple list of templates-ids for this team
if more than one template is given a random one will be chosen excluding those with a rate of 0 (if all rates are 0 default to the first one), the chance of a template being choosen is: rate of this template / sum of the rates of all templates for this team (so rate is not a percent)
I split the patch in three:
Part 1: changes needed to parse the templates from script files
Part 2: changes to the script files
Part 3: actually use the parsed data to generate the character attributes
So what do you think?
Kildor:
I like the idea. Know nothing about code guidelines, but the whole point «to make as scriptable as possible» is good :-)
Mattn:
i will definitely apply this to trunk asap. thank you very much for the patch.
Mattn:
applied to trunk - thanks again - https://sourceforge.net/apps/trac/ufoai/changeset/31491
DarkRain:
Glad I could help
Navigation
[0] Message Index
[#] Next page
Go to full version