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

LOOKING FOR HELP - Weapon Modding

vitaminded

New member
I'm trying to add a weapon in the game with unity by making it a unity3d file but when i add it to the sdx folder and do the xml lines

it shows me this in game XD

looks like im holding a piece of leather

but why though ? XD

37890562_10217144892551499_6834091879097696256_n.jpg

does anybody know how to import correctly ?

i am adding the item into the xml and take some lines from sniper rifle and making it a mix between sniper and ak47, im not so good at modding since this is the first time i'm doing something like this




I would appreciate some help :D

AK5C rifle FBX FILE https://www.sendspace.com/file/tcxt14

icon in case u want it ak5cRifle.png

37890562_10217144892551499_6834091879097696256_n.jpg

 
That means your mesh file code is wrong. :)

Difficult to explain, but it should look like this.

Code:
<property name="Meshfile" value="#M4A1?M4A1"/>
The #M4A1 bit in this example is the name of the unity3D file under resources. The ?M4A1 bit of the code is the name of the PARENT object within Unity 3D.

 
Unity_2018-07-26_16-22-56.jpg

7DaysToDie_2018-07-26_16-22-33.jpg

Please ignore the M4A1 stuff in the gun parts code. I used my existing rifle to test this worked. You will also want to change the magazine items to use the same as the AK-47.

Code:
<item id="3998" name="gunAK5C">
<property name="CustomIcon" value="gunAK5C" />
<property name="DescriptionKey" value="gunAK5CDesc"/>
<property name="Meshfile" value="#AK5C?AK5C"/>
<property name="Material" value="metal"/>
<property name="RepairTools" value="repairKit"/>
<property name="HoldType" value="48"/>
<property name="DegradationBreaksAfter" value="false"/>
<property name="SoundJammed" value="weapon_jam"/>
<property name="Attachments" value="flashlight02"/>
<property name="CrosshairOnAim" value="true"/> <!-- aimTest -->
<property name="CrosshairUpAfterShot" value="true"/> <!-- aimTest -->
<property class="Parts">
	<property name="Stock" value="partsM4A1_stock"/>
	<property name="Receiver" value="gunScope"/>
	<property name="Pump" value="partsM4A1_parts"/>
	<property name="Barrel" value="partsM4A1_barrel"/>
</property>
<property name="Sound_Sight_In" value="rifle_sight_in"/>
<property name="Sound_Sight_Out" value="rifle_sight_out"/>
<property class="Action0"> <!-- AttackAction -->
	<property name="Class" value="Ranged"/>
	<property name="Delay" value="0.150"/>
	<property name="Auto_fire" value="true"/>
	<property name="Crosshair_min_distance" value="13"/> <!-- 13 -->
	<property name="Crosshair_max_distance" value="16"/> <!-- 16 -->
	<property name="Magazine_size" value="30"/>
	<property name="Magazine_items" value="9mmBullet, 9mmBulletHP, Unload"/>
	<property name="Magazine_item_ray_counts" value="1, 1"/>
	<property name="Magazine_item_ray_spreads" value="0, 0"/>
	<property name="Reload_time" value="3.9"/>
	<property name="Bullet_icon" value="uzi"/>
	<property name="Sound_start" value="ak47_fire_start"/>
	<property name="Sound_repeat" value="Weapons/Ranged/AK47/ak47_fire_lp"/>
	<property name="Sound_end" value="Weapons/Ranged/AK47/ak47_fire_end"/>
	<property name="Sound_empty" value="weapon_empty"/>
	<property name="Sound_reload" value="ak47_reload"/>
	<property name="Horde_meter_rate" value="2.5"/>
	<property name="Horde_meter_distance" value="20"/>
	<property name="Particles_muzzle_fire" value="nozzleflash_ak"/>
	<property name="Particles_muzzle_smoke" value="nozzlesmokeuzi"/>
	<property name="DamageBonus.head" value="3"/>
	<property name="DamageBonus.wood" value="5"/>
	<property name="DamageBonus.earth" value="0.2"/>
	<property name="DamageBonus.glass" value="1"/>
	<property name="Buff" value="critGunAK47"/>
	<property name="Buff_chance" value="0.1"/>
	<property name="ActionExp" value="1"/>
