PDA

View Full Version : [TSL]Appearance.2da: Locking NPC Equipment slots


stoffe
09-18-2005, 09:49 PM
original thread (http://www.lucasforums.com/showthread.php?t=152566)

Remember that this will only prevent the item from being unequipped/equipped on the inventory screen. A script calling ActionUnequipItem() will still remove it, and using ActionEquipItem() will put an item in that slot anyway.

Preventing an equipment slot from being changed by the player is done in the appearance.2da file on a per appearancetype basis by setting bitflags in the equipslotslocked column.

Add together the numbers in the Value column below for the slots you wish to lock and put the resulting sum in that column, where:

Slot: Value: Bitflag:
-------------- ------ --------------
Head 1 0000 0000 0001
Body 2 0000 0000 0010
Unknown 4 0000 0000 0100
Hands 8 0000 0000 1000
Right Weapon 16 0000 0001 0000
Left Weapon 32 0000 0010 0000
Unknown 64 0000 0100 0000
Left forearm 128 0000 1000 0000
Right forearm 256 0001 0000 0000
Implant 512 0010 0000 0000
Belt 1024 0100 0000 0000


Advanced:
As seen in the Bitflag column above the numbers are actually, when converted to binary, used to toggle on (1) and off (0) the different slots, where each slot is represented by a single bit in the value. When that particular bit is set to 1, the equipment slot it represents is locked. When it's set to 0, the slot can be changed.

So, in order to see which slots are locked for a particular appearance type you can use the standard Windows calculator (set to advanced mode in the menu), type in the value found in the colum and then click the "bin" radio button. The value will be shown in binary like above (with any leading zeroes stripped out), and you can check which bits are set to 1 against the above table.

Example: Locking both weapon slots (bit 5 and 6 from the right) would require the value 16+32 (0000 0001 0000 + 0000 0010 0000), resulting in the sum 48 (0000 0011 0000), where bits 5 and 6 are set to 1.