Adding Weapons(Ammo-Based): By Drumstix42 -Based from ZOD's tutorial, but for any ammo-based weapon STEP #1: -First put your weapon in your scripts/weapons folder in your mod directory. You can name it whatever you want, but it's best to call it your weapons name. IE. myGun.cs -The name you use here will be the name that you exec later on in server.cs -After that follow along this tutorial editing these files below | | | \ / ------- ------------------- --- inventory.cs ------------------- ------- Now find the function "function ShapeBase::clearInventory(%this)". We need to declare our weapon and ammo here like so: %this.setInventory(YourWeaponNameHere,0); %this.setInventory(YourWeaponNameHereAmmo,0); Just add these to the related lists. You can even just replace them over the TR2 list and make your own. We also have to find "function serverCmdGiveAll(%client)" and add our weapon and ammo there as well: %player.setInventory(YourWeaponNameHere,1); %player.setInventory(YourWeaponNameHereAmmo,999); Same here. Just add these to the related lists. You can even just replace them over the TR2 list and make your own. This makes it so when giveall function is put on in a server, you'll get the gun with 999 ammo =D ---------------------------------- -If you don't know about giveall, you type this in the console(press ~): $testcheats=1; then type this: giveall(); ---------------------------------- Ok we are done with inventory.cs lets save it and move on to inventoryHud.cs --------- ---------------------- --- inventoryHud.cs ---------------------- --------- We need to put the weapon in here so it shows up in the Inventory screen. So lets add the following, $InvWeapon[10] = "YourWeaponNameHere"; to the end of the list listed like so: There may be the Team Rabbit 2 guns, you can either just replace them all with this gun, or just add it below it. Just make sure your numbers go in order 7,8,9,10,11... $InvWeapon[8] = "Missile Launcher"; $InvWeapon[9] = "Shocklance"; $InvWeapon[10] = "YourWeaponNameHere"; Then we have to tell the Inventory screen what your weapon is in the next table listing like so: $NameToInv["YourWeaponNameHere"] = "YourWeaponNameHere"; Ok we are done with inventoryHud.cs lets save it and move on to OptionsDlg.cs -------- -------------------- --- OptionsDlg.cs -------------------- -------- We need to add the following lines in that file between the remap count of the grenadelauncher and the remapname of the Laser Rifle roughly around line 1290.: $RemapName[$RemapCount] = "YourWeaponNameHere"; $RemapCmd[$RemapCount] = "useYourWeaponNameHere"; $RemapCount++; That's all for OptionsDlg.cs, lets go over to player.cs -------- -------------------- --- player.cs -------------------- -------- Now lets allow the player to have the weapon.. open player.cs and lets give the weapon to one or more of the armors Find the datablock PlayerData(LightMaleHumanArmor) line,scroll down 'til you see max[weapons] It should be right above the MediumMaleHumanArmor datablock if that helps. add the lines to the bottom of the list: max[YourWeaponNameHere] = 1; max[YourWeaponNameHereAmmo] = AmmoNumberHere; We want to add this to each of the armor types we do not want using it to make sure they cannot carry this weapon like so: max[YourWeaponNameHere] = 0; max[YourWeaponNameHereAmmo] = 0; This makes it so the armor can't get the weapon no matter what. You could also just not to that, so the armor could only get it with giveall on. Now also, hunt down the list of ammo types on line 2470 or so(search for $ammoTypes).. and add this new one: (just add 1 to the last number in the list instead of the [6]. $ammoType[6] = "YourWeaponNameHereAmmo"; Just make sure it's numbers are in order. If the last ammotype is [5], you make this one [6] Ok we are done with player.cs lets save it and move on to weapons.cs -------- ------------------- --- weapons.cs ------------------- -------- Around line 6 is a big list of all the weapons, their ammo's and bitmaps... go to the bottom of the list and just after the last entry add (substitute the last number in the list + 1 for the 11, since the first weapon number is 0) -Now this is the same as in inventory hud. At the bottom of this list is the TR2 Weapons. You can just replace them with this, or put this at the bottom of the list, making the numbers stay in order as before. $WeaponsHudData[11, bitmapName] = "gui/hud_blaster"; //change blaster to w/e. This is for hud symbol on side of screen. $WeaponsHudData[11, itemDataName] = "YourWeaponNameHere"; $WeaponsHudData[11, ammoDataName] = "YourWeaponNameHereAmmo"; $WeaponsHudData[11, reticle] = "gui/hud_ret_shocklance"; //this is your reticle $WeaponsHudData[11, visible] = "false"; This make it show your reticle and hud icon with it's ammo. The only guns that have the visible = "false"; are the Laser Rifle, Shocklance, and the Targeting Laser reticles. All other reticles should be set to true. Now increment the $WeaponsHudCount by one, so if your last weapon is 11, make the number 12 $WeaponsHudCount = 12; Add an ammo reference below that to the $AmmoIncrement list $AmmoIncrement[YourWeaponNameHereAmmo] = 4; And even further down below, exec the script after all the other exec's in the "mounting weapons" list, add this to the bottom of it(not throwing weapons): exec("scripts/weapons/YourWeapon'sFileNameHere.cs"); Ok we are done with weapons.cs (whew) lets save it and move on to ammopack.cs -------- -------------------- --- ammopack.cs (located in "YourModFolder\scripts\packs") -------------------- -------- (This is not a required step to adding your weapon to the game) We want extra ammo if we have an ammo pack don't we? So lets add our weapon to the list at the end of the rest of them like so (remember to always inc the number in the brackets): $AmmoItem[6] = MissileLauncherAmmo; $AmmoItem[7] = RepairKit; $AmmoItem[8] = YourWeaponNameHereAmmo; Now find this datablock "datablock ItemData(AmmoPack)", we need to figure out the max ammo we want the pack to carry, basically the amount we type in here is multiplied by 2 when we have the pack. max[YourWeaponNameHereAmmo] = AmmoNumberHere; This makes the max ammo higher if you are equiped with the ammo pack! ---------------------------------------------------------------------------------------- For adding any other guns, just replace every instanced of YourWeaponNameHere with the gun name, and in weapon.cs make sure you exec the right file, yourgun.cs and it has the same CAPS and lowercase letters. ---------------------------------------------------------------------------------------- Congrats! You have hopefully added a gun to your mod! -Drumstix42