</property>
<property class="Action1"> <!-- UseAction -->
	<property name="Class" value="Zoom"/>
	<property name="Zoom_overlay" value="Items/Weapons/HUD/sniper_zoom_overlay"/>
	<property name="Zoom_max_out" value="40"/>
	<property name="Zoom_max_in" value="15"/>
</property>
<property name="LightSource" value="lightSource"/> <!-- Start: Needed for the attachment flashlight -->
<property name="ActivateObject" value="Attachments/flashlight/lightSource"/>
<property name="AttachmentFlashlight" value="flashlight02"/> <!-- End: Needed for the attachment flashlight -->
<property name="Group" value="Ammo/Weapons"/>
<property name="ActionSkillGroup" value="Rifles"/>
<property name="CraftingSkillGroup" value="craftSkillGuns"/>
<property name="RepairExpMultiplier" value="10.8"/>
<property name="LightValue" value="0.45"/>
<property name="EconomicValue" value="6400"/>
</item>
And this is the unity3D file for it. I did it super fast so positioning might be slightly off (looks like it needs to go up a little bit to me).

https://drive.google.com/open?id=1IJtkaGpcKA2nkEzkcn4hKNPyKLR-xb14

 
Last edited by a moderator:
hey thanx :D can you tell me how you did it ?

- - - Updated - - -

oooooooooooh so the <property name="Meshfile" value="#AK5C?AK5C"/> line was wrong

 
hey thanx :D can you tell me how you did it ?
- - - Updated - - -

oooooooooooh so the <property name="Meshfile" value="#AK5C?AK5C"/> line was wrong
Yep. That's why I included a screenshot of unity so you could see the object hierarchy :)

 
7onZRMu.png


There you go :)

