I don't need to test my programs. I have an error-correcting modem.
Legacy:Modifying Vehicle Weapons
This is tutorial is for UT2004 and UEd3
I (blip2) have noticed how many people often ask who to change the weapons on a vehicle - I myself asked a similar question and after 25 replies managed to get a result - not perfect but OK. But anyhow i have decided to help unclog the forums and write a tutorial.
The going on this may be slow as it is quite hard and there are thousands of possibilities for weapon changes.
Contents
Let's get started
The only prerequisite for this tutorial is Setting Up UnrealScript. This tutorial assumes you have UMake along with a basic text editor.
Copying your vehicle
First, Set Up Package Folders for the project. For the purposes of this tutorial I will use the project I am working on, "Shockmanta": this describes the weapon (shock balls) and the base vehicle (manta) and therefore is suitable.
e.g:
c:\UT2004> mkdir MyPackage c:\UT2004> mkdir MyPackage\Classes c:\UT2004> cd MyPackage\Classes
Note: this is not a tutorial on creating a new vehicle. We are simply taking a base vehicle and substituting its weapons for others that already exist in the game. Choose your vehicle and get the class file for it,
Read Setting Up UnrealScript for more information
A few points on where to find them
- The .uc files are within classes directories of the root folders
- A cheat sheet is a good place to start as the cheat goes
summon.(foldername).(classfile)
e.g.
summon.onslaught.onshoverbike
...summons a manta
So copy the class file for the vehicle into the new folder
e.g:
c:\UT2004\MyPackage\Classes> copy C:\UT2004\Onslaught\Classes\ONSHoverBike.uc .\ShockManta.uc
Modifying the vehicle
This is really just a case working it out yourself but i will give you a few guide lines to get you on your way
- Change the file name of the Vehicle you want to modify
eg.
ONSHoverBike.uc to ShockManta.uc
- At the top in the file there is a line that says:
class ONSHoverBike extends ONSHoverCraft
change it to:
class ShockManta extends ONSHoverBike
- You must set the class to the name of the .uc file otherwise it will not compile
- If you are only modifying the weapon it is probably best to extend the original vehicle (ONSHoverBike) but if you are going to do some serious modification you are best subclassing the vehicle class and copying the code from a vehicle within it
eg.
class ShockManta extends ONSHoverCraft
Code from ONSHoverBike (which you can then modify)
Modifying the vehicle weapon
For weapons it is probably best to start with the default properties section (near the bottom)
You will find a line that starts with DriverWeapons(0)=
The Weaponclass is the code for the bit that fires (I will go on to this later) and the weaponbone is the bone in the sceletal mesh that the firing bit is attached to (don't change it unless you've make your own vehicle and know the bone names)
You could change it to something like this:
DriverWeapons(0)=(WeaponClass=class'OnslaughtBP.ONSShockTankCannon',WeaponBone=PlasmaGunAttachment);
You're best off getting the WeaponClass from another vehicle (open the class and paste it into the new vehicle)
This is the primary weapons control for just about all vehicles (driver) and as you can probably see all I have done is replaced the manta weapon with the same bit in the ONSShocktank .uc file (OnslaughtBP folder if you are interested)
Passenger weapons are similar
PassengerWeapons(0)=(WeaponPawnClass=class'ONSTankSecondaryTurretPawn',WeaponBone=MachineGunTurret)
I have used the Goliath mini gun as an example.
Multiple passengers have the similar properties e.g. the Leviathan
DriverWeapons(0)=(WeaponClass=class'OnslaughtFull.ONSMASRocketPack',WeaponBone=RocketPackAttach); DriverWeapons(1)=(WeaponClass=class'OnslaughtFull.ONSMASCannon',WeaponBone=MainGunPostBase); PassengerWeapons(0)=(WeaponPawnClass=class'OnslaughtFull.ONSMASSideGunPawn',WeaponBone=RightFrontGunAttach); PassengerWeapons(1)=(WeaponPawnClass=class'OnslaughtFull.ONSMASSideGunPawn',WeaponBone=LeftFrontGunAttach); PassengerWeapons(2)=(WeaponPawnClass=class'OnslaughtFull.ONSMASSideGunPawn',WeaponBone=RightRearGunAttach); PassengerWeapons(3)=(WeaponPawnClass=class'OnslaughtFull.ONSMASSideGunPawn',WeaponBone=LeftRearGunAttach);
Note that passenger weapons classes are a subclass of WeaponPawn whereas the main weapon is subclass of Weapon.
The driver's alt fire is different from vehicle to vehicle. The manta crushes, the goliath zooms, the leviathan deploys. Maybe the raptor is the place to start if you want the driver to be able to fire multiple weapons. You are looking for something like:
function AltFire
And again just copy the bits you need
- Don't forget the name of your .uc must match the classname of your modified vehicle. NEVER EDIT THE ORIGINAL FILES or you will break network play.
Compiling the scripts
- Open UMake
- Put in C:\UT2004\(your folder name)
- Click 'compile'
- It will go through a list of packages
- If it fails, go up the list (in details) and find the bits in red (if you can't find any then it has probably compiled OK [please tell me if I'm wrong]) try to find the problem in the code (the red text may give a hint) and try to compile again - if the problem reoccurs try rewriting the code all over - you can also try the Atari forums (programming section) and PM me if you are really desperate (blip2)
- Once you're compiled go into UEd and in the actor browser open the .u file in the system directory with your modified vehicle's name in it you should then be able to get the vehicle by placing an ONSFactory (it doesn't matter which one [I used ONSArtilleryFactory completely at random] and changed the SVehicleFactory >> VehicleClass property to your vehicle (it should show up in the list if you did everything properly)
Extending the changes
Often just changing the basic weapon is not enough i.e. you want to change the power/speed etc. of the weapon so...
You do basically the same thing as you did with the first script. What you need to look for is in your first script (see above) for something that looks like the extention of the weapon, this will be found in the default properties under something like projectileclass etc.
You then find the script file for this (referred to as [rta] old file) and similar to above you change the file name and the internal class name at the top, save it ([rta]new file) and go back to your first script(the one above). Then change the place where you found the file name to your new file (don't forget to put the rootfolderofyourmod.thenewfilename in correctly), also make sure that all of the references of the old file are replaced with you new file. Wow it's complicated when you try to explain it (this probably means its hard to understand).
Again you either have the knack or you don't in which case I suggest getting someone to do it for you (I wish you luck :-D)
–Turrets (ToDo)–