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-2003 by The FreeCraft Project. Distributed under the
"GNU General Public License"
FreeCraft
Readme
FAQ
CCL
PREV
NEXT
Index
define-animations
define-unit-stats
define-unit-type
define-unittype-wc-names
get-unit-type-ident
get-unit-type-name
get-unit-type-property
set-unit-type-name
set-unit-type-property
unit-type
unit-type-array
Intro - Introduction to unit-type functions and variables
Everything around the C UnitType structure.
Functions
define-animations
Description
Define animations.
Syntax
(define-animations ident 'still script 'move script 'die script 'attack script)
- ident
- Name of the animation to define.
- script
A script is a list of quad numbers.
(#(Flags Pixel Sleep Frame) (#Flags Pixel Sleep Frame) ...)
* Format of quad numbers:
#(Flags Pixel Sleep Frame)
o Flags are the sum of the following:
1 Restart - restart animation
2 Reset - animation could here be aborted (switch to another)
4 Sound - play a sound with the animation
8 Missile - fire a missile at this point
o Pixel is the number of pixels to move (if this is a moving animation)
o Sleep is the number of frames to wait for the next animation
o Frame is increment to the frame of the image
Example
(define-animations 'animation-footman
'still '( ; #5
#( 0 0 4 0) #( 3 0 1 0))
'move '( ; #16 P32
#( 0 3 2 0) #( 0 3 1 5) #( 0 3 2 5) #( 0 2 1 10)
#( 0 3 1 10) #( 0 2 1 0) #( 0 3 2 0) #( 0 3 1 15)
#( 0 3 2 15) #( 0 2 1 20) #( 0 3 1 20) #( 3 2 1 0))
'attack '( ; #25
#( 0 0 3 25) #( 0 0 3 30) #( 0 0 3 35) #(12 0 5 40)
#( 0 0 10 0) #( 3 0 1 0))
'die '( ; #107
#( 0 0 3 45) #( 0 0 3 50) #( 0 0 100 55) #( 3 0 1 55)))
Defines the animations for the footman.
Used
$LIBRARYPATH/ccl/anim.ccl
define-unit-stats
Description
Define unit stats.
Syntax
(define-unit-stats ident player 'level level 'speed speed 'attack-range arange
'sight-range srange 'armor armor 'basic-damage bdamage 'piercing-damage pdamage
'hit-points hp 'costs costs)
- ident
- Ident of the unit.
- player
- Player number.
- level
- .
- speed
- .
- arange
- .
- srange
- .
- armor
- .
- bdamage
- .
- pdamage
- .
- hp
- .
- costs
- .
Example
(define-unit-stats)
.
Not Used
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 and
$FREECRAFT_LIBRARY/data/human/units.ccl and
$FREECRAFT_LIBRARY/data/orc/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
- missile
- 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.
define-unittype-wc-names
Description
Define unit-type mapping from original number to internal symbol.
Syntax
(define-unittype-wc-names footman grunt ...)
Example
(define-unittype-wc-names)
.
Used
$LIBRARYPATH/ccl/wc2.ccl
get-unit-type-ident
Description
Get the ident of the unit-type structure.
Syntax
(get-unit-type-ident unit-type)
- unit-type
- .
Example
(get-unit-type-ident)
.
Not Used
get-unit-type-property
Description
Get the property of the unit-type structure.
Syntax
(get-unit-type-property unit-type)
- unit-type
- .
Example
(get-unit-type-property)
.
Not Used
get-unit-type-name
Description
Get the name of the unit-type structure.
Syntax
(get-unit-type-name unit-type)
- unit-type
- .
Example
(get-unit-type-name)
.
Not Used
set-unit-type-name!
Description
Set the name of the unit-type structure.
Syntax
(set-unit-type-name! unit-type name)
- unit-type
- .
- name
- .
Example
(set-unit-type-name!)
.
Not Used
set-unit-type-property
Description
Set the property of the unit-type structure.
Syntax
(set-unit-type-property unit-type property)
- unit-type
- .
- property
- .
Example
(set-unit-type-property)
.
Not Used
unit-type
Description
Get unit-type structure.
Syntax
(unit-type ident)
- ident
- .
Example
(unit-type 'unit-great-hall)
.
Used
$LIBRARYPATH/ccl/ai.ccl
unit-type-array
Description
Get all unit-type structures.
Syntax
(unit-type-array)
Example
(unit-type-array)
.
Not Used
Last changed: $Id: unittype.html,v 1.15 2003/02/05 00:35:02 jsalmon3 Exp $
All trademarks and copyrights on this page are owned by their respective owners.
(c) 2002-2003 by
The FreeCraft Project