Template:Op items

Items
The title is a bit deceitful here. Items, despite the name, are not actual game items. Rather these are the *definitions* for real game items, and you can frequently see them referenced as "item types". However you should not confuse this with so called itp_type_* constants which define the major item classes existing in the game.

Consider this: a Smoked Fish (50/50) in your character's inventory is an item in the game world. It's item type is "itm_smoked_fish" and it's basic class is itp_type_food. So take care: operations in this section are dealing with "itm_smoked_fish", not with actual fish in your inventory. The latter is actually just an inventory slot from the Module System's point of view, and operations to work with it are in the troops section of the file.

Conditional operations
item_has_property = 2723
 * (item_has_property, , ),
 * Version 1.161+. Check that the item has specified property flag set. See the list of itp_* flags in header_items.py.

item_has_capability = 2724
 * (item_has_capability, , ),
 * Version 1.161+. Checks that the item has specified capability flag set. See the list of itcf_* flags in header_items.py

item_has_modifier = 2725
 * (item_has_modifier, , ),
 * Version 1.161+. Checks that the specified modifiers is valid for the item. See the list of imod_* values in header_item_modifiers.py.

item_has_faction = 2726
 * (item_has_faction, , ),
 * Version 1.161+. Checks that the item is available for specified faction. Note that an item with no factions set is available to all factions.

Item slot operations
item_set_slot = 507
 * (item_set_slot, , , ),

item_get_slot = 527
 * (item_get_slot,, , ),

item_slot_eq = 547
 * (item_slot_eq, , , ),

item_slot_ge = 567
 * (item_slot_ge, , , ),

Generic item operations
item_get_type = 1570
 * (item_get_type,, ),
 * Returns item class (see header_items.py for itp_type_* constants).

store_item_value = 2230
 * (store_item_value,, ),
 * Stores item nominal price as listed in module_items.py. Does not take item modifier or quantity (for food items) into account.

store_random_horse = 2257
 * (store_random_horse, ),
 * Deprecated since early M&B days.

store_random_equipment = 2258
 * (store_random_equipment, ),
 * Deprecated since early M&B days.

store_random_armor = 2259
 * (store_random_armor, ),
 * Deprecated since early M&B days.

cur_item_add_mesh = 1964
 * (cur_item_add_mesh, <mesh_name_string>, [<lod_begin>], [<lod_end>], [ ]),
 * Version 1.161+. Only call inside ti_on_init_item trigger. Adds another mesh to item, allowing the creation of combined items. Parameter <mesh_name_string> should contain mesh name itself, NOT a mesh reference. LOD values are optional. If <lod_end> is used, it will not be loaded.

cur_item_set_material = 1978
 * (cur_item_set_material, <string_no>, <sub_mesh_no>, [<lod_begin>], [<lod_end>]),
 * Version 1.161+. Only call inside ti_on_init_item trigger. Replaces material that will be used to render the item mesh. Works only for main meta-mesh, so not for scabbards, etc., and does not work for horses, gloves and boots. Use 0 for <sub_mesh_no> to replace material for base mesh. LOD values are optional. If <lod_end> is used, it will not be loaded.

item_get_weight = 2700
 * (item_get_weight, <destination_fixed_point>, <item_kind_no>),
 * Version 1.161+. Retrieves item weight as a fixed point value.

item_get_value = 2701
 * (item_get_value,, <item_kind_no>),
 * Version 1.161+. Retrieves item base price. Essentially a duplicate of (store_item_value).

item_get_difficulty = 2702
 * (item_get_difficulty,, <item_kind_no>),
 * Version 1.161+. Retrieves item difficulty value.

item_get_head_armor = 2703
 * (item_get_head_armor,, <item_kind_no>),
 * Version 1.161+. Retrieves item head armor value.

item_get_body_armor = 2704
 * (item_get_body_armor,, <item_kind_no>),
 * Version 1.161+. Retrieves item body armor value.

item_get_leg_armor = 2705
 * (item_get_leg_armor,, <item_kind_no>),
 * Version 1.161+. Retrieves item leg armor value.

item_get_hit_points = 2706
 * (item_get_hit_points,, <item_kind_no>),
 * Version 1.161+. Retrieves item hit points amount.

item_get_weapon_length = 2707
 * (item_get_weapon_length,, <item_kind_no>),
 * Version 1.161+. Retrieves item length (for weapons) or shield half-width (for shields). To get actual shield width, multiply this value by 2. Essentially, it is a distance from shield's "center" point to it's left, right and top edges (and bottom edge as well if shield height is not defined).

item_get_speed_rating = 2708
 * (item_get_speed_rating,, <item_kind_no>),
 * Version 1.161+. Retrieves item speed rating.

item_get_missile_speed = 2709
 * (item_get_missile_speed,, <item_kind_no>),
 * Version 1.161+. Retrieves item missile speed rating.

item_get_max_ammo = 2710
 * (item_get_max_ammo,, <item_kind_no>),
 * Version 1.161+. Retrieves item max ammo amount. Ignores large bag modifier.

item_get_accuracy = 2711
 * (item_get_accuracy,, <item_kind_no>),
 * Version 1.161+. Retrieves item accuracy value. Note that this operation will return 0 for an item with undefined accuracy, even though the item accuracy will actually default to 100.

item_get_shield_height = 2712
 * (item_get_shield_height, <destination_fixed_point>, <item_kind_no>),
 * Version 1.161+. Retrieves distance from shield "center" to it's bottom edge as a fixed point number. Use (set_fixed_point_multiplier, 100), to retrieve the correct value with this operation. To get actual shield height, use shield_height + weapon_length if this operation returns a non-zero value, otherwise use 2 * weapon_length.

item_get_horse_scale = 2713
 * (item_get_horse_scale, <destination_fixed_point>, <item_kind_no>),
 * Version 1.161+. Retrieves horse scale value as fixed point number.

item_get_horse_speed = 2714
 * (item_get_horse_speed,, <item_kind_no>),
 * Version 1.161+. Retrieves horse speed value.

item_get_horse_maneuver = 2715
 * (item_get_horse_maneuver,, <item_kind_no>),
 * Version 1.161+. Retrieves horse maneuverability value.

item_get_food_quality = 2716
 * (item_get_food_quality,, <item_kind_no>),
 * Version 1.161+. Retrieves food quality coefficient (as of Warband 1.165, this coefficient is actually set for many food items, but never used in the code as there was no way to retrieve this coeff before 1.161 patch).

item_get_abundance = 2717
 * (item_get_abundance,, <item_kind_no>),
 * Version 1.161+. Retrieve item abundance value. Note that this operation will return 0 for an item with undefined abundance, even though the item abundance will actually default to 100.

item_get_thrust_damage = 2718
 * (item_get_thrust_damage,, <item_kind_no>),
 * Version 1.161+. Retrieves thrust base damage value for item.

item_get_thrust_damage_type = 2719
 * (item_get_thrust_damage_type,, <item_kind_no>),
 * Version 1.161+. Retrieves thrust damage type for item (see definitions for "cut", "pierce" and "blunt" in header_items.py).

item_get_swing_damage = 2720
 * (item_get_swing_damage,, <item_kind_no>),
 * Version 1.161+. Retrieves swing base damage value for item.

item_get_swing_damage_type = 2721
 * (item_get_swing_damage_type,, <item_kind_no>),
 * Version 1.161+. Retrieves swing damage type for item (see definitions for "cut", "pierce" and "blunt" in header_items.py).

item_get_horse_charge_damage = 2722
 * (item_get_horse_charge_damage,, <item_kind_no>),
 * Version 1.161+. Retrieves horse charge base damage.