Tribes Modding Tutorial by Plasmatic

Locked
AnniDv6
Posts: 1039
Joined: Mon Dec 12, 2011 3:25 pm

Tribes Modding Tutorial by Plasmatic

Post by AnniDv6 »

Tribes Modding Tutorial by Plasmatic
https://imgur.com/gallery/2o94Zqk

Text version in case you need to copy paste any of the code snipets:
Getting started.

First of all, modding takes patience. If you have none, take some yoga classes, buy a punching bag in the shape of a computer, etc. When you get some patience, you may be ready to try modding. You will screw up tribes many times, sometimes just by omitting a character, hitting the wrong key, and so on. On the other hand, when it works like you had intended, modding can be very satisfying.

With that in mind, its necessary to install another copy of tribes on your machine. This is very important as client packs like presto, sound packs, and other client sided mods will screw up your modding attempts. Sometimes very badly. Not only will having client scripts screw up modding, when you break tribes -and you will, it would be a shame to break the one you play tribes with. Having to reinstall tribes anyways, along with setting the game up the way you like.

Installing Tribes into a different directory:

Find your tribes disk, slap it into your cdrom and wait for the auto run to start. When (and if) it starts, close the auto run.

Double click the 'My Computer' icon on your desktop, then right click on the icon representing your cdrom and scroll down to explore. Select explore.

Once you're exploring, double click the 'setup.exe' icon and go through the install process.


Be sure to choose a different directory than the C:\Dynamix\Tribes directory.


Any directory will do, and the setup program will create a new one if you like. I use C:\MOD so I can get to it quickly, but anything will work. When the setup program asks you if you would like a shortcut on your desktop, click NO.


If you allow setup to create a shortcut, it will overwrite your existing shortcut. Most likely the one you play tribes with. The rest of the check boxes, and buttons have no bearing on what we need to mod with so you can answer NO and un check every box the rest of the way through the install.

Installing a mod:

Once you get Tribes installed into a new directory, we're ready to continue. Find the appropriate Tribes 1.x to 1.11 update and run the exe. Patching the modding tribes isn't really necessary, but changes were made to the tribes.exe and scripts.vol, and its a good idea to be compatible. If you're unsure what version you currently have, explore to the new tribes install, and double click 'Tribes.exe'. When Tribes starts up, the version number is shown in the bottom right corner of the screen. Most likely 1.0 or 1.8. If you have 1.8 and need the patch it can be found here: http://mods.tribes-universe.com/plastma ... 8to111.zip For some reason, the 1.8 to 1.11 patches are hard to find. Be sure to browse to the correct directory if the patch doest find the correct directory.

Once Patched, click into the directory that contains your freshly installed and patched tribes.exe, and double click the base folder. Right click and copy the scripts.vol.

Back up a directory, to the same directory that holds the tribes.exe. Right click on the background in the dir. and create a new folder. Name this whatever you would like to call your new mod. I've named mine 'SweetMod' but it can be almost anything. Right click this new folder and 'Paste' scripts.vol into it.


Once you've got scripts.vol into a new folder, you will need to create a shortcut to Tribes.exe and modify the 'extension' for the shortcut. Don't worry, this is easy. Right click the Tribes.exe icon and select 'create shortcut'


A new shortcut will appear in the folder alongside Tribes.exe. Right click this new Shortcut and select 'Properties'.


Select the 'Target line' and add ' -mod 'and the name of the new folder you just created.

My target looks like this:
C:\Modding\TRIBES\Tribes.exe -mod sweetmod
Note that there needs to be a space after tribes.exe and -mod and the name of the folder containing your new mod.

Double click this new shortcut, and set up tribes player, sound, video, etc. If you want to allow others to join your test server click the 'register with master server' box.

Click the Host Multi player box

then next, select a map, and type in a password it you like, then hit 'Host Game' at the lower right of screen.

Thats it. When the game loads up, you're running a un dedicated server (more on that later) with a mod. You can verify this by hitting the 'escape' key and looking at the top of screen.

