Barotrauma

Barotrauma

Barotrauma Workshop
You can build your own submarines and monsters with in-game editors and share your creations with other players. Imagine and experiment.
Can someone help me with this mod that I am testing ?
I am just making a test mod to practice in making mods, I just basically just recopy one of the entry for the smg and then make it effect another as I concentrate on the stun aspect of it.

Again as this is test of concept as I am still learning on how to make mods.

I just basically rename the gun, the ammo, the ammo container etc and modified the weapon effects.

The problem that I have is that , as I test it in local the mod load up fine there are no errors reported as I load it up in the mods list enabling it have no issues.

as I tested it out in the submarine editor, the problem arises as it stated that it can't find the 'item' in the place that I specifies in the file list.

I check and double check the file is there all of it, but it keep insisting that it can't find the 'item'.

The gun worked out fine though. Just the error message is annoying the hell out of me.

Content of filelist.xml

<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="ModSmgStun" modversion="1.0.0" corepackage="False" gameversion="1.2.8.0">
<Item file="%ModDir%/Weapons2.xml" />
</contentpackage>

Content of the weapons2.xml.

<Items>
<Item name="smg rounds 2" identifier="smground2" category="Weapon" interactthroughwalls="true" cargocontaineridentifier="metalcrate" tags="smallitem" impactsoundtag="impact_metal_light" hideinmenus="true" scale="0.5">
<InventoryIcon texture="Content/Items/InventoryIconAtlas.png" sourcerect="896,960,64,64" origin="0.5,0.5" />
<Sprite texture="Content/Items/Weapons/weapons_new.png" sourcerect="195,282,17,6" depth="0.55" origin="0.5,0.5" />
<Body width="40" height="14" density="30" />
<Pickable slots="Any" msg="ItemMsgPickUpSelect" />
<Projectile characterusable="false" hitscan="true" removeonhit="true">
<ParticleEmitter particle="tracerfirearm" particleamount="1" velocitymin="0" velocitymax="0" colormultiplier="255,255,115,175" scalemultiplier="1,0.6" />
<Attack structuredamage="0" targetforce="5" itemdamage="4" severlimbsprobability="0.0">
<Affliction identifier="stun" strength="12.5" />
</Attack>
<StatusEffect type="OnImpact" target="UseTarget">
<ParticleEmitter particle="impactfirearm" particleamount="1" velocitymin="0" velocitymax="0" />
</StatusEffect>
<StatusEffect type="OnImpact" target="UseTarget">
<Conditional entitytype="eq Structure" />
<Conditional hastag="eq door" />
<ParticleEmitter particle="spark" copyentityangle="true" anglemin="-10" anglemax="10" particleamount="5" velocitymin="-10" velocitymax="-200" scalemin="0.5" scalemax="1" />
</StatusEffect>
<!-- smg rounds should not exist outside magazines -->
<StatusEffect type="OnNotContained" target="This" stackable="false" delay="1">
<Remove />
</StatusEffect>
</Projectile>
<Upgrade gameversion="0.10.0.0" scale="0.5" />
</Item>
<Item name="smg magazine 2" identifier="smgmagazine2" maxstacksize="99" maxstacksizecharacterinventory="99" scale="0.5" category="Weapon" cargocontaineridentifier="metalcrate" linkable="true" tags="smallitem,smgammo,smgammo2" impactsoundtag="impact_metal_light">
<PreferredContainer primary="smg,smg2,smgunique,machinepistol" amount="1" spawnprobability="1" />
<PreferredContainer primary="armcab" amount="1" spawnprobability="1" notcampaign="true" />
<PreferredContainer secondary="outpostsecarmcab" minamount="1" maxamount="2" spawnprobability="0.5" />
<PreferredContainer secondary="wrecksecarmcab" minamount="1" maxamount="2" spawnprobability="0.2" />
<PreferredContainer secondary="secarmcab" />
<Price baseprice="1" displaynonempty="true" minleveldifficulty="1">
<Price storeidentifier="merchantoutpost" sold="false" multiplier="1.5" />
<Price storeidentifier="merchantcity" multiplier="1.25" minavailable="2" sold="false" />
<Price storeidentifier="merchantresearch" sold="false" multiplier="1.25" />
<Price storeidentifier="merchantmilitary" multiplier="0.9" minavailable="4" />
<Price storeidentifier="merchantmine" sold="false" multiplier="1.25" />
<Price storeidentifier="merchantarmory" multiplier="0.9" minavailable="4" />
</Price>
<Fabricate suitablefabricators="fabricator" requiredtime="1" requiresrecipe="false">
<RequiredSkill identifier="weapons" level="1" />
<RequiredItem identifier="steel" />
</Fabricate>
<Fabricate suitablefabricators="fabricator" requiredtime="1" requiresrecipe="false" displayname="recycleitem">
<RequiredSkill identifier="weapons" level="1" />
<RequiredItem identifier="smgmagazine2" mincondition="0.0" maxcondition="0.1" usecondition="false" />
</Fabricate>
<Deconstruct time="1">
<Item identifier="steel" />
</Deconstruct>
<InventoryIcon texture="InventoryIconAtlas3.png" sourcerect="960,960,64,64" />
<Sprite texture="weapons_new2.png" depth="0.54" sourcerect="146,157,21,44" origin="0.5,0.5" />
<Body width="14" height="40" density="25" />
<ItemContainer hideitems="true" capacity="1" drawinventory="false" canbeselected="false" ShowConditionInContainedStateIndicator="true" SpawnWithId="smground" removecontaineditemsondeconstruct="true" containedstateindicatorstyle="bullet">
<Containable items="smground2" />
<!--Spawn an SMG round on use. Condition -4.8 -> 21 shots per magazine.-->
<StatusEffect type="OnUse" target="This" condition="-4.8" disabledeltatime="true">
<SpawnItem identifiers="smground2" spawnposition="ThisInventory" />
</StatusEffect>
</ItemContainer>
<!--Magazines can be combined to raise condition.-->
<Holdable canBeCombined="true" slots="Any,RightHand,LeftHand" handle1="0,0" msg="ItemMsgPickUpSelect" />
<Upgrade gameversion="0.10.0.0" scale="0.5" />
</Item>
<Item name="smg 2" identifier="smg2" category="Weapon" cargocontaineridentifier="metalcrate" tags="smallautoweapon,smallitem,weapon,gun,gunsmith,mountableweapon" Scale="0.5" impactsoundtag="impact_metal_light">
<PreferredContainer primary="secarmcab" amount="1" spawnprobability="1" notcampaign="true" />
<PreferredContainer secondary="outpostsecarmcab" amount="1" spawnprobability="0.5" />
<PreferredContainer secondary="wrecksecarmcab,abandonedsecarmcab" amount="1" spawnprobability="0.25" />
<PreferredContainer secondary="armcab,weaponholder" />
<Price baseprice="90000" minleveldifficulty="1">
<Price storeidentifier="merchantoutpost" sold="false" multiplier="1.5" />
<Price storeidentifier="merchantcity" multiplier="1.25" minavailable="1" sold="false" />
<Price storeidentifier="merchantresearch" sold="false" multiplier="1.25" />
<Price storeidentifier="merchantmilitary" multiplier="0.9" minavailable="2" />
<Price storeidentifier="merchantmine" sold="false" multiplier="1.25" />
<Price storeidentifier="merchantarmory" multiplier="0.9" minavailable="2" />
</Price>
<Fabricate suitablefabricators="fabricator" requiredtime="1" requiresrecipe="false">
<RequiredSkill identifier="weapons" level="1" />
<RequiredItem identifier="steel" amount="1" />
</Fabricate>
<Deconstruct time="1">
<Item identifier="steel" />
</Deconstruct>
<InventoryIcon texture="InventoryIconAtlas3.png" sourcerect="832,830,64,64" origin="0.5,0.5" />
<Sprite texture="weapons_new2.png" sourcerect="0,121,144,80" depth="0.55" origin="0.5,0.5" />
<Body width="140" height="60" density="25" />
<Holdable slots="Any,RightHand+LeftHand" controlpose="true" holdpos="40,-10" aimpos="45,-10" handle1="-30,-15" handle2="26,5" holdangle="-35" msg="ItemMsgPickUpSelect" />
<RangedWeapon reload="0.1" weapondamagemodifier="1.3" penetration="0.15" holdtrigger="true" barrelpos="64,9" spread="10" unskilledspread="16" combatPriority="80" drawhudwhenequipped="true" crosshairscale="0.2">
<Crosshair texture="Content/Items/Weapons/Crosshairs.png" sourcerect="0,256,256,256" />
<CrosshairPointer texture="Content/Items/Weapons/Crosshairs.png" sourcerect="256,256,256,256" />
<ParticleEmitter particle="muzzleflash" particleamount="1" velocitymin="0" velocitymax="0" />
<Sound file="Content/Items/Weapons/SMGsingleShot1.ogg" type="OnUse" range="3000" selectionmode="Random" />
<Sound file="Content/Items/Weapons/SMGsingleShot2.ogg" type="OnUse" range="3000" />
<Sound file="Content/Items/Weapons/SMGsingleShot3.ogg" type="OnUse" range="3000" />
<Sound file="Content/Items/Weapons/SMGsingleShot4.ogg" type="OnUse" range="3000" />
<Sound file="Content/Items/Weapons/SMGsingleShot5.ogg" type="OnUse" range="3000" />
<Sound file="Content/Items/Weapons/SMGsingleShot6.ogg" type="OnUse" range="3000" />
<StatusEffect type="OnUse">
<ParticleEmitter particle="casingfirearm" particleamount="1" anglemin="90" anglemax="150" velocitymin="50" velocitymax="250" CopyEntityAngle="true" />
<Explosion range="150.0" force="1.5" shockwave="false" smoke="false" flames="false" sparks="false" underwaterbubble="false" camerashake="12.0" />
</StatusEffect>
<!--"Use" contained magazine to spawn projectiles.-->
<StatusEffect type="OnUse" target="Contained">
<Use />
</StatusEffect>
<RequiredItems items="smgammo2" type="Contained" msg="ItemMsgAmmoRequired" />
<RequiredSkill identifier="weapons" level="50" />
</RangedWeapon>
<ItemContainer capacity="1" maxstacksize="1" hideitems="false" containedstateindicatorslot="0" containedstateindicatorstyle="bullet" containedspritedepth="0.56">
<Containable items="smgammo2" hide="false" itempos="4,-10" rotation="-30" />
<SlotIcon slotindex="0" texture="Content/UI/StatusMonitorUI.png" sourcerect="256,448,64,64" origin="0.5,0.5" />
<SlotIcon slotindex="1" texture="Content/UI/StatusMonitorUI.png" sourcerect="320,448,64,64" origin="0.5,0.5" />
<SubContainer capacity="1" maxstacksize="1">
<Containable items="flashlight" hide="false" itempos="22,-1" setactive="true" />
</SubContainer>
</ItemContainer>
<aitarget sightrange="2000" soundrange="4000" fadeouttime="5" />
<Quality>
<QualityStat stattype="FirepowerMultiplier" value="0.1" />
</Quality>
<Upgrade gameversion="0.10.0.0" scale="0.5" />
<SkillRequirementHint identifier="weapons" level="1" />
<Item/>
</Item>
</Items>


