Jump to content

Carrying a fixed number of arrows


Hosseldon

Recommended Posts

I know there are workarounds like adding weight or the arrow famine setting in SkyTweak. But none of them quite cut it. Remember when you where sent to Bleak Fall Barrows for the first time not knowing what to expect, carrying just a bow and a few arrows? Remember that great feeling of realism when you run out of ammunitions and desperatly tried to run around picking up the bandit's arrows that missed you? Well, I want that sense of realism back. So, is there anybody out there with the skills to make the max amount of arrows you can carry a fixed number?
Nothing too fancy. Just something that let you tweak the max amount.
Or if you're feeling creative, maybe tying the max amount to your max stamina, and/or archery skill.
Now in an ideal world this mod would let you add other kind of items to a list based on the tags in the creation kit, so for example, you could add stuff added by mods like the weapons from Throwing Weapons Redux or the currently WIP Javelins by Soolie and set the max amount of those you can carry. But I'm not asking THAT much. If somebody knows how to do that and is willing to, that's just an awesome idea. In the meanwhile, i'll be satisfied nontheless if somebody just pick up the basic idea and do the arrow/bolt part.

Link to comment
Share on other sites

Anyone who wants to actually make the mod and release.....

Here is a head start

 

This script which would go on the player alias of a start game enabled quest has not been tested for compilation or function. It should limit the number of arrows/bolts the player carries. It does this by returning the excess to the source container. This script requires SKSE.

 

 

Scriptname RemoveExcessPlayerAmmo Extends ReferenceAlias
 
Actor Property PlayerRef Auto
Int Property MaxAmmo Auto
 
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
  If akBaseItem as Ammo
    Int QtyOnHand = GetPlayerAmmo()
    If QtyOnHand > MaxAmmo
      Int QtyRemove = MaxAmmo - QtyOnHand
      PlayerRef.RemoveItem(akBaseItem,QtyRemove,false,akSourceContainer)
      Debug.Notification("Max ammo reached.")
    EndIf
  EndIf
EndEvent
 
Int Function GetPlayerAmmo()
    Int AmmoNum = 0
    Int Index = 0
    While Index < PlayerRef.GetNumItems()
        Form Entry = PlayerRef.GetNthForm(Index)
        If Entry.GetType() == 42
            AmmoNum += PlayerRef.GetItemCount(Entry)
        EndIf
        Index += 1
    EndWhile
    Return AmmoNum
EndFunction

 

 

 

This script doesn't differentiate between ammo types. So if the max was 100, one could carry any combination of any arrow and any bolt (including those from mods) up to the quantity of 100.

Link to comment
Share on other sites

You can use the VendorItemArrow to avoid SKSE. Might also be better for compatibility reasons, as modders may potentially use ammo for some other type of item.

 

This is still not a complete script as you'll definitely want to use states to avoid issues with players grabbing multiple stacks of arrows at once.

scriptname LFG_ArrowLimiterScript extends ReferenceAlias

keyword property VendorItemArrow auto
GlobalVariable property ArrowLimit auto

message property ArrowLimitReached auto

Actor Me

int i

Event OnInit()

	Me = GetActorReference()

endEvent

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)

	if(akBaseItem.HasKeyword(VendorItemArrow))
		i = Me.GetItemCount(VendorItemArrow)
		if(i > ArrowLimit.value as int)
			i -= ArrowLimit.value as int
			if(akSourceContainer)
				Me.RemoveItem(akBaseItem, i, true, akSourceContainer)
			else
				Me.DropObject(akBaseItem, i)
			endif
			ArrowLimitReached.show()
		endif
	
	endif

endEvent
Edited by lofgren
Link to comment
Share on other sites

I've decided to add this function to my current big project which means I might as well release it independently.

 

The question is how many arrows are reasonable?

 

I have created the mod so that the limit can be edited if desired, but I need to choose a default starting value.

 

I did about five minutes of research and found:

 

Skyrim quivers hold 6 visible arrows.

 

Modern hunters typically carry 5-6 arrows in a quiver.

 

Soldiers in the middle ages carried roughly 20-25 arrows.

 

All of these numbers sound pretty restrictive for Skyrim. My initial setting was 100, which might be excessive.

 

IsharaMeridin, if you're interested, here is the script I ultimately created:

scriptname LFG_ArrowLimiterScript extends ReferenceAlias

keyword property VendorItemArrow auto

GlobalVariable property LFGArrowLimit auto

formlist property ArrowTypeFormList auto

message property LFGArrowLimitReached auto

Actor Me



