|Tribes 2 Links:||Weapons||Armor||Vehicals||Packs, Deployables||Official Map Editor Guide||Scriptingtd>|
Thanks to the Tribes 2 Coding Community and Nevermind for this tutorial.
|Adding an armour Author: Nevermind|
This tutorial will add an Armor class called the "Berzerker".
First, we want to make a new damage profile for our Berzerker armor. This allows you to easily change the damage a given weapon does to the armor, without affecting the other armors. Open damagetypes.cs. Scroll to the bottom where there is a datablock for MediumPlayerDamageProfile. Copy it, and rename it BerzerkerPlayerDamageProfile.
Open player.cs. Scroll down the file untill you find the datablock called: datablock PlayerData(MediumMaleHumanArmor) : MediumPlayerDamageProfile
Ok, now you gotta copy the entire datablock, and then paste it right under, and then you change the name from PlayerData(MediumMaleHumanArmor) : MediumPlayerDamageProfile to PlayerData(BerzerkerMaleHumanArmor) : BerzerkerPlaerDamageProfile.
The last part of the datablock title refers to the damage profile for the armor. Change it to use the new damage profile we created, BerzerkerPlayerDamageProfile.
Later in player.cs, you will see definitions of MediumFemaleHumanArmor and MediumMaleBiodermArmor, you need to define a female armor datablock and a Bioderm armor datablock for your new armor, or else bad things will happen. Copy the 2 datablocks just mentioned and rename them to be BerzerkerFemaleHumanArmor and BerzerkerMaleBiodermArmor, respectivly. Also change their parent datablock from MediumMaleHumanArmor to BerzerkerMaleHumanArmor.
Open inventoryHud.cs. Go to the section where it defines $InvArmor. The order of this array determines the order the armor appear on the HUD. Change this section to look like the following:
$InvArmor = "Scout";
$InvArmor = "Assault";
$InvArmor = "Juggernaut";
$InvArmor = "Berzerker";
Then change the $NameToInv directly below that to read:
$NameToInv["Scout"] = "Light";
$NameToInv["Assault"] = "Medium";
$NameToInv["Juggernaut"] = "Heavy";
$NameToInv["Berzerker"] = "Berzerker";
In player.cs, find the Player::getArmorSize(%this) function. Change it to read the following:
%dataBlock = %this.getDataBlock().getName();
if (getSubStr(%dataBlock, 0, 5) $= "Light")
else if (getSubStr(%dataBlock, 0, 6) $= "Medium")
else if (getSubStr(%dataBlock, 0, 5) $= "Heavy")
else if (getSubStr(%dataBlock, 0, 8) $= "Berzerker")