Jump to content
Enhet93

Problem with silencer on custom guns

Recommended Posts

Hey!

 

A few days ago i started making some custom made weapons with Blender and the Unity Editor for me and some friends, but before we can use them i still have to figure out why the silencers seem to have a random position on every gun. ("Barrel" entity in Unity is right in front of the Barrel exactly like the "Muzzle" one and that looks just fine ingame.)

I tried to fix it with this line in my XML's but either i don't get the real meaning of this command (English is not my Motherlanguage) or it just doesn't work for whatever reason.

 

<property name="BarrelOffset" value="0,0,0"/>

Instead of "0,0,0" i already tried some random numbers to figure out if it even moves.

Maybe i should mention there are NO Errors popping up inside the console while loading a map or savegame.

 

Share this post


Link to post
Share on other sites

Did you add your weapon to the silencer's item_modifiers node? For example I have added it to 2 of my guns, and in my mod's item_modifiers.xml I have:

 

<append xpath="/item_modifiers/item_modifier[@name='modGunSoundSuppressorSilencer']">
		
		<item_property_overrides name="gunHeavySniper">
			<property name="Sound_start" value="hunting_rifle_s_fire"/>
			<property name="BarrelOffset" value="-0.012,-0.015,0.62"/>
			<property name="BarrelScale" value="2,10,2"/>
		</item_property_overrides>
		
		<item_property_overrides name="gunMaria">
			<property name="Sound_start" value="pistol_s_fire"/>
			<property name="BarrelOffset" value="0,0,-0.05"/>
			<property name="BarrelScale" value="2,2,2"/>
		</item_property_overrides>
		
	</append>

That should be where you move it so it fits your gun. Also in Unity, make sure your Attachments child is on the main parent of the weapon. Without doing this I noticed the xml didn't seem to apply for some reason.

  • Thanks 1

Share this post


Link to post
Share on other sites
Posted (edited)

Hi! Thanks for your reply.

 

I checked some things and it seems that everything is okay.

 

My item_modifiers looks like this:

	<append xpath="/item_modifiers/item_modifier[@name='modGunSoundSuppressorSilencer']">

		<item_property_overrides name="gunKG">
			<property name="Sound_start" value="ak47_s_fire"/>
			<property name="Sound_end" value="silencefiller"/>
			<property name="Sound_loop" value="ak47_s_fire"/>
			<property name="BarrelOffset" value="-1,-0.5,-0.5"/>
			<property name="BarrelScale" value="1,1,1"/>
		</item_property_overrides>
	</append>

My Gun Prefab in Unity looks like this:

gunKG
	gunKG_mesh
		Attachments
			Barrel
			Side
			Scope
		Handle
			Muzzle
			Scope

 

 

Edit:

I fixed it now, because i took a second look on that Prefab layout and reworked it. 

Now it looks like this and every position can be changed now!

gunKG
	Attachments
		Barrel
		Side
		Scope
	Handle
		Clip
		Scope 1
		Muzzle
	gunKG_Mesh

 

Thanks alot @bdubyah

Edited by Enhet93
Found the fix (see edit history)

Share this post


Link to post
Share on other sites

Yeah, that caused a lot of headache before I finally figured it out. Lol.

 

Glad it works now! :)

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

×
×
  • Create New...