Hi all,
I wrote this script to strip a characters and companions belongings, and place in a chest. The only problem is it also strips the creature items from animal companions. How would I go about either unsummoning animal comapnions, or excluding creature items? I can't seem to find the right function.
//strip character and companions belongings and place in captains_chest
void main()
{
object oPC = GetPCSpeaker();
object oTarget;
object Target1;
Target1 = GetFirstFactionMember(oPC, FALSE);
while (GetIsObjectValid(Target1))
{
oTarget = GetObjectByTag("captain_chest");
object oItem;
oItem = GetFirstItemInInventory(Target1);
while (GetIsObjectValid(oItem))
{
AssignCommand(oTarget, ActionTakeItem(oItem, Target1));
oItem = GetNextItemInInventory(Target1);
}
int nInt;
for (nInt=0; nInt<NUM_INVENTORY_SLOTS; nInt++)
{
oItem = GetItemInSlot(nInt, Target1);
if (GetIsObjectValid(oItem))
AssignCommand(oTarget, ActionTakeItem(oItem, Target1));
}
AssignCommand(oTarget, TakeGoldFromCreature(GetGold(oPC), oPC));
Target1=GetNextFactionMember(oPC, FALSE);
}
}
exclude creature items?
Débuté par
bealzebub
, nov. 11 2011 03:02
#1
Posté 11 novembre 2011 - 03:02
#2
Posté 11 novembre 2011 - 03:23
Put an if statement in your loop. Before you strip the item check the nInt (slot) and make sure it isn't 1 of the 4 creature slots 14-17 -hide, weapon bite, weapon L, weapon R.
for (nInt=0; nInt<NUM_INVENTORY_SLOTS; nInt++)
{
oItem = GetItemInSlot(nInt, Target1);
if(nInt != 14 ||nInt != 15 || nItn != 16 | nInt != 17)
{
if (GetIsObjectValid(oItem))
AssignCommand(oTarget, ActionTakeItem(oItem, Target1));
}
}
for (nInt=0; nInt<NUM_INVENTORY_SLOTS; nInt++)
{
oItem = GetItemInSlot(nInt, Target1);
if(nInt != 14 ||nInt != 15 || nItn != 16 | nInt != 17)
{
if (GetIsObjectValid(oItem))
AssignCommand(oTarget, ActionTakeItem(oItem, Target1));
}
}
#3
Posté 11 novembre 2011 - 03:26
Or an even easier solution, change nInt<NUM_INVENTROY_SLOTS; to nInt<14. The creature slots are the last 4 so everything under slot 14 you want to strip.
#4
Posté 11 novembre 2011 - 03:32
thanks Shaughn. Scripting makes my head explode. (Boom!)
#5
Posté 11 novembre 2011 - 05:35
Out of curiosity, is there an easy way to unsummon animal companions? or a comapnions animal companion? Are they considered henchmen?
#6
Posté 12 novembre 2011 - 01:51
There has to be a way. I haven't done it, but I would suggest looking into the banishment script.
#7
Posté 13 novembre 2011 - 10:14
I think they're just deleted.





Retour en haut







