axfvh Posted November 23, 2013 Share Posted November 23, 2013 would it be possible to make an item that periodically changes its enchantment to random positive or negative effects...you know like the wabbajack but in apparel formi would imagine a script set to remove the item and add another version at the set interval of time...maybe the time period could even be randomized Link to comment Share on other sites More sharing options...
Xander9009 Posted November 23, 2013 Share Posted November 23, 2013 (edited) Should be easily possible the way you already mentioned. Neat idea, too. It's set up for ten rings. That's easily expandable. If you use more, you'll need to increase the 10 in RandomRing's RandomInt to the proper number of rings and then continue both functions so they work for whatever number you need. If you use less than 10, just lower the RandomRing's RandomInt to whatever number you need and fill in the rings in order. Don't need to erase the extra, but you can if you want). Put it on each ring and fill all the properties the same on each one (meaning, to remove itself, the equipped ring needs to be set as a property). There might have been a more eloquent way to go about it, but this was only 10 minutes of work. Event OnEquip(Actor akActor) RegisterForSingleUpdate(5) EndEvent Event OnUnequip(Actor akActor) UnregisterForSingleUpdate() Endevent Event OnUpdate() If ( Utility.RandomInt(1, 100) == 1 ) RemoveAllRings(akActor) GiveRandomRing(akActor) Else RegisterForSingleUpdate(5) EndIf EndEvent Function RemoveAllRings() akActor.RemoveItem(ring1, akActor.GetItemCount(ring1)) akActor.RemoveItem(ring2, akActor.GetItemCount(ring2)) akActor.RemoveItem(ring3, akActor.GetItemCount(ring3)) akActor.RemoveItem(ring4, akActor.GetItemCount(ring4)) akActor.RemoveItem(ring5, akActor.GetItemCount(ring5)) akActor.RemoveItem(ring6, akActor.GetItemCount(ring6)) akActor.RemoveItem(ring7, akActor.GetItemCount(ring7)) akActor.RemoveItem(ring8, akActor.GetItemCount(ring8)) akActor.RemoveItem(ring9, akActor.GetItemCount(ring9)) akActor.RemoveItem(ring10, akActor.GetItemCount(ring10)) EndFunction Function GiveRandomRing() Int RandomRing = Utility.RandomInt(1, 10) If ( RandomRing == 1 ) akActor.AddItem(ring1, 1) akActor.EquipItem(ring1) ElseIf ( RandomRing == 2 ) akActor.AddItem(ring2, 1) akActor.EquipItem(ring2) ElseIf ( RandomRing == 3 ) akActor.AddItem(ring3, 1) akActor.EquipItem(ring3) ElseIf ( RandomRing == 4 ) akActor.AddItem(ring4, 1) akActor.EquipItem(ring4) ElseIf ( RandomRing == 5 ) akActor.AddItem(ring5, 1) akActor.EquipItem(ring5) ElseIf ( RandomRing == 6 ) akActor.AddItem(ring6, 1) akActor.EquipItem(ring6) ElseIf ( RandomRing == 7 ) akActor.AddItem(ring7, 1) akActor.EquipItem(ring7) ElseIf ( RandomRing == 8 ) akActor.AddItem(ring8, 1) akActor.EquipItem(ring8) ElseIf ( RandomRing == 9 ) akActor.AddItem(ring9, 1) akActor.EquipItem(ring9) ElseIf ( RandomRing == 10 ) akActor.AddItem(ring10, 1) akActor.EquipItem(ring10) EndIf EndFunction Armor Property ring1 Auto Armor Property ring2 Auto Armor Property ring3 Auto Armor Property ring4 Auto Armor Property ring5 Auto Armor Property ring6 Auto Armor Property ring7 Auto Armor Property ring8 Auto Armor Property ring9 Auto Armor Property ring10 Auto Oh, and lets say you want the rings to be impossible to remove if it has a negative effect. Here's the modified version for that. Although, I don't know if it'll work properly, though it should. It'll need tested. To make this one work, it'll need the first script on each ring with the same properties and the second one on each ring with that ring's unique properties including a reference to itself (I have yet to manage to successfully call the item the script is attached to as an object, so just fill the property and it should work fine). Event OnEquip(Actor akActor) RegisterForSingleUpdate(5) EndEvent Event OnUnequip(Actor akActor) UnregisterForSingleUpdate() Endevent Event OnUpdate() If ( Utility.RandomInt(1, 100) == 1 ) RemoveAllRings(akActor) GiveRandomRing(akActor) Else RegisterForSingleUpdate(5) EndIf EndEvent Function RemoveAllRings() akActor.RemoveItem(ring1, akActor.GetItemCount(ring1)) akActor.RemoveItem(ring2, akActor.GetItemCount(ring2)) akActor.RemoveItem(ring3, akActor.GetItemCount(ring3)) akActor.RemoveItem(ring4, akActor.GetItemCount(ring4)) akActor.RemoveItem(ring5, akActor.GetItemCount(ring5)) akActor.RemoveItem(ring6, akActor.GetItemCount(ring6)) akActor.RemoveItem(ring7, akActor.GetItemCount(ring7)) akActor.RemoveItem(ring8, akActor.GetItemCount(ring8)) akActor.RemoveItem(ring9, akActor.GetItemCount(ring9)) akActor.RemoveItem(ring10, akActor.GetItemCount(ring10)) EndFunction Function GiveRandomRing() Int RandomRing = Utility.RandomInt(1, 10) If ( RandomRing == 1 ) akActor.AddItem(ring1, 1) ElseIf ( RandomRing == 2 ) akActor.AddItem(ring2, 1) ElseIf ( RandomRing == 3 ) akActor.AddItem(ring3, 1) ElseIf ( RandomRing == 4 ) akActor.AddItem(ring4, 1) ElseIf ( RandomRing == 5 ) akActor.AddItem(ring5, 1) ElseIf ( RandomRing == 6 ) akActor.AddItem(ring6, 1) ElseIf ( RandomRing == 7 ) akActor.AddItem(ring7, 1) ElseIf ( RandomRing == 8 ) akActor.AddItem(ring8, 1) ElseIf ( RandomRing == 9 ) akActor.AddItem(ring9, 1) ElseIf ( RandomRing == 10 ) akActor.AddItem(ring10, 1) EndIf EndFunction Armor Property ring1 Auto Armor Property ring2 Auto Armor Property ring3 Auto Armor Property ring4 Auto Armor Property ring5 Auto Armor Property ring6 Auto Armor Property ring7 Auto Armor Property ring8 Auto Armor Property ring9 Auto Armor Property ring10 Auto Bool Property SilentlyEquip = True Auto Bool Property CantBeRemoved = False Auto Armor Property Ring Auto Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) If ( akNewContainer as Actor ) (akNewContainer as Actor).EquipItem(Ring, CantBeRemoved, SilentlyEquip) EndIf EndEvent This also adds a variable to decide for each ring if it should be silently equipped. The default is true but easily changeable. Edited November 23, 2013 by Xander9009 Link to comment Share on other sites More sharing options...
axfvh Posted November 24, 2013 Author Share Posted November 24, 2013 oh wow thanks for all that, i've never done anything like this before so would i just compile the script and create the items mentioned in it in an esp? Link to comment Share on other sites More sharing options...
Xander9009 Posted November 24, 2013 Share Posted November 24, 2013 You'd make the rings with their own unique enchantments, and then on each ring, add the script and fill the properties. On the FIRST ring you add the script to, you'll have to add a script, and choose [new script] and give it a name. Paste in the first script and save with ctrl-s. If it compiles, great, if not, let me know. Do the same with the second script for each ring. Save the ESP and play it in game. Of course, at that point, the rings will only be obtainable by using the console, but at least you can test if they work. If you need a more detailed walkthrough or just need something specific clarified, let me know. Link to comment Share on other sites More sharing options...
Recommended Posts