Nwn2fixes


#102

yep & yep.

// Stores info on item about current possessor and slot equipped.
void RememberEquippedItem(object oPossessor, int iSlot)
{
    object oItem = GetItemInSlot(iSlot, oPossessor);
    if (GetIsObjectValid(oItem))
    {
        SetLocalInt(oItem, LAST_SLOT_NUM, iSlot + 1);
        SetLocalObject(oItem, LAST_SLOT_OBJ, oPossessor);
    }
}

// Stores info on all equipped items of possessor.
void RememberEquippedItems(object oPossessor)
{
    int iSlot = INVENTORY_SLOT_HEAD;
    for (; iSlot != NUM_INVENTORY_SLOTS; ++iSlot)
    {
        RememberEquippedItem(oPossessor, iSlot);
    }
}

// Restores item to slot last remembered.
void RestoreEquippedItem(object oPossessor, object oItem, int bReset = TRUE)
{
//  object oPossessor0 = GetLocalObject(oItem, LAST_SLOT_OBJ);

    int iSlot = GetLocalInt(oItem, LAST_SLOT_NUM);
    if (iSlot)
    {
        AssignCommand(oPossessor, ActionEquipItem(oItem, iSlot - 1));
        if (bReset)
        {
            DeleteLocalInt(oItem, LAST_SLOT_NUM);
            DeleteLocalObject(oItem, LAST_SLOT_OBJ);
        }
    }
}

// Restores all inventory items to equipment slot last remembered if any.
void RestoreEquippedItems(object oPossessor, int bReset = TRUE)
{
    // NOTE: righthand must be equipped before lefthand.
    object oLh;

    int iSlot;
    object oItem = GetFirstItemInInventory(oPossessor);
    while (GetIsObjectValid(oItem))
    {
        iSlot = GetLocalInt(oItem, LAST_SLOT_NUM);
        if (iSlot - 1 != INVENTORY_SLOT_LEFTHAND)
            RestoreEquippedItem(oPossessor, oItem, bReset);
        else
            oLh = oItem;

        oItem = GetNextItemInInventory(oPossessor);
    }

    if (GetIsObjectValid(oLh))
        RestoreEquippedItem(oPossessor, oLh, bReset);
}

#103

@kevL_s
Good. Here are general scripts that need to be recompiled:

  • ga_remember_equipped
  • ga_unequip_hands
  • ga_unequip_slot
  • ga_reequip_all_items
  • ga_restore_equipped

Found a typo in your code:

    if (GetIsObjectValid(oLh))
        RestoreEquippedItem(oPossessor, oLeftHandItem, bReset);

Replace oLeftHandItem with oLh.


#104

Tarmas house quest will clear if you enter the house 2x or more.


#105

added fixes (untested) for Wizard’s Arsenal quest and Remember/Restore Equipped Items functs.

a) Wizard’s Arsenal quest should not be assigned if PC has already entered Tarmas’ house.
b) Handle head-slot properly. Avoid TMI error in RestoreEquippedItems().


#106

done.


#107

Lol, dat jokers from OEI (see code comments).


#108

[dam they’re blocking links to Culture Club vids]


#109

Not from this end. I presume you meant the one with these colourful lyrics -

Karma, karma, karma, karma, karma chameleon
You come and go, you come and go
Loving would be easy if your colors were like my dreams
Red, gold, and green, red, gold, and green

TR


#110

excellent  :D

(is that a guy?)

ps. I tried to listen to a Cindi Lauper video also but then my brain melted.


#111

Boy George. More recently he’s been a judge on the UK version of The Voice.

But enough of this divergence. Back on topic. Looking good.

TR