//Created by Genisys 5/4/08 //Updated 2/14/09 (Found bugs!!) //This OnActivateItem script works off the resref name of the items equipped. //It allows those polymorphed who die to unequip all items and equip them again //with just the use of this item. (Believe me I know how frustrating that is!) #include "x2_inc_switches" //PROTOTYPE DECLARED void EquipAllUnequipedItems(object oTarget); void main () { //Declare All Major Variables object oPC; oPC = GetItemActivator(); object oItem1, oItem2, oItem3, oItem4, oItem5, oItem6, oItem7, oItem8, oItem9, oItem11, oItem12; AssignCommand(oPC, ClearAllActions()); //Add this code to bypass my weapon swapping script.. SetLocalInt(oPC, "SWAPPING", 1); DelayCommand(10.0, SetLocalInt(oPC, "SWAPPING", 0)); if ((GetItemInSlot(INVENTORY_SLOT_NECK, oPC) != OBJECT_INVALID)) { oItem1 = GetItemInSlot(INVENTORY_SLOT_NECK, oPC); SetLocalInt(oItem1, "NECK", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_NECK, oPC))); } if ((GetItemInSlot(INVENTORY_SLOT_BELT, oPC) != OBJECT_INVALID)) { oItem2 = GetItemInSlot(INVENTORY_SLOT_BELT, oPC); SetLocalInt(oItem2, "BELT", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_BELT, oPC))); } if ((GetItemInSlot(INVENTORY_SLOT_BOOTS, oPC) != OBJECT_INVALID)) { oItem3 = GetItemInSlot(INVENTORY_SLOT_BOOTS, oPC); SetLocalInt(oItem3, "BOOTS", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_BOOTS, oPC))); } if ((GetItemInSlot(INVENTORY_SLOT_CHEST, oPC) != OBJECT_INVALID)) { oItem4 = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC); SetLocalInt(oItem4, "CHEST", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC))); } if ((GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC) != OBJECT_INVALID)) { oItem5 = GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC); SetLocalInt(oItem5, "CLOAK", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC))); } if ((GetItemInSlot(INVENTORY_SLOT_HEAD, oPC) != OBJECT_INVALID)) { oItem6 = GetItemInSlot(INVENTORY_SLOT_HEAD, oPC); SetLocalInt(oItem6, "HEAD", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_HEAD, oPC))); } if ((GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC) != OBJECT_INVALID)) { oItem7 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC); SetLocalInt(oItem7, "L_HAND", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC))); } if ((GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC) != OBJECT_INVALID)) { oItem8 = GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC); SetLocalInt(oItem8, "L_RING", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC))); } if ((GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC) != OBJECT_INVALID)) { oItem9 = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC); SetLocalInt(oItem9, "R_HAND", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC))); } if ((GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC) != OBJECT_INVALID)) { oItem11 = GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC); SetLocalInt(oItem11, "R_RING", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC))); } if ((GetItemInSlot(INVENTORY_SLOT_ARMS, oPC) != OBJECT_INVALID)) { oItem12 = GetItemInSlot(INVENTORY_SLOT_ARMS, oPC); SetLocalInt(oItem12, "ARMS", 1); AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_ARMS, oPC))); } //Finally, have the PC equip all of the items after a delay.. DelayCommand(1.5, EquipAllUnequipedItems(oPC)); //Main Script End } ////////////////////////////////////////////////////////////// //PROTOTYPE DEFINED void EquipAllUnequipedItems(object oTarget) { object oItem; float fFloat = 0.5; //Loop through and find each item which was unequiped.. //Then assign the PC the action to equip it. //Then reset the variable to 0 oItem = GetFirstItemInInventory(oTarget); while(GetIsObjectValid(oItem)) { //Increment the float time by 0.1 second each time we loop fFloat += 0.1; if(GetLocalInt(oItem, "NECK") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_NECK))); SetLocalInt(oItem, "NECK", 0); } else if(GetLocalInt(oItem, "HEAD") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_HEAD))); SetLocalInt(oItem, "HEAD", 0); } else if(GetLocalInt(oItem, "CLOAK") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_CLOAK))); SetLocalInt(oItem, "CLOAK", 0); } else if(GetLocalInt(oItem, "ARMS") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_ARMS))); SetLocalInt(oItem, "ARMS", 0); } else if(GetLocalInt(oItem, "BELT") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_BELT))); SetLocalInt(oItem, "BELT", 0); } else if(GetLocalInt(oItem, "BOOTS") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_BOOTS))); SetLocalInt(oItem, "BOOTS", 0); } else if(GetLocalInt(oItem, "CHEST") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_CHEST))); SetLocalInt(oItem, "CHEST", 0); } //NOTE: Right hand must go before left hand!! else if(GetLocalInt(oItem, "R_HAND") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_RIGHTHAND))); SetLocalInt(oItem, "R_HAND", 0); } else if(GetLocalInt(oItem, "R_RING") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_RIGHTRING))); SetLocalInt(oItem, "R_RING", 0); } //NOTE: Left hand must go after right hand! else if(GetLocalInt(oItem, "L_HAND") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_LEFTHAND))); SetLocalInt(oItem, "L_HAND", 0); } else if(GetLocalInt(oItem, "L_RING") == 1) { DelayCommand(fFloat, AssignCommand(oTarget, ActionEquipItem(oItem, INVENTORY_SLOT_LEFTRING))); SetLocalInt(oItem, "L_RING", 0); } else { //Do nothing :) } oItem = GetNextItemInInventory(oTarget); } //Protoype End }