Jump to content

Advance One-Handed skill with punches (script)


Durai

Recommended Posts

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 float

EndFunction

 

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.

Endif

EndEvent

 

 

 

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

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 auto
perk property oneh1 auto
perk property oneh2 auto
perk property oneh3 auto
perk property oneh4 auto

float BUAD
float UAD
float OneH
float AR
float LV

Function OneH (Actor TargetActor)
OneH = TargetActor.GetBaseActorValue("OneHanded") as Float
EndFunction

Function LV (Actor TargetActor)
LV = TargetActor.GetLevel() as Float
EndFunction

Function BUAD (Actor TargetActor)
BUAD = TargetActor.GetBaseActorValue("UnarmedDamage") as Float
EndFunction

Function UAD (Actor TargetActor)
UAD = TargetActor.GetActorValue("UnarmedDamage") as Float
EndFunction

Event 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.")
endif
endEvent

Event OnUnEquipped(Actor akActor)
UAD(akActor)
BUAD(akActor)
if akActor == Game.GetPlayer()
Game.GetPlayer().ModAV("UnarmedDamage", -(UAD-BUAD))
; Debug.Notification("Unarmed Damage decreased.")
endif
endEvent

 

 

 

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

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 by FrankFamily
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...