Companion's inventory

Hello !
I would like to know how to forbid the player from modifying some parts (head, chest…) of the inventory of a companion. Not all the inventory, like for henchmen, but some parts only.
Woul be helpful for “unusual” compagnions like lizards or animals or anything.
Thanks (and excuse my english, as usual) !

You could use the equip/unequip scripts.

For example, assuming the head is given via a helmet tagged “lizardhead”:

    // i_lizardhead_ue
    /*

    	Script to prevent unequipping the helm (lizard head) via the inventory

    	02 Nov 2020
    */



    void main()
    {
    	// * This code runs when the item is unequipped
    	object oPC      = GetPCItemLastUnequippedBy();
    	object oItem    = GetPCItemLastUnequipped();
    	AssignCommand(oPC, SpeakString("<color=magenta>I don't want to lose my head!</color>"));
    	object oItemInSlot 	= GetItemInSlot(INVENTORY_SLOT_HEAD, oPC);
    	if (oItemInSlot != OBJECT_INVALID) //unequip the new helm first, if any
    	{
    		AssignCommand(oPC, ActionUnequipItem(oItemInSlot));
    	}
    	// revert to the previously worn helm
    	AssignCommand(oPC, ActionEquipItem(oItem, INVENTORY_SLOT_HEAD));
    }
2 Likes

Okay it looks great ! Where do I put this script ?

In your module, or your campaign directory.
Make sure it’s called i_itemtag_ue.

i for Item
itemtag to be replaced by the actual tag of the item
ue for UnEquip

And of course change INVENTORY_SLOT_* accordingly (HEAD, CHEST, etc… depending on the body armor you want to keep).

2 Likes

There are a couple of boxes on the creature’s properties saying never show, helmet and never show armour that will make them always appear the same no matter what they’re wearing. Just change their appearance to match what you want in the armor set tab of properties ( last tab ) and they’ll never change from that, it’s also the easiest way to make npc’s so you don’t have to “dress” them via the inventory.

2 Likes

True, but in that case bracers/gloves and boots will never appear either.

1 Like

It seems weird to allow some items and not to see their visual.
Another solution : could give restrictions to all items in the module.
The script of 4760 seems perfect !

On EXPANSION1, thereis an specific script to bear OKKU for do it :), just need Change the PC and parametres

2 Likes