Creating Custom Items

From Ardenfall Wiki
Jump to navigation Jump to search

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