Try...
void main()
{
object oPC = GetFirstPC();
object oArmor = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oArmor))
{
if( GetBaseItemType(oArmor) == BASE_ITEM_ARMOR )
{
SetPlotFlag(oArmor,FALSE);
DestroyObject(oArmor);
}
oArmor = GetNextItemInInventory(oPC);
}
if( GetIsObjectValid(GetItemInSlot(INVENTORY_SLOT_CHEST,oPC)) )
{
SetPlotFlag(oArmor,FALSE);
DestroyObject(oArmor);
}
}
Naming the variable oArmor when you are setting it equal to GetFirstItemInInventory() is misleading. In this case, oArmor is equal to whatever the first item is. Purely my preference, but I generally use oItem in an instance like this.
Also, you may need to check if they have an armor equiped already and destroy that too. Hope that helps.
Modifié par Terrorble, 27 avril 2013 - 11:37 .