Difference between revisions of "User talk:Lisselli"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Lisselli
m
imported>Lisselli
m
Line 1: Line 1:
GetName - Form
'''Member of:''' [[Form Script]]
Gets the name of the form, full name if possible. Requires F4SE 0.03.1.
== Syntax ==
<source lang="papyrus">
string Function GetName() native
</source>
== Parameters ==
None
== Return Value ==
The name of the form.
== Examples ==
<source lang="papyrus">
; 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)
</source>
== See Also ==
[[Form Script]]
<source lang="papyrus">
<source lang="papyrus">
Function SetActorValueCap(Actor akActor, String asValueName, Float afValueCap = 100.0)
Function SetActorValueCap(Actor akActor, String asValueName, Float afValueCap = 100.0)

Revision as of 03:15, 13 May 2017

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