WasiWasbourne Posted December 29, 2012 Share Posted December 29, 2012 I'm making a mod, and I want to instill a sort of magic quiver effect on one set of arrows. I tried to accomplish this by utilizing a player.additem, so that while it does stay at the same amount, the same arrow that was shot doesn't come back before it strikes home. My issue was that in order for the script to trigger, it had to hit a creature, and, while possibly useful, it isn't the effect I had intended on. Any help is greatly appreciated. Link to comment Share on other sites More sharing options...
The_Vyper Posted December 30, 2012 Share Posted December 30, 2012 It sounds to me like you're trying to set things up so that the quiver never runs out of arrows. The problem with running scripts on arrows is that their scripts will only work if/when they strike a creature or NPC. The solution is to have a unique bow scripted to refill the quiver. It will need to be an Object Script attached directly to the bow rather than a magic script attached by an enchantment. The script would look like this: Scriptname WasiInfiniteArrowBowScript Short CurrentCount Short BaseCount Short AddCount short myStat Begin OnEquip set myStat to 1 End Begin OnUnEquip set myStat to 0 End Begin GameMode if myStat == 1 Set CurrentCount to Player.GetItemCount ArrowID ;replace ArrowID with the EditorID of your arrow Set BaseCount to XX ;replace XX with whatever amount you want the quiver to have If CurrentCount < BaseCount Set AddCount to BaseCount - CurrentCount Message " " Message " " ;the double Message segment prevents the ItemAdded message from displaying Player.Additem ArrowID AddCount ;replace ArrowID as described above endif endif End This will get you the "unlimited arrows" effect, but there are two drawbacks: 1. Only bows with this script will replenish the arrow supply, so your arrow count will decrease if you use a bow that doesn't utilize this script.Solution: re-equip the scripted bow when running low on that particular arrow to replenish your supply. Not the ideal solution, but it works. 2. If you enchant a bow that uses this script, the bow will lose the script and cease to replenish the arrow supply.Solution: Give the bow an enchantment of its own so the Player can't add one. Again, not necessarily the ideal solution, but it still gets the job done. I've used this setup on multiple bows, so I know it works. :thumbsup: Link to comment Share on other sites More sharing options...
WasiWasbourne Posted January 2, 2013 Author Share Posted January 2, 2013 (edited) Thanks man, that's really helpful, I never even thought to write the script on the bow.I noticed you used Short and short for variables, and they were coloured differently. Is there a difference? If so, could you explain it? Edited January 3, 2013 by WasiWasbourne Link to comment Share on other sites More sharing options...
The_Vyper Posted January 6, 2013 Share Posted January 6, 2013 (edited) Thanks man, that's really helpful, I never even thought to write the script on the bow.You're welcome! :D I'm glad I was able to help. I noticed you used Short and short for variables, and they were coloured differently. Is there a difference? If so, could you explain it?"Short" is just a type of variable. Its spelling is not case-sensitive as far as scripting goes, so there's really no difference between the two. The only reason the first three "Shorts" are a different colour from the fourth "short" is the capitalization. The [ code ] system here automatically colours things depending capitalization; all words that start with capitalized letters appear in purple, while words with all lower case letters appear blue or black, and numbers appear teal. Example: Purple Words blue and black words blue black and Purple words 111,111,111 Aside from being all lower case, I'm not entirely sure what specifically determines the blue and black colouring of the words. Edit: typo Edited January 6, 2013 by The_Vyper Link to comment Share on other sites More sharing options...
Recommended Posts