Mostly Harmless

Legacy:Assault2Uzi

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Creating an Uzi

Changing the AssaultRifle's Spread and Rate of Fire properties

Where to start?

The first hurdle, but fortunatly not a very big one. Assuming that you downloaded the UT2003 source and have UnCodeX installed, we can start to look for classes which relate to the AssaultRifle in game.In UnCodeX you can find classes by pressing Ctrl+F,and in the search area typing Assault. THis will then find the classes with Assault in thier name, keep searching till you find AssaultRifle and open that file.

If you look through the code and down to the defaultproperties you will notice that there is no mention of spread or anything which seems to control the rate of fire? however you will notice the FireModeClass(0) and (1) variables and what they assigned to. So now we know search for the class AssaultFire in UnCodeX and open AssaultFire. Looking at the defaultproperties here we have found that there are mentions of spread and also rate of fire so we want to extend this file also finally we want to extend AssaultRiflePickup so we can place the new weapon in our maps.

Files You should have found

  • AssaultRifle.uc
  • AssaultFire.uc
  • AssaultRiflePickup.uc

Starting the code

First thing we want to do is make our uzi class, as we have no new models or sounds we can just use the AssaultRifle "as is" in the game. Subclassing the AssaultRifle will save us a lot of code. So create a file called Uzi.uc and add the code:

//===============================
 
// Uzi.uc 
 
//===============================
 
class Uzi extends AssaultRifle;

We only need to add a few defaultproperties, in this class which will make it different from the assault rifle

defaultproperties
 
{
  ItemName="Uzi"                     //Name of item
  FireModeClass(0)=UziFire           //This refers to the primary 
                                     //Firemode and points to
                                     //UziFire Class
  PickupClass=class'UziPickup'       //This is the Class pointed to
                                     //for pick up in the game
 
}
  • Things To Do
    1. What files too look at
    2. Make first changes -ROF and Spread {code snippet}
    3. Use Log tp show that spread is not changing even though we overide function.
    4. Highlight problem of subclassing super.func()/super(class).func()
    5. Correct Problem code {snipet}
    6. Possibly make mut for in game or run through commands to bring it in game?

Discussion

SuperApe: Incomplete? Needs linkage?