Journey into the gritty and not particularly pleasant world of Max Payne. This third person action game features a strong storyline and an altogether interesting antihero. Max Payne is a gritty journey to the present day New York City during the worst winter blizzard in a century. The thriller pulp story keeps the players guessing right on till the end. The game shoots from the lowest slum pits to the greatest skyscraper heights, leaving behind a trail of corpses, splatters of blood, and empty brass rolling on the floor.

Post tutorial Report RSS Adding a new weapon to Max Payne

This mod creates a new weapon, the "Super Desert Eagle" which fires faster, has a larger clip, and does more damage.

Posted by on - Intermediate Weapons Modelling

Tutorial written by Aaron Shivji aka Shivs

Mirrored here for archival purposes

Adding a new weapon to Max Payne

all information will be in normal text and all code will be in BOLD ITALLIC. This tutorial requires a text editor which allows you to search for particular words.

What This Does:

This mod creates a new weapon, the "Super Desert Eagle" which fires faster, has a larger clip, and does more damage. The new weapon has the same sounds and graphics as the desert eagle, but is a new gun, not a modification of the original desert eagle. This tutorial is for people who want to know how to make a new weapon in max payne, does not create anything spectacularly cool but you could use this information to create your own weapons which are =)

Intro: This is my first tutorial and I am not very familiar with max script, there may be better ways to do this but I don't know of it yet. I figured this out by messing around with the code for about 6 hours and got this working. After I figured it out I decided to write a tutorial because I haven't seen any on the internet and I figured that lots of people would need this information.

Getting Started:

(If you are familiar with RasMaker then you can skip this part)

The first thing you have to do to make a Max Payne Mod is getting to know how to use rasmaker. This program archives your datafiles and allows you to open a .ras file. To get this program install the max payne editing tools off the game CD. Go in to the directory you installed the editing tools and move the directory \rasmaker to c:\rasmaker (or whatever other drive you have) this isn't necessary, it just makes things easier. Now go to your max payne game folder and copy the x_data.ras and x_english.ras files in to this new directory. These are the datafiles you will need for this tutorial, they contain all of the code, graphics, sounds etc. needed to make mods. to extract the data from these files open up a dos prompt and go to your rasmaker directory. Type "rasmaker -x x_data.ras" then type "rasmaker -x x_english.ras". This will extract all of the data files needed in to a folder called \data in your rasmaker directory.

Making the Mod:

Ok, now that we have all the files extracted we can begin. There should be about 350 megabytes of files in the data folder and we only need about 1 mb of them for this tutorial, so naturally we have to delete some stuff. Open up the data folder and delete all the folders except for "console", "database", and "hud". delete all of the files in this folder except for weaponpriority.txt. Go in to the database directory and delete all the folders except "skeletons" and "weapons", go in to the skeletons directory then open up the default_skeleton folder and delete the folder "anim". Delete all of the files in this folder except "characteranimid.h", "shooting.h", and "weaponid.h". Now go in to the weapons folder and delete all the folders except "deserteagle" and the file "deserteagle.txt". Now re-name the folder "deserteagle" to "supdeagle" and re-name "deserteagle.txt" to "supeagle.txt". This doesn't overwrite the old desert eagle, but we are using the old desert eagle files as a model for the new weapon. Any files you don't include in your mod aren't modified and the game just loads the orignial (so it loads all the info you just deleted from the original x_data.ras/x_english.ras in your max payne directory and adds your information to it).

Ok, we are done with the deleting, now for the modifying. Go to your \data folder and open up "weaponpriority.txt". You should see something that looks like this:

[BestWeapons]
{
[weapon] ID = WEAPONID_JACKHAMMER;
[weapon] ID = WEAPONID_MP5;
[weapon] ID = WEAPONID_INGRAMDUAL;
[weapon] ID = WEAPONID_INGRAM;
[weapon] ID = WEAPONID_PUMPSHOTGUN;
[weapon] ID = WEAPONID_SAWEDSHOTGUN;
[weapon] ID = WEAPONID_DESERTEAGLE;
[weapon] ID = WEAPONID_BERETTADUAL;
[weapon] ID = WEAPONID_BERETTA;
[weapon] ID = WEAPONID_BASEBALLBAT;
[weapon] ID = WEAPONID_LEADPIPE;
}

Add in this line:

[weapon] ID = WEAPONID_SUPDEAGLE;

at the bottom.

