Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 3982aae4c3194d313a3de1350cbefb10 > files > 1491

freecraft-1.18-3mdk.ppc.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<!--
----	(c) Copyright 2002-2003 by Lutz Sammer

----    FreeCraft is free software; you can redistribute it and/or modify
----    it under the terms of the GNU General Public License as published by
----    the Free Software Foundation; only version 2 of the License.

----    FreeCraft is distributed in the hope that it will be useful,
----    but WITHOUT ANY WARRANTY; without even the implied warranty of
----    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
----    GNU General Public License for more details.
-->
    <TITLE>FreeCraft Configuration Language Description: UnitType</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
    <META NAME="Author" CONTENT="johns98@gmx.net">
    <META NAME="Keyword" CONTENT="ccl,unittype">
    <META NAME="Description" CONTENT="">
</HEAD>
<BODY>
    <H1>FreeCraft Configuration Language Description: UnitType</H1>
<HR><PRE WIDTH=80>
     ___________		     _________		      _____  __
     \_	  _____/______   ____   ____ \_   ___ \____________ _/ ____\/  |_
      |    __) \_  __ \_/ __ \_/ __ \/    \  \/\_  __ \__  \\   __\\   __|
      |     \   |  | \/\  ___/\  ___/\     \____|  | \// __ \|  |   |  |
      \___  /   |__|    \___  >\___  >\______  /|__|  (____  /__|   |__|
	  \/		    \/	   \/	     \/		   \/
    ______________________                           ______________________
			  T H E   W A R   B E G I N S
	   FreeCraft - A free fantasy real time strategy game engine
</PRE>
<P><B>(C) Copyright 1998-2003 by The FreeCraft Project. Distributed under the
<A HREF="../gpl.html">"GNU General Public License"</A></B>
<HR>
<A HREF="../clone.html">FreeCraft</A> 
<A HREF="../readme.html">Readme</A> 
<A HREF="../faq.html">FAQ</A> 
<A HREF="ccl.html">CCL</A> 
<A HREF="ui.html">PREV</A> 
<A HREF="ai.html">NEXT</A> 
<A HREF="ccl-index.html">Index</A> 
<HR>
<A HREF="#define-animations">define-animations</A>
<A HREF="#define-unit-stats">define-unit-stats</A>
<A HREF="#define-unit-type">define-unit-type</A>
<A HREF="#define-unittype-wc-names">define-unittype-wc-names</A>
<A HREF="#get-unit-type-ident">get-unit-type-ident</A>
<A HREF="#get-unit-type-name">get-unit-type-name</A>
<A HREF="#get-unit-type-property">get-unit-type-property</A>
<A HREF="#set-unit-type-name">set-unit-type-name</A>
<A HREF="#set-unit-type-property">set-unit-type-property</A>
<A HREF="#unit-type">unit-type</A>
<A HREF="#unit-type-array">unit-type-array</A>
<HR>
<H2>Intro - Introduction to unit-type functions and variables</H2>

Everything around the C UnitType structure.

<H2>Functions</H2>
<A NAME="define-animations"></A>
<H3>define-animations</H3>

<H4>Description</H4>

Define animations.

<H4>Syntax</H4>

<CODE>(define-animations ident 'still script 'move script 'die script 'attack script)</CODE>

<DL>
<DT>ident</DT>
<DD>Name of the animation to define.
</DD>
<DT>script</DT>
<DD><PRE>
	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
</PRE></DD>
</DL>

<H4>Example</H4>

<PRE>
    (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)))

</PRE>

<P>Defines the animations for the footman.

<H4>Used</H4>

<A HREF="../../data/ccl/anim.ccl"> $LIBRARYPATH/ccl/anim.ccl </A>

<A NAME="define-unit-stats"></A>
<H3>define-unit-stats</H3>

<H4>Description</H4>

Define unit stats.

<H4>Syntax</H4>

<CODE>(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)</CODE>

<DL>
<DT>ident</DT>
<DD>Ident of the unit.
</DD>
<DT>player</DT>
<DD>Player number.
</DD>
<DT>level</DT>
<DD>.
</DD>
<DT>speed</DT>
<DD>.
</DD>
<DT>arange</DT>
<DD>.
</DD>
<DT>srange</DT>
<DD>.
</DD>
<DT>armor</DT>
<DD>.
</DD>
<DT>bdamage</DT>
<DD>.
</DD>
<DT>pdamage</DT>
<DD>.
</DD>
<DT>hp</DT>
<DD>.
</DD>
<DT>costs</DT>
<DD>.
</DD>
</DL>

<H4>Example</H4>

<PRE>
    (define-unit-stats)
</PRE>

<P>.

<H4>Not Used</H4>

<A NAME="define-unit-type"></A>
<H3>define-unit-type</H3>

