Jump to content

Is there A Variable used for when ammo is unequipped?


Recommended Posts


scn OvadBowScript
short active
short Igot
short Iwant
short Ineed
Ref OvadArrow


Begin OnEquip
set active to 1
End

Begin OnUnEquip
set active to 0
End

Begin GameMode
If Active == 0

Endif

If active == 1
If onkeydown 256
set Ovadarrow to player.getequippedobject 17
Else
Return
endif

set Igot to Player.GetItemCount OvadArrow
set Iwant to 2
If Igot == 1 || Igot < 1
set Ineed to Iwant - Igot
player.additemNS OvadArrow Ineed
endif

endif

end

Begin MenuMode
If Active == 0

Endif
End

 

So I am attempting to make a Bow that will have unlimited arrows. The arrows will be whatever arrows the player has equipped, allowing the bow to use any arrow in game. This portion works well and I was able to fix my original issue I had ( and posted in a wrong Forum ) of the script freezing when the bow was unequipped. Is there a variable that can be used to determine if the ammo slot is empty, like using the equipment slot bit assignments?

Edited by CountryRoberts
Link to comment
Share on other sites

It is not working for the moment but maybe we should hint it to the xOBSE author that you need it?

GetEquipmentSlot - The Elder Scrolls Construction Set Wiki

 

Reserved values are currently nonfunctional and/or obsolete.

reserved
9 (weapon)
10 (back weapon)
11 (side weapon)
12 (quiver)

Edited by Pellape
Link to comment
Share on other sites

Thanks Guys. My thoughts were broadened and I changed the script to this:

scn OvadBowScript
short active
short Igot
short Iwant
short Ineed
Ref OvadArrow
Ref HadArrow



Begin OnEquip
	set Ovadarrow to player.getequippedobject 17
	set active to 1
End

Begin OnUnEquip
	set active to 0
End

Begin GameMode
	If Active == 0

	Endif

	If active == 1
	If onkeydown 256
		set Ovadarrow to player.getequippedobject 17
		If OvadArrow == 0
			If Player.getItemCount Arrow1Iron < 1
				Player.additemNS Arrow1Iron 1
			Endif
			Player.equipitemsilent Arrow1Iron 
			set Ovadarrow to player.getequippedobject 17
		Endif
	endif

		set Igot to Player.GetItemCount OvadArrow
		set Iwant to 2
			If Igot == 1 || Igot < 1
			set Ineed to Iwant - Igot
			player.additemNS OvadArrow Ineed
			endif

	endif
	
end

Begin MenuMode
	If Active == 0

	Endif
End

I will be tweaking this script more for perfection but minus a small arrow count bug( which I will be working on repairing) we now have a working bow that can shoot unlimited arrows regardless if vanilla or from a custom mod. as soon as I perfect this bow the stealth boots, and learn the dialog stuff I will upload my mod upon completing it.

Link to comment
Share on other sites

Cool. :)

 

One thought though...

	If Active == 0

	Endif

...is unnecessary both in the GameMode and in the MenuMode. The only reason you would use that check is if you want to exit the script faster with:

	If Active == 0
		return
	Endif

Otherwise, I suggest you delete them and delete the MenuMode section completely as it should not be needed at all.

Link to comment
Share on other sites

I am just happy that I am able to help, even if I do have a lot to learn myself and I do learn some really by trying to find solutions for others and sometimes I am all gone by the wind, out bicycling... It is also a good opportunity to get a break from tedious modding, that I am doing right now, editing 3D meshes. ;)

Link to comment
Share on other sites

The way you feel about your 3D meshes is how I feel with scripting at times( mostly when I think I have a great idea, but find out my knowledge base is insufficient for the set task, to the point that I have to search 6 hours worth of reading material because not knowing how to ask the question the correct way) but then I break down and post a question here and Pellape ( and others your not unloved, thats right DrakeThe Dragon, Mixxa77, and QQuiz I am calling yall out for the awesome help ya'll have been giving me) and I start to make progress again.

 

CS gets more action on my PC then the actual game does right now lol.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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