Jump to content

Problems with EquipItem()


Liaen

Recommended Posts

I'm trying to build a better version of the no helmet hack, one that works with Awakening and such but currently stuck...

 

This is the code for moving the items from cloak slot to helmet slot

oMember = oParty[i];
oCloakSlotItem = GetItemInEquipSlot(8, oMember);
oHelmetSlotItem = GetItemInEquipSlot(5, oMember);

// if there is an item in the cloak slot
if (IsObjectValid(oCloakSlotItem) == TRUE)
{
   // if there is an item in the helmet slot unequip it
   if (IsObjectValid(oHelmetSlotItem) == TRUE)
   {
       UnequipItem(oMember, oHelmetSlotItem);
   }
   // move the item from cloak slot to helmet slot
   iResult = EquipItem(oMember, oCloakSlotItem, 5);
   DisplayFloatyMessage(oMember, "Showing "+ObjectToString(oCloakSlotItem)+" on "+GetName(oMember)+" "+IntToString(iResult), FLOATY_MESSAGE, 0xffffff, 5.0);
}

And this is the code for moving the items from helmet slot to cloak slot

oMember = oParty[i];
oCloakSlotItem = GetItemInEquipSlot(8, oMember);
oHelmetSlotItem = GetItemInEquipSlot(5, oMember);

// if there is an item  in the helmet slot
if (IsObjectValid(oHelmetSlotItem) == TRUE)
{
   // Try to kick out any helm in the cloak slot
   if (IsObjectValid(oCloakSlotItem) == TRUE)
   {
       UnequipItem(oMember, oCloakSlotItem);
   }
   // move the item from helmet slot to cloak slot
   iResult = EquipItem(oMember, oHelmetSlotItem, 8);
   DisplayFloatyMessage(oMember, "Hiding "+ObjectToString(oHelmetSlotItem)+" on "+GetName(oMember)+" "+IntToString(iResult), FLOATY_MESSAGE, 0xffffff, 5.0);
}

 

As you can see they are almost identical... the Debug FloatyMessages display the status, name, itemid and the result of EquipItem function.

The thing is, in the first case it works, in the second it doesn't and I can't imagine why.

The Items are already in the cloak slot when I load my savegame so the first script works one time.

The second part always fails and the helmet stays in the helmet slot.

 

When I open and close the inventory it says something like

 

Showing 220669 on Alistair 1

Hiding 220669 on Alistair 0

 

The character oMember exists, the item o...SlotItem exists, the slot is valid in both cases, but the 0 at the end says that EquipItem(oMember, oHelmetSlotItem, 8); fails and I don't know why... any ideas?

 

Edit: Even when I use UnequipItem(oMember, oHelmetSlotItem); before, it doesn't work (just unequips them but doesn't equip, iResult is always 0)

No other Mods active, no stuff in override folder

 

Edit2: WTH Now I'm completely confused: If No Helmet Hack is active (but not loadet into origins because I did set it to ExtendedModuleUID="DAO_PRC_EP_1") then it works, I get both messages with 1 at the end... :wacko:

Link to comment
Share on other sites

The character oMember exists, the item o...SlotItem exists, the slot is valid in both cases, but the 0 at the end says that EquipItem(oMember, oHelmetSlotItem, 8); fails and I don't know why... any ideas?

 

Edit: Even when I use UnequipItem(oMember, oHelmetSlotItem); before, it doesn't work (just unequips them but doesn't equip, iResult is always 0)

 

Since cloak was an un-used/un-supported slot, is it possible they've removed support for it from EquipItem in Awakening? "If an incorrect slot is given or an invalid object is given the function will return 0" - maybe it's now considered an invalid slot.

 

EDIT: Or, alternately, did they change the bitm GDA def for helmets to not allow it to go into the cloak slot?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...