User talk:Lisselli

From the CreationKit Wiki
Revision as of 04:14, 16 July 2017 by imported>Lisselli (→‎See Also)
Jump to navigation Jump to search

GetName - Form Member of: Form Script

Gets the name of the form, full name if possible. Requires F4SE 0.03.1.

Syntax

string Function GetName() native

Parameters

None

Return Value

The name of the form.

Examples

; If you want to know the name of the player's current cell.
String sCellName = Game.GetPlayer().GetParentCell().GetName()
debug.trace("My cell's name is: " +sCellName)

See Also

Form Script


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