Reaper67 Posted March 18, 2013 Share Posted March 18, 2013 I don't know if this has already been requested, but I have yet to see this completed. The idea is to script a bow that adds and equips a unique arrow, then tracks the number of said arrow in the inventory so it can add and equip again once the number reaches zero. I figured out the first part (pretty simple OnEquipped script), but I'm lost on the tracking and "refresh" parts. No matter what I try it doesn't seem to work. I've tried tying the refresh script to OnAttack, nothing. I tried using OnUpdate, nothing. I even tried using a global variable that is managed by a spell that is added when the bow is equipped, still nothing. I would like to build this mod on my own, but could use a little scripting help. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 18, 2013 Share Posted March 18, 2013 First off you don't want to wait till reaching zero of a particular arrow. If you do, the bow will auto-change to another arrow in the inventory. You need to add more when the count reaches 1 instead. Would be helpful to see the scripts that you have attempted to work with as well as what object those scripts are attached to. Link to comment Share on other sites More sharing options...
Reaper67 Posted March 18, 2013 Author Share Posted March 18, 2013 I don't have the scripts on hand, as I have deleted the mods that were using them (got fed up). I can try to recreate them though... OnAttack method:Scriptname (assoc. with bow) extends objectblablabla Ammo Property arrowname Auto Event OnEquipped(Actor akActor) If (akActor == Game.GetPlayer()) Game.GetPlayer().AddItem(arrowname, 1, True) Game.GetPlayer().EquipItem(arrowname, 1) EndIfEndEvent Event OnAttack(Actor akActor) If (akActor == Game.GetPlayer()) Game.GetPlayer().AddItem(arrowname, 1, True) Game.GetPlayer().EquipItem(arrowname, 1) EndIfEndEvent Event OnUnEquipped(Actor akActor) 'same if statement' Game.GetPlayer().RemoveItem(arrowname, 10) EndIfEndEvent I think this one would work if I used 2 rather than 1, based on what you told me. If you still need to see the other, much longer, scripts, I'll try to recreate them. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 18, 2013 Share Posted March 18, 2013 There is no OnAttack event that I know of. It isn't listed on the Creation Kit's Papyrus wiki pages. At any rate to track how many of a known item that the player has use GetItemCount. If you were to use an update cycle on a player alias script on a dummy quest, you could in theory keep track of the arrows and replenish them as necessary. Of course if you are completely removing the arrows when the bow is no longer equipped then you'll have to check for that as well on the player alias script, or pass a global variable value to indicate when it is safe to add more arrows etc... Link to comment Share on other sites More sharing options...
Reaper67 Posted March 20, 2013 Author Share Posted March 20, 2013 I get how GetItemCount works, but I have messed with OnUpdate very little and quest scripting not at all. If you could give a short description, or just post links it would be much appreciated. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 21, 2013 Share Posted March 21, 2013 Check this mod out. It was released just the other day. One of the character's bow/quiver is described as repelenishing indefinitely. Perhaps there is something there that you can glean from. Or failing that, perhaps the author might be able to give you insight. I see no sense in re-inventing the wheel if it has already been done.http://skyrim.nexusmods.com/mods/32751 Link to comment Share on other sites More sharing options...
Reaper67 Posted March 21, 2013 Author Share Posted March 21, 2013 I asked the author and he said that he just gave the NPC 1,000,000 arrows. I'm thinking that I'll have to make a quest, but I don't know the first thing about aliases and such. Help please! Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 21, 2013 Share Posted March 21, 2013 Is that all he did? That's kinda lame if you ask me. What happens if they run out? :P Decide first if the arrows are going to be unique to that bow only... If the arrows will be unique... Do an on equipped event on the bow.Add X number of the arrow to the playerForce equip the arrows and set so player cannot removeDo a while loop and add 1 arrow so long as the bow is equippedPerhaps include a wait so that it isn't always adding arrows Do an on unequipped event on the bowGet count of the arrows and remove them That might work, depending upon how long the bow is equipped the player could end up with TONS of arrows. Use the Creation Kit wiki and see if you can't figure out the scripting first. Link to comment Share on other sites More sharing options...
Reaper67 Posted March 21, 2013 Author Share Posted March 21, 2013 I understand the scripting you're referring to, but I don't know much about the while loop, wait or tieing get count into remove item (do you just type player.removeitem(blabla, getitemcont)?). Link to comment Share on other sites More sharing options...
Reaper67 Posted March 21, 2013 Author Share Posted March 21, 2013 Also the arrows will be unique. Link to comment Share on other sites More sharing options...
Recommended Posts