UFO:Alien Invasion
Development => Newbie Coding => Topic started by: DarkRain on August 15, 2010, 07:26:35 pm
-
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: chrtemplate <template-id> {}
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:
templates {}
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?
-
I like the idea. Know nothing about code guidelines, but the whole point «to make as scriptable as possible» is good :-)
-
i will definitely apply this to trunk asap. thank you very much for the patch.
-
applied to trunk - thanks again - https://sourceforge.net/apps/trac/ufoai/changeset/31491
-
Glad I could help
-
I still dont get it how can i run scripts. IE my new chatacter templates taken from http://ufoai.ninex.info/wiki/index.php/UFO-Scripts/team_templates.ufo this example.
-
you dont run scripts, it is descriptive scripts called at the loading time of the game. The only thing to do is to move it at base/ufos.