Jump to content

Need help with a script Identifying/Removing Equipped weapons


RedxYeti

Recommended Posts

Im very new to scripting so bear with me.

 

I need help making a script that can identify or just flat out remove the weapon in the player characters hands

 

Using a form list breaks the quest.

 

It doesnt matter what happens to the weapon in the players hand because its forced into their hands earlier in the script and is a non essential item

 

Maybe i can use OnItemAdded to track the item placed in the hands?

 

tldr; i need to yeet the weapons in the players hands, no matter what they are but it cant go to the inventory

Link to comment
Share on other sites

        int ListSize = myFormList.GetSize()
        int CurrentItems = 0
        int ItemsLeft = 10; remove 10 items, change this to whatever number you want to remove
 
        while CurrentItems <= ListSize && ItemsLeft > 0
                Form CurrentItem1 = myFormList.GetAt(CurrentItems)
                int ItemCount = PlayerREF.GetItemCount(CurrentItem1)
 
                PlayerREF.RemoveItem(CurrentItem1, ItemsLeft)
                ItemsLeft -= ItemCount
                CurrentItems += 1
        endwhile

i was able to butcher this to my needs from the creation kit wiki for my own needs. its pretty jank tho.

Link to comment
Share on other sites

If this is all you want to do, then you could probably check for the currently equipped weapon, store that to a variable and then have RemoveItem remove that weapon. It will remove the equipped weapon, especially if that weapon is the only instance on the player. (if there's 2, I'd say it's a 50/50 chance it'll remove the unequipped one).

Link to comment
Share on other sites

Form ForLeft = Whoever.GetEquippedObject(0)

Form ForRight = Whoever.GetEquippedObject(1)

 

Then if they exist aka something is armed, you can do GetType() checks to know what to do

 

If its a spell, call UnequipSpell and declare it the appropriate hand slot

 

If its an item in right hand just unequip. If its something in their left hand I think the syntax is Whoever.UnEquipItemEx(ForLeft,2,False)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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