The TRPG 5.005 Help List FAQ



VII. scripts.vol

A. Description and Introduction.
      The "scripts.vol" file is the volume file containing all of the RPG 5.005 scripts which run a server (except the map and a few other random things.) This is where your administrative expertise, and server ownership come into play for modifying TRPG 5.005 weapons, items, etc.. into something unique from all the other servers.

Ab. Extracting and Editing.
      To even begin mixing up these files you should extract them with an extraction tool just so you can get a feel for how everything in the "scripts.vol" file is organized.
      You can download the "PakScape" .vol file extractor or the "volumer" .vol extractor or you can even use the "Extract.exe" file included with the tribes tools pack (if you have it) to extract the files from the scripts.vol... pakscape can be used to re-pack the files into a .vol as well. There is also the Visual VT utility in the downloads section of this FAQ.
      NOTE: you do not need to extract/edit/replace any of the files in the scripts.vol to implement changes. You can simply make a new myfile.cs file to place into the same directory as your scripts.vol file which will still be included in the game when launched. If you want to get rid of older items, you will need to extract and remove the undesired code by using one of the above mentioned tools, or naming a new file the same name as the items.cs file and redoing all of the items yourself in their new fassion. -Leaving the old files and putting in a new .cs file of the same name as the old file is reccomended, this way your base version of TRPG files stay together in a .vol file and you can destroy your modified files anytime you need.
      The best way to get started Editing and getting these files to be of some use is to go ahead and make some useable items! The next few sections will help to get you started in each.

B. Creating a Hand to Hand Weapon.
      Creating a Hand to Hand weapon is realy not too tough. You just have to keep track of putting your data into the appropriate fields.
Here's an example of the Hatchet:
$AccessoryVar[Hatchet, $AccessoryType] = $AxeAccessoryType;
$AccessoryVar[Hatchet, $SpecialVar] = "6 20";
$AccessoryVar[Hatchet, $Weight] = 5;
$AccessoryVar[Hatchet, $MiscInfo] = "A Hatchet.";
$SkillType[Hatchet] = $SkillSlashing;
$SkillRestriction[Hatchet] = $SkillSlashing @ "0";
$ItemCost[Hatchet] = GenerateItemCost(Hatchet);


//****************************************
//Hatchet
//****************************************

ItemImageData HatchetImage
{
	shapeFile = "hatchet";
	mountPoint = 0;
	weaponType = 0; // Single Shot
	reloadTime = 0;
	fireTime = GetDelay(Hatchet);
	minEnergy = 0;
	maxEnergy = 0;
	accuFire = true;
	sfxFire = SoundSwing1;
	sfxActivate = AxeSlash2;
};


ItemData Hatchet
{
	heading = "bWeapons";
	description = "Hatchet";
	className = "Weapon";
	shapeFile = "hatchet";
	hudIcon = "axe";
	shadowDetailMask = 4;
	imageType = HatchetImage
	price = 0;
	showWeaponBar = true;
};

function Hatchet::onFire(%player, %slot)
{
	MeleeAttack(%player, GetRange(Hatchet), Hatchet);
}
      As you can see, the hatchet has a lot of code to make it work. Here's the approximate breakdown of it:
$AccessoryVar[Hatchet, $AccessoryType] = $AxeAccessoryType;
//Above line defines the Hatchet as an AxeAccessoryType.
$AccessoryVar[Hatchet, $SpecialVar] = "6 20";
//Above line defines Hatchet to have a SpecialVar 6 of value 20.
//That is, attack = 20.
$AccessoryVar[Hatchet, $Weight] = 5;
//Above line defines Hatchet to have a weight of 5.
$AccessoryVar[Hatchet, $MiscInfo] = "A Hatchet.";
//Above line defines Hatchet to have #w info of "A Hatchet."
$SkillType[Hatchet] = $SkillSlashing;
//Above line defines Hatchet to use the SkillSlashing.
$SkillRestriction[Hatchet] = $SkillSlashing @ "0";
//Above line defines Hatchet to have a SkillSlashing Restriction
//of "0".  That is, Hatchet can be used when sp=0 in slashing.
$ItemCost[Hatchet] = GenerateItemCost(Hatchet);
//Above line should NOT be changed.


//****************************************
//Hatchet
//****************************************

ItemImageData HatchetImage
{
	shapeFile = "hatchet";
	//Above line defines the way the weapon in hand looks.
	//In this case, it is using the shape "hatchet".
	mountPoint = 0;
	//Where the weapon is mounted (don't mess with this).
	weaponType = 0; // Single Shot
	//Weapon Type (don't mess with this).
	reloadTime = 0;
	//reloadTime (don't mess with this).
	fireTime = GetDelay(Hatchet);
	//FireTime gets the delayTime for Hatchet.
	minEnergy = 0;
	maxEnergy = 0;
	accuFire = true;
	//don't change the 3 lines above this one.
	sfxFire = SoundSwing1;
	//Above line defines the sound the Hatchet makes when fired.
	sfxActivate = AxeSlash2;
	//Above line defines the sound the Hatchet makes when Equipped.
};


