Durai Posted December 7, 2015 Share Posted December 7, 2015 So I'm working on a mod for my brother so he can do a "Monk" playthrough of Skyrim. 2/3 of the script works as intended (after adjusting some values) but this last part has me stuck. float OneH Function OneH OneH = game.getav("One-Handed") as floatEndFunction Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \bool abBashAttack, bool abHitBlocked) if (akSource as weapon) Game.AdvanceSkill ("One-Handed", OneH/5) Debug.Notification("We gained XP!");Supposed to appear whenever attack connects. EndifEndEvent In short, the player's One-Handed skill should increase every time they strike an opponent bare handed. No increase ever occurs. If any of the code looks off, it's because I'm typing this from memory. This script is attached to gauntlets that the player character wears. However the notification never displays. The other scripts I have attached to the gauntlets work just fine (and display their notifications when the conditions have been met). Did I code it wrong, or should it not be attached to the gauntlets? If not, where should the script be attached to? Any help is greatly appreciated! Link to comment Share on other sites More sharing options...
IsharaMeradin Posted December 7, 2015 Share Posted December 7, 2015 OnHit is an event being received by the object that is being hit. i.e. a bandit, a table, a chair. The gauntlets may trigger the event if something else were to hit them. The event does not work in the way you want it to, sorry. Link to comment Share on other sites More sharing options...
dpgillam Posted December 7, 2015 Share Posted December 7, 2015 KainXavier has a stable mod that does this.One Handed Fists, #52634. look how he did it. Link to comment Share on other sites More sharing options...
Durai Posted December 10, 2015 Author Share Posted December 10, 2015 So I worked out a way to do what I wanted, even if it resorted to creating unarmed "weapons" and giving them a scripted enchant. However I have a new problem that I need help with: Scriptname _IronKnuckle_A extends ObjectReference perk property oneh0 autoperk property oneh1 autoperk property oneh2 autoperk property oneh3 autoperk property oneh4 autofloat BUADfloat UADfloat OneHfloat ARfloat LVFunction OneH (Actor TargetActor) OneH = TargetActor.GetBaseActorValue("OneHanded") as FloatEndFunctionFunction LV (Actor TargetActor) LV = TargetActor.GetLevel() as FloatEndFunctionFunction BUAD (Actor TargetActor) BUAD = TargetActor.GetBaseActorValue("UnarmedDamage") as FloatEndFunctionFunction UAD (Actor TargetActor) UAD = TargetActor.GetActorValue("UnarmedDamage") as FloatEndFunctionEvent OnEquipped(Actor akActor) OneH(akActor) LV(akActor) If Game.GetPlayer().HasPerk(oneh4) Game.GetPlayer().ModAV("UnarmedDamage", ((LV*1.5)*(1+OneH/100)*(2))) Elseif Game.GetPlayer().HasPerk(oneh3) Game.GetPlayer().ModAV("UnarmedDamage", ((LV*1.5)*(1+OneH/100)*(1. :cool:)) Elseif Game.GetPlayer().HasPerk(oneh2) Game.GetPlayer().ModAV("UnarmedDamage", ((LV*1.5)*(1+OneH/100)*(1.6))) Elseif Game.GetPlayer().HasPerk(oneh1) Game.GetPlayer().ModAV("UnarmedDamage", ((LV*1.5)*(1+OneH/100)*(1.4))) Elseif Game.GetPlayer().HasPerk(oneh0) Game.GetPlayer().ModAV("UnarmedDamage", ((LV*1.5)*(1+OneH/100)*(1.2))) Else Game.GetPlayer().ModAV("UnarmedDamage", ((LV*1.5)*(1+OneH/100))); Debug.Notification("Unarmed Damage increased.") endifendEventEvent OnUnEquipped(Actor akActor) UAD(akActor) BUAD(akActor) if akActor == Game.GetPlayer() Game.GetPlayer().ModAV("UnarmedDamage", -(UAD-BUAD)); Debug.Notification("Unarmed Damage decreased.") endifendEvent I created a formula to boost unarmed damage when the player equips the fist "weapon" I made. However, if the player uses any item that boosts unarmed damage (Gloves of the Pugilist) and they unequip the fists first, then enchanted gloves, their unarmed damage gets messed up. The problem can be fixed by unequiping the enchanted item and then equiping/unequiping the fists, but this can be immersion breaking. Is there a way for me to script it so the fists store the first value of unarmed damage before any enchanted items buff them? I was thinking of storing the initial value as an int, but I can't remember how that works, or if it works at all. Any help is appreciated! Link to comment Share on other sites More sharing options...
FrankFamily Posted December 11, 2015 Share Posted December 11, 2015 (edited) Question, why do you even need a script?, you need to fortify unarmed damage (depending on level) while your fist is equipped, right?, then why not make a magic effect for fortify unarmed, and add multiple instances of it in a spell with getlevel conditions, so the effect depends on level. Now you need to add the spell/ability while the fist is equipped, which can also be done scriptless: Make a dummy magic effect for the enchantment of your weapon, on the magic effect there's a "Equip ability" drop down menu on the bottom of the interface, add there you fortify unarmed ability. Should add the abiltiy whenever the weapon is equipped. And you don't risk ruining the values. About your script, from experience you cannot really rely on OnEquipped/OnUnequipped, they won't run if the item is equipped with hotkeys, so it ends up messing stuff. Edited December 11, 2015 by FrankFamily Link to comment Share on other sites More sharing options...
Recommended Posts