<H4>Description</H4>

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

    The default unit types are defined in <A HREF="../../data/ccl/units.ccl">
    $FREECRAFT_LIBRARY/data/units.ccl</A> and
    <A HREF="../../data/ccl/human/units.ccl">
    $FREECRAFT_LIBRARY/data/human/units.ccl</A> and
    <A HREF="../../data/ccl/orc/units.ccl">
    $FREECRAFT_LIBRARY/data/orc/units.ccl</A>. This could also be defined in
    own levels. <P>

<H4>Syntax</H4>

<CODE>(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)</CODE>

<DL>
<DT>ident</DT>
<DD>The unit-type unique identifier.  It is used to reference unit-types in
game. F.E: "unit-knight", "unit-gold-mine".
</DD>
<DT>name</DT>
<DD>The unit-type name shown in the game. F.E: "Knight", "Gold Mine".
If the name is too long, it is split at space.
</DD>
<DD></DD>
<DT>graphics</DT>
<DD>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.<P>

Examples:
    <DL>
    <DT>#( "knight.png" () () () )</DT>
    <DD>For all tilesets are the same graphics "knight.png" used. </DD>
    <DT>#( "gold mine (summer).png" "gold mine (winter).png"
	"gold mine (wasteland).png" "gold mine (swamp).png")</DT>
    <DD>"gold mine (summer).png" is used for the summer tileset.<BR>
	"gold mine (winter).png" is used for the winter tileset.<BR>
	"gold mine (wasteland).png" is used for the wasteland tileset.<BR>
	"gold mine (swamp).png" is used for the swamp tileset. </DD>
    <DT>"unit-knight"</DT>
    <DD>The graphics from the unit-type "unit-knight" is also used for the
	this unit-type (here paladin).</DD>
    </DL>
</DD>
<DT>pixel_size</DT>
<DD>Size of the unit-type graphic in pixeln. A list of X (width) and Y (height)
sizes.  F.E. '( 72 72 ), '( 96 96 ).</DD>
<DT>animations</DT>
<DD>Identifier to reference the animation sequences (scripts) for the
unit-type. F.E. "animations-knight", "animations-gold-mine".</DD>
<DT>icon</DT>
<DD>Identifier to reference the icon shown in game for this unit-type.
F.E. "icon-knight", "icon-gold-mine".</DD>
<DT>speed</DT>
<DD>The speed shown for this unit-type in game. (NOTE: this is
only shown and *not* used). F.E. 10, 13.</DD>
<DT>overlay</DT>
<DD>Define the overlay shown if this unit is constructed (build).
Currently are available:
<UL>
<LI> 6 land construction site
<LI> 7 human shipyard construction site
<LI> 8 orc shipyard construction site
<LI> 9 human oil well construction site
<LI>10 orc oil well construction site
<LI>11 human refinery construction site
<LI>12 orc refinery construction site
<LI>13 human foundry construction site
<LI>14 orc foundry construction site
<LI>15 wall construction site
</UL>
NOTE: this will be changed to identifiers sometime.
</DD>
<DT>sight_range</DT>
<DD>Sight range (in tiles) of this unit. F.E. 6, 14.</DD>
<DT>hitpoints</DT>
<DD>Hitpoints for this Unit. F.E. 90, 1000</DD>
<DT>magic</DT>
<DD>Flag to determine whether this unit is a spell user. 0 = false (not a magic
user), 1 = true (magic user).  F.E. 1, 0</DD>
<DT>costs</DT>
<DD>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 ).<P>
NOTE: This is extendable more costs could be added. (using 6 resources insteed
of 3. Or redefining the gold resource into a crytal resource)
</DD>
<DT>tile_size</DT>
<DD>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 ).
</DD>
<DT>box_size</DT>
<DD></DD>
<DT>attack_range</DT>
<DD></DD>
<DT>computer_reaction_range</DT>
<DD></DD>
<DT>human_reaction_range</DT>
<DD></DD>
<DT>armor</DT>
<DD></DD>
<DT>priorty</DT>
<DD></DD>
<DT>damage</DT>
<DD></DD>
<DT>piercing_damge</DT>
<DD></DD>
<DT>weapon_upgradable</DT>
<DD></DD>
<DT>armor_upgradeable</DT>
<DD></DD>
<DT>decay</DT>
<DD></DD>
<DT>annoy_factor</DT>
<DD></DD>
<DT>points</DT>
<DD></DD>
<DT>missile</DT>
<DD></DD>
<DT>corpse</DT>
<DD></DD>
<DT>type</DT>
<DD></DD>
<DT>right_mouse</DT>
<DD></DD>
<DT>can_target</DT>
<DD></DD>
<DT>flags</DT>
<DD></DD>
<DT>sounds</DT>
<DD></DD>
<DT>attack_sound</DT>
<DD></DD>
</DL>

<H4>Example</H4>

