Jump to content
Mikhail Ragulin

Tutorial - how to add a new weapon.

Recommended Posts

Are you now talking about replacing the files in the game directory or putting them into a mod .zip file because the latter doesn't work 100% of the time it seems.

I literally just made a zip file in the mod directory with the modinfo.xml and the items.xml with the ak47 set to "unlimited" and it absolutely, positively, doesn't work.

I think the problem is trying to do two things at once - adding a weapon, and using the mod system (I don't know if this even works yet, or if one has to download something extra to use it).

So, using completely clean files, do this:

Make these changes from "clean":

1) Edit Items.XML to change the AK47 from Normal to Unlimited

And go from there.

Share this post


Link to post
Share on other sites

I have stickied this thread as I believe it is very useful to all modders, and if Mikhail would permit, I believe it should grow into a set of larger tutorials.

Share this post


Link to post
Share on other sites
I think the problem is trying to do two things at once - adding a weapon, and using the mod system (I don't know if this even works yet, or if one has to download something extra to use it).

So, using completely clean files, do this:

And go from there.

Well atleast that worked.

Share this post


Link to post
Share on other sites
Well atleast that worked.

Progress. Now it's working, try adding bits one part at a time. After each bit, load the game up to make sure there are no conflicts/errors.

Share this post


Link to post
Share on other sites

Well I got the weapon description, stats and increased burst fire working, but the sounds don't work.

Sounds.xml

 <Sound name="Weapon AK Single" volume="1.0" group="1" comment="">     <Wave>audio/sfx/weapons/Weapon_AK_Single.ogg</Wave>   </Sound>   <Sound name="Weapon AK Burst" volume="1.0" group="1" comment="">     <Wave>audio/sfx/weapons/Weapon_AK_Burst.ogg</Wave>   </Sound></Sounds>

and the two files in the audio/sfx/weapons/ are named "Weapon_AK_Single.ogg" and "Weapon_AK_Burst.ogg"

is there a specific bitrate and frequency the audio files have to be rendered on?

Share this post


Link to post
Share on other sites

When I make new sounds, I use the vanilla frequencies/bit-rate (I don't know if they have to be these ones, but using vanilla ones is a good place to start), which are: 44100hz, 16 bit PCM, mono.

Share this post


Link to post
Share on other sites

Alright I got it working. But guess what;

Now majority of sounds don't work. All I have done is add lines of code that don't mess up with others, seriously I have been really careful with that. Yet this happens. How is this possible?

How the hell a handful of lines of code, separated from others with one empty line, can fuck up the functionality of the game so royally?

So for one last time, help me with this shit. What did I do wrong?

stuff added:

sounds_gc.xml

   <Sound name="Weapon AK Single" volume="1.0" group="1" comment="">     <Wave>audio/sfx/weapons/Weapon_AK_Single.ogg</Wave>   </Sound>   <Sound name="Weapon AK Burst" volume="1.0" group="1" comment="">     <Wave>audio/sfx/weapons/Weapon_AK_Burst.ogg</Wave>

strings.xml

  <Row ss:AutoFitHeight="0" ss:Height="135">   <Cell><Data ss:Type="String">weapon.ak47</Data><NamedCell     ss:Name="_FilterDatabase"/></Cell>   <Cell ss:StyleID="s68"><Data ss:Type="String"><font face="fonts/arial.mvec"\><b>Avtomat Kalashnikova 47:</b>"Avtomat Kalashnikova 47" first developed in the Soviet Union by Mikhail Kalashnikov. Due to it's rugged design, AK47 is incredibly reliable and sturdy weapon, capable of going weeks in the field without maintenance. This weapon uses the powerful 7.62x39mm round that has twice the stopping power than the 5.56x45mm NATO round, which is known to have trouble penetrating even a brick. AK47 is incredibly reliable and deadly weapon suited for all situations. It is without a question, the greatest assault rifle in the world. Range:                                                    20Damage:                                                 40 KineticSuppression:                                           25 Single / 80 BurstMitigation:                                                0Ammo Capacity:                                     30 shotsReaction Modifier:                                   1xFire Modes:- 28%% TU                                                 45 Acc x 1 shot- 40%% TU                                                 80 Acc x 1 shot- 55%% TU                                               130 Acc x 1 shot- 60%% TU                                                45 Acc x 10 shots</Data><NamedCell     ss:Name="_FilterDatabase"/></Cell>  </Row>

Share this post


Link to post
Share on other sites

In your first section you don't have </sound> after </wave>, is this an error in posting to the forum or is that missing from the sounds_gc?

If it is missing from the file that may explain why any sounds past that point are not functioning.

Share this post


Link to post
Share on other sites

Yep, that was missing and I have no idea why.

Everything seems to be working at the moment but I'm still waiting for this game to collapse on itself.

Share this post


Link to post
Share on other sites

Yes thanks for all the help, good lord this has been the most frustrating modding project I have ever taken. There were a number of things that went absolutely nuts in the game that I didn't post about here, which took about two-three reinstalls of the game due to the persistence of the problems.

I also just got the 7,62x39mm ammo added to the game and working too.

Truly, this is a great day for Rodina.

Share this post


Link to post
Share on other sites

That missing </Sound> was probably my fault, sorry about that. I'm glad you got it working, I was going to come back and post that I used your sounds in my install and they worked flawlessly (and sound great, as well as accurate!).

Share this post


Link to post
Share on other sites

Thank you OP. I've been trying to introduce some AOE weapons for the high weapon tiers - sorry Gold Hawk but you dropped the ball on your weapons selection.

My original idea was to reuse as much asset as possible of the Alien Plasma Cannon but your guide makes me realise I can do a bit more (plus all the other files I wasn't aware I need to change).

Much appreciated.

Share this post


Link to post
Share on other sites

Adding multiple ammunition types is something of a sore point. The closest that anyone has ever got is to give a rocket-type weapon a clip. That way you can unload and reload different ammo types.

Share this post


Link to post
Share on other sites

i have a short question,

i tried to move the rocketlauncher out of ballistics to rockets. it doesent work, i can move it to lasers etc etc.. but not into the section equipment, where the rockets are.

same with the assault shield.. i can move it within equipment, so grenades etc, but not to the weapon section like balllistics... where is that coded ?

Share this post


Link to post
Share on other sites

This tutorial was very helpful and an excellent place for me to start and learn how things work :D

I think the rest I can learn via deductive reasoning.

Also, just wanted to share something that makes all this work much easier:

Notepad++

Share this post


Link to post
Share on other sites
This tutorial was very helpful and an excellent place for me to start and learn how things work :D

I think the rest I can learn via deductive reasoning.

Also, just wanted to share something that makes all this work much easier:

Notepad++

you can ask all your question at forum or via pms.. nice to see more modder in this game..

Share this post


Link to post
Share on other sites

I wouldn't call myself a modder yet!

More of a first-rate amateur. At everything. When I started gaming, I used to tinker with game files for fun. The ease of accessibility that I find in Xenonauts combined with the wealth of unused game assets is.... enticing.

Like, I really want to implement the X-44 Saracen as an alternate to the Corsair that carries 4x Missiles (not torpedoes).

And I'm trying to mod the AK-47 into the game as a variant assault rifle with slightly lower damage, but a small value of mitigation (which reflects my half-assed wiki research on how the M16/AK-47 compare).

I want to add the DHVRL back in as a researchable weapon for use with the Predator Armor as an alternate to machine guns (since they can't use the rocket launcher :( ).

I want to mod most of the alien stats so that they include appropriate armor values and health values adjusted to match the change (according to the xenonauts wiki only Androns have armor).

I want to add a new map/mission for late game which plays like a terror mission, but where you're called in to help defend an NPC military base using the local forces models (of which there are a reasonable number with which to do this). Sort of a siege mission.

So far the only significant modding I've done was halving the weight of the Singularity cannon. Because that irritated the crap out of me.

But I DO have a question about weapon modding! If people are willing to help me out on this, it would please me :D

I'm looking at the weapons.xml and weapons_gc.xml, which as I understand it need to match.... but... o.O I'm confused. Okay, here's what I see:

In weapons.xml,

the rifle has an accuracy of "1.2".

So does the AK47.

And the sniper rifle has an accuracy of "1.6"

In weapons_gc.xml,

The rifle has an accuracy of 130 if you spend 55AP

The AK47's accuracy is 115 for 55AP

The sniper is 165 for 65AP

Are these connected somehow? They don't appear to match up properly....

And then there's range....

weapons.xml

Rifle & AK47 is 32

Sniper is 40

weapons_gc.xml

Rifle is 20, AK47 is 15

Sniper is 30

I feel like I've seriously misunderstood something here! But I don't know what it is...

And one other thing:

The AK47 currently uses the same ammo as the standard rifle according to these files.

Now, from the tutorial I know how to change it to use the assets for the appropriate AK-47 ammo and how to make that a distinct ammo type.

BUT! If I do that, will it screw over all the local forces equipped with the AK-47? Will they suddenly have the wrong ammunition type for their weapon?

If so, then if I want to use the AK47's proper ammo I should copy paste and create an entirely new AK-47 for my troops. But if I do that the inconsistency will bug me a little bit that my AK-47 uses different ammo than the AK-47's I'd find in the field...

Edited by DarkExcalibur42

Share this post


Link to post
Share on other sites

I can say that don't care weapon.xml so much.. weight and ammo are the only ones which should match. That acc modifier means nothing too. Weapon GC xml is your main goal.

You can change npc equipment too at aiprops.

Check kabill modes and take them as reference. His mods are always most dated and best coded to decode.

Adding a new mission is not possible at least for now. You can create more npc and put them to maps but don't have high hopes about these..

I was not a modder until this game now I stop playing and giving everything for my little mod :)

Share this post


Link to post
Share on other sites

Ground attack missions are bombardment missions rather then ground combat as I know. I read some ideas about maps without ufos. I don't know much about that side of the game.

Yeah msvknight you are totally right. I got some chains u would like at my incoming mod :)

Share this post


Link to post
Share on other sites
Ground attack missions are bombardment missions rather then ground combat as I know. I read some ideas about maps without ufos. I don't know much about that side of the game.

Yeah msvknight you are totally right. I got some chains u would like at my incoming mod :)

all guns need moar chaingun, pistols, shotguns, EVERTHIN!!

Share this post


Link to post
Share on other sites

Folks, as amusing as this has been this is a stickied thread about How to Add a New Weapon. Not the MOAR CHAINS thread. If you want to discuss the importance of multibarrelled weapons firing flaming chainsaws and angry badgers, please do it elsewhere.

Share this post


Link to post
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

×