User talk:Lisselli
Jump to navigation
Jump to search
Function SetActorValueCap(Actor akActor, String asValueName, Float afValueCap = 100.0)
; Store the base and current value.
Float BaseValue = akActor.GetBaseActorValue(asValueName)
Float CurrentValue = akActor.GetActorValue(asValueName)
; Cap default is 100. If checking for attributes, adjust the desired cap accordingly.
; Check if the current value is over the cap.
if (BaseValue <= afValueCap && CurrentValue > afValueCap)
;Unless the base is also over the cap, we\ll assume it\s not.
akActor.ForceActorValue(asValueName, afValueCap)
elseif BaseValue > afValueCap && CurrentValue > BaseValue
; bring the base and current back down to the cap.
BaseValue = BaseValue - (BaseValue - afValueCap)
akActor.SetActorValue(asValueName, BaseValue)
akActor.ForceActorValue(asValueName, afValueCap)
else
return
endif
EndFunction
Float Function GetDaysInMonth(Float afMonth=0.0) Global
; Returns number of days of a month
; Morning Star ; 0.0 ; days 31.0 :: Sun's Height ; 6.0 ; days 31.0
; Sun's Dawn ; 1.0 ; days 28.0 :: Last Seed ; 7.0 ; days 31.0
; First Seed ; 2.0 ; days 31.0 :: Hearthfire ; 8.0 ; days 30.0
; Rain's Hand ; 3.0 ; days 30.0 :: Frostfall ; 9.0 ; days 31.0
; Second Seed ; 4.0 ; days 31.0 :: Sun's dusk ; 10.0 ; days 30.0
; Midyear ; 5.0 ; days 30.0 :: Evening Star ; 11.0 ; days 31.0
if afMonth == 0.0
return 31.0
elseif afMonth == 1.0
return 28.0
elseif afMonth == 2.0
return 31.0
elseif afMonth == 3.0
return 30.0
elseif afMonth == 4.0
return 31.0
elseif afMonth == 5.0
return 30.0
elseif afMonth == 6.0
return 31.0
elseif afMonth == 7.0
return 31.0
elseif afMonth == 8.0
return 30.0
elseif afMonth == 9.0
return 31.0
elseif afMonth == 10.0
return 30.0
elseif afMonth == 11.0
return 31.0
endif
EndFunction
Int Function GetNumMaxSkills(bool abGetNonMaxed=false)
; returns the number of skills that are capped.
Actor Player = Game.GetPlayer()
Float[] fSkills = new Float[18]
fSkills[0] = Player.GetActorValue("Alteration")
fSkills[1] = Player.GetActorValue("Alchemy")
fSkills[2] = Player.GetActorValue("Block")
fSkills[3] = Player.GetActorValue("Conjuration")
fSkills[4] = Player.GetActorValue("Destruction")
fSkills[5] = Player.GetActorValue("Enchanting")
fSkills[6] = Player.GetActorValue("HeavyArmor")
fSkills[7] = Player.GetActorValue("Illusion")
fSkills[8] = Player.GetActorValue("Lockpicking")
fSkills[9] = Player.GetActorValue("LightArmor")
fSkills[10] = Player.GetActorValue("Marksman")
fSkills[11] = Player.GetActorValue("OneHanded")
fSkills[12] = Player.GetActorValue("Pickpocket")
fSkills[13] = Player.GetActorValue("TwoHanded")
fSkills[14] = Player.GetActorValue("Restoration")
fSkills[15] = Player.GetActorValue("Sneak")
fSkills[16] = Player.GetActorValue("Smithing")
fSkills[17] = Player.GetActorValue("Speechcraft")
Int index = fSkills.Length
Int iCount
if abGetNonMaxed
While index
index -= 1 ; Start from the last index
if fSkills[index] == 100.0 ; Find any skill that is lvl 100.
iCount += 1 ; record how many were found.
endif
EndWhile
else
While index
index -= 1 ; Start from the last index
if fSkills[index] < 100.0 ; Find any skill that is lvl 100.
iCount += 1 ; record how many were found.
endif
EndWhile
endif
return iCount
EndFunction