Your mod will be listed as server type, with ' base' tacked onto the end. Right now the mod you're running is merely base renamed, but we're about to change that.

This new shortcut can be copied and placed anywhere you like for easy access. I've placed a copy of mine in my 'quick launch' tool bar next to the windows 'Start' button so I can start it with one click. I've also added -mission modtest to my target line, so Tribes loads a map automatically when starting. Modtest is a map I created specifically for testing mods, and can be found at http://www.annihilation.info -Modding takes time, and this speeds it up some. If you have 'register with master server' box checked players on the internet (if you're connected) can connect. This is sometimes a bad thing if you started up the mod to test one thing, and someone joins just as you're restarting. Type something into the 'password' field and players joining will need to type a password to join. Sometimes nice if you want to show your mod to a friend, but don't want the untamed hordes poking around in your unfinished mod.


Getting ready to edit a mod:

OK, you've got a mod installed, it works fine, but its just base mod, what now? There are 2 ways to mod, and test new code. I'll show you the easiest and fastest way to do this. First get into the base folder and rename or delete scripts.vol

Before we go any further, you may want to change your setting in windows so you can see extensions. If you click onto say, scripts.vol and you see only 'scripts' you can't see extensions (the thingy after the '.' for the computer illiterate.) Get into your settings and change it. In winXP the setting is located at start> control panel> folder options> view> hide extensions for known file types. It is similar with windows 98se and NT, but you're on your own. No I won't help you with this.

OK, renaming scripts.vol. You can either move this file, delete or rename it. I move it to a different, unused folder or deleted.


Moving it would be the better option, as you will probably be needing it sometime to un-FUBAR your mod. Moving it is necessary. If left it will interfere with any changes you make.

Once you get this moved, you will need to get back to the new folder containing your new mod, and 'unpack' the scripts.vol. I prefer win vol -available at in the downloads/ vol utilities section at http://www.annihilation.info Once you download and run the winvol.exe it should attach itself to any file with a .vol extension. Once thats done, double click the scripts.vol and 'unpack' it to the same directory.


Delete the scripts.vol, or move it. VERY IMPORTANT as if you leave it will interfere with your new mod.

Once you've removed the 2 scripts.vol files, in the

C:\Modding\TRIBES\SweetMod

and

C:\Modding\TRIBES\base

