Difference between revisions of "Creating a New Melee Weapon"

From RPG Creation Kit
Jump to navigation Jump to search
(Created page with "In this tutorial we are going to see how to add a new Meele Weapon in the game. In particular we are going to add a one-handed sword that the Player and NPCs will be able to use. I'm going to use [https://sketchfab.com/3d-models/chevalier-sword-b2662f2666a844e8a1bd0e7c4a7672d8 this model] made by [https://sketchfab.com/rubenve rubenve]. == Creating the Prefabs == thumb|229x229px|The base Prefab of our weapon. The first thing you need to do is to drop...")
 
Line 4: Line 4:


== Creating the Prefabs ==
== Creating the Prefabs ==
[[File:Cnmw1.png|thumb|229x229px|The base Prefab of our weapon.]]
[[File:Cnmw1.png|thumb|229x229px|"ChevalierSwordPrefab" The base Prefab of our weapon.]]
The first thing you need to do is to drop your weapon in the scene and apply the material. Once you did that, prefab the weapon as "ChevalierSwordPrefab", we are going to use this prefab as a base for the other ones we need to create.
The first thing you need to do is to drop your weapon in the scene and apply the material. Once you did that, prefab the weapon, I'll do it as "ChevalierSwordPrefab", we are going to use this prefab as a base for the other ones we need to create.


We are going to need '''3 Prefabs''' for this weapon:
We are going to need '''3 Prefabs''' for this weapon:


* '''[[Item In World]]'''
* '''[[Item In World]]'''
* '''Weapon On Hand:''' which will allow for the collision detection.
* '''Weapon On Hand:''' which is the weapon displayed in the First Person and held in the hands of the NPCs, this will allow for the collision detection.
* '''Weapon Sheathed:''' which is displayed on the NPCs when they are not in combat.
* '''Weapon Sheathed:''' which is displayed on the NPCs when they are not in combat.


We are going to start with the creating the [[Weapon Item]] and then the '''Item In World.'''


== Creating the Weapon Item ==
[[File:Cmwg1.gif|thumb|GIF that shows the creation of the Item In World for the ChevalierSword we are creating.]]
To create a New Weapon Item, right click in the Project Window -> Create -> RPG Creation Kit -> Items -> WeaponItem


We are going to start with the '''Weapon On Hand'''
Name it "''[WEAPON] ChevalierSword''" and leave it for now, we are going to create the '''Item In World''' first. Drop the Prefab we've just made "ChevalierSwordPrefab" in the scene and rename it "ChevalierSwordPrefab_InWorld", Reach for the top bar "RPG Creation Kit -> Create New -> Item In World" a window will open.
 
Drag and drop the "ChevalierSwordPrefab" prefab we've just dropped in the scene in the "'''GameObject'''" field, you can edit the other settings as you may wish, I suggest you leave the default ones. Last thing to do is to setting the '''"Item Ref"''' to be the Weapon Item we just created, then click on '''COMPELTE & CLOSE''' and make sure to Update the prefab.
 
Refer to the gif on the right for visualizing the process.


== Creating the Weapon On Hand ==
== Creating the Weapon On Hand ==
To create the Weapon On Hand in the easiest way possible load a savegame and equip a One Handed sword (or a 2handed if you're doing it).
Then pause the game and switch to the Scene View, reach the Character Controller and click on the Sword to quickly see in the hierarchy the '''"hand.R"''' GameObject, child of the FPS Arms. What we are going to do is to drop an instance of the ChevalierSwordPrefab in the hand, and then manually adjust it until it fits in the FPS hands:

Revision as of 22:19, 10 March 2022

In this tutorial we are going to see how to add a new Meele Weapon in the game.

In particular we are going to add a one-handed sword that the Player and NPCs will be able to use. I'm going to use this model made by rubenve.

Creating the Prefabs

"ChevalierSwordPrefab" The base Prefab of our weapon.

The first thing you need to do is to drop your weapon in the scene and apply the material. Once you did that, prefab the weapon, I'll do it as "ChevalierSwordPrefab", we are going to use this prefab as a base for the other ones we need to create.

We are going to need 3 Prefabs for this weapon:

  • Item In World
  • Weapon On Hand: which is the weapon displayed in the First Person and held in the hands of the NPCs, this will allow for the collision detection.
  • Weapon Sheathed: which is displayed on the NPCs when they are not in combat.

We are going to start with the creating the Weapon Item and then the Item In World.

Creating the Weapon Item

GIF that shows the creation of the Item In World for the ChevalierSword we are creating.

To create a New Weapon Item, right click in the Project Window -> Create -> RPG Creation Kit -> Items -> WeaponItem

Name it "[WEAPON] ChevalierSword" and leave it for now, we are going to create the Item In World first. Drop the Prefab we've just made "ChevalierSwordPrefab" in the scene and rename it "ChevalierSwordPrefab_InWorld", Reach for the top bar "RPG Creation Kit -> Create New -> Item In World" a window will open.

Drag and drop the "ChevalierSwordPrefab" prefab we've just dropped in the scene in the "GameObject" field, you can edit the other settings as you may wish, I suggest you leave the default ones. Last thing to do is to setting the "Item Ref" to be the Weapon Item we just created, then click on COMPELTE & CLOSE and make sure to Update the prefab.

Refer to the gif on the right for visualizing the process.

Creating the Weapon On Hand

To create the Weapon On Hand in the easiest way possible load a savegame and equip a One Handed sword (or a 2handed if you're doing it).

Then pause the game and switch to the Scene View, reach the Character Controller and click on the Sword to quickly see in the hierarchy the "hand.R" GameObject, child of the FPS Arms. What we are going to do is to drop an instance of the ChevalierSwordPrefab in the hand, and then manually adjust it until it fits in the FPS hands: