ScriptObject Script

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Extends: None

Native base object for every script object in the game. Has no form or editor object equivalent, and will be forced as the base object of every script, even if a script does not explicitly extend it.

Definition[edit | edit source]

ScriptName ScriptObject Native Hidden

Properties[edit | edit source]

None

Global Functions[edit | edit source]

None

Member Functions[edit | edit source]

  • Function AddInventoryEventFilter(Form akFilter)
    • Adds an inventory event filter to this script.
  • Var Function CallFunction(string asFuncName, Var[] aParams)
    • Calls a function on this script synchronously by name.
  • Function CallFunctionNoWait(string asFuncName, Var[] aParams)
    • Calls a function on this script asynchronously by name.
  • Function CancelTimer(int aiTimerID)
    • Cancels a pending real-time timer event on this script with the specified ID.
  • Function CancelTimerGameTime(int aiTimerID)
    • Cancels a pending game-time timer event on this script with the specified ID.
  • ScriptObject Function CastAs(string asScriptName)
    • Attempts to cast this script as another kind of script, but without adding a dependency to the caller.
  • Var Function GetPropertyValue(string asPropertyName)
    • Obtains the value of a property on this script by name.
  • string Function GetState()
    • Obtains this script's current state
  • string Function GotoState(string asNewState)
    • Sets this script's current state, calling the appropriate begin/end state events.
  • bool Function IsBoundGameObjectAvailable()
    • Checks to see if this script is attached to a valid, and available, in-game object.
  • Function RegisterForAnimationEvent(ObjectReference akSender, string asEventName)
    • Registers this script to receive the specified animation event from the specified object reference.
  • Function RegisterForCustomEvent(ScriptObject akEventSource, CustomEventName asEventName)
    • Registers this script to receive the specified custom event from the specified script.
  • Function RegisterForDetectionLOSGain(Actor akViewer, ObjectReference akTarget)
    • Registers this script to receive a single detection-based LOS gain event when the viewer sees the target.
  • Function RegisterForDetectionLOSLost(Actor akViewer, ObjectReference akTarget)
    • Registers this script to receive a single detection-based LOS lost event when the viewer loses sight of the target.
  • Function RegisterForDirectLOSGain(ObjectReference akViewer, ObjectReference akTarget, string asViewerNode, string asTargetNode)
    • Registers this script to receive a single direct LOS gain event when the viewer sees the target.
  • Function RegisterForDirectLOSLost(ObjectReference akViewer, ObjectReference akTarget, string asViewerNode, string asTargetNode)
    • Registers this script to receive a single direct LOS lost event when the viewer loses sight of the target.
  • Function RegisterForDistanceGreaterThanEvent(ScriptObject akObj1, ScriptObject akObj2, float afDistance)
    • Registers this script to receive a single distance greater than event when the two objects are farther then afDistance apart.
  • Function RegisterForDistanceLessThanEvent(ScriptObject akObj1, ScriptObject akObj2, float afDistance)
    • Registers this script to receive a single distance less than event when the two objects are closer then afDistance apart.
  • Function RegisterForHitEvent(ScriptObject akTarget, ScriptObject akAggressorFilter, Form akSourceFilter, Form akProjectileFilter, int aiPowerFilter, int aiSneakFilter, int aiBashFilter, int aiBlockFilter, bool abMatch)
    • Registers this script to receive a single hit event matching the filters passed in.
  • Function RegisterForLooksMenuEvent()
    • Registers this script to receive looks menu events.
  • Function RegisterForMagicEffectApplyEvent(ScriptObject akTarget, ScriptObject akCasterFilter, Form akEffectFilter, bool abMatch)
    • Registers this script to receive a single magic effect apply event matching the filters passed in.
  • Function RegisterForMenuOpenCloseEvent(string asMenuName)
    • Registers this script to receive menu open/close events from a particular menu
  • Function RegisterForPlayerSleep()
    • Registers this script to receive sleep events for when the player goes to sleep or wakes up.
  • Function RegisterForPlayerTeleport()
    • Registers this script to receive teleport events from the player.
  • Function RegisterForPlayerWait()
    • Registers this script to receive wait events from the player.
  • Function RegisterForRadiationDamageEvent(ScriptObject akTarget)
    • Registers this script to receive a single radiation damage event from the target.
  • Function RegisterForRemoteEvent(ScriptObject akEventSource, ScriptEventName asEventName)
    • Registers this script to receive an event when the target script receives an event.
  • Function RegisterForTrackedStatsEvent(string asStat, int aiThreshold)
    • Registers this script to receive an event when a tracked stat equals or goes past a threshold.
  • Function RegisterForTutorialEvent(string asEventName)
    • Registers this script to receive tutorial-related events.
  • Function RemoveAllInventoryEventFilters()
    • Remove all inventory event filters on this script.
  • Function RemoveInventoryEventFilter(Form akFilter)
    • Remove a specific inventory event filter.
  • Function SendCustomEvent(CustomEventName asEventName)
    • Sends a custom event to any other script that is registered for it.
  • Function SetPropertyValue(string asPropertyValue, Var aValue)
    • Sets a property's value on this script by name, synchronously.
  • Function SetPropertyValueNoWait(string asPropertyValue, Var aValue)
    • Sets a property's value on this script by name, asynchronously.
  • Function StartTimer(float afInterval, int aiTimerID)
    • Starts a real-time timer on this script with the specified ID and interval.
  • Function StartTimerGameTime(float afInterval, int aiTimerID)
    • Starts a game-time timer on this script with the specified ID and interval.
  • Function UnregisterForAllEvents()
    • Unregisters this script from all events it has registered for.
  • Function UnregisterForAllCustomEvents()
    • Unregisters this script from all custom events it has registered for.
  • Function UnregisterForAllHitEvents(ScriptObject akTarget)
    • Unregisters this script from receiving any hit events from the specified target (or all targets).
  • Function UnregisterForAllMagicEffectApplyEvents(ScriptObject akTarget)
    • Unregisters this script from receiving any magic effect apply events from the specified target (or all targets).
  • Function UnregisterForAllMenuOpenCloseEvents()
    • Unregisters this script from receiving any menu open/close events.
  • Function UnregisterForAllRadiationDamageEvents()
    • Unregisters this script from receiving any radiation damage events from all targets.
  • Function UnregisterForAllRemoteEvents()
    • Unregisters this script from receiving any remote events it has registered for.
  • Function UnregisterForAllTrackedStatsEvents()
    • Unregisters this script from receiving any tracked stats events.
  • Function UnregisterForAnimationEvent(ObjectReference akSender, string asEventName)
    • Unregisters this script from receiving the specified animation event from the specified object reference.
  • Function UnregisterForCustomEvent(ScriptObject akEventSource, CustomEventName asEventName)
    • Unregisters this script from receiving the specified custom event from the specified script.
  • Function UnregisterForDistanceEvents(ScriptObject akObj1, ScriptObject akObj2)
    • Unregisters this script from receiving any distance-related events from the two objects.
  • Function UnregisterForLooksMenuEvent()
    • Unregisters this script from looks menu events.
  • Function UnregisterForHitEvent(ScriptObject akTarget, ScriptObject akAggressorFilter, Form akSourceFilter, Form akProjectileFilter, int aiPowerFilter, int aiSneakFilter, int aiBashFilter, int aiBlockFilter, bool abMatch)
    • Unregisters this script from receiving a specific filtered hit event.
  • Function UnregisterForLOS(ObjectReference akViewer, ObjectReference akTarget)
    • Unregisters this script from any LOS events between the viewer and target.
  • Function UnregisterForMagicEffectApplyEvent(ScriptObject akTarget, ScriptObject akCasterFilter, Form akEffectFilter, bool abMatch)
    • Unregisters this script from receiving a specific filtered magic effect apply event.
  • Function UnregisterForMenuOpenCloseEvent(string asMenuName)
    • Unregisters this script from receiving open/close menu events for a particular menu.
  • Function UnregisterForPlayerSleep()
    • Unregisters this script from sleep events.
  • Function UnregisterForPlayerTeleport()
    • Unregisters this script from teleport events.
  • Function UnregisterForPlayerWait()
    • Unregisters this script from wait events.
  • Function UnregisterForRadiationDamageEvent(ScriptObject akTarget)
    • Unregisters this script from receiving radiation damage events from the target.
  • Function UnregisterForRemoteEvent(ScriptObject akEventSource, ScriptEventName asEventName)
    • Unregisters this script from the specified event from the specified event source.
  • Function UnregisterForTrackedStatsEvent(string asStat)
    • Unregisters this script from a tracked stat event.
  • Function UnregisterForTutorialEvent(string asEventName)
    • Unregisters this script from tutorial events.