(if you've installed into the same directory as I have) and de-vol ed scripts.vol in your mods folder, you're ready to start hacking away at the mod.
You may want to double click your mod shortcut to make sure everything is running at this point. If you've followed all the steps up until now, Tribes should start up with the new mod running. If it doesn't for some reason, and all you see is a black screen, something is wrong. Hit ~ (the key right below escape on your keyboard) to bring up the tribes console. If your shortcut target points to the wrong directory, or none at all you will probably see a string of:

Game::EndFrame: Unknown command.
Game::EndFrame: Unknown command.
Game::EndFrame: Unknown command.
Game::EndFrame: Unknown command.
Game::EndFrame: Unknown command.

Don't worry, hit alt-enter to get tribes into a window and close it. Check your shortcut target and retry. You can create a new shortcut and discard the old one if necessary. Make sure the target line points to the new mod directory.

Once you are sure everythings working, thats it!

Enjoy.

Have fun..

Ah yes, you're reading this to find out how to mod, aren't you?....

Then we should probably go on and.....


Making changes to a mod:

Allrighty, you've now got a bunch of .cs files in a folder. Thats the raw, un 'vol ed' version of a mod and should run fine as is. There is no base\scripts.vol to interfere with operation, and no scripts.vol in the same directory as the .cs files to mess with changes you're about to make. Super.

.cs files can be opened with notepad, word pad or just about any text editor out there. double click on one and find out what your machine does with it. If your machine opens it up in notepad, for sanity sake, change it to word pad at the very least. Right click, select 'open with' and then 'choose program' Check the 'always open with' box so your computer remembers the setting. Word pad is nice in that is will search a complete document by hitting ctrl-f. Handy for large files. Windows 98 will search all files in a folder with ctrl-f also, but for some reason, microsoft screwed this feature up with xp and their screwy search function. Personally, I prefer Ultra Edit - http://www.ultraedit.com/ It has some VEEERY nice features, global search, replace, find, and a function list to name a few. I generally have 10+ files open at once with Ultra Edit, and its never let me down.

With that out of the way, lets dive in!
Open up items.cs. This file contains just about everything in Tribes hence the name. Right at the top there are the lines:

//----------------------------------------------------------------------------
$ItemFavoritesKey = ""; // Change this if you add new items
// and don't want to mess up everyone's
// favorites - just put in something
// that uniquely describes your new stuff.

There are a few things to note here:

anything followed by // will be ignored by the tribes engine, and can be used to place notes.
$ denotes a 'global' variable. one that stays in server memory until deleted or changed
% denotes a temporary variable, one only in server memory within functions, more on this later.
; is needed after an operation.

Tribes will freak out worse than you're mean second grade teacher about punctuation. Pay attention to parentheses (), squiggly parentheses {}, quotations "", and operators +-/!*

Change the $ItemFavoritesKey to something unique, you 'don't want to mess up everyone's favorites', right? Dynamix put notes in there, pay attention to them.. You can simply click in between the "" and add some text like so:


$ItemFavoritesKey = "Super mod ultra 4000";

It really doesn't matter. When players play the mod and set favorites, it will ba saved differently than other mods. In their ClientPrefs.cs in config directory to be exact.

Save changes, get in the habit of doing this often. Backing up may not be a bad idea when you get something nice coded.

OK, now lets mess with some other stuff.
Scroll down to line 1018, or if you're using word pad hit ctrl-f to search and type in plasma, hit next 12 times or until you see:



ItemData PlasmaAmmo
{
description = "Plasma Bolt";
heading = "xAmmunition";
className = "Ammo";
shapeFile = "plasammo";
shadowDetailMask = 4;
price = 2;
};

ItemImageData PlasmaGunImage
{
shapeFile = "plasma";
mountPoint = 0;

weaponType = 0; // Single Shot
ammoType = PlasmaAmmo;
projectileType = PlasmaBolt;
accuFire = true;
reloadTime = 0.1;
fireTime = 0.5;

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

sfxFire = SoundFirePlasma;
sfxActivate = SoundPickUpWeapon;
sfxReload = SoundDryFire;
};

ItemData PlasmaGun
{
description = "Plasma Gun";
className = "Weapon";
shapeFile = "plasma";
hudIcon = "plasma";
heading = "bWeapons";
shadowDetailMask = 4;
imageType = PlasmaGunImage;
price = 175;
showWeaponBar = true;
validateShape = true;
};

This is the information for the Plasma gun.
The fist 'group' 'ItemData PlasmaAmmo' defines what PlasmaAmmo looks like when dropped, and in the inventory screen when selected.
'ItemImageData PlasmaGunImage' defines weapon characteristics while mounted on a player, and 'ItemData PlasmaGun' defines what the item looks like in inventory and when dropped from a player.

Find the lines:


reloadTime = 0.1;
fireTime = 0.5;
and change them to look like this:
reloadTime = 0.0; //0.1;
fireTime = 0.1; //0.5;

Remember // denotes a note and tribes will ignore anything after. Its always a good idea when making changes to put a comment with the old value near the change. Those lines do exactly what you would think. Reducing the reload and fire time speeds up the fire rate.

OK, so we've got a fast plasma gun that chews up ammo quick. Maybe time for some more ammo? This can be changed in armordata.cs. Line 35 looks like this...
$ItemMax[larmor, PlasmaAmmo] = 30;
Increase it to 300 just for fun. Larmor is tribes name for Light Armor, male. you will need to change the values for the other 4 armors also (Heavy armor is the same for both genders) Ctrl-f through the armordata.cs file for 'PlasmaAmmo' and make similar changes

Now we've got a fast Plasma gun that is quite evil compared to the other weapons. Lets change that, as balancing is very important. It doesn't do any good to create a mod with one armor/ weapon that overpowers all the other armors/ weapons. Players will catch on quick and use only that combination, and get bored or cheesed off quick.

In the PlasmaGun's definition data block- 'ItemImageData PlasmaGunImage' there is the line
projectileType = PlasmaBolt; which means that this gun will fire PlasmaBolt's lets make some changes to this projectile. Open up baseProjData.cs (starting to see a pattern in the .cs file names?) and search for 'BulletData PlasmaBolt'

change the line:


damageValue = 0.45;

to:


damageValue = 0.08;

We're jacking up the fire rate roughly 6 times, so in order to be balanced with the other weapons (assuming they're base weapons) we're reducing damage roughly 6 times. A plasma gun that fires this quickly will most likely blind any player you hit with explosions also, but I'm not factoring that in.

