Jump to content

How to change the equipment slots ?


Recommended Posts

how to effectively use the "GetEquipmentSlot" (OBSE) ?

 

here is my f*#@ed up script :

====================

scn aaaArissaQuestScript

short ArissaQ
short Count
ref ArissaRobe

begin gameMode
if (ArissaQ == 0)
AddTopic aaaArissaIntro
set ArissaQ to 1
endif
end

begin gameMode
set Count to 1
set ArissaRobe to 18
if aaaArissaRef.GetIsCurrentPackage aaaArissaPractice01 || aaaArissaRef.GetIsCurrentPackage aaaArissaPractice02 || aaaArissaRef.GetIsCurrentPackage aaaArissaPractice03
ArissaRobe.GetEquipmentSlot aaaArissaPracticeRobe
else
ArissaRobe.GetEquipmentSlot aaaArissaMageRobe
endif
if aaaArissaRef.GetCurrentAIProcedure == 13
aaaArissaRef.SetIgnoreFriendlyHits 1
endif
End

=================

Link to comment
Share on other sites

Judging by the script you posted, it would appear as if you were using the GetEquipmentSlot command. The GetEquipmentSlot command returns the equipment slot for the item. You would want to use the Set version to set it, as in, SetEquipmentSlot. That might help.

 

Other than that, your script looks a bit odd. Are both GameMode blocks in the same script? And what is it that the script is supposed to do?

Link to comment
Share on other sites

GetEquipmentSlot returns the SlotCode of the item it is called on, that is what slots it occupies.

 

Its usual way of use is to "set" a variable to the returned value, like so:

 

 

let slotCode := GetEquipmentSlot itemID

(Hint, when used with BaseItems instead of actual inventory item references, if that's even possible, do not use GetEquipmentSlot with the "reference.GetEquipmentSlot" notation. Always use "GetEquipmentSlot baseItem" instead.)

 

Your script is not going to do anything with the returned SlotCode though, from all I can see. And as you already set the "ArissaRobe" variable to "18", the SlotCode of common robes usually, it begs the question why GetEquipmentSlot is even intended to be used to begin with.

 

But ArissaRobe is a "ref" variable, so setting it to "18" does set it to the reference with FormID "00000018", which possibly is some item in the Oblivion.esm, but I can't tell which one it is or why you're doing this either. What GetEquipmentSlot returns is a "short" value, for what it's worth.

 

To make a long story short, if you indeed want to get the SlotCode of the slots a specific item is occupying, then use it like I explained above.

But if you want to get the item that is currently occupying a specific slot, you'll have to use a different function for that, for example GetEquippedObject.

Link to comment
Share on other sites

Thank you, Drake. That was a great explanation. Maybe I should also elaborate a bit, I managed to sound a bit harsh, sorry about it. :blush:

 

To add to my "what is the script supposed to do" question, I meant that the script looks like as if you were trying to change the equipment slots for two distinct items - aaaArissaPracticeRobe and aaaArissaMageRobe - and do it for the first one during practise AI packages, the for the second one when not doing any practise. So I was wondering if you wanted - instead - to equip one robe during practise, and the other one when not practising. As Drake mentioned, the script looks like as if the manipulation of equipment slots would not necessarily have been the thing you were after (although it could have been, it just looks interesting at the moment).

 

For example, if you wanted to set the equipment slot ID for your aaaArissaPracticeRobe to occupy only upper body, then you might use something like this:

SetEquipmentSlot 2 aaaArissaPracticeRobe

And if you wanted it to occupy both upper and lower body, you would use something like this:

SetEquipmentSlot 18 aaaArissaPracticeRobe

But if you just wanted to equip items, you would probably need some variation of the EquipItem command (and in that case, you would not need to do any equipment slot manipulation):

ArissaActorRef.EquipItem aaaArissaPracticeRobe 1   ; <-- where 1 might help keep the item equipped (or might not)

If that makes any sense. Drake is so much better at explaining things. Actually, everyone is - and they are far less annoying than me while at it. :happy:

Edited by Contrathetix
Link to comment
Share on other sites

  • Recently Browsing   0 members

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