Below this Part, there is another part that looks like this:

[CycleWeapons]
{
[weapon] ID = WEAPONID_BASEBALLBAT;
[weapon] ID = WEAPONID_LEADPIPE;

at the bottom, under "[weapon] ID = WEAPONID SNIPER;"

add in:

[weapon] ID = WEAPONID_SUPDEAGLE;

OK, we are done with this file. Now we have to assign an ID for our new gun. Open up the \data\database\ folder. There is a long list of weapon names and ID's. Under "#define WEAPONID_PAINKILLER 16"

write in: "#define WEAPONID_SUPDEAGLE 17".

This ID allows the game to know what to call the gun. It is needed later on in other files.

Now scroll down a bit, under "#define INVENTORYID_PAINKILLER 13"

write in "#define INVENTORYID_SUPDEAGLE 14"

Now scroll down a bit more, under "#define SLOTID_PAINKILLER 10"

write in "#define SLOTID_SUPDEAGLE 5"

This ID is tells the game what weapon slot to show the gun in the HUD. Slot 5 is the same slot as the sniper rifle.

Ok we are done with this file. Now open up "shooting.h" in the database folder. This defines the properties with all of the weapons. Scroll down till you find where it says "//Desert Eagle and just above it at in this:

//Super Desert Eagle
#define SUPDEAGLE_SHOOTINGFREQUENCY 5
#define SUPDEAGLE_MAXSHOOTINGFREQUENCY 5.001 
#define SUPDEAGLE_SLOWMOTIONMULTIPLIER 0.25 
#define SUPDEAGLE_BULLETDAMAGE 15 
#define SUPDEAGLE_BULLETSPREAD 25
#define SUPDEAGLE_CLIPSIZE 50
#define SUPDEAGLE_POCKETSIZE 150

This information is the properties for our weapon. You can fiddle around with them, but it is a good idea to finish up everything before you do that.

Ok we are done with this file now. Alright now open up the file "characteranimid.h" this is a really large file, it helps if you are using a text editor which allows you to search. Ok, now either do a search for "CHARANIM_RELOADPAINKILLER" or look for it manually and add this line under it:

#define CHARANIM_RELOADSUPDEAGLE 297

Ok now find the line "#define CHARANIM_SHOOTPAINKILLER 326" and add the line

#define CHARANIM_SHOOTSUPDEAGLE 327

under it.

Ok, now under the line "#define CHARANIM_SHOOTHIGHPAINKILLER 356" add in the line:

#define CHARANIM_SHOOTHIGHSUPDEAGLE 357

Now under the line "#define CHARANIM_SHOOTLOWPAINKILLER 386" add in the line:

#define CHARANIM_SHOOTLOWSUPDEAGLE 387

Now under the line "#define CHARANIM_DISCARDPAINKILLER 416" add in:

#define CHARANIM_DISCARDSUPDEAGLE 417

Now under the line "#define CHARANIM_MODESWITCHPAINKILLER 446" add in:

#define CHARANIM_MODESWITCHSUPDEAGLE 447

ok we are finished with this file, basically this file tells the game the ID #'s for the animation sequences for each weapon.

Alright, now go in to the \data\database\weapons\ folder and open the file you created earlier "supdeagle.txt" this is a copy of the desert eagle file and you need to change a few things.

Scroll down to the middle and Under the [Attributes] part change it so it looks like this(don't delete any parts I left out, they stay the same):

[Attributes]
SlotIndex = SLOTID_SUPDEAGLE;
InventoryID = INVENTORYID_SUPDEAGLE;
WeaponID = WEAPONID_SUPDEAGLE;

Clipsize = SUPDEAGLE_CLIPSIZE;
Pocketsize = SUPDEAGLE_POCKETSIZE;

MaximumShootingFrequency = SUPDEAGLE_MAXSHOOTINGFREQUENCY;
DefaultShootingFrequency = SUPDEAGLE_SHOOTINGFREQUENCY;
ShootingFrequencyMultiplier = SUPDEAGLE_SLOWMOTIONMULTIPLIER;

everything else stays the same.

Ok, now open up the data\console folder and open up the file "console.txt". Add in this line under "[Aliases]":

GetSupDeagle="player->c_pickupweapon(supdeagle);player->c_pickupammo(supdeagle,1000);";

this allows you to type in "GetSupdeagle" in the console and you will receive the gun without having to pick it up (like a cheat code).

Ok, now go in to \data\hud\ and open up the file hud.txt.

Scroll down till you find this part(you can make it easier by searching for "WEAPONID_SNIPER"):

[SlotWeapon]
{
[WeaponSpecific]
ID = WEAPONID_SNIPER;

[SpriteWindow]
ReferencePoint = CENTER;
Position = SLOT6_WEAPONPOSITION;
Width = SLOTWEAPON_WIDTH;
Height = SLOTWEAPON_HEIGHT;
UVUpperLeft = ( U_0xOFFSET , V_4xOFFSET , 0);
UVLowerRight = ( U_1xOFFSET , V_5xOFFSET , 0);
}

directly under this part add in:

[SlotWeapon]
{
[WeaponSpecific]
ID = WEAPONID_SUPDEAGLE;

[SpriteWindow]
ReferencePoint = CENTER;
Position = SLOT6_WEAPONPOSITION;
Width = SLOTWEAPON_WIDTH;
Height = SLOTWEAPON_HEIGHT;
UVUpperLeft = ( U_2xOFFSET , V_1xOFFSET , 0);
UVLowerRight = ( U_3xOFFSET , V_2xOFFSET , 0);
}

now scroll down some more and find this part(you can search for "WEAPONID_DESERTEAGLE" however it is the second reference to that text so hit search twice):

[ActiveWeapon]
{
[WeaponSpecific]
id = WEAPONID_DESERTEAGLE;
LowAmmunition = LOWAMMO_ALWAYS_VISIBLE;
UnlimitedAmmoText = "-";

[Sprite]
ReferencePoint = DOWNRIGHT;
Position = WEAPON_POSITION ;
Width = WEAPON_WIDTH ;
Height = WEAPON_HEIGHT ;
Filename = "bitmaps\weapons\deserteagle.jpg";
AlphaFilename = "bitmaps\weapons\deserteagle_alpha.pcx";
DefaultVertexAlpha = WEAPON_ALPHA ;
}

add in this part directly under it:

[ActiveWeapon]
{
[WeaponSpecific]
id = WEAPONID_SUPDEAGLE;
LowAmmunition = LOWAMMO_ALWAYS_VISIBLE;
UnlimitedAmmoText = "-";

[Sprite]
ReferencePoint = DOWNRIGHT;
Position = WEAPON_POSITION ;
Width = WEAPON_WIDTH ;
Height = WEAPON_HEIGHT ;
Filename = "bitmaps\weapons\deserteagle.jpg";
AlphaFilename = "bitmaps\weapons\deserteagle_alpha.pcx";
DefaultVertexAlpha = WEAPON_ALPHA ;
}

This allows us to see the gun in the HUD, it will appear in slot 6 under the sniper rifle.

ok we are done with this file, and almost done the mod. Just two more files to edit.

Now go in to the \data\database\skeletons\ folder and open up the file pigrat.txt (don't ask me why its called that).

Find the line(search for CHARANIM_RELOADDESERTEAGLE): "[REVERT] From = CHARANIM_RELOADDESERTEAGLE; To=CHARANIM_RELOAD BERETTA;"

and add this line under it:

[Revert] From = CHARANIM_RELOADSUPDEAGLE; To = CHARANIM_RELOADBERETTA;

now scroll down a bit and find the line "[REVERT] From = CHARANIM_SHOOTDESERTEAGLE; To = CHARANIM_SHOOT BERETTA;"

and add this under it:

[Revert] From = CHARANIM_SHOOTSUPDEAGLE; To = CHARANIM_SHOOTBERETTA;

now find the line (its a few lines down) "[REVERT] From=CHARANIM_SHOOTHIGHDESERTEAGLE; To=CHARANIM_SHOOTHIGHBERETTA; and add this line under:

[Revert]From=CHARANIM_SHOOTHIGHSUPDEAGLE;To=CHARANIM_SHOOT HIGHBERETTA;

about 10 lines down find "[Revert]From=CHARANIM_SHOOTLOWDESERTEAGLE; To=CHARANIM_SHOOTLOWBERETTA;

and add this under it:

[Revert]From=CHARANIM_SHOOTLOWSUPDEAGLE; To = CHARANIM_SHOOTLOWBERETTA;

now find the line "[Revert]From=CHARANIM_DISCARDDESERTEAGLE;To=CHARANIM_DISCARDBERETTA;" and add this line under it:

[Revert]From = CHARANIM_DISCARDSUPDEAGLE; To = CHARANIM_DISCARDBERETTA;

now find the line "[Revert]From=CHARANIM_MODESWITCHDESERTEAGLE;To= CHARANIM_MODESWITCHBERETTA;

and add this under it:

[Revert]From=CHARANIM_MODESWITCHSUPDEAGLE;To=CHARANIM_MODE SWITCHBERETTA;

we are done with this file, it is used for the animations of the weapon. Only one more to go....

Go to the data\database\skeletons\ and open the file default_skeleton.txt.

Ok, search for "CHARANIM_RELOADDESERTEAGLE" you should see this:

[Animation] Index = CHARANIM_RELOADDESERTEAGLE; Filename = anim\reloaddeserteagle.kf2;[Properties]
{
[Movement] EndPosition = (0,0,0); Rotation = (0,0,0);
[Message] Frame = 35; String = "RightHandWeapon->WS_Animate(" WEAPONANIM_RELOAD ");";
[Message] Frame = 39; String = "this->C_Reload();";
}

copy this text and paste it directly under the original, then change the line "[Animation] Index =

CHARANIM_RELOADDESERTEAGLE;" to:

[Animation] Index = CHARANIM_RELOADSUPDEAGLE;

it should look like this:

[Animation] Index = CHARANIM_RELOADDESERTEAGLE; Filename = anim\reloaddeserteagle.kf2;
[Properties]
{
[Movement] EndPosition = (0,0,0); Rotation = (0,0,0);
[Message] Frame = 35; String = "RightHandWeapon->WS_Animate(" WEAPONANIM_RELOAD ");";
[Message] Frame = 39; String = "this->C_Reload();";
}

[Animation] Index = CHARANIM_RELOADSUPDEAGLE; Filename = anim\reloaddeserteagle.kf2;
[Properties]
{
[Movement] EndPosition = (0,0,0); Rotation = (0,0,0);
[Message] Frame = 35; String = "RightHandWeapon->WS_Animate(" WEAPONANIM_RELOAD ");";
[Message] Frame = 39; String = "this->C_Reload();";
}

now search for "CHARANIM_SHOOTDESERTEAGLE" and do the exact same thing that you did above. Do the same thing for all of these:

CHARANIM_SHOOTLOWDESERTEAGLE

CHARANIM_SHOOTHIGHDESERTEAGLE

now search for CHARANIM_DISCARDDESERTEAGLE and add this line under:

[Revert]From = CHARANIM_DISCARDSUPDEAGLE; To = CHARANIM_DISCARDBERETTA;

do the same thing for CHARANIM_MODESWITCHDESERTEAGLE and add this line under it:

[Revert]From =CHARANIM_MODESWITCHSUPDEAGLE;To= CHARANIM_HOLSTERWEAPON;

Ok, that is it for coding. Now you have to archive this with rasmaker. Go in to dos and open up your rasmaker directory. type

"rasmaker -a data firstmod.mpm".

now in your rasmaker directory there should be a file called firstmod.mpm, take this file and move it in to your max payne directory. Go to your max payne short cut and open up the properties, under target add "-developer" after the path of the game. Run max payne and in the selection box at the bottom of the setup screen select firstmod then press play. Once you are in game hit f12 to open up the console and type in

Getsupdeagle

Then press 6 and select the gun under the sniper rifle, this is the gun you just made. Congratulations, you are done! try messing around with the settings, you can make the gun much more powerfull and fire faster, I will leave that for you to experiment with.

From:

Author: Aaron Shivji aka Shivs

E-Mail: ashivji@home.com

Comments
Phantron
Phantron

Hey, this is a great tutorial! However, I just wanted to change ONE value for the sniper, so it could be used with shootdogding. Sadly, when putting the single file in, it says this:
I.imgur.com

Reply Good karma Bad karma+1 vote
cd5ssmffan
cd5ssmffan

Exception in engineInit: X_SharedDB: Weapons "barrett" and "barrett" had same ID

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Icon
Max Payne
Platforms
Windows
Publisher
Rockstar
Engine
Unknown
Contact
Send Message
Homepage
Remedy-ent.com
Release date
Game watch
Follow
Tutorial
Browse
Tutorials
Report
Report
Share
Related Games
Max Payne
Max Payne First Person Shooter
Related Groups
Remedy Entertainment
Remedy Entertainment Developer & Publisher
Rockstar
Rockstar Developer & Publisher