Jump to content

Arrows/bolts and quivers


Recommended Posts

To help with my undress/re-equip scripts I'm trying to add quiver/arrow functionality but all my online searches for info keep giving me other mods!

So:

a) my conclusion is that arrows/bolts aren't armour/weapons and don't use armour/weapon slots - is this correct?

b) my conclusion is that quivers also aren't amour and don't use armour slots - is this correct?

 

c) given the above, how does (if at all) a script identify equipped arrows/bolts and equipped quivers?

d) if it is possible to obtain the id for these items, what script function will 'equip' them?

 

diziet

Link to comment
Share on other sites

Arrows and bolts (referred to as ammo from here on) are not armor objects nor are the quivers themselves. The quivers are actually tied to the specific ammo (i.e. the quiver and ammo are within the same NIF file). Changing the ammo changes the quiver. Ammo are projectile records. Furthermore, the game does not always automatically equip the ammo in the most logical of methods.

 

For original Skyrim I have a mod called Aesthetic Bolt Quiver. This mod hides the real ammo object within the player body and equips an armor object that looks like a full bolt quiver at the user selected body slot and position (back or hip). It utilizes the OnObjectEquipped event on an actor alias script (works with player, follower and up 20+ currently loaded random Dawnguard crossbow wielding NPCs) to catch the real ammo and then it equips the "fake" ammo.

 

Also for original Skyrim I have a mod called Inventory Management System which includes containers to store both bolts and arrows. This utilizes two formlist that are filled with the respective ammo types. I have an optional TES5Edit script which will scan all active plugins and build a patch file filling these formlists in the process. Without using the TES5Edit script, the OnItemAdded event catches ammo as it is obtained and adds it to their respective formlists. The player can then use the MCM menu to designate what order they want their ammo to be equipped (a different list for each is filled) and since there is no ammo in the player inventory but in the respective containers only the target ammo gets transferred and equipped.

 

All that to say, you can look into those mods if you wish to see my scripting. Without more information on what you are wanting to do, I cannot give any more than some examples that may or may not do something similar to what you have mentioned.

Link to comment
Share on other sites

All that to say, you can look into those mods if you wish to see my scripting. Without more information on what you are wanting to do, I cannot give any more than some examples that may or may not do something similar to what you have mentioned.

What I want to do is detect any equipped/visible quiver that is on the player when entering a trigger box, make a note of it, unequip/hide it and re-equip it when leaving.

With weapons, shields, spells, armour this is easy. I have no idea how to interrogate the player for an equipped quiver/arrows.

It's interesting that the quiver is linked to the arrows. This suggests that I need to detect only any equipped arrows.

 

diziet

Link to comment
Share on other sites

Yes, you would need to look for the equipped ammo and un-equip them. The quivers will disappear too.

 

None of the GetEquipped... functions will return ammo. They all look for whatever is in the right, left or shout positions. If you do not mind using SKSE we can utilize this custom function to obtain the currently equipped ammo of the passed in actor

 

 

Ammo Function GetEquippedAmmo(Actor Dude)
    ;this function returns the ammo equipped by the passed in actor otherwise it returns NONE
    Ammo Entry = NONE
    Int Z = Dude.GetNumItems()
    Int Y = 0
    While Y < Z
        If Dude.GetNthForm(Y) as Ammo
            Entry = Dude.GetNthForm(Y) as Ammo
            If Dude.IsEquipped(Entry)
                Y = Z ; only one ammo can be equipped once gotten advance count to exit early
            EndIf
        EndIf
        Y += 1
    EndWhile
    Return Entry
EndFunction

 

You would store the result locally on your script so that you can un-equip and later re-equip as you see fit.

Link to comment
Share on other sites

Yes, you would need to look for the equipped ammo and un-equip them. The quivers will disappear too.

 

None of the GetEquipped... functions will return ammo. They all look for whatever is in the right, left or shout positions. If you do not mind using SKSE we can utilize this custom function to obtain the currently equipped ammo of the passed in actor

 

 

Ammo Function GetEquippedAmmo(Actor Dude)
    ;this function returns the ammo equipped by the passed in actor otherwise it returns NONE
    Ammo Entry = NONE
    Int Z = Dude.GetNumItems()
    Int Y = 0
    While Y < Z
        If Dude.GetNthForm(Y) as Ammo
            Entry = Dude.GetNthForm(Y) as Ammo
            If Dude.IsEquipped(Entry)
                Y = Z ; only one ammo can be equipped once gotten advance count to exit early
            EndIf
        EndIf
        Y += 1
    EndWhile
    Return Entry
EndFunction

 

You would store the result locally on your script so that you can un-equip and later re-equip as you see fit.

Ok, this looks good, I even think I understand it! At least I now know what to read up on: GetNthForm :smile:

For a newbie modder like myself this is really good learning stuff,

I would like to use this at some point in my later version of my mod with your permission.

 

diziet

Link to comment
Share on other sites

I just read the reference at https://www.creationkit.com/index.php?title=GetNthForm_-_ObjectReference

reading the notes states that passing an index to GetNthForm of 3 will return NONE if GetNumItems returns 2, this implies that the index runs from 1,

but the example script at the bottom on that page seems to imply that the index runs from 0 (much like arrays I guess): in the while loop it places iFormIndex -= 1 _before_ not after using the index in GetNthForm.

 

could you confirm either way for me please?

 

diziet

Link to comment
Share on other sites

I just read the reference at https://www.creationkit.com/index.php?title=GetNthForm_-_ObjectReference

reading the notes states that passing an index to GetNthForm of 3 will return NONE if GetNumItems returns 2, this implies that the index runs from 1,

but the example script at the bottom on that page seems to imply that the index runs from 0 (much like arrays I guess): in the while loop it places iFormIndex -= 1 _before_ not after using the index in GetNthForm.

 

could you confirm either way for me please?

 

diziet

Link to comment
Share on other sites

I just read the reference at https://www.creationkit.com/index.php?title=GetNthForm_-_ObjectReference

reading the notes states that passing an index to GetNthForm of 3 will return NONE if GetNumItems returns 2, this implies that the index runs from 1,

but the example script at the bottom on that page seems to imply that the index runs from 0 (much like arrays I guess): in the while loop it places iFormIndex -= 1 _before_ not after using the index in GetNthForm.

 

could you confirm either way for me please?

 

diziet

Link to comment
Share on other sites

  • Recently Browsing   0 members

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