Aller au contenu

Photo

exclude creature items?


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
bealzebub

bealzebub
  • Members
  • 352 messages
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);
}
}

#2
Shaughn78

Shaughn78
  • Members
  • 637 messages
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));
}
}

#3
Shaughn78

Shaughn78
  • Members
  • 637 messages
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
bealzebub

bealzebub
  • Members
  • 352 messages
thanks Shaughn. Scripting makes my head explode. (Boom!)

#5
bealzebub

bealzebub
  • Members
  • 352 messages
Out of curiosity,   is  there an easy way to unsummon animal companions? or a comapnions animal companion? Are they considered henchmen?

#6
Shaughn78

Shaughn78
  • Members
  • 637 messages
There has to be a way. I haven't done it, but I would suggest looking into the banishment script.

#7
The Fred

The Fred
  • Members
  • 2 516 messages
I think they're just deleted.