Jump to content

Need help with script for Werewolf amulet.


Durai

Recommended Posts

So shortly after Dawnguard was released for the PC, I worked on making an amulet for Werewolves that would allow them to be somewhat playable for a good portion of the game. I succeeded to an extent but because I'm no pro at scripting, there were some glaring issues with mod.

 

1. If I wear the amulet well after my first transformation, the script that is supposed to reset the stat increases causes my character to suffer from stat decreases.

2. Without a way to force the amulet to re-equip after reverting back to my original race, the stat increases can remain permanent (until the amulet is re-equipped and resets the stats).

 

I'm hoping someone here can help me rectify these mistakes so I can enjoy my mod as I originally intended. Here's the script that I was able to write so far:

 

Scriptname WerewolfAmulet001 extends ObjectReference  

Race Property WerewolfBeastRace Auto
GlobalVariable Property WasWerewolf Auto

float BaseHealth 
float BaseDResist
float BaseUnarmed
float BaseMResist

Function BaseHealth (Actor TargetActor)
       BaseHealth = TargetActor.GetBaseActorValue("Health") as Float
EndFunction

Function BaseDResist (Actor TargetActor)
        BaseDResist = TargetActor.GetBaseActorValue("DamageResist") as Float
EndFunction

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

Function BaseMResist (Actor TargetActor)
	BaseMResist = TargetActor.GetBaseActorValue("MagicResist") as Float
EndFunction

Event OnEquipped(Actor akActor)
       BaseHealth(akActor)
       BaseDResist(akActor)
        BaseUnarmed(akActor)
       if akActor == Game.Getplayer()
               If WasWerewolf.Value == 1
                       Game.GetPlayer().ModAV("DamageResist", -200)
                       Game.GetPlayer().ModAV("Health", - 100)
                           Game.GetPlayer().ModAV("UnarmedDamage", - 25)
			Game.GetPlayer().ModAV("MagicResist", -35)
                       WasWerewolf.SetValue(0)
               Else
                       Game.GetPlayer().SetAV("Health", BaseHealth)
                       Game.GetPlayer().SetAV("DamageResist", BaseDResist)
                           Game.GetPlayer().SetAv("UnarmedDamage", BaseUnarmed)
			Game.GetPlayer().SetAV("MagicResist", BaseMResist)
               EndIf
       endif
endEvent

Event OnUnequipped(Actor akActor)
       If akActor == Game.GetPlayer()
               If Game.GetPlayer().GetRace()==WerewolfBeastRace
                       WasWerewolf.SetValue(1)
                       Game.GetPlayer().ModAV("Health", 100)
                       Game.GetPlayer().ModAV("DamageResist", 200)
                           Game.GetPlayer().ModAV("UnarmedDamage", 25)
			Game.GetPlayer().ModAV("MagicResist", 35)
               EndIf
       EndIf
EndEvent

 

If someone/anyone can lend me a hand I'd be most appreciative. I'm trying to get the amulet to re-equip after the Werewolf transformation ends, as well as figuring out someway to prevent the script from decreasing stats if the amulet was not worn before the first transformation.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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