Creating a new unit
November 17, 2002 - 15:46
Quote:
Tutorial Name: Creating a new unit in Tîberian Sun
Made by: Banshee
Dificulty: Very easy

Attention! You can post this tutorial in any forum you wish as long as I'm credited. If you wanna post it in your site, ask me first by e-mailing to webmaster@ppmsite.com.



Before making a new unit, you must have 2 things in mind:

1) What kind of unit it will be? Infantry, vehicle, aircraft or building?
2) What will be the atributes of it, I mean, how you call it? What sorta of abilities, weapons, etc it will have?

With that in mind, go to the list of the type the unit which you will build and add a non-used number in the end with the internal name of your unit. Example, if you wanna create an infantry called Sniper and wants the game recognizes it internally as SNIPER (Internal name), then go to infantry list and add it in the end. If it's your first new infantry and the others weren't edited, you'll see something like that:

Quote:
[InfantryTypes]
1=E1
2=E2
3=E3
4=MEDIC
5=WEEDGUY
6=ENGINEER
7=MUTANT
8=CIV1
9=CIV2
10=CIV3
11=JUMPJET
12=DOGGIE
13=CYC2
14=UMAGON
15=GHOST
16=MHIJACK
17=SLAV
18=CHAMSPY
19=MWMN
20=MUTANT3
21=OXANNA
22=TRATOS
23=CYBORG
24=CTECH
25=SNIPER



Observe the last line. 25 is the unused number, and SNIPER is how the game will internally recognize your unit. If you wanna make a vehicle, declare your unit in [VehicleTypes]. If it's an aircraft, declare it in [AircraftTypes]. If it's a building, declare it in [BuildingTypes].

The internal name is how the game will recognize it when you write the properties of it later or when you add it in any taskforce in ai.ini. However, the game doesnt show this name to the user who is playing, unless it's the same name from the property Name=.

The second part is to take a similar unit and "clone it" (copy and paste) and change it's properties until it reaches what you wish.

A Sniper should be similar to Umagon, so let's clone Umagon. Here is the original code from Umagon:

Quote:
[UMAGON]
Name=Umagon
Category=Soldier
Primary=Sniper
CrushSound=SQUISH6
TiberiumProof=yes
TiberiumHeal=yes
Strength=150
Armor=light
TechLevel=-1
Sight=7
Speed=5
Owner=GDI
Pip=white
AllowedToStartInMultiplayer=no
Cost=400
Points=5
Trainable=no
VoiceSelect=10-I000,10-I002,10-I004,10-I006
VoiceMove=10-I016,10-I020,10-I022
VoiceAttack=10-I024,10-I026,10-I028,10-I030
VoiceFeedback=
VoiceDie=DEDGIRL1,DEDGIRL2,DEDGIRL2,DEDGIRL4
Locomotor={4A582744-9839-11d1-B709-00A024DDAFD1}
PhysicalSize=1
MovementZone=Infantry
ThreatPosed=15 ; This value MUST be 0 for all building addons
ImmuneToVeins=yes


Now, let's modify it, so we have the Sniper:

Quote:
[SNIPER]     ; Note that this line now have the Internal name of your unit.
Name=Sniper   ; The player will see the name when the cursor is over the unit or in the sidebar.
Prerequisite=GAPILE,GATECH
Category=Soldier
Primary=Sniper
CrushSound=SQUISH6
TiberiumProof=yes
TiberiumHeal=yes
Strength=150
Armor=light
TechLevel=-1
Sight=7
Speed=5
Owner=GDI
Pip=white
AllowedToStartInMultiplayer=no
Cost=400
Points=5
Trainable=no
VoiceSelect=10-I000,10-I002,10-I004,10-I006
VoiceMove=10-I016,10-I020,10-I022
VoiceAttack=10-I024,10-I026,10-I028,10-I030
VoiceFeedback=
VoiceDie=DEDGIRL1,DEDGIRL2,DEDGIRL2,DEDGIRL4
Locomotor={4A582744-9839-11d1-B709-00A024DDAFD1}
PhysicalSize=1
MovementZone=Infantry
ThreatPosed=15 ; This value MUST be 0 for all building addons
ImmuneToVeins=yes


Now, you do the changes you want in it. Example:

Quote:
[SNIPER]     ; Note that this line now have the Internal name of your unit.
Image=TRATOS
Name=Sniper   ; The player will see the name when the cursor is over the
unit or in the sidebar.
Prerequisite=GAPILE,GATECH
Category=Soldier
Primary=Sniper
CrushSound=SQUISH6
Strength=180
Armor=none
TechLevel=9
Sight=7
Speed=5
Owner=GDI
Pip=white
AllowedToStartInMultiplayer=no
Cost=1200
Points=25
VoiceSelect=13-I000,13-I002,13-I004,13-I006
VoiceMove=13-I008,13-I010,13-I012,13-I014
VoiceAttack=13-I016,13-I018,13-I020
VoiceFeedback=
VoiceDie=DEDMAN1,DEDMAN2,DEDMAN2,DEDMAN4,DEDMAN5,DEDMAN6
Locomotor={4A582744-9839-11d1-B709-00A024DDAFD1}
PhysicalSize=1
MovementZone=Infantry
ThreatPosed=45 ; This value MUST be 0 for all building addons
ImmuneToVeins=yes



Important Considerations:

- The name of the unit should be equal to the name of the image declared in art.ini OR the atribute Image=XXXXX must exist (XXXXX is a name of an image declared in art.ini). Otherwise the game will report an internal error. If the image doesnt exist, your unit will be invisible to human eyes, but not to AI "eyes".
- Primary= MUST EXISTS and points an existing weapon or "none". Otherwise the game will also report an internal error.
- Internal name MUST EXIST AND FIT THE DECLARED ONE, otherwise the unit will not appear.
- Name= should exist, since we dont want to build a nonamed unit
- The atributes which are not used in the unit may use it's original value.


That's all for now and enjoy modding.