ItemData Hatchet
{
	heading = "bWeapons";
	//Above line defines the section in your inventory the weapon falls
	//under, in this case, weapons ;-)
	description = "Hatchet";
	//The Name of the weapon.
	className = "Weapon";
	//The class of the item (in this case, a Weapon).
	shapeFile = "hatchet";
	//Above line defines the shape used in-hand of player to display weapon.
	hudIcon = "axe";
	//Above line defines the icon to represent this weapon in the HUD.
	shadowDetailMask = 4;
	//no touch. (I don't know about this)
	imageType = HatchetImage
	//can't remember what this is used for, but, you will need to change the
	//"Hatchet" part of this with whatever your weapon Internal Name is.
	price = 0;
	//I would not change the above line unless you want some major wierdness.
	showWeaponBar = true;
	//leave it.
};

function Hatchet::onFire(%player, %slot)
//Above line tells weapon (Hatchet) what to do when fired; run the 
//following 3 lines of the function.
{
	MeleeAttack(%player, GetRange(Hatchet), Hatchet);
	//Above line checks how close the target is, and hits it if it's close enough.
}
      I am not an expert coder/scripter, but I defined the above to the best of my ability and to the obviousness of it's code representation. Everywhere the word "Hatchet" appears just like that, you should replace with your Custom Weapon name, for example; "SwordBrutus" could replace "Hatchet" BUT, this would only be the internal name. To define the Name and Description of the weapon you would need to edit the two lines that are "description = "Hatchet";" which is the Name that appears in the window, and "$AccessoryVar[Hatchet, $MiscInfo] = "A Hatchet.";" which defines the Actual description of a weapon when you type "#w weaponname".       If you want, you can go ahead and make your own file called "custitem.cs" (for custom items) and put all your custom items into this file. You could even break up your items by their use, ie; custweap.cs, custitem.cs, custarmor.cs, custspells.cs, etc... Don't worry that your custom items and spells and such are not in the same files as other items and things. TRPG will still find them, provided you made the data correctly. ;-)
      Here's a custom weapon scripter I made to help people make Hand to Hand combat weapons a bit faster and easier WeaponScripter. There is also a link on the page so that you can download the file and use it offline to make more weapons.
Here is an Example of a weapon I made using the scripter. It has 35 attack, 200 mana regen, 500 hit point regen, weight 150, and a slashing skill restriction of 10:
$AccessoryVar[SwordBrutus, $AccessoryType] = $SwordAccessoryType;
$AccessoryVar[SwordBrutus, $SpecialVar] = "6 35" "10 500" "11 200";
$AccessoryVar[SwordBrutus, $Weight] = 150;
$AccessoryVar[SwordBrutus, $MiscInfo] = "The Sword of a Weakling.";
$SkillType[SwordBrutus] = $SkillSlashing;
$SkillRestriction[SwordBrutus] = $SkillSlashing @ "10";
$ItemCost[SwordBrutus] = GenerateItemCost(SwordBrutus);


//****************************************
//SwordBrutus
//****************************************

ItemImageData SwordBrutusImage
{
	shapeFile = "elfinblade";
	mountPoint = 0;
	weaponType = 0; // Single Shot
	reloadTime = 0;
	fireTime = GetDelay(SwordBrutus);
	minEnergy = 0;
	maxEnergy = 0;
	accuFire = true;
	sfxFire = SoundSwing3;
	sfxActivate = AxeSlash2;
};


ItemData SwordBrutus
{
	heading = "bWeapons";
	description = "Brutus";
	className = "Weapon";
	shapeFile = "elfinblade";
	hudIcon = "katana";
	shadowDetailMask = 4;
	imageType = SwordBrutusImage
	price = 0;
	showWeaponBar = true;
};

function SwordBrutus::onFire(%player, %slot)
{
	MeleeAttack(%player, GetRange(SwordBrutus), SwordBrutus);
}

C. Creating a Ranged Weapon.
      Creating a ranged weapon. The following is a bunch of code pertaining to the sling weapon item and the projectile it will be shooting.
$AccessoryVar[Sling, $AccessoryType] = $RangedAccessoryType;
$AccessoryVar[Sling, $SpecialVar] = "6 11";
$AccessoryVar[Sling, $Weight] = 2;
$AccessoryVar[Sling, $MiscInfo] = "A sling.";
$SkillType[Sling] = $SkillArchery;
$WeaponRange[Sling] = 35;
$WeaponDelay[Sling] = 1.5;

$AccessoryVar[SmallRock, $SpecialVar] = "6 10";
$AccessoryVar[SmallRock, $Weight] = "0.2";
$AccessoryVar[SmallRock, $MiscInfo] = "A small rock.";
$SkillType[SmallRock] = $SkillArchery;
$ProjRestrictions[SmallRock] = ",Sling,";


//**************************************
//   SLING
//**************************************

