Jump to content


Photo

[COMPLETE] Externalise Item-Creature Exclusions


  • Please log in to reply
10 replies to this topic

#1 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 15 January 2011 - 01:18 AM

More of an incidental finding and implementation than a request, but this will certainly allow custom creature/NPC-specific items. You can also use this to bar certain creature/NPCs from picking up/using certain items. For more dynamic restriction on using certain items use the Forbid Item effect.


-----Externalise Item-Creature Exclusions [M, X]
Externalises creature-specific item restrictions to ITCREXCL.2DA.

ITCREXCL.2DA
Description
[ROWNAME]: Death variable/Script name of creature (not case-sensitive)
ITEM: the resource name of the item that the item-creature restrictions apply to
NO_PICKUP_E: if set to non-zero, the ITEM cannot be removed from any equipment slot of the creature with associated death variable
STRREF_PE: the string reference to display in the inventory screen when the ITEM is attempted to be removed from an equipment slot of the creature with associated death variable
ONLY_EQUIP: if set to non-zero, the ITEM can only be equipped by the creature with associated death variable (this is 'stackable', in that multiple ITEM entries under different death variables mean that multiple creature with associated death variables can equip the ITEM
STRREF_E: the string reference to display in when a creature other than that with the associated death variables tries to equip the ITEM
NO_PICKUP_I: if set to non-zero, the ITEM cannot be removed from any inventory slot of the creature with associated death variable
STRREF_I: the string reference to display in the inventory screen when the ITEM is attempted to be removed from an equipment slot of the creature with associated death variable
NO_DROP_I: if set to non-zero, the ITEM cannot be placed in any inventory slot of the creature with associated death variable
STRREF_DI: the string reference to display in the inventory screen when the ITEM is attempted to be placed in any inventory slot of the creature with associated death variable
NO_DROP_E: if set to non-zero, the ITEM cannot be placed in any equipment slot of the creature with associated death variable
STRREF_DE: the string reference to display in the inventory screen then the ITEM is attmpted to be placed in any equipment slot of the creature with associated death variable

For example,
	ITEM	NO_PICKUP_E	STRREF_PE	ONLY_EQUIP	STRREF_E	NO_PICKUP_I	STRREF_I	NO_DROP_I	STRREF_DI	NO_DROP_E	STRREF_DE
MINSC	MISC84	1	10218	1	10218	1	10218	0	-1	0	-1
Item MISC84 cannot be removed from "Minsc"'s equipment slots or inventory slots, and can only be equipped by "Minsc".

Options:
-0: disabled
-1: enabled

Edited by Ascension64, 15 January 2011 - 01:20 AM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#2 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 15 January 2011 - 06:57 AM

Way cool - and so, so much easier than trying to get a convergence of allow/disallow to work!

#3 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 14 August 2011 - 03:59 AM

Here are some differences between GemRB and ToBEx with semi-compatible features.

item_use.2da in gemrb is the equivalent of ITCREXCL.2DA in ToBEx

Description: This table lists special items that won't be dropped by certain actors.

Columns:
USER - the scripting name of the playable character
STRREF - the displayed string
FLAGS - actions disabled
1 - named actor cannot remove it
2 - anyone else cannot equip it
4 - can only swap it for something else
Rows: Item resrefs
Example:
2DA V1.0
*
	USER	STRREF  FLAG
MISC84	*    	10218	3
MISC88	ALORA	10219	2
MISC89	*   	10222	3
SW1H13	XAN	10220	2
AROW14	ELDOTH	10221	2 

Bit 4 was required for PST.
Avenger

#4 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 07 February 2012 - 12:10 AM

If anyone is currently using this hack in their mod, could you please let me know ASAP. I will be re-implementing this hack to more closely reflect GemRB's item_use.2da.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#5 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 07 February 2012 - 03:01 AM

This is the revised hack.

-----740 Externalise Item-Creature Exclusions [M, X]
Externalises creature-specific item restrictions to ITEM_USE.2DA.

ITEM_USE.2DA
Description
[ROWNAME]: the resource name of the item that the item-creature restrictions apply to
USER: 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 # applies
FLAG: bitfield indicating the type/s of restriction to apply

FLAG 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

For 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".

Options:
-0: disabled
-1: enabled

Note that this isn't quite the same as GemRB, in that if you use bit1, you should set STRREF2 rather than just using STRREF.

Edited by Ascension64, 07 February 2012 - 03:11 AM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#6 Turambar

Turambar
  • Modder
  • 935 posts

Posted 10 February 2012 - 07:14 AM

What version will start using the revised hack?
I could use that in DSotSC, as an optional component

Turambar

Currently supporting: DSotSC for BGT, NTotSC - forum

Turambar's fixes and tweaks for BG2, BGT, DSotSC, NTotSC, SoBH and more!

 

Before posting questions (even regarding posts written by myself), please look at Jarno Mikkola's FAQs for the Megamods!
(how to correctly report CTDs)

 


vipersig.jpg


#7 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 10 February 2012 - 02:06 PM

The proper beta 0023 release.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#8 Eric P.

Eric P.

    Journeyman Modder

  • Member
  • 1178 posts

Donator

Posted 11 February 2012 - 06:47 AM

How is this preferable to editing .cre files in NI?

Working and playing on a Mac Pro 6,1 running Mac OS X 10.13.6 High Sierra, and a Mac Pro 3,1 running Mac OS X 10.11.6 El Capitan.

~Buion na 'ell! I serve with joy! Your eyes and ears I shall be. Let us hunt together!~
- Erysseril Gwaethorien: a joinable, romanceable NPC mod for BGII - SoA/ToB, in sporadic development.

A female elf warrior of nature and a Bhaalspawn cross paths during their quests, joining forces to share adventure and companionship. Will they find more?


#9 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 11 February 2012 - 02:53 PM

Just three examples.

1. Say I have an NPC mod 'Coo'. Coo has a specific item 'Cuck' that I want to keep in Coo's quick items (like Minsc's Boo). Whenever a player tries to pick up Cuck, I want it to display a STRREF specific to picking up Coo. You can't do that by just editing the item or the cre.
2. Say I have an NPC mod 'Spade Wielder' who has the unique item 'Spade'. Only Spade Wielder can wield the spade. The only way to only infallibly allow Spade Wielder to wield the item is to set an item_use.2da entry for it.
3. Say I have an NPC 'Cadaverphobia' who just hates carrying corpses. You would need to set an item_use.2da entry for each corpse in order to prevent the player from dropping corpses into Cadaverphobia's inventory. You won't be able to restrict by item type in the cre here because corpses are all misc and that would prevent putting books, etc. in the inventory.

