Mike1072 Posted September 16, 2016 Share Posted September 16, 2016 I have some information about opcode 319 and item_use.2da determined from testing.Here is the current IESDP description of opcode 319. #319 (0x319) Usability: Item UsabilityParameter #1: IDS EntryParameter #2: IDS FileSpecial: Description noteDescription: This effect restricts the item to creature(s) matching the object identifiers. The string to display when an invalid creature attempts to use the item is held in 0x2c. Known values for 'IDS File' are: 2 EA.ids 3 General.ids 4 Race.ids 5 Class.ids 6 Specific.ids 7 Gender.ids 8 Align.ids 9 Kit.ids 10 Actor's name 11 Actor's scripting name (8 maximum in resource field) If 'IDS File' is set to 10, the item is restricted to characters with the name specified by the strref held in parameter1. If 'IDS File' is set to 11, the item is restricted to characters with the death variable specified by the resource field. The message defined in 'Description note' will be displayed whenever this effect is triggered. 1)As referenced in Cam's original post about this opcode, setting the effect's power to 0 restricts the specified characters from using the item, while setting the power to 1 restricts everyone except the specified characters from using the item.Regardless of whether the power is set to 0 or 1, multiple effects stack restrictively. If one effect prevents males from using the item and another effect prevents everyone except elves from using it, the only characters who can use it are non-male elves. Likewise, these effects stack restrictively with the class, kit, and attribute restrictions specified in the item header.2)Effect probabilities are ignored for 319, so the restriction will remain active even if both probability1 and probability2 are set to 0. To disable a 319 effect you must remove it from the file.3)The strref supplied in the special parameter is not displayed "when an invalid creature attempts to use the item" nor "whenever this effect is triggered". When the power is set to 0, the text is displayed in a 'Not usable by' section of the item description. When the power is set to 1, the text appears in a 'Usable by' section of the item description.These usability descriptions replace the normal usability descriptions that are generated based on the class and kit descriptions specified in the item header. Edit: This may only happen if parameter 2 is set to 10 or 11, need to confirm. If an item has multiple 319 effects and all effects have the same power, the 'Not usable by' or 'Usable by' section of the item description (as appropriate) will list all of the strings associated with those effects. However, if an item has some 319 effects that have power 0 and others that have power 1, only the 'Usable by' section will be displayed and it will list only the effects with power 1. 4)If an item has 319 effects and is also referenced in item_use.2da, the contents of the description usability section depend on whether the item has any class or kit restrictions in the item header. If there are no such restrictions, the 319 effects will control the usability description as described above. If there are class or kit restrictions, then the usability section will be replaced with Usable by: USER, where USER is the script name associated with the item in item_use.2da with exact capitalization preserved.As an example, npshld.itm in BG2EE has a 319 effect with param2 = 11 (actor's script name), resource = ~ANOMEN~, and special = 9138 (~Anomen~). It also has some class and kit restrictions and it is referenced in item_use.2da: NPSHLD ANOMEN 9382 2 Its usability section reads: Usable by:ANOMEN If the entry in item_use.2da is changed to this: NPSHLD AnOmEn 9382 2 Then its usability section will read: Usable by:AnOmEn If the class and kit restrictions in the item header are removed, then the usability section will instead be generated from the 319 effect and read: Usable by:Anomen 5)item_use.2da doesn't seem to be described in IESDP, but the EE implementation appears to be a simpler form of this ToBEx feature without the additional STRREF columns. I didn't test the functionality of the FLAGS column, but vanilla items included in EE utilize FLAGS values between 1 and 4. Item RestrictionsTobEx externalises creature-specific item restrictions to ITEM_USE.2DA. This allows modmakers to customise specific item restrictions for creatures in the style of Minsc's Boo and Xan's Moonblade. ITEM_USE.2DA[ROWNAME]: the resource name of the item that the item-creature restrictions apply toUSER: death variable/script name of creature (not case-sensitive)STRREF#: the string reference to display in the inventory screen when the restriction indicated by the flag value of # appliesFLAG: bitfield indicating the type/s of restriction to applyFLAG bits bit 0 [1]: the item cannot be picked up from any slot of the creature (this overrides bits 3 and 4) bit 1 [2]: the item can only be equipped by the creature (this is 'stackable', so multiple item entries with different creatures mean that each of the listed creatures can equip the item) bit 2 [4]: no restrictions (this bit is reserved for GemRB) bit 3 [8]: the item cannot be picked up from any equipped slot of the creature bit 4 [16]: the item cannot be picked up from any inventory slot of the creature bit 5 [32]: the item cannot be dropped into any equipped slot of the creature bit 6 [64]: the item cannot be dropped into any inventory slot of the creature Example USER STRREF FLAG STRREF2 STRREF4 STRREF8 STRREF16 STRREF32 STRREF64 MISC84 MINSC 10218 3 10218 -1 -1 -1 -1 -1 Item MISC84 cannot be picked up from any slot of "Minsc", and can only be equipped by "Minsc". Link to comment
Avenger Posted October 3, 2016 Share Posted October 3, 2016 Actually, the EE's item_use feature is closer to GemRB. 1 - specified actor cannot remove it 2 - only specified actor can equip it 3 - no one can remove it, ignores the specification 4 - actor can remove it, but only for another item (like Annah/Grace in PST) Link to comment
critto Posted October 6, 2016 Share Posted October 6, 2016 How does the thief's Use Any Item ability work together with this opcode? Would the items restricted by it be usable by a rogue who has said ability or not? Link to comment
Roxanne Posted October 6, 2016 Share Posted October 6, 2016 How does the thief's Use Any Item ability work together with this opcode? Would the items restricted by it be usable by a rogue who has said ability or not? Just tested these cases NPC with ability use any item can - use item not for own class - use item only useable by (other) specific actor. Seems like the ability overrides the restrictions (as would have been expected, right?) Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.