# FreeCraft Configuration Language Description: UnitType

         ___________		     _________		      _____  __
         \_	  _____/______   ____   ____ \_   ___ \____________ _/ ____\/  |_
          |    __) \_  __ \_/ __ \_/ __ \/    \  \/\_  __ \__  \\   __\\   __\
          |     \   |  | \/\  ___/\  ___/\     \____|  | \// __ \|  |   |  |
          \___  /   |__|    \___  >\___  >\______  /|__|  (____  /__|   |__|
    	  \/		    \/	   \/	     \/		   \/
        ______________________                           ______________________
    			  T H E   W A R   B E G I N S
    	   FreeCraft - A free fantasy real time strategy game engine

(C) Copyright 1998-2000 by The FreeCraft Project. Distributed under the "Artistic License"

FreeCraft Readme FAQ

## Intro - Introduction to unit-type functions and variables

Everything around the C UnitType structure.

## Functions

### define-unit-type

#### Description

Define the unit types in game it is based on the UDTA.

The default unit types are defined in $FREECRAFT_LIBRARY/data/units.ccl. This could also be defined in own levels.

#### Syntax

`(define-unit-type ident name graphics pixel_size animations icon speed overlay sight_range hitpoints magic costs tile_size box_size attack_range computer_reaction_range human_reaction_range armor priorty damage piercing_damge weapon_upgradable armor_upgradeable decay annoy_factor points missle corpse type right_mouse can_target flags sounds attack_sound)`

ident
  The unit-type unique identifier. It is used to reference unit-types in game. F.E: "unit-knight", "unit-gold-mine".
name
  The unit-type name shown in the game. F.E: "Knight", "Gold Mine". If the name is too long, it is split at space.
graphics
  Defines the graphics used to display the unit-type in game. This could be an array "#( summer winter wasteland swamp) with different files for the tilesets. Or an indentifier "unit-xyz" if the graphics from an other unit-type should be reused.

  Examples:

  #( "knight.png" () () () )
    For all tilesets are the same graphics "knight.png" used.
  #( "gold mine (summer).png" "gold mine (winter).png" "gold mine (wasteland).png" "gold mine (swamp).png")
    "gold mine (summer).png" is used for the summer tileset.
    "gold mine (winter).png" is used for the winter tileset.
    "gold mine (wasteland).png" is used for the wasteland tileset.
    "gold mine (swamp).png" is used for the swamp tileset.
  "unit-knight"
    The graphics from the unit-type "unit-knight" is also used for the this unit-type (here paladin).
pixel_size
  Size of the unit-type graphic in pixeln. A list of X (width) and Y (height) sizes. F.E. '( 72 72 ), '( 96 96 ).
animations
  Identifier to reference the animation sequences (scripts) for the unit-type. F.E. "animations-knight", "animations-gold-mine".
icon
  Identifier to reference the icon shown in game for this unit-type. F.E. "icon-knight", "icon-gold-mine".
speed
  The speed shown for this unit-type in game. (NOTE: this is only shown and *not* used). F.E. 10, 13.
overlay
  Define the overlay shown if this unit is constructed (build). Currently are available:
  - 6 land construction site
  - 7 human shipyard construction site
  - 8 orc shipyard construction site
  - 9 human oil well construction site
  - 10 orc oil well construction site
  - 11 human refinery construction site
  - 12 orc refinery construction site
  - 13 human foundry construction site
  - 14 orc foundry construction site
  - 15 wall construction site
  NOTE: this will be changed to identifiers sometime.
sight_range
  Sight range (in tiles) of this unit. F.E. 6, 14.
hitpoints
  Hitpoints for this Unit. F.E. 90, 1000
magic
  Flag to determine whether this unit is a spell user. 0 = false (not a magic user), 1 = true (magic user). F.E. 1, 0
costs
  Define the costs to build (or aquire) this unit. It is an array of #( time gold wood oil) or #(time gold wood oil ore stone coal). Time is in frames to build this unit. Gold is the amount required to build this unit. Wood is the amount required to build this unit. Oil is the amount required to build this unit. F.E.: #( 200 2000 1000 200 ).

  NOTE: This is extendable more costs could be added. (using 6 resources insteed of 3. Or redefining the gold resource into a crytal resource)

tile_size
  Define the unit-type size in tiles. NOTE: currently only buildings could be bigger than one tile. A list of X (width) and Y (height) sizes. F.E. '( 1 1 ), '( 2 2 ).
box_size
attack_range
computer_reaction_range
human_reaction_range
armor
priorty
damage
piercing_damge
weapon_upgradable
armor_upgradeable
decay
annoy_factor
points
missle
corpse
type
right_mouse
can_target
flags
sounds
attack_sound

#### Example

        (define-unit-type "unit-footman"		"Footman"
          ;; graphic data
          #("footman.png"
    	()
    	()
    	() )
          '(  72  72 )			;; graphic size
          "animations-footman"	;; animations
          "icon-footman"
          ;;Speed OvFrame SightR Hitpnt Magic  BTime	Gold	Wood	Oil
    	  10       0      4     60      0 #(   60    600       0      0 )
          ;;Tile    Box Size    Attack	ReactC	ReactH
          '( 1 1 ) '(  31  31 )     1       6       4
          ;;Armor Prior	Damage	Pierc	WUpgr	AUpgr
    	   2    60      6      3       1       1
          ;;Decay Annoy	Points
    	  0      0      50
          "missile-none"
          'corpse-human
          'type-land
          'right-attack
          'can-target-land
          ;; flags
          'land-unit
          'can-attack
          'organic
          'selectable-by-rectangle
          ;; sounds
          #("footman-selected"
    	"footman-acknowledge"
    	"footman-ready"
    	"footman-help"
    	"footman-dead" )
          "footman-attack" )

Define the unit-type "unit-footman" as footman.

### print-unit-type-table

#### Description

Print the current unit type table for the C code. ( $FREECRAFT/src/unit/ut_table.c contains the result) Use "Save" to generate the scheme (FreeCraft configuration language) tables.

#### Syntax

(print-unit-type-table)

Last changed: $Id: unittype.html,v 1.3 2000/08/13 16:16:11 johns Exp $
All trademarks and copyrights on this page are owned by their respective owners.