UFO:Alien Invasion

Development => Newbie Coding => Topic started by: DarkRain on August 15, 2010, 07:26:35 pm

Title: Scriptable character templates
Post 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:
Code: [Select]
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:
Code: [Select]
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?
Title: Re: Scriptable character templates
Post by: Kildor on August 16, 2010, 07:01:25 am
I like the idea. Know nothing about code guidelines, but the whole point «to make as scriptable as possible» is good :-)
Title: Re: Scriptable character templates
Post by: Mattn on August 16, 2010, 08:43:46 am
i will definitely apply this to trunk asap. thank you very much for the patch.
Title: Re: Scriptable character templates
Post by: Mattn on August 16, 2010, 10:02:02 am
applied to trunk - thanks again - https://sourceforge.net/apps/trac/ufoai/changeset/31491
Title: Re: Scriptable character templates
Post by: DarkRain on August 16, 2010, 06:10:51 pm
Glad I could help
Title: Re: Scriptable character templates
Post by: yayaca on October 14, 2010, 12:04:05 pm
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.
Title: Re: Scriptable character templates
Post by: bayo on October 14, 2010, 01:54:36 pm
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.