Edited by Ascension64, 11 February 2012 - 02:53 PM.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)


#10 Avenger_teambg

Avenger_teambg
  • Member
  • 604 posts

Posted 03 March 2012 - 04:15 AM

If there is still room to modification, please consider the single strref approach.
If you absolutely need different strrefs for an item/actor pair, you can still have them by two entries with disjunct action flags. (None of the standard engine hardcoded uses needed this).
You just have to add the action flags to the filter too (if you haven't already).

About the action flags, i will consider using yours. Our Bit 2 is simply saying: you can remove this item only if you drop another in its place. (You can only swap it).
So, it is a kind of 'cannot remove' equipped flag (like your bit 3), except that it is still swappable.
Avenger

#11 Ascension64

Ascension64
  • Modder
  • 5983 posts

Posted 06 April 2012 - 06:04 PM

I don't think there is a right answer to this.
I have included support for a single strref approach if modders don't supply a valid strref for a non-bit 1 action flag (I have neglected to include this in the description above). So in effect, I have provided the most flexible option available.
The disadvantage is that the 2DA has lots of other less intuitive columns due to the names of the columns.
The action flags I have implemented are based directly off what the original coding allowed me to do. Many aren't in use, but at least provides modders further flexibility for unusual cases.

--------------
Retired Modder
Note: I do not respond to profile comments/personal messages in regards to troubleshooting my modifications. Please post on the public forums instead.

Baldur's Gate Trilogy-WeiDU and Mods
Throne of Bhaal Extender (TobEx)

Contributions: (NWN2) A Deathstalker (voice acting) - (IWD2) IWD2 NPC Project (soundset editing) - (Misc) SHS PC Soundsets (voice acting)
Legacy: (BG/Tutu/BGT) Beregost Crash Fixer 1.9 (18 Jul 10) - (BG2) Enable conversations with charmed/dominated creatures (18 Jul 10) - (BG2) Experience Corrections (18 Jul 10) - (Misc) Platform Conversion Utility RC2 (13 Feb 10)