Item - Object Information

Sections in this file:

General
Magical Items
Permanent Magical Effect
Spell-Like Effect
Armor
Physical Characteristics
Other

A new feature for version 2.18 is the possibility of obtaining an item object which can be modified directly. You need to GetItemObj first, to obtain the item, and then you need to save it back to the creature, using SetItemObj. Properties are accessed directly, in the same way as creature properties. See for example:

Set MyItem = Cr.GetItemObj(ItemNum)
MyItem.Name = "Modified item name"
cr.SetItemObj(itemnum, MyItem)


An exception is the armor data parameters, which have slightly different nomenclature.

Indirect Access
The item properties are also accessible through the cr.GetItemStat() and cr.SetItemStat() function calls. You need to know the item number - to find a particular item you can loop through all items and search for a matching name.
Pass the parameter name indicated as a parameter. The names of properties are not case-sensitive. When calling arrays, add the optional parameter ArrayNum; and do not put parentheses in the parameter name. e.g.

Call Cr.GetItemStat(1, "TreasureChance", 3)

...will access the value of TreasureChance(3) (which is the chance of a major treasure).


General

Go back to top

Members

Name As String
Id As Integer
Cost As Single 'In gold pieces
Weight As Single 'In pounds
Desc As String 'Rich-text descriptive string
ItemType As String 'Type or category of item
AutoGenerated As Boolean 'Set to true for items which are made at startup

Disposable As Boolean 'lose 1 after each use
Count As Integer 'number of items

'--- Item's basic types ---
Magical As Boolean
Psionic As Boolean 'psionic item
Identified As Integer '0 = no, 1 = yes

Equipped As Integer 'is the object worn/used?
IgnoreWeight As Boolean 'Weight being ignored

TreasureChance() As Single
TreasureChanceNum As Long

Magical Items

Go back to top

Members

UnidentifiedPrice As Single 'Price displayed if unidentified
UnidentifiedName As String 'Name displayed if unidentified

' --- Magical Item Creation requirements ---
CostToCreate As Long 'Cost to create a magic item, usually 1/2 gp price
CasterLevel As Integer 'min. level to create
FoundBy As String 'only for adventure items
XPCost As Long 'xp cost to create
Prerequisites As String 'to be able to create

' --- Vars for its use ----
ChargesFull As Integer '# of charges when full
Charges As Integer '# of charges left
WearableType As Integer 'UNUSED-on head, cloak, bracer, ring, etc...

'- For Intelligent Items -
IsIntelligent As Boolean
Intel As Integer
Wis As Integer
Cha As Integer
Ego As Integer
Alignment As String
ReadLanguages As Boolean
ReadMagic As Boolean
Purpose As String
PurposePower As String
Languages As String
Abilities As String

Permanent Magical Effect

Go back to top

Members

HasCondition As Boolean ' v.1.15 (INLINE condition)

'Used internally. You should not need to modify this
ConditionInline As String 'v.1.15

Spell-Like Effect

Go back to top

Members

'-- Reproducing Spells --
SpellReproduced As Integer 'If 1 then this item reproduces SpellRelated (new v.2.00)
SpellCasterLevel As Long 'Level at which it's cast (new v.2.00)
SpellRelated As String 'The spell being cast, for reproducing spell effects (new v.2.00)
SpellCasterClass As String 'Class which casts the spell
SpellMetamagic As String 'Metamagic feats applied (v.2.00)

ReproducesPower As Boolean 'Set to true for items reproducing psionic power


'-- Linked Conditions --
CondList(0 To MAX_ITEM_COND) As Integer 'the conditions while using/wearing the object
CondListDuration(0 To MAX_ITEM_COND) As Integer 'time in rounds until that condition expires
NumConds As Integer
ConditionString As String 'condition list separated by semicolons
ConditionFirst As Integer 'first condition applied
NumCondsTemp As Integer '# conditions not always on
NumCondsAlways As Integer '# conditions not always on



Armor

Go back to top

Members

'For armor/shield
Private ArmorData As Armor

'---- For armor/shield when using GetItemStat ----
ArmorData.Name As String
ArmorData.IsArmor As Byte '0 = not armor, 1 = armor
ArmorData.IsShield As Byte '0 = not shield, 1 = shield
ArmorData.Proficiency As Byte '0=none; 1=light, 2=med, 3=heavy
ArmorData.AC As Integer 'NON - magical bonus to AC
ArmorData.Magic As Integer 'magical bonus to AC
ArmorData.MaxDex As Integer 'Max dex bonus
ArmorData.Check As Integer 'armor check penalty
ArmorData.SpellFailure As Integer '%chance of arcane spell failure
ArmorData.Speed20 As Integer 'speed for base = 20
ArmorData.Speed30 As Integer 'speed for base = 30
ArmorData.Speed40 As Integer 'speed for base = 40
ArmorData.Spikes As Boolean 'if true, then it has armor (shield) spikes
ArmorData.RemoveTime As String 'Unused. Time to remove armor in an emergency.

'---- For armor/shield when using the Item Object ----
'(call these like this 'It.Armor_Magic = +3')
Armor_Name As String 'Not used in the program.
Armor_IsArmor As Byte '0 = not armor, 1 = armor
Armor_IsShield As Byte '0 = not shield, 1 = shield
Armor_Proficiency As Byte '0=none; 1=light, 2=med, 3=heavy
Armor_AC As Integer 'NON - magical bonus to AC
Armor_Magic As Integer 'magical bonus to AC
Armor_MaxDex As Integer 'Max dex bonus
Armor_Check As Integer 'check penalty
Armor_SpellFailure As Integer '%chance of arcane spell failure
Armor_Speed20 As Integer 'speed for base = 20
Armor_Speed30 As Integer 'speed for base = 30
Armor_Speed40 As Integer 'speed for base = 40
Armor_Spikes As Boolean 'if true, then it has armor (shield) spikes
Armor_RemoveTime As String 'time to remove - unused.


Physical Characteristics

Go back to top

Members

Hardness As Integer
HitPoints As Integer
BreakDC As Integer
ArmorClass As Integer
Size As String
Age As Long
HitPointsMax As Integer 'v.1.12.169

'Container Characteristics
IsContainer As Boolean 'If true, can contain other items
UID As Long 'Unique ID for this item (for containers) new v.2.06
ContainerFixedWeight As Boolean 'If true, container is the same weight no matter what is inside
ExpandContents As Boolean 'For the items list: expand the contents of this container
ParentContainerUID As Long 'The UID of the immediate parent container
EffectiveWeight As Single 'The total weight of this container + all contained items. (Takes into account container fixed weight, and Ignore Weight)

'It is not recommended to mess directly with contents of containers!
'(Reading these values is harmless, though).
Contained() As Long 'List of UIDs of contained items
NumContained As Long


Other

Go back to top

Members

Functions

Sub AppendCode(SourceItem As ItemObj, CodeSection As Integer)
'Appends the script code that is in CodeSection of the item object SourceItem
' to the item's own code.
'
'CodeSection is an integer that determines which code section to append:
' Shared Code = 0
' Use Item = 1
' Rest = 2
' Equip Item = 3
' Unequip Item = 4
' Weapon Ability = 5
' Armor Ability = 6
' Contents Change = 7
' Condition Effect = 8
' Attack Bonus Calculation = 9






Documentation for DM Genie and Player Genie, page Item. Copyright © Mad Scientist Studios, 2006.
Help Contents   |   DM Genie home page
Click here if you cannot see the table of contents on the left