the 'sprite' pictures I copy and renamed from the original to the matching names that I modified.

Still it keep reporting unable to find 'item'

Can someone help me out with this problem ?
< >
Showing 1-4 of 4 comments
Azure Nocte 14 2 Mar, 2024 @ 1:32pm 
Delete the third to last line: <Item/>
Originally posted by Azure Nocte:
Delete the third to last line: <Item/>

Yes, you're right that is the problem, XD lol been looking at it for days not able to tell what went wrong glad you tell me , it doesn't report any error after that. thanks a lot.. this means I can make a whole tons of guns, lol
Azure Nocte 14 2 Mar, 2024 @ 6:50pm 
You're welcome! In general, when errors occurs, you can press F3 to see what caused it, in which file and which line.
And if you want to know more, I recommend this document: Barotrauma Modding Guide [regalis11.github.io]
Originally posted by Azure Nocte:
You're welcome! In general, when errors occurs, you can press F3 to see what caused it, in which file and which line.
And if you want to know more, I recommend this document: Barotrauma Modding Guide [regalis11.github.io]

Well actually I know something did went wrong because I press the F3 button, and it kind of show up on it's own (dev console ) but not exactly where in the what that cause the error, anyway thanks for showing me that it is the error in the code line in the xml file.

it only said , x mod, unable to find item error, lol but the gun worked so it drive me nuts, lol
< >
Showing 1-4 of 4 comments
Per page: 1530 50