Scriptname ProperWeaponScaleAlias extends ReferenceAlias  

Actor Property PlayerRef Auto

;Alternative shield scale, scale the shield in hand instead on the back, may cause problems with drawn shields
bool Property SHIELD_SOLUTION_ALT = false AutoReadOnly

string Property NINODE_RIGHT_HAND = "NPC R Hand [RHnd]" AutoReadOnly
string Property NINODE_LEFT_HAND = "NPC L Hand [LHnd]" AutoReadOnly

string Property NINODE_AXE = "WeaponAxe" AutoReadOnly
string Property NINODE_MACE = "WeaponMace" AutoReadOnly
string Property NINODE_SWORD = "WeaponSword" AutoReadOnly
string Property NINODE_DAGGER = "WeaponDagger" AutoReadOnly
string Property NINODE_WEAPON_BACK = "WeaponBack" AutoReadOnly
string Property NINODE_WEAPON = "WEAPON" AutoReadOnly
string Property NINODE_SHIELD = "SHIELD" AutoReadOnly

;Dual Sheath Nodes
string Property NINODE_AXE_LEFT = "WeaponAxeLeft" AutoReadOnly
string Property NINODE_MACE_LEFT = "WeaponMaceLeft" AutoReadOnly
string Property NINODE_SWORD_LEFT = "WeaponSwordLeft" AutoReadOnly
string Property NINODE_DAGGER_LEFT = "WeaponDaggerLeft" AutoReadOnly
string Property NINODE_SHIELD_BACK = "ShieldBack" AutoReadOnly
string Property NINODE_STAFF = "WeaponStaff" AutoReadOnly
string Property NINODE_STAFF_LEFT = "WeaponStaffLeft" AutoReadOnly

;Magic Nodes (unused) (May needed in later version)
string Property NINODE_RIGHT_MAGIC = "NPC R MagicNode [RMag]" AutoReadOnly
string Property NINODE_LEFT_MAGIC = "NPC L MagicNode [LMag]" AutoReadOnly

;RaceMenuPlugin Key
string Property BASE = "" AutoReadOnly
string Property RM_PLUGIN = "RSMPlugin" AutoReadOnly
string Property RMW_PLUGIN = "RMWPlugin" AutoReadOnly
string Property RMX_HAND_KEY = "RMX_Hand" AutoReadOnly

;Mod Keys
string Property PWS_PLUGIN = "PWS_PLUGIN" AutoReadOnly
string Property PWS_RMPLUGIN = "PWS_RMPLUGIN" AutoReadOnly
string Property PWS_RMWEAPON = "PWS_RMWEAPON" AutoReadOnly
string Property PWS_HANDS = "PWS_HANDS" AutoReadOnly

actor MySelf
int iSetDebug = 0

int Gender
bool Female
int leftHand = 0
int rightHand = 1

int rightHandType = 0
int leftHandType = 0

float defaultWEAPONScale = 1.0
float defaultSHIELDScale = 1.0

Event OnInit()
	if ( iSetDebug == 1 )
		Debug.Notification( "Proper Weapon Scale has been initialized." )
	endif
    SetActorGender()
EndEvent

Event OnPlayerLoadGame()
	if ( iSetDebug == 1 )
		Debug.Notification( "Proper Weapon Scale has been loaded." )
	endif
    SetActorGender()
EndEvent

Function SetActorGender()
	MySelf = PlayerRef
	Gender = MySelf.GetActorBase().GetSex()
	if ( Gender == 1 )
		Female = Gender as bool
	elseif ( Gender == 0 )
		Female = Gender as bool
	endif
	if ( iSetDebug == 1 )
		Debug.Notification( "Getting gender for " + MySelf.GetActorBase().GetName() + "." )
		if ( Gender == 1 )
			Debug.Notification( MySelf.GetActorBase().GetName() + " is Female." )
		elseif ( Gender == 0 )
			Debug.Notification( MySelf.GetActorBase().GetName() + " is Male." )
		else
			Debug.Notification( MySelf.GetActorBase().GetName() + " is an unknown gender." )
		endif
	endif
