HOW-TO: Add items and attributes

Adding Items to NPC inventory

To add item to NPC Inventory you can use Inventory tab in NPC Template Editor.

df86b1c8-cd60-41e7-8f97-b5fe46ac253b.png

 

To add new inventory item use Add item button (red sign button)

ced910b7-17a3-4317-9e4a-2c2a5468ff81.png

First select category of item from items category! Without that you won't be able to select an item.

After selecting category can add new Item. You can do that by using red arrow in initializer row. To select specific item select - CInventoryInitializerUnifrom to select random item form chosen category select CInventoryInitializerRandom.

 

After selecting CInventoryInitializerUnifrom you can choose item from dropdown (red arrow button in itemName row)

This tutorial adds information and context to the creating custom entity NPC tutorial which you can find, here: HOW-TO: Create a new NPC.

 

 


 

Adding custom items

Items represent a number of different objects that can be purchased, found in the world or received during quests.

To add custom item you need to add new item definition to existing .xlm file (check .xml files named def_item .xml) or create your own .xml (preferred method - creating new one will prevent from modifying original files).

Important note - You need to mount every new .xml file so that it can be visible to the engine and its contents can be used in other files. To do that you need to modify existing one or create new .reddlc file. See DLC Mods for more info.

Item Definitions

Every item has an intended use and generally falls into one of the following categories, Equipment, Components or Other.

Equipment

Components

Other

Equipment

Components

Other

Consumables

Alchemy

Monster Trophies

Weapons

Crafting

Quest Rewards

Armor

Herbs

Junk

Upgrades

Mutagens

 

Item Abilities

Every item has an intended use and can be examined in the player inventory.

Once acquired, an item might be equipped, used, sold, given or dropped.

Example:

  • Equipped to grant the player unique abilities during combat.

  • Used to augment other items.

  • Given to a crafter to crafter new items.

  • Sold to a merchant for money.

  • Given to an NPC to complete a challenge or quest.

Creating an XML Item Definition

When creating a new item definition in xml, the following properties must be defined:

  • name ="Short sword 2"

  • category ="steelsword"

  • price ="16"

  • initial_durability ="100"

  • max_durability ="100"

  • enhancement_slots ="0"

More detailed information for every property type has been included below, but only for properties driven by game design. Other aspects of an item's design like attachment points and user interface options are outside the scope of this documentation.

 

 

 

Name

___

To keep schematic names consistent, use the crafted item’s name followed by ‘schematic’.

Naming Convention

  • name_name = "Name of Item"

Example

  • name_name = "Short sword 2”

Category

___

The category of an Item should represent its intended use.

Naming Convention

  • category ="Category Name"

Example

  • category ="steelsword"

 

 

 

 

Durability

___

An Item's Durability represents how much damage it can sustain before becoming ineffective in combat.

Durability is determined by setting two values, the initial durability and the max durability.

Naming Convention

  • initial_durability ="0 - 100"

  • max_durability ="0 - 100"

Example

  • initial_durability ="80"

  • max_durability ="100"

Price

___

The price of an item represents it's base worth to the player and is unmodified by merchants.

Naming Convention

  • price ="XXXX"

Example

  • price ="16"

 

 

 

Enhancement Slots

___

The number of enhancement slots represents the amount of Upgrades (Runestone or Glyph) an item can hold.

The maximum number of enhancement slots is 3.

Naming Convention

  • enhancement_slots ="X"

Example

  • enhancement_slots ="3"

 

Example of an item’s full xml definition

<item           name ="Short sword 2"           category ="steelsword"           price ="16"           initial_durability ="100"           max_durability ="100"           enhancement_slots ="0"           stackable ="1"           grid_size ="2"           equip_template ="short_sword_lvl2"           equip_slot ="steel_sword_back_slot"           hold_slot ="r_weapon"           weapon ="true"           lethal ="true"           ability_mode ="OnHold"           hand ="right"           sound_identification ="long steel"           draw_event ="DrawWeapon"           draw_act ="draw_steel_sword_back_act"           draw_deact ="draw_steel_sword_back_deact"           holster_event ="HolsterWeapon"           holster_act ="holster_steel_sword_back_act"           holster_deact ="holster_steel_sword_back_deact"           localisation_key_name ="item_name_short_sword_2"           localisation_key_description ="item_desc_steel_sword"           icon_path ="icons/inventory/weapons/short_sword_lvl1_64x128.png" >           <tags> Autogen, PlayerSteelWeapon, Weapon, sword1h, 1handedWeapon, mod_weapon           </tags>           <base_abilities>                     <a>Default weapon _Stats</a>                     <a>Short sword 2 _Stats</a>           </base_abilities>           <recycling_parts>                     <parts count="1">Leather squares</parts>                     <parts count="2">Iron ingot</parts>           </recycling_parts> </item>

 


 

Adding attributes

To add custom attributes to NPC Entity Template you need to add new gameplay parameter in gameplay tab. To do that use red button with plus icon next to Gameplay params label:

To add new gameplay attributes select CCharacterStatsParam from dropdown list.

After adding new CCharacterStatsParam you can add new ability that contain attributes definitions.

New ability definitions are defined in separate .xml file.

 

 


Adding custom attribute

To add custom attribute you need to add new ability definition to existing .xlm file (check .xml files named monster_base_abl.xml) or create your own .xml (preferred method - creating new one will prevent from modifying original files).

You can use example below to create an abilities definition file:

<?xml version="1.0" encoding="UTF-16"?> <redxml>   <definitions>   <abilities>         <ability name="test_bandit">             <level type="add" min="15" max="15" />             <vitality type="base" min="2000" max="2000" />             <stamina type="base" min="200" max="200" />             <experience type="add" min="100" max="100" />         </ability>   </abilities>   </definitions> </redxml>

 

You can modify Base Stats:

  • vitality

  • essence

  • stamina

  • toxicity

  • focus

  • morale

  • air

  • panic

  • panicStatic

  • swimmingStamina

Power stats:

  • attack_power

  • spell_power

Regeneration stats:

  • vitalityCombatRegen

  • vitalityRegen

  • essenceRegen

  • staminaRegen

  • moraleRegen

  • airRegen

  • panicRegen

  • swimmingStaminaRegen

Resistance Stats:

  • physical_resistance

  • poison_resistance

  • fire_resistance

  • frost_resistance

  • shock_resistance

  • force_resistance

  • slashing_resistance

  • piercing_resistance

  • bludgeoning_resistance

  • rending_resistance

  • elemental_resistance

  • burning_DoT_damage_resistance

  • poison_DoT_damage_resistance

  • bleeding_DoT_damage_resistance

 

 

 


 

______________________________________
The Witcher 3: Wild Hunt Complete Edition © 2024 CD PROJEKT S.A. Published by CD PROJEKT S.A. Developed by CD PROJEKT RED. CD PROJEKT®, The Witcher®, REDengine® are registered trademarks of CD PROJEKT Capital Group. All rights reserved. The Witcher game is set in the universe created by Andrzej Sapkowski in his series of books. All rights reserved.