Skip to content

Auto identify

ForSeriousForSerious Member Posts: 508
The idea is simple enough: Upon opening creature remains, identify all items that the player has enough lore for.

I'm not sure if I can find the creature remains to put such a script there, and I wouldn't be surprised to learn that they're all unique to each creature. So this idea might be unreachable.

My next idea is to do the identification on death. This I know I have access to, but if you're in a party, the lore used will be of the killer. I suppose it wouldn't be too much of a stretch to use the highest lore in the party.

Anyway, can I put a script on all the creature remains?

Comments

  • QuilistanQuilistan Member Posts: 192
    what about in the OnAcquireItem event in the module properties? The Player would have to pick up the item.
  • ForSeriousForSerious Member Posts: 508
    edited July 8
    I thought of that. It doesn't stack items because they're already in the inventory by the time they get identified.

    Now that I think of it, the server I played on the most, had something like that. You'd pick up an item, and if it could be stacked, it would delete it after a bit and make the main stack heavier. Those were special items, but I could do something similar with normal items.
  • ForSeriousForSerious Member Posts: 508
    Going the module level on acquire item route, I had a thought. Instead of trying to figure out if they already have an incomplete stack after identifying, I should be able to give the item back to the container it came from and have the container give it right back.
  • QuilistanQuilistan Member Posts: 192
    Sounds interesting. Care to share the script?
  • ForSeriousForSerious Member Posts: 508
    I opened a can of worms with this one. So far, I can force the player to examine the item, but that's only after a delay. There's no way that I know of to close the examine window for the player.
    Since I want to avoid that, the only way to get the lore required to identify something is probably in the json version of the item. I haven't dug into that yet. If it's not reported there, I might be out of luck for the moment.

    It's a real shame that ActionUseSkill(SKILL_LORE) was never considered as identifying objects. That would make the identifying part easy.
  • ForSeriousForSerious Member Posts: 508
    Okay. This seems to be working. It's only meant for taking items from containers.
    Add this to the module OnAcquireItem script.
    object oItem = GetModuleItemAcquired();
    object oPossessor = GetModuleItemAcquiredBy();
    object oTakenFrom = GetModuleItemAcquiredFrom();
    if(GetIsObjectValid(oTakenFrom) && !GetIdentified(oItem))
        {
            int iSkill = GetSkillRank(SKILL_LORE, oPossessor);
            string sGold = Get2DAString("skillvsitemcost", "DeviceCostMax", iSkill);
            SetIdentified(oItem, TRUE);
            int iMax = StringToInt(sGold);
            int iValue = GetGoldPieceValue(oItem);
            if(iMax <= iValue)
            {
                SetIdentified(oItem, FALSE);
            }
            int iMaxStack = StringToInt(Get2DAString("baseitems", "Stacking", GetBaseItemType(oItem)));
            if(GetIdentified(oItem) && iMaxStack > 1)
            {
                AssignCommand(oPossessor, ActionGiveItem(oItem, oTakenFrom));
                DelayCommand(0.1, AssignCommand(oTakenFrom, ActionGiveItem(oItem, oPossessor)));
            }
        }
    

    Note: The item has to be identified before you can get the gold piece value of it. There must be a delay between the container getting the item and it giving it back. I tried having the player take the item back, but it closed the container; Super annoying.
  • QuilistanQuilistan Member Posts: 192
    So taking and giving back the item is for the purpose of stacking it, correct? (example: if it is a potion or something else that is stackable in the inventory.)

    Without that the player would just have to stack the item themselves?
  • ForSeriousForSerious Member Posts: 508
    edited July 14
    Yes it's just for stacking. Without it, it would be the same as identifying items that can stack that are already in your inventory. I didn't want to try and re-invent the stacking logic, but it is still doable if you want to avoid moving the item again.
  • QuilistanQuilistan Member Posts: 192
    Thank you for sharing. I am starting to get much better at scripting, but getting confirmation on stuff like this really helps.

Sign In or Register to comment.