thingy123 Posted February 23, 2014 Share Posted February 23, 2014 Hey guys I've been making my mod to make an enchantment for the bow so the bows could use bound arrows. These are the scripts (Thanks to KingsGambit and his help as well as his source files): Adds Bound Arrow ability to the the object Scriptname AddUnboundAbility extends ObjectReference{OnEquip Adds Ability}Spell Property boundArrow autoAmmo Property BoundBowFFSelf autoEvent OnEquipped(Actor akActor)If (akActor == Game.GetPlayer())Game.GetPlayer().AddSpell(boundArrow, false)EndIfEndEventEvent OnUnequipped(Actor akActor)If (akActor == Game.GetPlayer())Game.GetPlayer().RemoveSpell(boundArrow)Game.GetPlayer().removeitem(boundArrow,Game.GetPlayer().getItemCount(boundArrow), true)EndIfEndEvent This adds the arrows to the bow when the bow is equipped Scriptname AddUnboundArrow extends activemagiceffect{Replenish Arrows}Ammo Property boundArrow AutoEVENT OnEffectStart(Actor Target, Actor Caster)caster.additem(boundArrow,2, TRUE)caster.equipItem(boundArrow, TRUE, TRUE)endEVENT This removes the arrow when the bow is unequipped Scriptname UnboundArrowScript extends activemagiceffectAmmo Property boundArrow AutoEVENT OnEffectStart(Actor Target, Actor Caster)Game.GetPlayer().removeitem(boundArrow,Game.GetPlayer().getItemCount(boundArrow),abSilent = true)endEVENT I have been messing around with Magic Effects, and making these scripts to be script version, and made enchantment that uses the scripts. I've put the enchantment on test bow and loaded up the vanilla Skyrim (That is, Skyrim Legendary edition without mods). I've been finding these scripts do not activate as bound arrows do not appear on my bow. I've messed around with amulet, using Constant Effects and Fire and Forget contacts attributes in CK, but no success in my tests and experiments. I'm beginning to wonder if I did something wrong or I missed something somewhere. Is there any solutions I am not aware of for this issue? I just can't figure out how to make the bound arrows pop up for the bow in the enchantment. Also attached to this, is the image of the script for the bound Arrows in Magic Effects. Link to comment Share on other sites More sharing options...
Xander9009 Posted February 23, 2014 Share Posted February 23, 2014 The first script is messed up. It's got the spell and ammo properties types' switched and then BoundArrow is used as both a spell and as ammo later in the script. Second, you only need one script for this. The one on the magic effect that adds and removes the spell, and the one on the bow that equips, replenishes, and removes the arrows. The magic effect should be constant effect, target self, archetype script. Add this modified script to it. Make a new enchantment that uses this magic effect. Put that enchantment on the bow. Let us know what happens. (use a save game that has never seen the bow, enchantment, or any of the scripts before). Scriptname AddUnboundArrow extends activemagiceffect {Replenish Arrows} Ammo Property BoundArrow Auto Event OnEffectStart(Actor Target, Actor Caster) Game.GetPlayer().AddItem(BoundArrow,2, TRUE) Game.GetPlayer().EquipItem(BoundArrow, TRUE, TRUE) EndEvent Event OnEffectStart(Actor Target, Actor Caster) Game.GetPlayer().RemoveItem(BoundArrow, Game.GetPlayer().GetItemCount(BoundArrow), True) EndEvent Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) If ( akBaseItem == BoundArrow ) Game.GetPlayer().AddItem(BoundArrow,1, TRUE) EndIf EndEvent If you find it's leaving one bound arrow in your inventory after unequipping the bow, let me know. Link to comment Share on other sites More sharing options...
thingy123 Posted February 23, 2014 Author Share Posted February 23, 2014 @Xander9009Ah.. I'll modify the script now and let you know how it goes. I've been having a niggling feeling when I was reading the script. I've changed spell and ammo properties but the compile failed and I swapped them back and it worked. I was trying to figure out how I did it wrong. I'll try your new script now. Thanks, bro! Edit:Error in compiling: Starting 1 compile threads for 1 files...Compiling "AddUnboundArrow"...D:\Steam\steamapps\common\skyrim\Data\Scripts\Source\AddUnboundArrow.psc(11,0): script event oneffectstart already defined in the same stateNo output generated for AddUnboundArrow, compilation failed. Going to edit the script a little bit Edit 2: Scriptname AddUnboundArrow extends activemagiceffect{Replenish Arrows}Ammo Property BoundArrow AutoEvent OnEffectStart(Actor Target, Actor Caster)Game.GetPlayer().AddItem(BoundArrow,2, TRUE)Game.GetPlayer().EquipItem(BoundArrow, TRUE, TRUE)EndEventEvent OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)If ( akBaseItem == BoundArrow )Game.GetPlayer().AddItem(BoundArrow,1, TRUE)EndIfEndEvent Took out a script to get it to successfully compile, but CK's not letting me apply the script to enchantment unless I set it to Fire and Forget, Contact instead of Costant Effect, Self, and I'm trying to figure out how to put constant effect script on a enchantment to be put on enchantment.. as the test result with that script failed. Link to comment Share on other sites More sharing options...
Xander9009 Posted February 24, 2014 Share Posted February 24, 2014 (edited) Sorry, I didn't get an update. Next time, just go ahead and make a new post so I get a message about it. I failed to keep in mind that weapon enchantments can't be constant effect. The best way to do it in this case, then, would be to put a script directly on the bow to add and remove an ability which will maintain the ammo. The reason for this is that we need the event OnItemRemoved to work, and that'll only work on aliases, object references (including actors), and active magic effects. So, try this process: On the constant self magic effect you already have, check Hide in UI, and try adding this script: Ammo Property BoundArrow Auto Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) If ( akBaseItem == BoundArrow ) GetTargetActor().AddItem(BoundArrow,1, TRUE) EndIf EndEvent Put that effect on a constant effect self ability spell. Add this script to the bow: Ammo Property BoundArrow Auto Spell Property BoundArrowAbility Auto Event OnEquipped(Actor akActor) akActor.AddItem(BoundArrow,2, TRUE) akActor.EquipItem(BoundArrow, TRUE, TRUE) akActor.AddSpell(BoundArrowAbility, False) EndEvent Event OnUnequipped(Actor akActor) akActor.RemoveSpell(BoundArrowAbility) akActor.RemoveItem(BoundArrow,akActor.GetItemCount(BoundArrow), TRUE) EndEvent Make an empty fire and forget contact magic effect with a name and id. Check No Duration and No Magnitude, and No Area, give it the description you want to show up on the bow, then at the bottom, uncheck the spellmaking Magnitude and Duration. Make an enchantment with that effect. Now that I've written it out, I'm going to go test it myself as well. Edited February 24, 2014 by Xander9009 Link to comment Share on other sites More sharing options...
Xander9009 Posted February 24, 2014 Share Posted February 24, 2014 Well, I made a couple of typos, but those are fixed. I just tested it and it worked. Equipped the bow and I had arrows. No matter how fast I shot the bow, the script was faster, so I never ran out of arrows, meaning they were never unequipped and I never ran out. When I unequipped the bow or equipped a different weapon, even another bow, the arrows were removed long before I could use them. No notifications. I didn't check the Active Effects menu, but I don't think anything would show up in there with Hide UI checked. Note, bound arrows can't be picked up from the ground, but they do hang around on the ground. I don't know if you care about that, but they're just going to hang around until the area resets, probably. Link to comment Share on other sites More sharing options...
thingy123 Posted February 24, 2014 Author Share Posted February 24, 2014 Ah, I'll test the script that you updated and follow your instructions, then I'll look into the enchantment thing. I think having an amulet is good for that but how to add that to archers only in leveled lists.. Hmm. But for now, I'll figure out how to work it into the enchantment for the bows. Edit: I'll do this tomorrow.. A bit tired. Good night! Link to comment Share on other sites More sharing options...
Xander9009 Posted February 24, 2014 Share Posted February 24, 2014 Well, the script has to be on the weapon itself. The enchantment on the bow is just so they can't enchant it with something else. If you want them to be able to, or if you just don't want to use the enchantment, feel free to leave it out. It does nothing. It's just a placeholder. The script should work just fine on an amulet or something else that can be equipped. So you could easily put it on an amulet, bow, boots, whatever. Note that if you want the enchantment on the amulet, make sure to change the effect and enchantment types to constant effect. As far as putting it on an amulet and making the amulet appear on archers, you'd have to find a leveled list that appears on archers and only archers, and then add the amulet to it. You could do this manually, but it'll cause overwrite issues if they have another mod installed that changes that list. You can also do it through a script. It wouldn't conflict with anything, but it would be a tad more complicated, though not too bad. Link to comment Share on other sites More sharing options...
thingy123 Posted February 25, 2014 Author Share Posted February 25, 2014 *sigh* I'm feeling like a retard. Just tried similar things you did. Why were the scriptname and extends thingy missing? I'm just wondering Link to comment Share on other sites More sharing options...
Xander9009 Posted February 25, 2014 Share Posted February 25, 2014 I didn't put the scriptname because the scriptname can't be changed. When you make new script, you have to pick a name for it, and the Extends section should be filled in automatically, so I skipped that line. Did you get it working? Link to comment Share on other sites More sharing options...
thingy123 Posted February 25, 2014 Author Share Posted February 25, 2014 Nevermind. Been busy. I'm a bit tired, lol. I'll work on it now. Link to comment Share on other sites More sharing options...
Recommended Posts