MSFD Disabling ability to equip an item
[no fix] PCSkipEquip (is short variable)
Short PCSkipEquip
Set PcSkipEquip to 1
Set this to 1 to skip equipping object. Good for popping up messages for breaking seals on books and such. For an extended example look at the SealedTreasuryReport script in the editor. Its also great for using e.g. clothing objects as script triggers in connection with the OnPCEquip function (see my climbing mod for an example, the climbing gear is actually a belt, but of course cannot be equipped).
Note: Apparently equipping a book in inventory sets this to one (instead of setting OnPCEquip to one, as it should). See tips and tricks section.
There is a bug associated with using this, that leads to duplication of the item that has the SkipEquip function. I have seen this happen both with QuickKey usage and when normally equipping items from the inventory when OnPCEquip is also called. To bypass this, reset the inventory by adding and removing a dummy item (from within the section of the script that checks the OnPCEquip function). Do not remove the item with the script itself, as this causes a crash (see RemoveItem function). If you have a lot of SkipEquip items, make the item call a global script (StartScript) that adds and removes the item, e.g.:
Begin doubling_fix
Player->Additem "Item ID", 1
Player->RemoveItem "Item ID", 1
StopScript doubling_fix
End
Sample Script: Here is a short script I made for a werewolf mod, it makes an item non-equippable under certain conditions:
Begin non_equippable
; keeps lycantrophic PC's from equipping werewolf hunter items for balancing reasons
; if the PC equips these before becoming a werwolf, he can wear them until he takes them off
; but then can't reequip them. So after the first transform he can't equip them again
short PCSkipEquip
short OnPCEquip
if ( PCWerewolf != 1 ); if player is not a ww, he can use the armor
set PCSkipEquip to 0
return
else
set PCSkipEquip to 1
endif
if ( OnPCEquip == 1 )
MessageBox "This item is enchanted with werewolf bane-spells. You can not wear it!"
set OnPCEquip to 0
endif
End