Home » MODDING HQ 1.13 » v1.13 Modding, Customising, Editing » v1.13 XML Customization » Bizarre Caliber/Attachment Issue (Odd modding issue with newly made weapon)
Bizarre Caliber/Attachment Issue[message #353200] Wed, 18 April 2018 07:55 Go to next message
Registered:April 2018
Location: United States
So I've been working on a pretty substantial update to the 1.13 weapon lineup and have had no significant problems thus far. That is, of course, until my most recent addition. Specifically, I am trying to add the CBJ-MS (one variant in 9x19 and another in 6.5x25 CBJ). The 9x19 works without any issues seeing as it uses standard 30-round smg magazines and a 100-round drum with a magazine extension attachment. However, the 6.5 version behaves strangely when selected using cheats (my only real way of spawning the item in-game that I know of). It does not spawn with a magazine inside it, nor does it come with its retractable stock attachment by default. Strangely, if I change the caliber entry in weapons.xml to some older caliber (including others I've already created myself), everything works fine.

Here are some other considerations to keep in mind:
- I did create proper entries for all the different 6.5x25mm magazines (including magazines.xml, items.xml, and ammostrings.xml)
- If I manually set aside the malfunctioning weapon in a merc's inventory and then feed it magazines by hand, it works without issue (fires, makes sound, does proper damage, has proper recoil, expresses correct ammunition properties like AET, AP, etc)
- The weapon itself accepts all of its attachments properly when applied manually through the in-game inventory
- I have already implemented weapons into the game which utilize new calibers and not encountered this issue before (a PTRS with 14.5mm ammunition, as well as .500 S&W magnum)
- I can even change the CBJ-MS to use said new calibers and it works as it supposed to

I'll reiterate what the problem is just so that I am clear. [1] The weapon spawns on the character with no magazine already inside (0/30 ammunition displayed). [2] The retractable stock defaultAttachment does not come attached by default despite the entry being correct in items.xml AND attachments.xml.


Now I will go into what sorts of methods I've tried to address the problem:
- I've gone back to an entirely new set of XML files and it made no difference (Wat? Really? Why? Why does .500 S&W work but not this? It has to be something obvious I just can't see)
- I've tried using completely different values for the magazines.xml file (such as magType=0-3, different ammoTypes)
- I've tried changing the weapon to something else entirely (name, type, sound, rate of fire, different defaultAttachments or none at all)

I'm at a loss at this point, which is why I am here. I suspect that if I don't fix this problem, other issues will come up when enemies use the weapon or if I buy it from Bobby Ray's (especially the retractable stock not spawning properly). I can't just rely on existing calibers for my mod to be of any real value anymore, so this mystery needs to be solved. I'll post all the relevant code below and see if any of you talented gentlemen can spot the bug. Thanks in advance.

- DrB

Toggle Spoiler

Toggle Spoiler

Toggle Spoiler

Toggle Spoiler

Toggle Spoiler

[Updated on: Wed, 18 April 2018 09:46]

Re: Bizarre Caliber/Attachment Issue[message #353212 is a reply to message #353200] Wed, 18 April 2018 18:15 Go to previous messageGo to next message

Registered:August 2004
Location: So. Cal. or texas
From my experience Troubleshooting, I would try your ammo type on another weapon and see if it works normally or causes issues. with luck that will narrow your focus on where the problem is or if its just one problem or more than one.
Re: Bizarre Caliber/Attachment Issue[message #353223 is a reply to message #353212] Thu, 19 April 2018 05:44 Go to previous message
Registered:April 2018
Location: United States
Figured it out!

I tried isolating each XML file one by one until the problem occurred, narrowing it down to the oh-so-famous Magazines.xml. There, I eventually noticed that there was a 30 digit discrepancy between some uiIndex numbers. Despite all my references being correct in items.xml and elsewhere, strange problems occurred nonetheless. Now, every weapon spawns with a magazine and its correct attachments. I don't know why those things are related (seeing as they're managed by two completely different files), but no matter.

Sort of frustrated with myself for allowing something so small be at the root cause of so much frustration. Oh well. It's all cleared up now and I can move forward on my project. Thanks for the recommendation as it ultimately led to me doing what I mentioned above.

I'll put a post up in the general modding section once I'm further along.
Previous Topic: Changing throwing distances - possible?
Next Topic: Trying to create a new gun, but xml editor is giving me an error.
Goto Forum:

Current Time: Sun May 26 00:31:01 EEST 2019

Total time taken to generate the page: 0.01122 seconds