Creating Custom Items: Difference between revisions
Created page with "The easiest way to create a custom item is to copy an existing ItemData in the Asset Lookup Table, then register your new ItemData back into the Asset Lookup Table. This will allow this item to be spawned, picked up, sold, and stolen. === Simple Item Example === TODO === Weapon Example === TODO === Armor Example === TODO" |
No edit summary |
||
| Line 4: | Line 4: | ||
=== Simple Item Example === | === Simple Item Example === | ||
This is how to create a 'misc' item, which is an item that can be picked up, sold, etc, but not equipped or anything fancy. | |||
=== Weapon Example === | <u>Import Model</u> | ||
TODO | |||
First set up a GLTF model that you want to import into your asset manifest.<syntaxhighlight lang="json"> | |||
{ | |||
"assetId": "AssetExampleMod.KawamokuModel", | |||
"type": "gltf_scene", | |||
"properties" : | |||
[ | |||
{ | |||
"name": "path", | |||
"value": "Assets/kawamoku.gltf" | |||
} | |||
] | |||
} | |||
</syntaxhighlight><u>Item Data</u> | |||
Then create your item data file. You can define whatever values you want, but here lets just override a few.<syntaxhighlight lang="json"> | |||
{ | |||
"parent": "misc", | |||
"parameters": { | |||
"itemName": "Kawamoku Plush", | |||
"pickupVisual": "AssetExampleMod.KawamokuModel" | |||
} | |||
} | |||
</syntaxhighlight>Note the 'parent' being set to 'misc'. You can instead override whatever value you want. You can find an item in the lookup table, copy the guid, and then use that instead, if you want. | |||
<u>Import Item</u> | |||
Next simply import the item in the asset manifest.<syntaxhighlight lang="json"> | |||
{ | |||
"assetId": "AssetExampleMod.KawamokuItem", | |||
"type": "scriptable_object", | |||
"properties" : | |||
[ | |||
{ | |||
"name": "path", | |||
"value": "Data/kawamoku_item.json" | |||
} | |||
] | |||
} | |||
</syntaxhighlight><u>Test Item</u> | |||
Now use the item debugger to spawn the item! Huzzah! | |||
=== Melee Weapon Example === | |||
<u>Import Model</u><syntaxhighlight lang="json"> | |||
{ | |||
"assetId": "AssetExampleMod.WeaponExample", | |||
"type": "gltf_scene", | |||
"properties" : | |||
[ | |||
{ | |||
"name": "path", | |||
"value": "Assets/mod_weapon_example.glb" | |||
} | |||
] | |||
} | |||
</syntaxhighlight>TODO: Update this example with using the correct shader! | |||
<u>Item Data</u> | |||
Then create your item data file. You can define whatever values you want, but here lets just override a few.<syntaxhighlight lang="json"> | |||
{ | |||
"parent": "katana", | |||
"parameters": { | |||
"itemName": "Modded Katana", | |||
"damage": 300 | |||
}, | |||
"melee_prefab": { | |||
"model": "AssetExampleMod.WeaponExample", | |||
"trail_start": [0, 0, 0], | |||
"trail_end": [0, 2, 0] | |||
} | |||
} | |||
</syntaxhighlight>Note the melee_prefab entry defining a trail start and end. This is the vector position of where the "whoosh" trail appears on the weapon. | |||
The parent can be 'katana', 'dagger', 'greatsword', 'greataxe'. OR you can reference an existing weapon to create an item based on that. | |||
<u>Import Item</u> | |||
Next simply import the item in the asset manifest.<syntaxhighlight lang="json"> | |||
{ | |||
"assetId": "AssetExampleMod.WeaponItem", | |||
"type": "scriptable_object", | |||
"properties" : | |||
[ | |||
{ | |||
"name": "path", | |||
"value": "Data/katana_item.json" | |||
} | |||
] | |||
} | |||
</syntaxhighlight><u>Test Item</u> | |||
Now use the item debugger to spawn the item! Huzzah! | |||
Note that when you reload a mod with a weapon, it'll re-equip the weapon. This is intended. | |||
=== Armor Example === | === Armor Example === | ||
TODO | TODO | ||
Latest revision as of 00:22, 20 July 2026
The easiest way to create a custom item is to copy an existing ItemData in the Asset Lookup Table, then register your new ItemData back into the Asset Lookup Table.
This will allow this item to be spawned, picked up, sold, and stolen.
Simple Item Example
This is how to create a 'misc' item, which is an item that can be picked up, sold, etc, but not equipped or anything fancy.
Import Model
First set up a GLTF model that you want to import into your asset manifest.
{
"assetId": "AssetExampleMod.KawamokuModel",
"type": "gltf_scene",
"properties" :
[
{
"name": "path",
"value": "Assets/kawamoku.gltf"
}
]
}Item Data Then create your item data file. You can define whatever values you want, but here lets just override a few.
{
"parent": "misc",
"parameters": {
"itemName": "Kawamoku Plush",
"pickupVisual": "AssetExampleMod.KawamokuModel"
}
}Note the 'parent' being set to 'misc'. You can instead override whatever value you want. You can find an item in the lookup table, copy the guid, and then use that instead, if you want.
Import Item
Next simply import the item in the asset manifest.
{
"assetId": "AssetExampleMod.KawamokuItem",
"type": "scriptable_object",
"properties" :
[
{
"name": "path",
"value": "Data/kawamoku_item.json"
}
]
}Test Item
Now use the item debugger to spawn the item! Huzzah!
Melee Weapon Example
Import Model
{
"assetId": "AssetExampleMod.WeaponExample",
"type": "gltf_scene",
"properties" :
[
{
"name": "path",
"value": "Assets/mod_weapon_example.glb"
}
]
}TODO: Update this example with using the correct shader!
Item Data
Then create your item data file. You can define whatever values you want, but here lets just override a few.
{
"parent": "katana",
"parameters": {
"itemName": "Modded Katana",
"damage": 300
},
"melee_prefab": {
"model": "AssetExampleMod.WeaponExample",
"trail_start": [0, 0, 0],
"trail_end": [0, 2, 0]
}
}Note the melee_prefab entry defining a trail start and end. This is the vector position of where the "whoosh" trail appears on the weapon.
The parent can be 'katana', 'dagger', 'greatsword', 'greataxe'. OR you can reference an existing weapon to create an item based on that.
Import Item
Next simply import the item in the asset manifest.
{
"assetId": "AssetExampleMod.WeaponItem",
"type": "scriptable_object",
"properties" :
[
{
"name": "path",
"value": "Data/katana_item.json"
}
]
}Test Item
Now use the item debugger to spawn the item! Huzzah!
Note that when you reload a mod with a weapon, it'll re-equip the weapon. This is intended.
Armor Example
TODO