• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Custom Ammo

high all, I'm trying to add in some custom ammo like exploding 9mm. and trying to change the hunting rifle's magazine size to 3

I have the ammo in but cant get it to load in the gun this is what im using. does these need to go at the top of the xml?

Code:
<set xpath="/items/item[@name='gunHuntingRifle']/property[@class='Action1']/passive_effect[@name='MagazineSize'][@value='1']/@value">3</set>
Code:
<set xpath="/items/item/property[@class='Action0']/property[@name='Magazine_items'][@value='ammo9mmBullet,ammo9mmBulletSteel']/@value">ammo9mmBullet,ammo9mmBulletSteel,ammo9mmBulletExp</set>
got the ammo to load but when I spawned in a zombie I couldn't move, I died and I could move again but my fire Butten was reload and no ammo was being loaded. here is my ammo code.

and the ammo

Code:
<item name="ammo9mmBulletExp">
<property name="DisplayType" value="ammoBullet"/>
<property name="HoldType" value="45"/>
<property name="Meshfile" value="Items/Misc/sackPrefab"/>
<property name="DropMeshfile" value="Items/Misc/sack_droppedPrefab"/>
<property name="Material" value="Mbrass"/>
<property name="Stacknumber" value="500"/> <!-- STK ammo -->
<property name="CraftingSkillGroup" value="craftSkillGuns"/>
<property name="EconomicValue" value="14"/>
<property name="Group" value="Ammo/Weapons"/>
<property class="Action1">
	<property name="Class" value="Projectile"/>
	<property name="Gravity" value="-7"/>
	<property name="Explosion.ParticleIndex" value="4"/> <!-- which Prefab/particle is used -->
	<property name="Explosion.RadiusBlocks" value="2"/> <!-- damage radius for blocks -->
	<property name="Explosion.BlockDamage" value="75"/> <!-- damage for blocks in the center of the explosion -->
	<property name="Explosion.RadiusEntities" value="2"/> <!-- damage radius for entities -->
	<property name="Explosion.EntityDamage" value="50"/> <!-- damage for entities in the center of the explosion. Zombies take 2x this damage. -->
       <property name="Explosion.DamageBonus.stone" value="15"/>
	<property name="Explosion.DamageBonus.metal" value="7"/>
	<property name="Explosion.DamageBonus.earth" value="25"/> <!-- should work? -->
	<property name="Explosion.DamageBonus.wood" value="35"/>
	<property name="Explosion.DamageBonus.water" value="0"/>
</property>
<property name="CraftingSkillGroup" value="craftSkillScience"/>
<property name="Group" value="Ammo/Weapons"/>
<effect_group name="Base Effects" tiered="false">
	<passive_effect name="EntityDamage" operation="base_set" value="25"/>
	<passive_effect name="BlockDamage" operation="base_set" value="7"/>
	<passive_effect name="ProjectileVelocity" operation="base_set" value="60"/>
	<display_value name="ExRadius" value="5" />
</effect_group>
</item>
thanks for any help.

 
Untested but you might try

Code:
<set xpath="/items/item[@name='gunHuntingRifle']/effect_group/passive_effect[@name='MagazineSize']/@value">3</set>
Code:
<set xpath="/items/item/property[@class='Action0']/property[@name='Magazine_items' and @value='ammo9mmBullet,ammo9mmBulletSteel']/@value">ammo9mmBullet,ammo9mmBulletSteel,ammo9mmBulletExp</set>
 
Are you trying to remove the current ammo or add to it lol. you havent detailed which weapon also you want to modify. and have unfinished and unstarted comments.

Try

<set xpath="/items/item[@name=gunPistol]/property[@name=Magazine_items='ammo9mmBullet,ammo9mmBulletSteel,ammo9mmBulletExp']</append>

 
Last edited by a moderator:
sry, trying to add exploding ammo in, and any gun that uses ammo9mmBullet, I'm going to do this to all the ammo. would I have to do that for each gun or each ammo?

for the ammo test I used a pistol, I got the ammo load fired 3 to 5 stots that didn't explode and then my fire Butten was reload but it didn't reload, I died and fire butten was back.

 
Last edited by a moderator:
sry, trying to add exploding ammo in, and any gun that uses ammo9mmBullet, I'm going to do this to all the ammo. would I have to do that for each gun or each ammo?for the ammo test I used a pistol, I got the ammo load fired 3 to 5 stots that didn't explode and then my fire Butten was reload but it didn't reload, I died and fire butten was back.
I am new to xpath lol but have learnt a bit in the last weeks.

Have you xpathed the ammo into items.xml as well or placed or

I am also unsure as to how to get every gun that uses 9mm to use that but I will link to your thread to people that will and maybe they can help better

 
If you look at the XPATH tutorial thread one of the main examples explains how to add an ammo type to guns that use something similar.

Take a look at them and you should be able to easily modify that and add it to the other guns.

 
I’ve got the ammo to load it’s the other things, I can’t move and fire is reload but it doesn’t reload, I die and all good but the bullet doesn’t explode.

 
Back
Top