Do right-click, open image in new tab on that one and you'll get the full size.

 
hey KhaineGB it's still not working, :'( this is what my xml looks like

Code:
<item id="3998" name="gunAK5C">
   <property name="Meshfile" value="#AK5C?AK5C"/>
<property name="Material" value="metal"/>
<property name="CustomIcon" value="ak5crifle" />
<property name="DescriptionKey" value="gunAK5CDesc"/>
<property name="RepairTools" value="repairKit"/>
<property name="HoldType" value="48"/>
<property name="DegradationBreaksAfter" value="false"/>
<property name="SoundJammed" value="weapon_jam"/>
<property name="Attachments" value="flashlight02"/>
<property name="CrosshairOnAim" value="true"/> <!-- aimTest -->
<property name="CrosshairUpAfterShot" value="true"/> <!-- aimTest -->
<property class="Parts">
	<property name="Stock" value="partsAK47_stock"/>
	<property name="Receiver" value="Scope"/>
	<property name="Pump" value="partsAK47_parts"/>
	<property name="Barrel" value="partsAK47_barrel"/>
</property>
<property name="Sound_Sight_In" value="rifle_sight_in"/>
<property name="Sound_Sight_Out" value="rifle_sight_out"/>
<property class="Action0"> <!-- AttackAction -->
	<property name="Class" value="Ranged"/>
	<property name="Delay" value="0.150"/>
	<property name="Auto_fire" value="true"/>
	<property name="Crosshair_min_distance" value="13"/> <!-- 13 -->
	<property name="Crosshair_max_distance" value="16"/> <!-- 16 -->
	<property name="Magazine_size" value="30"/>
	<property name="Magazine_items" value="762mmBullet" />
	<property name="Magazine_item_ray_counts" value="1, 1"/>
	<property name="Magazine_item_ray_spreads" value="0, 0"/>
	<property name="Reload_time" value="3.9"/>
	<property name="Bullet_icon" value="uzi"/>
	<property name="Sound_start" value="ak47_fire_start"/>
	<property name="Sound_repeat" value="Weapons/Ranged/AK47/ak47_fire_lp"/>
	<property name="Sound_end" value="Weapons/Ranged/AK47/ak47_fire_end"/>
	<property name="Sound_empty" value="weapon_empty"/>
	<property name="Sound_reload" value="ak47_reload"/>
	<property name="Horde_meter_rate" value="2.5"/>
	<property name="Horde_meter_distance" value="20"/>
	<property name="Particles_muzzle_fire" value="nozzleflash_ak"/>
	<property name="Particles_muzzle_smoke" value="nozzlesmokeuzi"/>
	<property name="DamageBonus.head" value="3"/>
	<property name="DamageBonus.wood" value="5"/>
	<property name="DamageBonus.earth" value="0.2"/>
	<property name="DamageBonus.glass" value="1"/>
	<property name="Buff" value="critGunAK47"/>
	<property name="Buff_chance" value="0.1"/>
	<property name="ActionExp" value="1"/>
</property>
<property class="Action1"> <!-- UseAction -->
	<property name="Class" value="Zoom"/>
	<property name="Zoom_overlay" value="Items/Weapons/HUD/sniper_zoom_overlay"/>
	<property name="Zoom_max_out" value="40"/>
	<property name="Zoom_max_in" value="15"/>
</property>
<property name="LightSource" value="lightSource"/> <!-- Start: Needed for the attachment flashlight -->
<property name="ActivateObject" value="Attachments/flashlight/lightSource"/>
<property name="AttachmentFlashlight" value="flashlight02"/> <!-- End: Needed for the attachment flashlight -->
<property name="Group" value="Ammo/Weapons"/>
<property name="ActionSkillGroup" value="Rifles"/>
<property name="CraftingSkillGroup" value="craftSkillGuns"/>
<property name="RepairExpMultiplier" value="10.8"/>
<property name="LightValue" value="0.45"/>
<property name="EconomicValue" value="6400"/>
</item>
 
I don't see any reason why it wouldn't. It worked fine for me.

Is the unity3d file in Mods/SDX/Resources?

 
i renamed it from <item id="3998" name="gunAK5C"> to <item id="3998" name="AK5C"> but in the game when i hover my mouse over it it says AK-47 ASSULT RIFLE :/

 
Then I'm super confused. I know that unity3D file I posted + the code works fine because I got a screenshot in-game. O.o

I'll poke around and see if anyone else has any ideas.

 
Its hard to troubleshoot without all the data. If you can package up your files into a mod, we can look it over. Chances are a typo in the xml, given KhaineGB got the model in game.

 
i have this in items xml

Code:
<item id="2506" name="AK5C">
   <property name="Meshfile" value="#AK5C?AK5C"/>
<property name="Material" value="metal"/>
<property name="CustomIcon" value="ak5crifle" />
<property name="DescriptionKey" value="AK5CDesc"/>
<property name="RepairTools" value="repairKit"/>
<property name="HoldType" value="48"/>
<property name="DegradationBreaksAfter" value="false"/>
<property name="SoundJammed" value="weapon_jam"/>
<property name="Attachments" value="flashlight02"/>
<property name="CrosshairOnAim" value="true"/> <!-- aimTest -->
<property name="CrosshairUpAfterShot" value="true"/> <!-- aimTest -->
<property class="Parts">
	<property name="Stock" value="partsAK5C_stock"/>
	<property name="Receiver" value="partsAK5C_receiver"/>
	<property name="Pump" value="partsAK5C_parts"/>
	<property name="Barrel" value="partsAK5C_barrel"/>
</property>
<property name="Sound_Sight_In" value="rifle_sight_in"/>
<property name="Sound_Sight_Out" value="rifle_sight_out"/>
<property class="Action0"> <!-- AttackAction -->
	<property name="Class" value="Ranged"/>
	<property name="Delay" value="0.150"/>
	<property name="Auto_fire" value="true"/>
	<property name="Crosshair_min_distance" value="13"/> <!-- 13 -->
	<property name="Crosshair_max_distance" value="16"/> <!-- 16 -->
	<property name="Magazine_size" value="30"/>
	<property name="Magazine_items" value="762mmBullet" />
	<property name="Magazine_item_ray_counts" value="1, 1"/>
	<property name="Magazine_item_ray_spreads" value="0, 0"/>
	<property name="Reload_time" value="3.9"/>
	<property name="Bullet_icon" value="uzi"/>
	<property name="Sound_start" value="ak47_fire_start"/>
	<property name="Sound_repeat" value="Weapons/Ranged/AK47/ak47_fire_lp"/>
	<property name="Sound_end" value="Weapons/Ranged/AK47/ak47_fire_end"/>
	<property name="Sound_empty" value="weapon_empty"/>
	<property name="Sound_reload" value="ak47_reload"/>
	<property name="Horde_meter_rate" value="2.5"/>
	<property name="Horde_meter_distance" value="20"/>
	<property name="Particles_muzzle_fire" value="nozzleflash_ak"/>
	<property name="Particles_muzzle_smoke" value="nozzlesmokeuzi"/>
	<property name="DamageBonus.head" value="3"/>
	<property name="DamageBonus.wood" value="5"/>
	<property name="DamageBonus.earth" value="0.2"/>
	<property name="DamageBonus.glass" value="1"/>
	<property name="Buff" value="critGunAK47"/>
	<property name="Buff_chance" value="0.1"/>
	<property name="ActionExp" value="1"/>
</property>
<property class="Action1"> <!-- UseAction -->
	<property name="Class" value="Zoom"/>
	<property name="Zoom_overlay" value="Items/Weapons/HUD/sniper_zoom_overlay"/>
	<property name="Zoom_max_out" value="40"/>
	<property name="Zoom_max_in" value="15"/>
</property>
<property name="LightSource" value="lightSource"/> <!-- Start: Needed for the attachment flashlight -->
<property name="ActivateObject" value="Attachments/flashlight/lightSource"/>
<property name="AttachmentFlashlight" value="flashlight02"/> <!-- End: Needed for the attachment flashlight -->
<property name="Group" value="Ammo/Weapons"/>
<property name="ActionSkillGroup" value="Rifles"/>
<property name="CraftingSkillGroup" value="craftSkillGuns"/>
<property name="RepairExpMultiplier" value="10.8"/>
<property name="LightValue" value="0.45"/>
<property name="EconomicValue" value="6400"/>
</item>

and this in recipes

Code:
<recipe name="AK5C" count="1" craft_area="assembly">
<ingredient name="partsAK5C_stock" count="1"/>
<ingredient name="partsAK5C_receiver" count="1"/>
<ingredient name="partsAK5C_barrel" count="1"/>
<ingredient name="partsAK5C_parts" count="1"/>
</recipe>

it's not working :p

 
No other item id 2506 in the item.xml? Try extending off the ak47 in case your missing a property. try adding <property name="HandMeshfile" value="#AK5C?AK5C"/> to force the handmesh to your model. That should work if you are using the correct parent object name and file name

 
this is what im looking to right now will reply if i find something :p

this is what im looking to right now will reply if i find something :p
When i have that issue is usually because i screwed something in unity, not the xml files, the game shows a kind of leather sack because cant use the object you imported... so the xml could be fine....

the code: <property name="Meshfile" value="#M4A1?M4A1"/> (example) works locating the imported object and the mesh inside the object (if im not wrong) I used to have the same issue quite a lot until i decided to name everything the same way...

when you take the mesh in unity name it "Test" and then when you create the empty object to contain it also name it "Test"... you will end up with a child object named "Test" from a main object called "Test"....then export it and... yes you guessed name the object "Test".... i guess by now you know how the xml shoould look like...

<property name="Meshfile" value="#Test?Test"/>

also always be aware of caps sensitive so careful when typing... to really be sure do a simple object like a club from scratch dont use the same scene... check that out then once solved move forward with another gun...

hope it helps somehow.

 
Check your logs. You probably will see an error message like "SDX: Could not find asset 'AK5C'

 
Back
Top