Form Script

From the CreationKit Wiki
Revision as of 12:24, 2 October 2012 by imported>JustinOther (Added new SKSE functions/events.)
Jump to navigation Jump to search


Native base script for every form in the game.

Definition

ScriptName Form

Properties

None

Global Functions

None

Member Functions

int Function GetFormID()

  • Returns this form's form ID.

int Function GetGoldValue()

  • Returns this form's value in gold.

bool Function HasKeyword(Keyword akKeyword)

  • Returns if this form has the specified Keyword attached.

Function PlayerKnows()

  • Is the "Known" flag set on the form?

Function RegisterForAnimationEvent(ObjectReference akSender, string asEventName)

  • Registers this form to receive the specified animation event from the specified object.

Function RegisterForLOS(Actor akViewer, ObjectReference akTarget)

  • Registers this form to receive gain and lost LOS events between the viewer and the target.

Function RegisterForSingleLOSGain(Actor akViewer, ObjectReference akTarget)

  • Registers this form to receive a single LOS gain event when the viewer sees the target.

Function RegisterForSingleLOSLost(Actor akViewer, ObjectReference akTarget)

  • Registers this form to receive a single LOS lost event when the viewer loses sight of the target.

Function RegisterForSingleUpdate(float afInterval)

  • Registers this form to receive a single update event in the specified time.

Function RegisterForSingleUpdateGameTime(float afInterval)

  • Registers this form to receive a single update event in the specified number of game hours.

Function RegisterForSleep()

  • Registers this form to receive sleep events for when the player goes to sleep or wakes up.

Function RegisterForTrackedStatsEvent()

  • Registers this form to receive tracked stats events for when tracked stats are updated.

Function RegisterForUpdate(float afInterval)

  • Registers this form to receive update events with the specified interval, or changes the update interval.

Function RegisterForUpdateGameTime(float afInterval)

  • Registers this form to receive update events with the specified interval in game time hours, or changes the update interval.

Function StartObjectProfiling()

  • Starts profiling all scripts attached to this form.

Function StopObjectProfiling()

  • Stops profiling all scripts attached to this form.

Function UnregisterForAnimationEvent(ObjectReference akSender, string asEventName)

  • Unregisters this from from receiving the specified animation event from the specified object.

Function UnregisterForLOS(Actor akViewer, ObjectReference akTarget)

  • Unregisters this form from any LOS events between the viewer and target.

Function UnregisterForSleep()

  • Unregisters this form from sleep events.

Function UnregisterForTrackedStatsEvent()

  • Unregisters this form from tracked stats events.

Function UnregisterForUpdate()

  • Unregisters this form from update events.

Function UnregisterForUpdateGameTime()

  • Unregisters this form from game time update events.

SKSE Member Functions

int Function GetType()

  • Returns this form's form typecode.

string Function GetName()

  • Returns this form's full name.

Function SetName(string name)

  • Sets this form's full name.

float Function GetWeight()

  • Returns this form's weight.

Function SetWeight(float weight)

  • Sets this form's weight.

Function SetGoldValue(int value)

  • Sets this form's base gold value.

int Function GetNumKeywords()

  • Returns the number of keywords on this form.

Keyword Function GetNthKeyword(int index)

  • Returns the keyword specified by index on this form.

bool Function HasKeywordString(string s)

  • Returns whether this form has a keyword with the specified string.

Function RegisterForKey(int keyCode)

  • Registers for OnKeyDown and OnKeyUp events for the given DXScanCode.

Function UnregisterForKey(int keyCode)

  • Unregisters for OnKeyDown and OnKeyUp events for the given DXScanCode.

Function UnregisterForAllKeys()

Function RegisterForMenu(string menuName)

  • Registers for OnMenuOpen and OnMenuClose events for the given menu.

Function UnregisterForMenu(string menuName)

  • Unregisters for OnMenuOpen and OnMenuClose events for the given menu.

Function UnregisterForAllMenus()

  • Unregisters all registered menus.

Function RegisterForModEvent(string eventName, string callbackName)

  • Registers a custom event callback for given event name.

Function SendModEvent - Form|(string eventName, string strArg = "", float numArg = 0.0)

  • Sends a custom event with given generic parameters.

Function UnregisterForModEvent(string eventName)

  • Unregisters a custom event callback for given event name.

Function UnregisterForAllModEvents()

  • Unregisters all registered custom events.

Form Function TempClone()

  • Returns a temporary clone of this form

Events

Event OnAnimationEvent(ObjectReference akSource, string asEventName)

  • Received when one of animation events we are listening for is recieved.

Event OnAnimationEventUnregistered(ObjectReference akSource, string asEventName)

  • Received when one of the animation events we are listening for has been automatically unregistered by the game due to the target animation graph unloading.

Event OnGainLOS(Actor akViewer, ObjectReference akTarget)

  • Received when the viewer goes from not seeing the target to seeing the target - if this form is registered.

Event OnLostLOS(Actor akViewer, ObjectReference akTarget)

  • Received when the viewer goes from seeing the target to not seeing the target - if this form is registered.

Event OnSleepStart(float afSleepStartTime, float afDesiredSleepEndTime)

  • Received when the player goes to sleep.

Event OnSleepStop(bool abInterrupted)

  • Received when the player wakes up or is interrupted in sleep.

Event OnTrackedStatsEvent(string asStat, in aiStatValue)

  • Received when tracked stats are updated.

Event OnUpdate()

  • Received at periodic intervals, if the form is registered.

Event OnUpdateGameTime()

  • Received at periodic intervals of game time, if the form is registered.

SKSE Events

Event OnKeyDown(int keyCode)

Event OnKeyUp(int keyCode, float holdTime)

Event OnMenuOpen(string menuName)

Event OnMenuClose(string menuName)