New Weapon The Quick Way

From Mod Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 20:05, 1 July 2008 (edit)
Soduka (Talk | contribs)
(New page: == New Weapon The Quick Way == After learning how to edit all the weapon variables, it's time to make a new one. Suggested reading before doing this tutorial include reading the '''Tool L...)
← Previous diff
Revision as of 17:25, 3 July 2008 (edit) (undo)
Soduka (Talk | contribs)

Next diff →
Line 66: Line 66:
So you want to test it out. Make sure you set the cost to really cheap so you can afford it, and dive into '''gamedata\config\misc''' and open up trade_trader.ltx. Around Line 490 you will see lots of weapons ending in _m1. You will want to place your weapon there. So, to add it, place the code in below the other lines as such: So you want to test it out. Make sure you set the cost to really cheap so you can afford it, and dive into '''gamedata\config\misc''' and open up trade_trader.ltx. Around Line 490 you will see lots of weapons ending in _m1. You will want to place your weapon there. So, to add it, place the code in below the other lines as such:
- wpn_ak100_m1 = 1, 3+ wpn_ak100_m1 = 1, 1
-The first number says how many he keeps in stock, and I'm still not sure about the second number. It's been used as a decimal and others, try it out and see what it means.+The first number says how many he keeps in stock, the second number refers to the chance that the trader will have it, in percentage. If you place a 1, he will have it 100 Percent of the time. Another example:
 + 
 + wpn_ak100_m1 = 1, 0.3
 + 
 +In this, only 1 Ak100 is carried and it is only carried 30 % of the time.
[[Category:Articles]] [[Category:Articles]]

Revision as of 17:25, 3 July 2008

Contents

New Weapon The Quick Way

After learning how to edit all the weapon variables, it's time to make a new one. Suggested reading before doing this tutorial include reading the Tool List, Editing Weapons, and Your first modification. Please take the time to make sure you understand file structure and modding basics before attempting this because this tutorial will skip over the basics. We will also assume you have a gamedata folder worked out and have extracted everything you need.


Tool Required

Notepad++



Making a new weapon requires a few steps. First of all, browse to gamedata\config\misc and open up unique_items.ltx. Go down to line 377 or round abouts and you should see where a section ends and the Arena weapons begin. BEFORE the Arena line starts is where you will add the first stage of your new weapon. We add _m1 to the end of the wpn_ak100 to denote the version. This is the first attempt at the gun so it is _m1. If we were to release the gun and then patch it later, we could name it wpn_ak100_m2.

[wpn_ak100_m1]:wpn_ak100
$spawn                          = ""weapons\ak-74""
description                     = enc_weapons1_wpn-ak100_m1
inv_name                        = wpn_ak100_m1
inv_name_short                  = wpn_ak100_m1
cost                            = 2000
fire_modes                      = 1, -1
ammo_limit                      = 210
ammo_current                    = 500
ammo_mag_size                   = 35
ammo_class                      = ammo_5.45x39_fmj, ammo_5.45x39_ap
sprint_allowed                  = true
misfire_probability             = 0.003
condition_shot_dec              = 0.0001
hit_power                       = 0.35, 0.39, 0.42, 0.45
hit_impulse                     = 140
fire_distance                   = 1000
bullet_speed                    = 900
rpm                             = 600
scope_zoom_factor               = 50

Now you may be wondering why this contains so much more information than the guns above it. Those guns, instead of putting all the info there, use a ; and then the original weapon name to just get the info not changed and override those settings with what's put there. Basically, the only information placed there is the stuff that's different than the original information. For example:

[wpn_sig_m2]:wpn_sig550	;SiG ñíàéïåðñêèé

It's referring to the original SIG in Russian, and then changing the values it wants to change below. Anyway, back to the code I placed above. Place it in and space it correctly away from the other guns like the rest of the code. Here I have created the weapon AK 100. Since we don't have a custom model and such the game will spawn the AK-74 model. Obviously if I were really trying to make this gun I would pick a more closely resembling weapon, but this is just for show. The description line points to where we're going to place the text you read in game about the weapon. The inv_name and inv_name_short can be anything really, just make them something that can easily be recognized. The rest I do not need to explain because it is already explained in the Editing Weapons tutorial.


Localizing the Information

Now we need to create an area in the text section to give back correct information about our gun. Conceivably we can throw this into any .xml file in gamedata\config\text\eng, but we like to be nice and organized, so we're going to place it in string_table_enc_weapons.xml. Open it up and we have to put this at the end:

   <string id="enc_weapons1_wpn-ak100_m1">
       <text>The AK 100 is a super cool design by Soduka Industries. It is remarkably similar to the AK 74 for some reason, but we love it anyway.</text>
   </string>
   <string id="wpn_ak100_m1">
       <text>AK 100</text>
   </string>

It's important to understand how this works as many games use this exact system, sometimes they call it Localization files. Instead of putting the text directly into the weapons, the developers place a code the weapons refer to, which then refers to the string id which has the actual info. This allows the developers to quickly locate all the info and change it if necessary, and also allows quick translation into other languages. In this case, the string id for the explanation of the weapon is the description code:

description                     = enc_weapons1_wpn-ak100_m1

The text is where you place the description, hence the definition in the weapons section. The second string id is the wpn_ak100_m1, or the inv_name. This is short for inventory name, or the name of the weapon when you click on it. Mine is AK 100. That's just about it for making the basic new weapon. However, for all the bells and whistles you will need to do it another way, by creating its own entity file in gamedata\config\weapons. It's OK for now though.


Adding it to the First Trader

So you want to test it out. Make sure you set the cost to really cheap so you can afford it, and dive into gamedata\config\misc and open up trade_trader.ltx. Around Line 490 you will see lots of weapons ending in _m1. You will want to place your weapon there. So, to add it, place the code in below the other lines as such:

wpn_ak100_m1 = 1, 1

The first number says how many he keeps in stock, the second number refers to the chance that the trader will have it, in percentage. If you place a 1, he will have it 100 Percent of the time. Another example:

wpn_ak100_m1 = 1, 0.3

In this, only 1 Ak100 is carried and it is only carried 30 % of the time.

Personal tools