The other lines in the data block do just what you would think:


bulletShapeName = "plasmabolt.dts"; // the shape in air
explosionTag = plasmaExp; // the explosion, defined in baseExpdata.cs

damageClass = 1; // direct collision or splash -0 impact, 1, radius
damageValue = 0.08; // damage to player or objects
damageType = $PlasmaDamageType; // damage type
explosionRadius = 4.0; // damage area around impact

muzzleVelocity = 55.0; // speed projectile travels
totalTime = 3.0; // time in air before disintegrating
liveTime = 2.0; // time after contact until explosion
lightRange = 3.0; // light around projectile for accelerated graphics
lightColor = { 1, 1, 0 }; // light color around projectile
inheritedVelocityScale = 0.3; // velocity based on player speed, from 0 to 1. higher numbers are more accurate
isVisible = True; // only valid for bullets

soundId = SoundJetLight; // sound in air

While we're in here, lets change the muzzleVelocity to something a little faster, say double 'stock' speed.


muzzleVelocity = 110.0; //55.0;

Other changes and debugging:

So now we have a fast firing, scary weapon that does a little more damage than normal in a fairly balanced mod. You can change other weapons and armors by fiddling with variables in the data blocks.

Make incremental changes so if you have problems you will know where to look. If you change something and the mod wont load, or some items don't work and you don't remember what you changed last. with the mod running hit ~ (the key just below the 'escape' key on your keyboard) and type

exec(item);

or whatever .cs file you think the problem may be in. No extension needed, Tribes will assume it a .cs file. If there is an error in the .cs file, Tribes will tell you, and even let you know what line.

Check the offending line for missing ; or }'s

Re-defing any data blocks by executing .cs files with data blocks will make the mod unstable. Not a good thing, but acceptable when looking for errors. If you execute any data block twice tribes will crash almost instantly. No big deal, but I thought I should warn you.

There are 8 basic types of projectiles:
BulletData Plasmagun, chaingun, Plasma turret, Ion turret, blaster. Fires in a straight line.
RocketData DiscLauncher, fighter rocket, RocketLauncher Fires in a straight line.
GrenadeData Grenadelauncher, MortarGun, Mortar Turret. Projectile speed, arc dependent on maxLevelFlightDist. Bounces dependent on Mass, and Elasticity settings. projSpecialTime defines smoke animation time. Note that Grenades players throw are actually Mines set to detonate 2 seconds after throwing.
SeekingMissileData Rocket turret. Follows target. Note, needs a target when fired.
LaserData Laser rifle, Laser turrets. Damage is based on energy conversion dependent on shooter object.
TargetLaserData Target laser. No damage.
LightningData Elf gun, Elf turret, JailGun. Damage based on a corresponding damage function usually located in baseProjData.cs Animation needs an 'anchor' in order to animate from shooter to target. Will auto- aim a bit dependent on defined cone angle.
RepairEffectData Repair pack, Repair gun. Effect based on functions in baseProjData.cs same as Lightning data projectile as it needs a target in order to animate.
Attached the files below in case the Imgur album goes down. Start with one (1), 24 is the last pic of the tutorial.
Attachments
24.png
23.png
22.png
21.png
20.png
19.png
18.png
17.png
16.png
15.png
14.png
13.png
12.png
11.png
10.png
9.png
8.png
7.png
6.png
5.png
4.png
3.png
2.png
1.png
Locked