EndFunction

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
	; Run Gender check.
	SetActorGender()
	if (Gender == 0 || Gender == 1)
		rightHandType = MySelf.GetEquippedItemType(rightHand)
		leftHandType = MySelf.GetEquippedItemType(leftHand)

		if (rightHandType == 0)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMWEAPON)
		elseif (rightHandType == 1)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRM(MySelf, Female, NINODE_SWORD), PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRMW(MySelf, Female, NINODE_SWORD), PWS_RMWEAPON)
		elseif (rightHandType == 2)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRMW(MySelf, Female, NINODE_DAGGER), PWS_RMWEAPON)
		elseif (rightHandType == 3)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRM(MySelf, Female, NINODE_AXE), PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRMW(MySelf, Female, NINODE_AXE), PWS_RMWEAPON)
		elseif (rightHandType == 4)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRM(MySelf, Female, NINODE_MACE), PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRMW(MySelf, Female, NINODE_MACE), PWS_RMWEAPON)
		elseif (rightHandType == 5)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)	
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRM(MySelf, Female, NINODE_WEAPON_BACK), PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRMW(MySelf, Female, NINODE_WEAPON_BACK), PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultWEAPONScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultWEAPONScale, PWS_HANDS)
		elseif (rightHandType == 6)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)	
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRM(MySelf, Female, NINODE_WEAPON_BACK), PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRMW(MySelf, Female, NINODE_WEAPON_BACK), PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultWEAPONScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultWEAPONScale, PWS_HANDS)
		elseif (rightHandType == 7)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)	
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultWEAPONScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultWEAPONScale, PWS_HANDS)
		elseif (rightHandType == 8)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRMW(MySelf, Female, NINODE_STAFF), PWS_RMWEAPON)
		elseif (rightHandType == 9)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMWEAPON)
		elseif (rightHandType == 10)
			if (!SHIELD_SOLUTION_ALT)
				SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
				SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)	
				SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_PLUGIN)
			else
				SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
				SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)	
			endif
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, GetNodeScaleRMW(MySelf, Female, NINODE_SHIELD_BACK), PWS_RMWEAPON)
		elseif (rightHandType == 11)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMWEAPON)
		elseif (rightHandType == 12)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMWEAPON)
		else
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, defaultWEAPONScale, PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultWEAPONScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultWEAPONScale, PWS_HANDS)
		endif

		if (leftHandType == 0)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_HANDS)	
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 1)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)	
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, GetNodeScaleRMW(MySelf, Female, NINODE_SWORD_LEFT), PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 2)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)	
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, GetNodeScaleRMW(MySelf, Female, NINODE_DAGGER_LEFT), PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 3)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)	
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, GetNodeScaleRMW(MySelf, Female, NINODE_AXE_LEFT), PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 4)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)	
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, GetNodeScaleRMW(MySelf, Female, NINODE_MACE_LEFT), PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 5)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, GetNodeScaleRM(MySelf, Female, NINODE_WEAPON_BACK), PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, GetNodeScaleRMW(MySelf, Female, NINODE_WEAPON_BACK), PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 6)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, GetNodeScaleRM(MySelf, Female, NINODE_WEAPON_BACK), PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, GetNodeScaleRMW(MySelf, Female, NINODE_WEAPON_BACK), PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 7)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)	
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleBase(MySelf, Female, NINODE_RIGHT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_WEAPON, 1/GetNodeScaleHand(MySelf, Female, NINODE_RIGHT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 8)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, GetNodeScaleRMW(MySelf, Female, NINODE_STAFF_LEFT), PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 9)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 10)
			if (!SHIELD_SOLUTION_ALT)
				SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
				SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)	
				SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_PLUGIN)
			else
				SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
				SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)	
			endif
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, GetNodeScaleRMW(MySelf, Female, NINODE_SHIELD_BACK), PWS_RMWEAPON)
		elseif (leftHandType == 11)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		elseif (leftHandType == 12)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleBase(MySelf, Female, NINODE_LEFT_HAND), PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, 1/GetNodeScaleHand(MySelf, Female, NINODE_LEFT_HAND), PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		else
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_HANDS)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMPLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD, defaultSHIELDScale, PWS_RMWEAPON)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_PLUGIN)
			SetNodeScaleEXD(MySelf, Female, NINODE_SHIELD_BACK, defaultSHIELDScale, PWS_HANDS)
		endif
	endif
EndEvent

Function SetNodeScaleEXD(Actor akActor, bool isFemale, string nodeName, float value, string modkey)
	If value != 1.0
		NiOverride.AddNodeTransformScale(akActor, false, isFemale, nodeName, modkey, value)
		if ( iSetDebug == 1 )
			if ( iSetDebug == 1 )
				Debug.Notification( MySelf.GetActorBase().GetName() + " has " + modkey + " Transformation (Scale: " + value + ") added.")
			endif
		endif
	Else
		NiOverride.RemoveNodeTransformScale(akActor, false, isFemale, nodeName, modkey)
		if ( iSetDebug == 1 )
			Debug.Notification( MySelf.GetActorBase().GetName() + " has " + modkey + " Transformation removed on" + " nodeName" + ".")
		endif
	Endif
	NiOverride.UpdateNodeTransform(akActor, false, isFemale, nodeName)
EndFunction

float Function GetNodeScaleBase(Actor akActor, bool isFemale, string nodeName)
	return NiOverride.GetNodeTransformScale(akActor, false, isFemale, nodeName, BASE)
EndFunction

float Function GetNodeScaleHand(Actor akActor, bool isFemale, string nodeName)
	return NiOverride.GetNodeTransformScale(akActor, false, isFemale, nodeName, RMX_HAND_KEY)
EndFunction

float Function GetNodeScaleRM(Actor akActor, bool isFemale, string nodeName)
	return NiOverride.GetNodeTransformScale(akActor, false, isFemale, nodeName, RM_PLUGIN)
EndFunction

float Function GetNodeScaleRMW(Actor akActor, bool isFemale, string nodeName)
	return NiOverride.GetNodeTransformScale(akActor, false, isFemale, nodeName, RMW_PLUGIN)
EndFunction