Tribes 2 Scripting/Coding. Tribes 2 General Game Information Modifications Heads-Up-Displays Scripting/Coding Mapping Missions Custom Skin Creation Screenshots, duh! Links to Greater Sites Origional Tribes Page
Tribes 2 Links: Weapons Armor Vehicals Packs, Deployables Official Map Editor Guide Scripting
Tribes2 logo Team combat on an epic scale.

Grenade Addition Tutorial

This is another great tutorial put out on Vengeance Studios: Tribes 2 Editing by SmOkkin'Joe. Thanks!

By: SmOkkin' Joe
Summary:
Grenades are probably the easiest things to add into Tribes2 along with armors. This tutorial will explain how to add them in. I will explain the process of creating a new basic boost grenade and my very own Confusion Grenade. First off, A Grenade is a different type of weapon than the weapons. It is thrown and it doesn't have to be triggered to be blown up. There are Weapons, Grenades, Mines, and Beacons. Unlike Tribes1, the mines in Tribes2 are considered "mines" and not "grenades".
Also, if a file has what would be considered two words, such as "flash grenade", instead of writing it like that, say this FlashGrenade so that each new capital letter is the start of a new word.

**Note: Save allot. this stuff can be a PITA (Pain In The A--) if you crash and have to start over or accidentally kick the power plug switch. SAVE ALLOT**

1) Here are some little tricks to keep you going. First go into the base folder and open the scripts.VL2 file. I'm assuming that you don't know jack, but if you do, bear with me. Unzip the Scripts.Vl2 file into the base folder. You will see a folder now called scripts. Then Unzip the same scripts.Vl2 file into either the base folder or the scripts folder, but when it asks for a name in that little box, make it "Oscripts" (for Original Scripts). this will be your backup folder where you can replace good files with bad ones.
The second little thing is a nice program to make. Open up MS notepad in the start menu, and copy this down:

del scripts/*.cs.dso
del scripts/weapons/*.cs.dso
del scripts/vehicles/*.cs.dso
del scripts/packs/*.cs.dso
del scripts/turrets/*.cs.dso

Then click "save as" and name it Delete_DSO.bat (MAKE SURE THE SAVE TYPE IS ALL FILES AND NOT TEXT FILE). The reason that we are doing this is because the game creates cs.DSO files from every startup. The game tends to use these first if they are there rather than the .CS files, so if they are there, you're files wont be executed and run. save this to you're scripts folder and execute it before you run the game every time. another thing is that if you open them in the text editor, they're encoded and look like the matrix.

2) First off I take the Scripts/weapons/Grenade.cs file and open it up in my text editor. (I use MSVC++ and it works great. I also use one called "GWD Text Editor" which has a very cool "replace in files function"). Anyways, so you've opened up the Grenade.cs file. Next save it "as" BoostGrenade.cs and then make sure that in the weapons folder there is a BoostGrenade.cs and a Grenade.cs file. If there are continue, if not re-try what I just went through.

3) now that you have this new grenade file you have to edit it to make it into a boost grenade that boosts the player. go to your editor's edit menu (most likely) and find the replace option. replace the word Grenade with BoostGrenade, but go slowly because you don't want to replace the Damage Types, or anything with a .dts ending(3-d models of the game) or a wav ending(sounds).
also replace HandGrenade with boost grenade. replace them in that order though. otherwise it'll replace HandGreade with BoostGrenade and then when you replace Grenade with BoostGrenade you get stuff like "BoostBoostGrenade"

4) okay find the line that reads KickbackStrength = 2000 (I think). Change the value from 2000 to 15000 (that is what I use to boost a juggernaut)
then add the line function:

1000 is the time- 1000 = 1 sec I think.

You can change the color values of the smoke on your own, along with the .dts shape, just cut and paste form anything else. remember to SAVE THE FILE under the BoostGrenade.cs!!!!!!

Now for the other half. Getting it into the game

5)Ok now open up inventoryHud.cs and find where it says this:

Ok, now the top section is what the weapon is displayed as. The second half translates inside the computer, that the word Grenade in the quotes should refer to the file Grenade.cs (notice the NameToInv). this is easier to see on the Whiteout Grenade. The top is what the Hud menu say, and the bottom says that that menu item's info is contained within the file FlashGrenade. then add in your boost grenade so that it turns into this. keep the order and add a number. the new stuff is in Blue:

Ok then save the InventoryHud.cs file and make the changes.

6) Next open up Player.cs
This is where the find function comes in handy, files like these.

Search for any of these lines as they are all clumped together

This was found under the light armor information data, there will be one under the medium male and heavy male too. no need for the female and Bioderm, they just use the same data, different model.

Then simply add your boost grenade

This means that the light armors can all carry "4" Boost Grenades make sure you decide on your numbers here. also make sure you write the CS file name and not what will appear in the Hud menu. Next add your boost grenade in the same way to the other armor's inventory. Now save the file and continue on to 7.

7) Open up inventory.cs and find this clump of lines:

Now take a wild guess at what you're going to do next....

add this line to the bottom:

This file clears the inventory I think. once again make sure it's the file name and NOT the HUD name.

Now find these, below the giveall function.

Ok then add the line:



and now save it and close up inventory.cs

8)Open up hud.cs and find this or any of these lines:

This says that the sixth hand weapon is the CameraGrenade (ItemDataName) and the ammoDataName is CameraGrenade. the Slot where it is stored/thrown from is 0 and the BMP for the HUD is the .PNG file.
You need to copy these four (or any four) and paste them at the bottom under the beacon and before "$InventoryHudCount = 8;"

Then make it look like this:

** Note the bitmap name can be any of the HUD *.png files (such as the shrike or even Spinfusor one) **

Then change then number here from 8 to 9, because 0 counts as the first one.

Then save the file as it is. (hud.cs)

9)Open up the file called Weapons.cs this is our final file.
find this line:
$AmmoIncrement[Grenade] = 5;

This is the ammo increment line, it says that the inventory station will give at least this much ammo of a certain weapon at each visit. change it to this (I think).

$AmmoIncrement[BoostGrenade] = 6;

I put in six because that's what my light armor got. make sure it says you type of grenade.

Then find the line that says this.

exec("scripts/weapons/cameraGrenade.cs");

This is probably your most important line for the weapon. This tells the computer to execute this file in the defined directory.
Copy that and paste it below and then change it to say this:

exec("scripts/weapons/BoostGrenade.cs");

That is all there is to creating a new grenade. now in game you should have a new Boost Grenade!!!!

Confusion Grenade

This one is simple now that you know how to make a grenade. just create another grenade called ConfusionGrenade.cs and add it in the same way. i edited the explosion and where it says the shake camera duration,amp (amplitude), and other lines in explosion, just make sure that shakeCamera = true;

I set the duration to 10 seconds and the amp is high. is is based on the x,y,z axis "x" and "y" being side-to-side, front-and-back and "z" being up-and-down. shake the numbers up a bit for different effects. That's it! Have fun.

Also add both of these to the AmmoPack by opening AmmoPack.cs
Turn this:

Into this:

And then find this:
max[FlashGrenade] = 10;
And put this below it:
(numbers can be altered)
max[confusionGrenade] = 10;
max[BoostGrenade] = 5;

Then SAVE ammoPack.cs