<PRE>
    (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" )
</PRE>
	Define the unit-type "unit-footman" as footman.<P>

<!--

<LI><VAR>unit-type</VAR><BR>
    Get the pointer to the unit type structure.<P>
    (unit-type ident)
    <DL>
    <DT>ident</DT>
    <DD>The unit-type unique identifier.</DD>
    </DL>
    <P>
    <H4>Example:</H4>
    (unit-type "unit-peon")<P>
    Get the unit type structure of the peon. #<UnitType 0x80ac350 unit-peon><P>

<LI><VAR>unit-type-array</VAR><BR>
    Get an array of all currently defined unit type structures.<P>
    (unit-type-array)
    <P>

<LI><VAR>get-unit-type-ident</VAR><BR>
    Get the unique identfier of the unit type structure.<P>
    (get-unit-type-ident type)
    <DL>
    <DT>type</DT>
    <DD>Unit type pointer</DD>
    </DL>
    <P>
    <H4>Example:</H4>
    (get-unit-type-ident (unit-type "unit-peon"))<P>
    Get the identifier of the unit type peon.<P>
-->

<A NAME="define-unittype-wc-names"></A>
<H3>define-unittype-wc-names</H3>

<H4>Description</H4>

Define unit-type mapping from original number to internal symbol.

<H4>Syntax</H4>

<CODE>(define-unittype-wc-names footman grunt ...)</CODE>

<H4>Example</H4>

<PRE>
    (define-unittype-wc-names)
</PRE>

<P>.

<H4>Used</H4>

<A HREF="../../data/ccl/wc2.ccl"> $LIBRARYPATH/ccl/wc2.ccl </A>

<A NAME="get-unit-type-ident"></A>
<H3>get-unit-type-ident</H3>

<H4>Description</H4>

Get the ident of the unit-type structure.

<H4>Syntax</H4>

<CODE>(get-unit-type-ident unit-type)</CODE>

<DL>
<DT>unit-type</DT>
<DD>.
</DD>
</DL>

<H4>Example</H4>

<PRE>
    (get-unit-type-ident)
</PRE>

<P>.

<H4>Not Used</H4>

<A NAME="get-unit-type-property"></A>
<H3>get-unit-type-property</H3>

<H4>Description</H4>

Get the property of the unit-type structure.

<H4>Syntax</H4>

<CODE>(get-unit-type-property unit-type)</CODE>

<DL>
<DT>unit-type</DT>
<DD>.
</DD>
</DL>

<H4>Example</H4>

<PRE>
    (get-unit-type-property)
</PRE>

<P>.

<H4>Not Used</H4>

<A NAME="get-unit-type-name"></A>
<H3>get-unit-type-name</H3>

<H4>Description</H4>

Get the name of the unit-type structure.

<H4>Syntax</H4>

<CODE>(get-unit-type-name unit-type)</CODE>

<DL>
<DT>unit-type</DT>
<DD>.
</DD>
</DL>

<H4>Example</H4>

<PRE>
    (get-unit-type-name)
</PRE>

<P>.

<H4>Not Used</H4>

<A NAME="set-unit-type-name!"></A>
<H3>set-unit-type-name!</H3>

<H4>Description</H4>

Set the name of the unit-type structure.

<H4>Syntax</H4>

<CODE>(set-unit-type-name! unit-type name)</CODE>

<DL>
<DT>unit-type</DT>
<DD>.
</DD>
<DT>name</DT>
<DD>.
</DD>
</DL>

<H4>Example</H4>

<PRE>
    (set-unit-type-name!)
</PRE>

<P>.

<H4>Not Used</H4>

<A NAME="set-unit-type-property"></A>
<H3>set-unit-type-property</H3>

<H4>Description</H4>

Set the property of the unit-type structure.

<H4>Syntax</H4>

<CODE>(set-unit-type-property unit-type property)</CODE>

<DL>
<DT>unit-type</DT>
<DD>.
</DD>
<DT>property</DT>
<DD>.
</DD>
</DL>

<H4>Example</H4>

<PRE>
    (set-unit-type-property)
</PRE>

<P>.

<H4>Not Used</H4>

<A NAME="unit-type"></A>
<H3>unit-type</H3>

<H4>Description</H4>

Get unit-type structure.

<H4>Syntax</H4>

<CODE>(unit-type ident)</CODE>

<DL>
<DT>ident</DT>
<DD>.
</DD>
</DL>

<H4>Example</H4>

<PRE>
    (unit-type 'unit-great-hall)
</PRE>

<P>.

<H4>Used</H4>

<A HREF="../../data/ccl/ai.ccl"> $LIBRARYPATH/ccl/ai.ccl </A>

<A NAME="unit-type-array"></A>
<H3>unit-type-array</H3>

<H4>Description</H4>

Get all unit-type structures.

<H4>Syntax</H4>

<CODE>(unit-type-array)</CODE>

<H4>Example</H4>

<PRE>
    (unit-type-array)
</PRE>

<P>.

<H4>Not Used</H4>

<HR>
Last changed: $Id: unittype.html,v 1.15 2003/02/05 00:35:02 jsalmon3 Exp $<BR>
All trademarks and copyrights on this page are owned by their respective owners.
<ADDRESS>(c) 2002-2003 by <A HREF="http://freecraft.org">
The FreeCraft Project</A></ADDRESS></BODY></HTML>