ItemImageData SlingImage
{
	shapeFile = "crossbow";
	mountPoint = 0;

	weaponType = 0; // Single Shot
	ammoType = "";
	projectileType = NoProjectile;
	accuFire = false;
	reloadTime = 0;
	fireTime = GetDelay(Sling);

	lightType = 3;  // Weapon Fire
	lightRadius = 3;
	lightTime = 1;
	lightColor = { 0.6, 1, 1.0 };

	sfxFire = CrossbowShoot1;
	sfxActivate = CrossbowSwitch1;
	sfxReload = NoSound;
};
ItemData Sling
{
	description = "Sling";
	className = "Weapon";
	shapeFile = "crossbow";
	hudIcon = "grenade";
	heading = "bWeapons";
	shadowDetailMask = 4;
	imageType = SlingImage;
	price = 0;
	showWeaponBar = true;
};
function SlingImage::onFire(%player, %slot)
{
	%clientId = Player::getClient(%player);

	%vel = 60;
	ProjectileAttack(%clientId, Sling, %vel);
}
Yeehoo!!! Now let's examine what all of that means in detail:
$AccessoryVar[Sling, $AccessoryType] = $RangedAccessoryType;
//Above defines the Sling accessory Type, Ranged -as for all ranged weapons.
$AccessoryVar[Sling, $SpecialVar] = "6 11";
//Above line defines Attack of 11 for the Sling.
$AccessoryVar[Sling, $Weight] = 2;
//Above defines the Sling weight.
$AccessoryVar[Sling, $MiscInfo] = "A sling.";
//Above defines the Sling's #w info.
$SkillType[Sling] = $SkillArchery;
//Above defines the SkillType for the Sling as Archery -as all ranged are.
$WeaponRange[Sling] = 35;
//Above defines the Sling weapon range.
$WeaponDelay[Sling] = 1.5;
//Above defines the Delay in seconds of the sling to fire.

$AccessoryVar[SmallRock, $SpecialVar] = "6 10";
//Above defines the Attack strength of the SmallRock as 10. (this is the sling ammo.)
$AccessoryVar[SmallRock, $Weight] = "0.2";
//Above defines the SmallRock Weight at 0.2.
$AccessoryVar[SmallRock, $MiscInfo] = "A small rock.";
//Above defines the SmallRock #w info.
$SkillType[SmallRock] = $SkillArchery;
//Above denfines the Skill Needed to use SmallRock in a weapon.
$ProjRestrictions[SmallRock] = ",Sling,";
//Above defines the SmallRock ProjRestrictions... in other words, what weapon
//can use this ammo.


//**************************************
//   SLING  //weapon Name
//**************************************

ItemImageData SlingImage
{
	shapeFile = "crossbow";
        //Above defines the hand-held shape to be used by player.
	mountPoint = 0;
        //Above defines the mount point.  Leave this usually.
	weaponType = 0; // Single Shot
        //Above defines the WeaponType... leave this.
	ammoType = "";
        //Above defines the ammoType of the Sling... (player assigns this from the 
        //tab "ranged weapons" menu while in-game.
	projectileType = NoProjectile;
        //leave this I think.
	accuFire = false;
        //Leave this as well I think.
	reloadTime = 0;
        //Leve this too I think.
	fireTime = GetDelay(Sling);
        //This is fine, just change out your new weapon name for Sling.
	lightType = 3;  // Weapon Fire
        //Above defines the light that is emmited when a projectile is shot.
	lightRadius = 3;
        //The area that lights up as a result of the fireing of that weapon.
	lightTime = 1;
        //Above, the duration of the light emmited when the Sling is fired.
	lightColor = { 0.6, 1, 1.0 };
        //I would not change the above line... I am not sure what it looks like 
        //when you change the light color.

	sfxFire = CrossbowShoot1;
        //The above is the sound heard when the Sling is fired.
	sfxActivate = CrossbowSwitch1;
        //The Above is the sound heard when the Sling is equipped.
	sfxReload = NoSound;
        //Don't worry about the above line.
};
ItemData Sling
{
	description = "Sling";
        //Above is the name of the weapon in the Inventory Menu.
	className = "Weapon";
        //Above is the Type of Item Class.
	shapeFile = "crossbow";
        //The above line defines the in-hand shapeFile the character sees.
	hudIcon = "grenade";
        //The above defines the Image shown in the hud.
	heading = "bWeapons";
        //The above defines what section this item will go under in your inventory.
        //Because this is a weapon, no need to change this.
	shadowDetailMask = 4;
	imageType = SlingImage;
	price = 0;
	showWeaponBar = true;
        //No need to change the above 4 lines.
};
function SlingImage::onFire(%player, %slot)
//Above function starts to tell the sling what to do when it's fired with 
//something in the crosshairs.
{
	%clientId = Player::getClient(%player);

	%vel = 60;
	ProjectileAttack(%clientId, Sling, %vel);
}
ok! That was a bit much? Not really. Just think of it simply and you shouldn't have a problem!
      To ease your minds and allow faster and easier Ranged Weapon making, I will be completing the Ranged Weapon Making Script (sometime in the future)... it's just a matter of putting the stuff together and testing it out. Until then, go ahead and mess with this example. When I have the scripter done I will post a custom ranged weapon here.

D. Creating a Spell.

E. Creating an Armor/Clothing.

F. Creating an Item.