Jump to content

Mod Guide - Adding A New Weapon


Fnurg

Recommended Posts

Guide 2 : Adding a Weapon

 

This guide will hopefully give you some background information on how to add a simple weapon to UFO. We'll start off with deciding what exactly our weapon will do and then move on to adding the weapon and magazine entry.

 

First thing you're going to want to do is think of what kinda weapon you want to add and what charactaristics it will have. I've decided on an ultra low-tech weapon. The sawn off shotgun :(

 

The weapon will behave in the following manner :

  • It'll be very low tech and available at the start of the game
  • The weapons range will be less than that of the pump action gun
  • Because the gun is smaller, we can make aimed and burst shots quicker
  • The weapon will be lighter than the pump action
  • You'll need to use 2 hands to wield it.
  • The weapon will only have a capacity of 2 rounds
  • It'll be ultra devestating at close range
  • It'll have a burst mode, which is really firing 2 barrels at once
  • Reload time will be longer than that of the pump action weapon
  • The damage will be based on "Soft" lead pellets
  • It'll have its own icon

For the weapon icon, you can download this file. We'll learn how to create our own icons in a later guide.

 

Now we know how our weapon is going to behave, we need to add the details into the game. I assume you have already unpacked the gamedata.vfs, so open up the file tactical/configs/game/listofweapon.txt

 

Given that the weapon is a relative of the pump action shotgun, I'm going to use that entry as a template for our new weapon. Do a search for "pump" in the listofweapon.txt and you'll come across the entry below

 

  WEAPON
   ORIGIN HUMAN
   TYPE SHOTGUN
   SHORT_NAME "Pump"
   ID S-PUMP
   TECH_LEVEL 1
   CLASS RIFLE
   ANIM_TYPE SHOTGUN
   PRINCIPLE FIREARM
   HANDLING NORMAL
   EQUIPMENT ALL
   MAG_QUANTITY 10
   HAND 2.0
   NOTRELOAD FALSE
   WEIGHT 4.4
   ACCURACY_AIMEDA 0.0 
   ACCURACY_BURSTA 0.0
   ROUNDS_USED_AIMEDU 0
   ROUNDS_USED_BURSTU 0
   POWER 0
   DAMAGE 0
   TIMES_RELOAD 0.0
   TIMES_AIMEDT 0.0
   TIMES_BURSTT 0.0
   RANGE 0.0
   AREA 0.0
   PROJ_SPEED 0.0
   DURATION 0.0
   SEC_DAMAGE 0.0
   DTYPE ""
   EFFECT_FRONT_AIM "tactical/particles/gun groups/human/shotgun_group.pgrp"
   EFFECT_FRONT_BURST "tactical/particles/gun groups/human/shotgun_group.pgrp"
   EFFECT_BACK ""
   EFFECT_IMPACT ""
   EFFECT_AREA ""
   PATH_3D "tactical/models/weapons/h_s-pump_3d.txt"
   VIDEO "strategic/models/interface/equipment/weapons/human guns/h_s-pump_3d.txt"
   ICON "tactical/models/interface/items/weapons/h_s-pump.txt"
   PROJECTILE ""
   PROJECTILEFIRE ""
   PROJECTILESMOKE ""
   PARTICLE ""
   SHAPE "s52"
   SOUND_NAME_A "share/sound/wavs/guns/pump-a.wav"
   SOUND_NAME_B "share/sound/wavs/guns/pump-a2.wav"
   SOUND_NAME_RELOAD ""
   SOUND_NAME_IMPACT ""
 END_OF_WEAPON

 

This is the entry for the pump action shotgun and it's what we're going to use for our template. Now would be a good time to have a look at this thread. It explains all the different fields for a weapon entry. When you feel comfortable, come back to this guide and we'll start editing the stats.

 

 

OK. So I'm going to assume that you know a bit about the various fields in the above entry. Lets get to it then.

 

First off, we need a new UNIQUE identification for our gun. This is used and referenced internally by the game.

 

Change ID S-PUMP
to     ID S-SAWNOFF

 

In our list of changes, we want our weapon to be lighter than that of the pump action, so lets change the weight.

 

Change WEIGHT 4.4
to     WEIGHT 2.8

 

Theres only one last thing we need to change for this entry. Thats the icon. You did download the weapon icon right?

 

Change ICON "tactical/models/interface/items/weapons/h_s-pump.txt"

to ICON "tactical/models/interface/items/weapons/h_s-sawnoffss.txt"

 

And thats all we need to change for the listofweapon.txt entry. Copy and paste your changes into the end of the listofweapon.txt file (in between the lines END_OF_WEAPON and END_OF_LIST_OF_WEAPON).

 

 

Next comes the magazine entry. This will hold all the information relating to our sawnoff shotgun power, reload times and range. So open up tactical/configs/game/listofmagazine.txt and do a search for "pump" again. This should be what you find.

 

  MAGAZINE
   ORIGIN HUMAN
   ID MGS-PUMP            //id of our magazine
   WEAPON S-PUMP          //which weapon it is attached to
   TECH_LEVEL 1
   WEIGHT 0.38            //weight of each magazine
   EJECT 1                
   AMMOID ID_SHOT
   ACCURACY_AIMEDA 5.0    //how accurate the gun is in aimed mode
   ACCURACY_BURSTA 0.0    //how accurate the gun is in burst mode
   ROUNDS_USED_AIMEDU 1   //how many rounds are used up per aimed shot
   ROUNDS_USED_BURSTU 0   //how many rounds are used up per burst shot
   DAMAGE 40              //how much damage our weapon does per shot
   CAPACITY 6             //the capacity of each magazine
   TIMES_RELOAD 4.5       //how long it takes to reload
   TIMES_AIMEDT 2.2       //how long it takes to make an aimed shot
   TIMES_BURSTT 0.0
   RANGE 11.0             //range of our weapon
   AREA 0.0
   PROJ_SPEED 0.0
   DURATION 0.0
   SEC_DAMAGE 0.0
   DTYPE "S"              //the type of damage our weapon does
   PATH_3D "tactical/models/weapons/h_mgs-pump_3d.txt"
   ICON "tactical/models/interface/items/magazines/h_mgs-pump.txt"
   PROJECTILE ""
   PROJECTILEFIRE ""
   PROJECTILESMOKE ""
   SHAPE "s11"           //the size of our magazine in the inventory
   EFFECT_FRONT_AIM "tactical/particles/gun groups/human/shotgun_group.pgrp"
   EFFECT_FRONT_BURST "tactical/particles/gun groups/human/shotgun_group.pgrp"
   EFFECT_BACK ""
   EFFECT_IMPACT "tactical/particles/hit_effect groups/human_shotgun_hit.pgrp"
   EFFECT_AREA ""
   SOUND_NAME_IMPACT ""
 END_OF_MAGAZINE

 

Just in case you've forgotten what you read in this thread, i've commented a few important lines. These lines are the ones we are going to change. Lets start off with our magazine ID.

 

Change ID MGS-PUMP
to     ID MGS-SAWNOFF

 

We want our magazine to be used by our new weapon so

 

Change WEAPON S-PUMP
to     WEAPON S-SAWNOFF

 

Our magazines will only have 2 rounds each (yup, some of you have already spotted the problem with this no doubt :( ). The template we used (the pump action shotgun magazine) has 6 shells in each magazine. Little bit of a weight inconsistancy here, so lets divide our weight by 3 to get our new, lighter magazine weight.

 

Change WEIGHT 0.38
to     WEIGHT 0.13

 

Now to set up our accuracys.

 

Change ACCURACY_AIMEDA 5.0
to     ACCURACY_AIMEDA 3.0

 

Change ACCURACY_BURSTA 0.0
to     ACCURACY_BURSTA 2.0

 

Change ROUNDS_USED_BURSTU 0
to     ROUNDS_USED_BURSTU 2

 

We also wanted our gun to be a bit more powerful as well so

 

Change DAMAGE 40
to     DAMAGE 60

 

 

Now your probably going to expect to see the shotgun do 60 damage a pop ingame right? Wrong. It'll actually be closer to 900. And heres why.

Open up the tactical/configs/game/listofammo.txt file and do a search for "shot". You should see this entry :

 

  AMMO
   ID ID_SHOT
   TYPE "FIREARM"
   WEIGHT 0.03
   DAMAGE "S"
   ORIGIN "HUMAN"
   PELLETS 15
 END_OF_AMMO

 

This is the type of ammo that our sawnoff shotgun uses. Notice that it has 15 pellets in each shot? The pellets field acts as a multiplier for our damage. If pellets was set to 1, our shotgun would only do 60 damage. Instead we do 60 x 15 damage = 900.

Thanks to Llama8 for bringing this to my attention

 

 

Ok, with that out of the way. Lets get back to the magazine.

We also need to set the max capacity of the gun (2 barrels = 2 shot capacity)

 

Change CAPACITY 6
to     CAPACITY 2

 

Now for our times

 

Change TIMES_RELOAD 4.5
to     TIMES_RELOAD 5

 

Change TIMES_AIMEDT 1.5
to TIMES_AIMEDT 1.0

 

Change TIMES_BURSTT 0.0
to     TIMES_BURSTT 1.1

 

And now our last alteration, the range of our weapon

 

Change RANGE 11.0
to     RANGE 7.0

 

Yup, naff range but good damage :(

 

And thats it! Add your new entry into the listofmagazine.txt at the bottom of the file (in beween END_OF_MAGAZINE and END_OF_LIST_OF_MAGAZINE).

Now pack you mod and play (if you don't know how to, this thread describes how to pack and distribute your modification).

If you can't be bothered to pack your mod and you just want to see the changes in action, download this Alpine plugin.

 

 

Coming up in the future modding guides -

We'll learn how to add ingame text for our newly created weapon.

We'll add our weapon into the R&D tree

We'll learn how to make multiple magazines for our shotgun

We'll learn how to make our own graphics and how to put the ingame.

 

 

----

Its just a quick draft of a guide. I havent put the links in to the various files and references. Any feedback would be greatly appretiated :(

Link to comment
Share on other sites

Nice guide!

 

Anybody else has this kind of information? It beats having to find all this out myself by a long shot!

 

I'm writing up my prelimanary findings on the Phase system now. Will post it in this forum soon. It will not be a nice and complete guide like this :( , but anyone who wants to mod around in the story line or remove those ghastly difficulty jumps should find it interesting. :(

Link to comment
Share on other sites

  • 2 months later...
  • 4 weeks later...
I think i know Fnurgs answer already: Release it! We both even agreed to give some of the RB-Mod files to Strahd for the Stargate-Mod, so i see no reason why he should be against the "publishing" of this tutorial. I would say: release them and blame it on me when he somehow should be against it :( But i really think he's kind enough or even has an interest to give that info to the public.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...