Event OnInit()

	Me = GetActorReference()
	if(SKSE.GetVersion())
		RegisterforSingleUpdate(1.0)
	endif
endEvent

Event OnUpdate()
	gotostate("busy")
	form f
	int n = Me.GetNumItems()
	while(n)
		n -= 1
		f = Me.GetNthForm(n)
		if(f.HasKeyword(VendorItemArrow))
			if(!ArrowTypeFormList.HasForm(f))
				ArrowTypeFormList.AddForm(f)
			endif
		endif
		
		
	endWhile
	gotostate("ready")
	CullArrows(Me)
	debug.notification("Arrow limit initialized.")
endEvent

auto state ready
	Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
		if(!akBaseItem.HasKeyword(VendorItemArrow) || akItemReference)
			return
		endif
		

		if(!ArrowTypeFormlist.HasForm(akBaseItem))
			ArrowTypeFormlist.AddForm(akBaseItem)
		endif

		if(CullArrows(Me, akBaseItem, akSourceContainer))
			LFGArrowLimitReached.show()
		endif

	endEvent

endstate

bool function CullArrows(actor A, form f = none, ObjectReference O = none)
	
	int i = A.GetItemCount(ArrowTypeFormList)
	i -= LFGArrowLimit.value as int
	if(i <= 0)
		return false
	else
		int c
		int n
		if(f)
			c = A.GetItemCount(f)
			if(c)
				if(c > i)
					c = i
				endif
				if(O)
					A.RemoveItem(f, c, true, O)
				else
					O = A.DropObject(f, c)
					O.SetActorOwner(A.GetActorBase())
					O = none
				endif
				i -= c
			endif
		endif
		
		n = ArrowTypeFormList.GetSize()
		
		while(i && n)
			n -= 1
			f = ArrowTypeFormList.GetAt(n)
			c = A.GetItemCount(f)
			if(c)
				if(c > i)
					c = i
				endif

				if(O)
					A.RemoveItem(f, c, true, O)
				else
					O = A.DropObject(f, c)
					O.SetActorOwner(A.GetActorBase())
					O = none
				endif
				i -= c
			endif
		endwhile
		
	endif
	
	return b
endFunction

state busy
	bool function CullArrows(actor A, form f = none, ObjectReference O = none)
		return false
	endFunction
	Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
		if(akBaseItem.HasKeyword(VendorItemArrow) && !akItemReference)
			if(!ArrowTypeFormlist.HasForm(akBaseItem))
				ArrowTypeFormlist.AddForm(akBaseItem)
			endif

		endif
	endEvent

endState

Edited by lofgren
Link to comment
Share on other sites

Thank you for your answers! I also have done some research and 25 arrows might be the most realistic setting. But maybe that number is only for hardcore players. 50 could be more manageable, and 100 is the amount of bound arrows you get from a bound bow spell. But i think I run out of bound arrows only one time in 3 years of gameplay, so that might be too many. I think the best way to handle it would be starting with 25 and then expand the number as you progress in the game. For example you could carry more depending on archery skill or max stamina or a perk (but a perk would bring incompatibility with perk mods). But in the end, the most important thing is that, no matter what level you are, you should run out of arrows very often.

Link to comment
Share on other sites

A constant number is fine. But if making it dependent on carry weight is not too much work i'd like to see it as an optional file (or a deactivable feature?). I'm curious about how well that would give you a sense of progression. Also, if carry weight influence the max amount of arrows you can carry that means that you have to decide if it's worth it to have a fortify carry weight on your gear or you prefer some other enchantment. It could add a bit of depth to you gear choices.

Link to comment
Share on other sites

My concern with carry weight is that many users, including myself, use mods that drastically alter the carry weight system, or add plentiful carry weight bonuses such as those from Frostfall, Wet & Cold, or Bandoliers. So it's not just another feature I have to add, it's another configurable feature, because if it is not configurable then it won't be useful to a lot of users. For example in my game I typically get to 300 carry weight sometime after level 60, so obviosuly there's no setting that would be useful for both me and somebody using vanilla.
Link to comment
Share on other sites

The next step would be to limit the amount of "stuff"you can pick up as loot. It really is very unrealistic that you can carry 20 swords, 20 axes, 20 magic staves, etc., etc. in your inventory.

Especially as money is so unimportant in Skyrim. I have >1M gold coins, and no way to spend it all!

 

I like how the Witcher limited you to only one additional sword to take as loot.

 

Carrying a backpack, bandoliers, etc. would start becoming immersive, but not just for the weight you can carry. It should not be possible to carry all that junk!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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