Jump to content

Photo

Need script help with unequipping items

script lakeview unequip item outfit slot

  • Please log in to reply
17 replies to this topic

#1
TJHammersmith

TJHammersmith

    Fan

  • Members
  • PipPipPip
  • 403 posts

I'm very much a newb when it comes to scripts and as one of my first ventures into the field, I'm trying to edit the scripts that come with this mod (https://www.nexusmod...yrim/mods/28515)

 

In the original mod, NPCs enter the pool or bath and unequip all items. I'm trying to edit the script so that they only unequip certain slots (e.g. 32 (body), 37 (feet)).

 

The mod only has three scripts:

 

1. uni_enabler

Spoiler
 
2. uni_poolunequip
Spoiler
 
3. un_reequipall
Spoiler
 
My logic was that if I edited uni_poolunequip, that should achieve my desired result and the trigger of entering and exiting the pool, and requipping all items upon exiting the pool shouldn't change. My thought was to replace the "who.unequipall()" with commands like "who.UnequipItemSlot(32)", but that simply hasn't worked.
 
Can anyone advise what I'm doing wrong and suggest how I can achieve my desired outcome?


#2
skyflash71

skyflash71

    Journeyman

  • Members
  • Pip
  • 20 posts

according to CK`s page you should be able to use this function to unequip the item from specific slot

Function UnequipItemSlot(int aiSlot) native

 

Try the Slot Mask to see if its working



#3
TJHammersmith

TJHammersmith

    Fan

  • Members
  • PipPipPip
  • 403 posts

according to CK`s page you should be able to use this function to unequip the item from specific slot

Function UnequipItemSlot(int aiSlot) native

 

Try the Slot Mask to see if its working

 

I tried replacing the who.unequipall() with who.UnequipItemSlot(32) and then who.UnequipItemSlot(0x00000004) but neither worked and the NPC's still continue to unequip everything.

 

Dull question - the mod in question uses a bsa file, but when using the edited scripts, I've left them in the loose folders. The loose folders take precedence over the bsa file, right?



#4
dylbill

dylbill

    Resident poster

  • Premium Member
  • 2,952 posts

If the NPC is still unequipping everything, it means the UnEquipAll function is still being used. Did you compile the script? Loose files should take precedence over BSA but to be sure you can unpack the BSA and then delete it. UnequipItemSlot(32) does unequip your body armor clothes. I was curious so I tested it out on the player and it worked.



#5
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 10,568 posts

If you are not, you may need to test your script changes on a new game.  Objects already loaded in a save file do not always recognize changes to their scripts.



#6
TJHammersmith

TJHammersmith

    Fan

  • Members
  • PipPipPip
  • 403 posts

 

according to CK`s page you should be able to use this function to unequip the item from specific slot

Function UnequipItemSlot(int aiSlot) native

 

Try the Slot Mask to see if its working

 

I tried replacing the who.unequipall() with who.UnequipItemSlot(32) and then who.UnequipItemSlot(0x00000004) but neither worked and the NPC's still continue to unequip everything.

 

Dull question - the mod in question uses a bsa file, but when using the edited scripts, I've left them in the loose folders. The loose folders take precedence over the bsa file, right?

 

 

 

If the NPC is still unequipping everything, it means the UnEquipAll function is still being used. Did you compile the script? Loose files should take precedence over BSA but to be sure you can unpack the BSA and then delete it. UnequipItemSlot(32) does unequip your body armor clothes. I was curious so I tested it out on the player and it worked.

 

I'm such an idiot. I had edited the scripts correctly, but hadn't realised they weren't being activated properly because of a load order issue in MO2. *sigh*

 

One additional question - if I want the NPC to unequip their weapon, what slot number do I use? Or is a different command required?


Edited by TJHammersmith, 20 December 2020 - 02:00 AM.


#7
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 10,568 posts

 

One additional question - if I want the NPC to unequip their weapon, what slot number do I use? Or is a different command required?

 

Does not require SKSE

Weapon NPCRightWeapon = NPC.GetEquippedWeapon()
Weapon NPCLeftWeapon = NPC.GetEquippedWeapon(true)
If NPCRightWeapon ; we got a valid object
  NPC.UnequipItem(NPCRightWeapon)
EndIf
IF NPCLeftWeapon ; we got a valid object
  NPC.UnequipItem(NPCLeftWeapon)
EndIf

These may be useful reading:

GetEquippedWeapon

GetEquippedShield

GetEquippedSpell



#8
maxarturo

maxarturo

    What does this even mean?

  • Supporter
  • PipPipPipPipPip
  • 2,913 posts
Sorry for my intervencion TJHammersmith with my issue.
 
About a year ago i made a simple unequip - equip items script for one of my pools, mainly cause players like this kind of stuff....
 
But i came across a weird issue, i did only two tests with an 'Overpowered' character i had back then.
 
The issue:
- The 'Overpowered' character had gear, mainly weapons / swords (i can't remember if this issue also happened with the armors), with enchantments way over what the vanilla game can produce, if i remember correctly the swords had like over 550+ points of enchantment damage, each enchantment.
 
After the gear was removed and then added back and force equip, the enchantments instead of 550+ points had 76 points of damage !!??.
 
I only did two tests and since i'm not really interested in this kind of stuff, i just said F*** IT !!!, i didn't bother myself to look for the cause or for a solution, as a matter of fact i deleted everything right away.
 
Now i'm thinking to add this feature again to that particular pool, since players like a lot this kind of stuff, but this time i'll add an option to let the player decide if she/he wants to run this feature.
 
If anyone has an idea what might be causing something like this, or where to start looking it would save me some precious time.
 
I don't know if this is relevant, but the set up went like this:
Unequip 'Equpped gear' and equipped them in a mannequin > the rest of the player's stuff were transferred into a container > then unequip the gear from the mannequin and force equip on the player > then transfer the rest of the stuff from the container to the player's inventory.
 
Thanks a lot for reading this, and again sorry TJHammersmith.
 
Merry christmas.

Edited by maxarturo, 20 December 2020 - 01:19 PM.


#9
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 10,568 posts

@Maxarturo

It is a known "bug" that the game does not apply player assigned enchantments when gear is equipped via script.  This is why SKSE has the EquipItemEX function.  It allows picking out a specific instance from a stack and equipping it. 

 

The following may resolve the issue completely, however:

Equip Enchantment Fix (SSE version)

Equip Enchantment Fix (LE version)



#10
maxarturo

maxarturo

    What does this even mean?

  • Supporter
  • PipPipPipPipPip
  • 2,913 posts
Thanks IsharaMeradin.
 
I wasn't aware of this vanilla issue / bug.
Well... live one more day to learn one more thing...
 
Thank you and merry christmas.






Also tagged with one or more of these keywords: script, lakeview, unequip, item, outfit, slot

IPB skins by Skinbox
Page loaded in: 4.047 seconds