{Calls MoveTo if the calling ObjectReference is currently unloaded. Doesn't do anything if it IS loaded. No waiting or while loops. Returns true if it does the moveto}
{DEPRECATED: DO NOT USE. Calls MoveTo if both the calling ObjectReference and the akTarget ObjectReference have current locations that are not loaded.}
while self.GetCurrentLocation().IsLoaded() || akTarget.GetCurrentLocation().IsLoaded()
;do nothing
; debug.trace(self + "MoveToWhenUnloaded() waiting for current location and target location to be unloaded before moving. If called by a quest stage fragment, this may cause that quest stage to not complete until this function finishes (and if it's a startup stage, the quest will not report itself as running until the stage finishes.).", 1)
Utility.Wait(5) ;when this function is threaded we can increase this wait time... I set it lower for testing purposes so it reevaluates faster when I need to purge cell buffers in the Civil War when calling moveto on the player between Civil War campaigns
{This will become a native function... it will wait until the object is not persisting, then delete itself.}
While GetParentCell() && GetParentCell().IsAttached()
;do nothing
; debug.trace(self + "DeleteWhenAble() waiting for current location to be unloaded before deleting. If called by a quest stage fragment, this may cause that quest stage to not complete until this function finishes (and if it's a startup stage, the quest will not report itself as running until the stage finishes.).", 1)
Utility.Wait(5) ;when this function is threaded we can increase this wait time... I set it lower for testing purposes so it reevaluates faster when I need to purge cell buffers in the Civil War when calling moveto on the player between Civil War campaigns
EndWhile
Delete()
EndFunction
;jduvall
Function AddKeyIfNeeded(ObjectReference ObjectWithNeededKey)
{Should only be called by ObjectReferences that have/are containers (ie Containers and Actors). Checks to see if self has the key to ObjectWithNeededKey, and if not, creates a copy of the key and puts it in self.}
key NeededKey = ObjectWithNeededKey.GetKey()
if NeededKey != None
if GetItemCount(NeededKey) == 0
AddItem(NeededKey)
EndIf
EndIf
EndFunction
; Property to obtain the current X position of the object
float Property X
float Function get()
return GetPositionX()
EndFunction
EndProperty
; Property to obtain the current Y position of the object
float Property Y
float Function get()
return GetPositionY()
EndFunction
EndProperty
; Property to obtain the current Z position of the object
float Property Z
float Function get()
return GetPositionZ()
EndFunction
EndProperty
; Have akActivator activate this reference. If abDefaultProcessingOnly is true then any block will be bypassed
; and no OnActivate event will be sent. The function returns true if default processing ran, and succeeded. If
; default processing has been blocked, will always return false.
bool Function Activate(ObjectReference akActivator, bool abDefaultProcessingOnly = false) native
; Sets up a dependent animated object
; This function should be used only with a coder supervision. It is left undocumented because it can cause dangling pointers as well as very broken functionality
; for the dependent object if used improperly.
bool Function AddDependentAnimatedObjectReference( ObjectReference akDependent ) native
; Add an inventory event filter to this reference. Item added/removed events matching the
; specified form (or in the specified form list) will now be let through.
Function AddInventoryEventFilter(Form akFilter) native
; Adds the specified base object or object reference to this object reference's container/inventory
; Note that you cannot add more then one copy of a reference to a container (a warning will be printed if you try)
Function AddItem(Form akItemToAdd, int aiCount = 1, bool abSilent = false) native
; Adds this reference (which is a map marker) to the map, optionally making it available for fast travel
Function AddToMap(bool abAllowFastTravel = false) native
; Apply an impulse to this reference
Function ApplyHavokImpulse(float afX, float afY, float afZ, float afMagnitude) native
; Turns on and off blocking of normal activation - OnActivate events will still be sent
Function BlockActivation(bool abBlocked = true) native
; Calculate's this references encounter level based on the requested difficulty level
; 0 - Easy
; 1 - Medium
; 2 - Hard
; 3 - Very Hard
; 4 - None
int Function CalculateEncounterLevel(int aiDifficulty = 4) native
; Can the map marker be fast traveled to?
bool Function CanFastTravelToMarker() native
; Clears all effects of destruction from this object
Function ClearDestruction() native
; Create a detection event at this reference, with the specified owner. Sound level is between 0 and 100
Function CreateDetectionEvent(Actor akOwner, int aiSoundLevel = 0 ) native
; Damages this object and advances the destruction stage - does not return until the object is damaged
Function DamageObject(float afDamage) native
; Delets this object
Function Delete() native
; Disables this object - fading out if requested
Function Disable(bool abFadeOut = false) native
; Disables this object - fading out if requested. Does NOT wait for the fade or disable to finish
Function DisableNoWait(bool abFadeOut = false) native
; Drops the specified object from this object's inventory
ObjectReference Function DropObject(Form akObject, int aiCount = 1) native
; Enables this object - fading in if requested
Function Enable(bool abFadeIn = false) native
; Enables the ability to fast travel to this marker - or disables it. Note that if you disable
; fast travel the player will see "You haven't discovered this location" as an error message
Function EnableFastTravel(bool abEnable = true) native
; Enables this object - fading in if requested. Does NOT wait for the fade or enable to finish
Function EnableNoWait(bool abFadeIn = false) native
; Forcibly adds / removes the ragdoll for a reference to the world
Function ForceAddRagdollToWorld() native
Function ForceRemoveRagdollFromWorld() native
; Gets the actor that owns this object (or None if not owned by an Actor)
ActorBase Function GetActorOwner() native
; Get the current X angle of this object
float Function GetAngleX() native
; Get the current Y angle of this object
float Function GetAngleY() native
; Get the current Z angle of this object
float Function GetAngleZ() native
; Get a variable from the reference's animation graph (if applicable). Bool version.
bool Function GetAnimationVariableBool(string arVariableName) native
; Get a variable from the reference's animation graph (if applicable). Int version.
int Function GetAnimationVariableInt(string arVariableName) native
; Get a variable from the reference's animation graph (if applicable). Float version.
float Function GetAnimationVariableFloat(string arVariableName) native
; Returns the base object this reference represents
Form Function GetBaseObject() native
; Returns the object's current destruction stage
int Function GetCurrentDestructionStage() native
; Returns this reference's current location
Location Function GetCurrentLocation() native
; Returns the scene this reference is currently in - if any
Scene Function GetCurrentScene() native
; Calculates the distance between this reference and another - both must either be in the same interior, or same worldspace
float Function GetDistance(ObjectReference akOther) native
; Returns this reference's editor location
Location Function GetEditorLocation() native
; Gets the faction that owns this object (or None if not owned by a Faction)
Faction Function GetFactionOwner() native
; Gets the angle between this object's heading and the other object in degrees - in the range from -180 to 180
float Function GetHeadingAngle(ObjectReference akOther) native
; Get the current height of the object
float Function GetHeight() native
; Returns how many of the specified item is in this object reference's inventory
int Function GetItemCount(Form akItem) native
; Returns the smithed health of this object reference (1.0 == 100%)
float Function GetItemHealthPercent() native
; Returns the key base object that will unlock this object
Key Function GetKey() native
; Get the current length of the object
float Function GetLength() native
; Get our linked reference
ObjectReference Function GetLinkedRef(Keyword apKeyword = NONE) native
; Get the level of the lock on this object
int Function GetLockLevel() native
;jtucker, jduvall
;This function counts the number of linked refs that are in a linked Ref chain (ie object is linked to A, A is linked to B, etc. this then counts all the linked refs.)
;Often used in conjunction with GetNthLinkedRef()
;*** WARNING: Having a link ref chain that at any point loops back on itself and calling this function will result in very bad things. Don't do that!***
int Function countLinkedRefChain(keyword apKeyword = None, int maxExpectedLinkedRefs = 100)
; debug.trace( self + "countLinkedRefs() found itself. This suggests it was linked back to itself. This will create an infinite loop, so we are killing the function now. NumLinkedRefs =" + NumLinkedRefs)
EndIf
endWhile
if NumLinkedRefs >= maxExpectedLinkedRefs
; debug.trace( self + "countLinkedRefs() bailing out early because it found more linked refs than maxExpectedLinkRefs (suggesting an infinite loop). LinkedRefs found:" + NumLinkedRefs + ", maxExpectedLinkedRefs:" + maxExpectedLinkedRefs)
EndIf
return NumLinkedRefs
endFunction
; Returns the Nth linked ref from this reference (0 = self, 1 = GetLinkedRef, 2 = GetLinkedRef.GetLinkedRef, etc)
ObjectReference Function GetNthLinkedRef(int aiLinkedRef) native
; Enables all of the references that are linked, in a chain, to this one.
Function EnableLinkChain(Keyword apKeyword = None)
; Remove an inventory event filter from this reference. Item added/removed events matching the
; specified form (or in the specified form list) will no longer be let through.
Function RemoveInventoryEventFilter(Form akFilter) native
; Removes the specified item from this object reference's inventory
Function RemoveItem(Form akItemToRemove, int aiCount = 1, bool abSilent = false, ObjectReference akOtherContainer = None) native
; Removes a previously added dependent object
; This function should be used only with a coder supervision. It is left undocumented because it can cause dangling pointers as well as very broken functionality
; for the dependent object if used improperly.
bool Function RemoveDependentAnimatedObjectReference( ObjectReference akDependent ) native
; Resets this object, optional place the object at the new target
Function Reset(ObjectReference akTarget = None) native
; Has this object "say" the specified topic, as if spoken by the specified actor (if one is
; provided, and potentially "speaking" in the player's head.
Function Say(Topic akTopicToSay, Actor akActorToSpeakAs = None, bool abSpeakInPlayersHead = false) native
; Has this object behave as if the specified actor attempted to steal it
Function SendStealAlarm(Actor akThief) native
; Sets this object's actor cause to the specified actor
Function SetActorCause(Actor akActor) native
; Sets this object's owner to the specified actor base - None means to remove ownership
Function SetActorOwner(ActorBase akActorBase) native
; Set the orientation of the object (angles are in degrees)
Function SetAngle(float afXAngle, float afYAngle, float afZAngle) native
; Set a variable on the reference's animation graph (if applicable). Bool version.
Function SetAnimationVariableBool(string arVariableName, bool abNewValue) native
; Set a variable on the reference's animation graph (if applicable). Int version.
Function SetAnimationVariableInt(string arVariableName, int aiNewValue) native
; Set a variable on the reference's animation graph (if applicable). Float version.
Function SetAnimationVariableFloat(string arVariableName, float afNewValue) native
; Sets this object as destroyed or not
Function SetDestroyed(bool abDestroyed = true) native
; Sets this object's owner to the specified faction
Function SetFactionOwner(Faction akFaction) native
; Sets the lock level on this object. Will add an unlocked lock to it if it doesn't have one
Function SetLockLevel(int aiLockLevel) native
; Sets the motion type of the reference
; aeMotionType: The type of motion (see properties at end of file)
; abAllowActivate: When setting to a dynamic type, allows the simulation to be activated
Function SetMotionType(int aeMotionType, bool abAllowActivate = true) native
; Sets this object reference as one that teammates will refuse to do favors on
Function SetNoFavorAllowed(bool abNoFavor = true) native
; Opens/closes this object
Function SetOpen(bool abOpen = true) native
; Set the position of the object
Function SetPosition(float afX, float afY, float afZ) native
; Set the current scale of the object
Function SetScale(float afScale) native
; Makes the reference translate to the given position/orientation
; Note: Rotation speed is entirely dependent on the length of the path and the movement speed
; that is, the rotation will happen such that the reference reaches the goal orientation at the end