project-navigation
Personal tools

Author Topic: Scriptable character templates  (Read 5839 times)

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Scriptable character templates
« 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?

Offline Kildor

  • Project Artist
  • Captain
  • ***
  • Posts: 757
  • Project mapper and some other stuff`er
    • View Profile
    • http://ufoai.nx0.ru
Re: Scriptable character templates
« Reply #1 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 :-)

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Scriptable character templates
« Reply #2 on: August 16, 2010, 08:43:46 am »
i will definitely apply this to trunk asap. thank you very much for the patch.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Scriptable character templates
« Reply #3 on: August 16, 2010, 10:02:02 am »

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Scriptable character templates
« Reply #4 on: August 16, 2010, 06:10:51 pm »
Glad I could help

Offline yayaca

  • Cannon Fodder
  • **
  • Posts: 1
    • View Profile
Re: Scriptable character templates
« Reply #5 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.

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: Scriptable character templates
« Reply #6 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.