Jump to content

Identifying equipped items


Recommended Posts

So I'm having a hard time finding a code that will identify and fill a form with an equipped item. Ultimately I'm trying to remove all currently equipped items from the player and transfer them to another container. These aren't specific references, just whatever they currently have equipped. I thought about using slot masks but I'm having a hard time identifying how exactly to do this because it seems that the slot mask changes based on which slots the model uses, so helms will have a varying slot mask if it uses head, hair, face, etc. Any help would be appreciated

Link to comment
Share on other sites

I seem to have the basics covered on acquiring the different helm types.

 

So you know if there is any way to poll BiPed location numbers? I know that the slot forms add up and are attached to properties for those slots in the armor script but I'm having a heck of a time seeing if there is a simpler way of having the unassigned slot using items be identified with this by a simpler means that basically adding each of their given slots together in various combinations lol.

Link to comment
Share on other sites

so I managed to get something working but there is a weird quirk I can't quite figure out. When I run this activator it sorts through all my slots and stores all normal slot items (helm, ring, boots, etc). It however seems to ignore unassigned slot locations, BUT if you activate it a second time with no standard slot items equipped, it will get all the other slots on the second pass, and I'm unsure why this is

 

 

String[] Function StoreAttire(Actor target)
    String[] wornForms = new String[30]
    int index
    int slotsChecked
;;;;;; commenting out these lines for some reason allows the second pass to function, if left active, the second pass does nothing
;   slotsChecked += 0x00100000
;   slotsChecked += 0x00200000 ;ignore reserved slots   
;   slotsChecked += 0x80000000
 
    int thisSlot = 0x01
    while (thisSlot < 0x80000000)
        if (Math.LogicalAnd(slotsChecked, thisSlot) != thisSlot)
            Armor thisArmor = target.GetWornForm(thisSlot) as Armor
                Game.GetPlayer().RemoveItem(ThisArmor, akothercontainer = CurContainer)
                slotsChecked += thisArmor.GetSlotMask()
            else ;no armor was found on this slot
                slotsChecked += thisSlot
            endif

        thisSlot *= 2 ;double the number to move on to the next slot
    endWhile
EndFunction
Link to comment
Share on other sites

Yay, I managed to figure it out when I debugged the papyrus, now everything is working perfectly :)

 

 

String[] Function StoreAttire(Actor target)
    String[] wornForms = new String[30]
    int index
    int slotsChecked
 
    int thisSlot = 0x01
    while (thisSlot < 0x80000000)
        if (Math.LogicalAnd(slotsChecked, thisSlot) != thisSlot) ;only check slots we haven't found anything equipped on already
            Armor thisArmor = target.GetWornForm(thisSlot) as Armor
        if thisArmor != NONE
                Game.GetPlayer().RemoveItem(ThisArmor, akothercontainer = CurContainer)
        endif
            else ;no armor was found on this slot
                slotsChecked += thisSlot
            endif

        thisSlot *= 2 ;double the number to move on to the next slot
    endWhile
EndFunction
Link to comment
Share on other sites

  • Recently Browsing   0 members

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