F4SE Member Functions[edit | edit source]

  • RegisterForControl(string control)
    • Registers the given control for OnControlDown and OnControlUp events.
  • UnregisterForControl(string control)
    • Unregisters the given control for OnControlDown and OnControlUp events.

Events[edit | edit source]

  • Event OnAnimationEvent(ObjectReference akSource, string asEventName)
    • Received when one of animation events we are listening for is received.
  • 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 OnBeginState(string asOldState)
    • Event received when a state has just been entered.
  • Event OnDistanceGreaterThan(ObjectReference akObj1, ObjectReference akObj2, float afDistance)
    • Event received when the two objects are greater than the registered distance apart
  • Event OnDistanceLessThan(ObjectReference akObj1, ObjectReference akObj2, float afDistance)
    • Event received when the two objects are less than the registered distance apart
  • Event OnEndState(string asNewState)
    • Event received when a state has just been left.
  • Event OnGainLOS(ObjectReference akViewer, ObjectReference akTarget)
    • Received when the viewer goes from not seeing the target to seeing the target - if this script is registered.
  • Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial)
    • Event received when the target is hit with a weapon or projectile - if this script is registered.
  • Event OnInit()
    • Received when this script object's properties have been set, but before any other functions are called or events are received.
  • Event OnLooksMenuEvent(int aiFlavor)
    • Received when looks menu activity should trigger dialog.
  • Event OnLostLOS(ObjectReference akViewer, ObjectReference akTarget)
    • Received when the viewer goes from seeing the target to not seeing the target - if this script is registered.
  • Event OnMagicEffectApply(ObjectReference akTarget, ObjectReference akCaster, MagicEffect akEffect)
    • Event received when a magic effect is attempting to be applied to the target - if this script is registered.
  • Event OnMenuOpenCloseEvent(string asMenuName, bool abOpening)
    • Event received when a menu is opened or closed - if this script is registered
  • Event OnPlayerSleepStart(float afSleepStartTime, float afDesiredSleepEndTime, ObjectReference akBed)
    • Received when the player goes to sleep.
  • Event OnPlayerSleepStop(bool abInterrupted, ObjectReference akBed)
    • Received when the player wakes up or is interrupted in sleep.
  • Event OnPlayerTeleport()
    • Received when the player teleports.
  • Event OnPlayerWaitStart(float afWaitStartTime, float afDesiredWaitEndTime)
    • Received when the player starts waiting.
  • Event OnPlayerWaitStop(bool abInterrupted)
    • Received when the player stops waiting.
  • Event OnRadiationDamage(ObjectReference akTarget, bool abIngested)
    • Event received when the target takes radiation damage - if this script is registered.
  • Event OnTimer(int aiTimerID)
    • Received when the specified real-time timer expires.
  • Event OnTimerGameTime(int aiTimerID)
    • Received when the specified game-time timer expires.
  • Event OnTrackedStatsEvent(string asStat, int aiStatValue)
    • Received when tracked stats are updated.
  • Event OnTutorialEvent(String asEventName, Message aMessage)
    • Event called whenever a tutorial-related event occurs

F4SE Events[edit | edit source]