DataType: "OB", File: lists/objects.txt
The data attributes describing each object varies depending on the type of object. All objects share a set of generic stats, but each object has specific attributes that vary according to its type. All the generic attributes are listed first on each row, followed by a set of specific attributes at the end of the row. You may have as many objects as you want in your adventure, but keep in mind that each one adds about 35 bytes to your game. The following attributes must be listed in order, for every object’s row:
The following object attributes are all general, and are given for all types of objects.
- ObjectID (0..65535). ObjectID’s must start at 0 and be sequential and continuous.
- Object Name (Must be in quotation marks). There are several rules to constructing object names:
- The longest name for an un-enchanted object is 20 characters (i.e., “SWORD OF RETRIBUTION”)
- The longest name for an un-enchanted object with charges is 16 characters – the remaining 4 must be reserved for the charges display (i.e., “# 15”)
- For any object that has a special mod (i.e. +2 strength), you should include a “*” at the end of the name. This is not enforced by the game engine, so you may create your own notations for objects. Remember that the object name including the “*” character must still fit in the available space according to the rules above.
- For any bow or hand weapon that attacks a group rather than single target, you should include a “+” at the end of the name. This is not enforced by the game engine, so you may create your own notations for objects. Remember that the object name including the “+” character must still fit in the available space according to the rules above. Note that bow and hand weapons that attack groups are actually implemented as spell weapons (see examples in Sample Adventure objects.txt)
- TileID (0..255)
- Level (1..99) The object’s level is used only to determine when it can be found in the game (both in shops and on dead monsters). Obects whose level is the same as your highest party member are most likely to be chosen. Any object can be found by any level party, but the likelihood drops exponentially for each level of difference between your highest level party member and the level of the object.
- Uniqueness flag. (0 = object is not unique and can be found in shops and on dead monsters. 1 = object cannot be found in shops or monsters)
- Drop flag (0 = Object cannot be dropped, sold, or stolen. Object can, however, be taken away using a map special TAKE OBJECT instruction. 1 = Object can be dropped, sold, and stolen)
- ID Flag (0 = Object does not require identification. 1 = Object can be identified in the shop for quarter of object’s buy price. 64..127: Object becomes identified when the corresponding global game state bit is set)
- Buy price (0..65535). Cost to buy item in shop. Note that all shops are given a “discount factor” so that all items sold there can have their buy prices reduced by some factor.
- Sell price (0 = you can sell the object to a shop for a quarter of the buy price. 1..65535 = override default sale value with some chosen sale price)
- Find (0..255) 0 = object cannot be found from monster encounters. 1-255 = chance to find object after winning encounter. The object chosen after combat is the result of three picking levels:
- First, the chance for an object to appear is computed. If you defeated one monster group, you have a 20% chance to find an object. If you defeated two groups, you have a 30% chance, and for three groups, 40% chance. These chances are adjusted by bonuses supplied by special character class skills (such as the thief in Return of Kra'an).
- If it is decided that an object will be picked, the second stage is to evaluate the liklihood of a particular object being chosen based on its "find" value. The scale of values is relative, so you can provide any range of find values you like. Objects with a "find" value of 0 cannot be picked, and for the rest, higher find values mean higher chance to get picked. For example, an object with a value of 50 is half as likely to get picked as an object with value of 100.
- The last step in choosing a treasure object is to adjust the find value for each object by the difference between the object's level and the highest level character in your party. Chances to pick an object are not reduced for objects that are the same level as your party. But as the difference in levels increases, the chance to pick drops exponentially. Although objects at any level can be picked, an object that is two levels above or below your highest level party member is only one fourth as likely to be picked over an object with the same find value at the same level as your highest level party member.
- Shop (0..255) 0 = object cannot be bought from a shop. 1-255 = chance to find object in shop. Picking objects for a shop is a process that takes place in 5 stages:
- First, every day at midnight, all shops are randomly marked for re-picking. Each shop in the game has a 50% chance to be marked as needing re-picking the next time your party enters it.
- Next, if you enter a shop that has been marked for re-picking since the last time you entered it, each slot in the shop's inventory is considered for re-picking. Each slot has a 50% chance to get marked for needing re-picking.
- If an inventory slot has been marked for re-picking, the next step is to consider all objects that have a positive value of (1-255) for their "shop" value. Again, the scale of values is relative, so you can provide any range of find values you like. Objects with a "shop" value of 0 cannot be picked, and for the rest, higher shop values mean higher chance to get picked. For example, an object with a value of 50 is half as likely to get picked as an object with value of 100.
- The next step is to throw away objects that are not sold in that particular shop. For example, if you are picking inventory items for a shop that sells only hand weapons, you will throw away all objects who's "shop mask" (see below) does not contain 64 (the value for hand weapon type items).
- The last step in choosing a shop object is to adjust the shop value for by the difference between the object's level and the highest level character in your party. Chances to pick an object are not reduced for objects that are the same level as your party. But as the difference in levels increases, the chance to pick drops exponentially. Although objects at any level can be picked, an object that is two levels above or below your highest level party member is only one fourth as likely to be picked over an object with the same find value at the same level as your highest level party member.
- Shop Mask (0..255) All shops you place in your maps are given a mask parameter which corresponds to the objects sold there. So for your objects, you must identify the type of object using a "shop mask" so that when you enter a shop, the game will be able to choose the appropriate object types. Set your shop mask to one of the following types:
- Misc item = 1
- Jewelry = 2
- Potion = 4
- Fruit = 8
- Armor = 16
- Spell weapon = 32
- Hand weapon = 64
- Torch = 128
- Later, when you add a shop to a map, you will be asked for its mask. The mask is just the sum of the shop bits above. For example, a shop given a mask of 26 will sell jewelry (2) + fruit (8) + Armor (16)
- Determiner (0..3) Specifies the determiner given in text_interface.txt TEXT_DETERMINER_0..4. The ReturnKraan.pdb adventure’s text_interface.txt file includes the following four determiners which can be changed by changing your own adventure’s text_interface.txt file:
- TEXT_DETERMINER_0 “A” (You found a short bow”)
- TEXT_DETERMINER_1 “” (“You found thowing knives”)
- TEXT_DETERMINER_2 “AN” (“You found an elven long bow”)
- TEXT_DETERMINER_3 “THE” (“You found the brass key”)
- Min attribute type (“strength”, “intelligence”, “dexterity”) Requires any character attempting to equip the object to have a given minimum attribute type. If no min attrib is required, use "strength 0" (0 for min attrib value).
- Min attribute value (0..99)
- Bonus attribute type (“strength”, “dexterity”, “hitpoints”, “spellpoints”, “light”, “armorclass”, “resist_fire”, “resist_magic”) Any character equipping this object is awarded a bonus of the given attribute type. Note, you should never give an object a bonus of intelligence because that attribute is used to determine spell points awarded to the character at promotion time. If there were an object that gave a bonus to intelligence, that object could be used to cheat by simply passing it around to each party member at promotion time to gain an extra bonus of spell points for everyone. If no bonus is given, use "intelligence 0" (0 for bonus attrib value).
- Bonus attrib value (-99..99) Depends on bonus attribute type.
The following object attributes are all specific to the given object's type.
- Obect type. Must be one of the following. The rest of the object attributes all depend on the object type:
- “Protection” – Object is some kind of armor. The following attributes must follow all object who’s type is “Protection”:
- Body position (“armor”, “helmet”, “shield”, “gauntlet”).
- Armor class (-10 .. 10) Amount the armor protects the wearer when equipped
- Resist fire (0..99)
- Resist magic (0..99)
- Accuracy (0) For armor, you must always supply an accuracy of 0 at the end of the row because accuracy profiles do not apply to armor objects.
- “Jewelry” – Object is some type of jewelry. Jewelry modifies some attribute of the wearer when equipped. The following attributes must follow all objects whose type is “Jewelry”:
- Body position (“necklace”, “ring”)
- Attribute affect type (“strength”, “dexterity”, “armorclass”, “resist_fire”, “resist_magic”, “spellpoints”, “hitpoints”)
- Attribute affect value (-99 .. 99)
- Accuracy (0) For jewelry, you must always supply an accuracy of 0 at the end of the row because accuracy profiles do not apply to jewelry objects.
- “Potion” – Object is a potion that permanently modifies a character’s attribute when consumed. The following attributes must follow all objects whose type is “Potion”:
- Attribute affect type (“strength”, “dexterity”, “armorclass”, “resist_fire”, "experience", “resist_magic”, “spellpoints”, “hitpoints”, “stamina”, “intelligence”) Note that potions can be given an attribute type of intelligence or stamina since they can only be used by one character.
- Attribute affect value (-99 .. 99)
- Accuracy (0) For potions, you must always supply an accuracy of 0 at the end of the row because accuracy profiles do not apply to potions objects.
- “SpellWeapon” – Object is a spell weapon that casts some spell in and/or out of combat with some limited number of uses. All spell weapon objects must end with the following attributes:
- Spell ID (0..255) The ID of a valid spell.
- Number of charges (1..99)
- Accuracy (0.. max AccuracyID) The accuracy field for spell objects is used to determine if the character equipping or using the object will be successful at using it. So for spell weapons that cast spells that can be cast outside of combat, the accuracyID should be 0 (or the accuracyID of the object profile representing default behavior for all character classes) because all characters are always successful at using spell weapons for non-offensive purposes.
- “Fruit” – Object is a fruit that modifies a character’s current hitpoints or spellpoints when consumed. The following attributes must follow all objects whose type is “Fruit”:
- Attribute affect type (“spellpoints”, “hitpoints”) Attribute affect value (-99 .. 99)
- Accuracy (0) For fruit, you must always supply an accuracy of 0 at the end of the row because accuracy profiles do not apply to potions objects.
- “Torch” – Object is a torch which provides light when equipped. All torch objects must be followed by the following attributes:
- Light value (1..4)
- Time (1..255) This value is proportional to the number of walking steps taken by your party.
- Accuracy (0) For fruit, you must always supply an accuracy of 0 at the end of the row because accuracy profiles do not apply to potions objects.
- “HandWeapon” – Object is a hand weapon which must be followed by the following attributes:
- Physical damage (0..255) The amount of damage dealt by the weapon on a monster upon a successful hit. Note this is base damage, not actual damage. The actual physical damage is computed as some value between half and full base damge + some factor for the attacker’s strength.
- Fire damage (0..255). Fire damage given to target upon successful hit. Note actual damage given is reduced according to target’s fire resistance.
- Magic damage (0..255). Magic damage given to target upon successful hit. Note actual damage given is reduced according to target’s magic resistance.
- Special flag (0..255) This indicates what type of special monster vulnerabilities can be overcome by this weapon. In Return Of Kra’an, only the Kra’an dragon had a special defense of 1, meaning that all weapons and spells would have no effect unless they also had a special flag of 1. Only the dragon bane sword had this flag set. But this flag can be used to give many weapons many special uses against different sets of monsters with special invulnerabilities.
- Accuracy profile ID (0.. maxAccuracyID) This attribute is used to store a valid accuracy profile ID which represents which character classes are adept at using the weapon.
- “Misc” – Object is none of the above. This is mainly used for keys (or objects that have one time special uses and act like keys). Objects of this type must have the following attributes:
- Code (1..255) Don’t know – use “1”’
- Accuracy (0) For misc objects, you must always supply an accuracy of 0 at the end of the row because accuracy profiles do not apply to misc objects.
Example:
# Name Tile Lev Uniq drop ID buy sell find shop mask det attrib val bonus val type phys fire magic special accuracy
69 "KNIFE" 130 1 0 1 0 20 0 90 90 64 0 strength 10 intelligence 0 HandWeapon 3 0 0 0 0
70 "KNIFE" 130 1 0 1 0 20 0 70 70 64 0 strength 10 intelligence 0 HandWeapon 3 0 0 0 0
71 "KNIFE" 130 1 0 1 0 30 0 50 50 64 0 strength 10 intelligence 0 HandWeapon 4 0 0 0 0
72 "DAGGER" 130 1 0 1 0 30 0 80 80 64 0 strength 12 intelligence 0 HandWeapon 4 0 0 0 0
73 "DAGGER" 130 1 0 1 0 40 0 60 60 64 0 strength 12 intelligence 0 HandWeapon 5 0 0 0 0
74 "DAGGER" 130 1 0 1 0 55 0 40 40 64 0 strength 12 intelligence 0 HandWeapon 6 0 0 0 0
75 "DAGGER OF LIGHT*" 131 2 1 1 1 80 0 0 0 0 0 strength 12 light 1 HandWeapon 5 1 0 0 0