Last updated
Last updated
First, you'll want to .
Second, you'll want to ensure that the Usage, Resource Gathering, and Combat sections are filled out correctly and make sense for your new weapon.
Usage Rate determines how fast this weapon can be used
Usage Distance determines the distance at which objects are affected by this weapon
Can Gather Resources is for tools that will be used to harvest materials from raw materials like wood from trees or stone from rocks
Types that can be gathered are simply the types of resources this weapon can harvest from raw materials
Can Deal Damage determines if this weapon is able to hurt NPCs or not
Damage is the amount of damage given when an NPC is hit with this weapon
Create a wieldable prefab using the following steps
The easiest way to get started is to duplicate an existing wieldable prefab. You can find one in the Stonehill Games\Survival Starter Kit\Prefabs\Wieldables
folder. Once you have located one you can press Ctrl+D
on windows or Cmd+D
on a mac to duplicate the object. Name it something like YourObject_Wieldable for example Knife_Wieldable.
Double-click the new wieldable prefab to open it.
Place your model in the opened prefab and align it with the existing model.
Delete the existing model
Select the top-level prefab object and change the Wield Tool Item to the Item Data object you created in the previous steps
Change the animation controller and animations using the following steps
For this demo, I will copy the sword animations and use them for the knife I'm creating. Start by finding the sword animations in Stonehill Games\Survival Start Kit\Animations\Sword
.
Duplicate the Sword folder and name it Knife
Rename the files to have the title Knife instead of Sword
Select the Knife Animation Controller and drag it into the Controller slot of the Animator script
Open the animator controller by double-clicking it.
Select the Sword Idle animation by clicking on it
Rename it to Knife Idle and select the Knife Idle animation in the Motion
Do the same thing with the attack animation. Select it by clicking on it, rename it to Knife Attack, and select the Knife Attack Motion
Select the ItemData object you created earlier and set the Wieldable Prefab equal to the Knife_Wieldable object you just created
Create the drop prefab using the following steps
Duplicate the Sword_Drop prefab and name it Knife_Drop
Open the Knife_Drop prefab
Drag your model into the hierarchy and position it on top of the sword model that is already there
Delete the sword model
Select the top-level prefab object and set the Item Object Item to the ItemData object you created earlier
Edit the collider to fit the model you dragged into the prefab
Exit the prefab editor and select the ItemData object you created earlier
Set the Drop Prefab equal to the Knife_Drop prefab you just created
Drop your prefab item into the world, pick it up, and equip it. You should see the wieldable prefab selected when you use your mouse wheel to select the weapon from your inventory. Next, you should be able to inflict damage on the world if you set the Can Deal Damage flag to true and set the Damage value to greater than zero.
You can get details about each section in the section of this manual.
This page will show you how to create a new weapon. The weapon can gather resources, damage NPCs, or both based on the properties you provide the system.