Misc
Grouping smaller misc stuff here.
Utility:
Spoiler
; Returns the SKSE plugin version. String Function GetVersion() Global Native ; Send a log line to the MGF log. Bool Function LogLine(String Log) Global Native ; Clears the MGF SKSE log. For testing purposes. Function LogClear() Global Native ; Get the current console target. ObjectReference Function GetConsoleTarget() Global Native ; Sets the console target to ObjRef. ; Can do SetConsoleTarget(None) to clear the target. Function SetConsoleTarget(ObjectReference ObjRef) Global Native ; Returns true if akForm's dynamic flag is set. Bool Function IsDynamicForm(Form akForm) Global Native ; Returns the [x,y,z] position akRef was placed at in the editor. Float[] Function GetEditorPosition(ObjectReference akRef) Global Native ; Returns the cell where this reference was placed in the editor. Cell Function GetEditorCell(ObjectReference akRef) Global Native ; Teleports player to coordinates. ; SetPosition() resets the camera which is pretty jarring. This doesn't. Function TeleportPlayerToCoords(Float x, Float y, Float z) Global Native ; Transitions the player to the coordinates rather than straight up teleporting them. Function TeleportPlayerToCoordsSmooth(Float x, Float y, Float z, Float Speed, Float StealthMult, Float LandingProtectionSeconds, Float ReleaseDistance) Global Native ; Returns a random value. ; String version just returns a random word`from a small repository. Mostly for testing purposes. Bool Function GetRandomBool() Global Native Int Function GetRandomInt(Int Minimum = 0, Int Maximum = 100) Global Native Float Function GetRandomFloat(Float Minimum = 0.0, Float Maximum = 1.0) Global Native String Function GetRandomString() Global Native ; Convert a string to an integer. Returns the integer value or Default if conversion fails. ; Supports: ; Decimal: "123", "-456" ; Hexadecimal: "0x1A2B", "0X1a2b" ; Whitespace trimming Int Function StringToInt(String Value, Int Default) Global Native ; Convert a string to a float. Returns the float value or Default if the conversion fails. ; Supports: ; Decimal: "123.45", "-456.78" ; Scientific notation: "1.23e5", "4.56E-2" ; Whitespace trimming Float Function StringToFloat(String Value, Float Default) Global Native ; Returns a 1:1 count of akForms in ObjRef. Int[] Function CountForms(ObjectReference ObjRef, Form[] akForms) Global Native ; Returns the boundary size of a reference as [x, y, z] extents. Float[] Function GetObjectRef3DSize(ObjectReference akRef) Global Native ; Disable a list of object references instead of looping one by one. Bool Function DisableObjRefs(ObjectReference[] ObjRefs) Global Native ; Delete a list of object references instead of looping one by one. Bool Function DeleteObjRefs(ObjectReference[] ObjRefs) Global Native ; Returns true if the activator's IsMarker flag is set (object has no visual presence in-game) bool Function GetIsMarkerFlag(Form akForm) Global Native ; Sets the form's IsMarker flag. Call Disable()/Enable() on all placed references afterwards to apply visually. ; Note1: Flag change does not persist across game restarts. ; Note2: This flag is on the BASE activator. So all references of that activator are affected but currently loaded. ; Note3: Visibility in game is entirely dependent on the form actually having a model. ; References will not update their visual unless they are Disable()/Enable(). ; Flag: True: IsMarker (invisible). False: !IsMarker (visible). ; Primarily intended for debug purposes. Bool Function SetIsMarkerFlag(Form akForm, Bool Flag) Global Native ; Add all actors in a json to a faction. ; akFaction: The faction to add actors to. ; FileName: Path + file name. Relative to 'Data/SKSE/Plugins/StorageUtilData'. ; Eg: FileName = "Mcgufin/HsgNpcs.json" -> 'Data/SKSE/Plugins/StorageUtilData/Mcgufin/HsgNpcs.json' ; KeyName: The json key name to parse. Function AddJsonActorsToFaction(Faction akFaction, String FileName, String KeyName) Global Native ; Experimental: ; Even though this may fix your object reference name it may cause text elsewhere to have an upper case when it shouldn't :shrug: ; If it's an uncommon word (or better yet, an amalgamation of words) then I suppose the likelihood is low? Function SetDisplayNamePatchStringTable(ObjectReference ObjRef, String akName) Global Native ; Returns an Actor Reference from a given ActorBase. ; Successfully retrieving a reference will depend on: ; 1) Reference persistence ; 2) Whether the reference has actually been instantiated yet Actor Function GetActorRefFromBase(ActorBase akBase) Global Native ; Returns the index of the first matching magic effect on an actor, or -1 if none found. Int Function FindFirstMatchMagicEffect(Actor akActor, MagicEffect[] akEffects) Global Native ; Add one of each form in akForms to ObjRef. Function AddFormsToObjRef(ObjectReference ObjRef, Form[] akForms) Global Native ; Returns the 'Consume sound' set for akPotion. Form Function GetAlchemyConsumeSound(Potion akPotion) Global Native
UI / Menu / String Manipulation:
Spoiler
; Splits a path + filename + extension into it's constructive parts. ; Accepted folder separators = '\', '\\', '/'. ; Eg: "\Textures\Actors\SomeMod\Body.dds" -> ["Textures", "Actors", "SomeMod", "Body", "dds"] ; Filename is always the 2nd last element. Extension is always the last element, even if the file has no extension. ; Eg: "\Textures\Actors\SomeMod\Body" -> ["Textures", "Actors", "SomeMod", "Body", ""] String[] Function FormatFilePathSplit(String Path) Global Native ; Opposite of FormatFilePathSplit. Reconstruct parts into a single path + filename + extension string using ; a custom separator. String Function FormatFilePathJoin(String[] Parts, String Separator = "/") Global Native ; If Str is longer than Len then truncates a section of the string beginning at HeadLen to fit Len. ; Replaces the truncated section with Fill. If Str is <= Len then simply returns Str. String Function FormatMenuStringTruncate(Int Len, String Str, Int HeadLen = 0, String Fill = "...") Global Native ; Format a string for a menu system into left/right. ; Packs left/sep/right with a flexible gap. One side is preserved and the other clipped when space runs out. ; Len: The total desired length of the string. ; Left / Right: The strings to place on the left / right. ; Separator: Optional. Placed at the end of 'Left'. ; Priority: If the combined length exceeds Len then: 0 = Preserve left, clip Right. 1: Preserve right, clip left. ; Pad: The 'gap' required between left and right. -1 = Pad out the string to 'Len'. ; Clip: If a string is clipped in the center then place this string between. String Function FormatMenuStringGap(Int Len, String Left, String Right, String Separator = ": ", Int Priority = 1, Int Pad = -1, String Clip = "...") Global Native ; Lays out left/sep/right in a fixed-width two-column grid. Each side clips independently on overflow. String Function FormatMenuStringGrid(Int Len, String Left, String Right, String Separator = ": ", String Clip = "...") Global Native ; Trim a float to a number of decimal places with optional rounding. For display purposes mostly. String Function SnipToDecimalPlaces(Float Value, Int Places = 2, Bool RoundUp = true) Global Native ; Quick 'is any menu open' check. Works with mods that unpause menus. Bool Function IsAnyMenuOpen() Global Native Bool Function IsGamePaused() Global Native
Naming / Identification:
Spoiler
; -- EditorID / FormID -- ; Return the EditorID of a form. String Function GetEditorID(Form akForm) Global Native ; Returns a string array of the EditorIDs of the form array. Handy for menus. String[] Function GetEditorIDsFromForms(Form[] akForms) Global Native ; Gets a form by it's EditorID. Requires PO3 Extender Form Function GetFormByEditorID(String EditorID) Global Native ; Array version. Input and output arrays are equal length, even if an ID could not be resolved (none). Form[] Function GetFormsByEditorID(String[] EditorIDs) Global Native ; Returns a string representation of a form's formID. ; Eg: GetFormIDAsHex(Game.GetPlayer()) = '00000014' String Function GetFormIDAsHexString(Form akForm) Global Native ; Array version of GetFormIDAsHexString. Returns '00000000' for any None form. String[] Function GetFormIDsAsHexStrings(Form[] akForms) Global Native ; -- Origin Mod -- ; Get the original mod that created the form. ; For references, returns the base object's origin mod. String Function GetFormOriginMod(Form akForm) Global Native ; Returns string array of the names of mods editing this form ; Element 0 = Defining mod ; Last element = Winning override String[] Function GetModsAffectingForm(Form akForm) Global Native ; -- Display Name -- ; Returns the best available name for a form. ; Depth: 0 = Display name only, 1 = Form name, 2 = EditorID. ; Note that depth 0 here only works if the passed in forms are references. Either actors or ; object references. Also some form types don't have any 'name' field but depth 2 should ; cover these cases. String Function GetFormName(Form akForm, Int Depth = 2) Global Native ; Array version of GetFormName. String[] Function GetFormNames(Form[] akForms, Int Depth = 2) Global Native ; Returns the best available name for an object reference. ; Order of preference: 1 - Display name, 2 - Base object name, 3 - Base EditorID. ; Depth: 0 = Display name only. 1 = Display name or base name. 2 = Display name or base name or editorID. ; Depth is clamped to 0 - 2. String Function GetObjRefName(ObjectReference akRef, Int Depth = 2) Global Native ; Array version of GetObjRefName. Empty string for any None or nameless ref (same array size). String[] Function GetObjRefNames(ObjectReference[] akRefs, Int Depth = 2) Global Native ; To save casting here's the actor versions. String Function GetActorName(Actor akActor, Int Depth = 2) Global Native String[] Function GetActorNames(Actor[] akActors, Int Depth = 2) Global Native ; Returns [RefName, RefEditorID, RefFormID, BaseName, BaseEditorID, BaseFormID] for a reference string[] Function GetFullRefInfo(ObjectReference akRef) Global Native ; Convert the contents of a formlist into a string array of the names of the items in the list. ; Primarily for menu display purposes. This is massively faster than looping like: SomeList.GetAt(i).GetName(). ; If the form names are blank (like say for a formlist of formlists) then falls back to getting the EditorID instead. ; RemoveString = Optionally remove a string from each name. ; UseEditorID = Override the default behavior and force return EditorIDs instead of form names. String[] Function GetFormListNames(FormList akList, string RemoveString = "", Bool UseEditorID = false) Global Native
Distance / Sorting:
Spoiler
; -- Distance -- ; Returns the distance between 2 positions. Points = [x,y,z] position array. Float Function GetDistanceBetweenPoints(Float[] Point1, Float[] Point2) Global Native ; If both refs are in the same cell or worldspace then returns a normal GetDistance(). ; If not then tries to give you an (VERY) approximate distance using center/horse markers and load doors. ; If you require distance accuracy this isn't the function for you. Think of it as more of a 'roughly how far away'. ; Any negative number means the result was ambigious and should be discarded. ; Best used for very long distance estimates. Float Function GetAnchoredDistance(ObjectReference RefA, ObjectReference RefB) Global Native ; Batch version of GetAnchoredDistance: returns each akRefs[i]'s 'distance'. Float[] Function GetRefAnchoredDistances(ObjectReference akOrigin, ObjectReference[] akRefs) Global Native ; Actor version. Float[] Function GetActorAnchoredDistances(ObjectReference akOrigin, Actor[] akActors) Global Native ; -- Sorting -- ; Same approach as GetAnchoredDistance() but sorts akRefs array by distance to akOrigin. Closest to furthest. ; DropUnknowns: True - Removes ambigious results. False: Keep ambigious results (but they are still sorted to the end of the array). ; Good way to find which ref is approximately closest, regardless of where they are. ObjectReference[] Function SortRefsByAnchoredDistance(ObjectReference akOrigin, ObjectReference[] akRefs, bool DropUnknowns = true) Global Native ; Actor version. Actor[] Function SortActorsByAnchoredDistance(ObjectReference akOrigin, Actor[] akActors, Bool DropUnknowns) Global Native ; Same as SortRefsByAnchoredDistance but returns the sorted INDEX order of akRefs by distance instead of reordering akRefs. ; For use with parallel arrays. ; Eg: Result[0] = Index in akRefs of the closest ref, Result[1] = 2nd closest. Result[Result.Length - 1] = The index of the most distance ref. Int[] Function SortRefIndicesByAnchoredDistance(ObjectReference akOrigin, ObjectReference[] akRefs, Bool DropUnknowns = true) Global Native ; Actor version. Int[] Function SortActorIndicesByAnchoredDistance(ObjectReference akOrigin, Actor[] akActors, Bool DropUnknowns) Global Native ; Sort actors by the distance from their editor position to akRef. ; For prioritizing package data data that uses 'Near Editor Location'. Actor[] Function SortActorsByEditorDistance(Actor[] akActors, ObjectReference akRef) Global Native
Keywords & Inventory:
Spoiler
; Count the number of items in an object reference with any keyword in akKeywords. ; Reverse = false: Count any items with any of the supplied keywords. ; Reverse = true: Count any items without any of the supplied keywords. ; Note: Stacks count! ; Eg: if the player has 2x "Miner's Clothes" then: ; _MGF_Util.CountItemsWithKeywords(PlayerRef, akKeywords = [ClothingBody], Reverse = false) = 2 Int Function CountItemsWithKeywords(ObjectReference ObjRef, Keyword[] akKeywords, Bool Reverse = false) Global Native ; Returns a form array of items in ObjRef that have at least one of the supplied keywords. ; Reverse = false: Get items in ObjRef with any of the supplied keywords. ; Reverse = true: Get items in ObjRef with none of the supplied keywords. ; Returned forms are unique - No duplicates. Form[] Function GetItemsWithKeywords(ObjectReference ObjRef, Keyword[] akKeywords, Bool Reverse = false) Global Native ; Returns a full list of keywords equipped on an actor. Armor & weapons. Keyword[] Function GetAllWornKeywords(Actor akActor) Global Native ; abReverse = false: Returns every member of akKeywords that akActor has equipped. ; abReverse = true: Returns every member of akKeywords that akActor does not have equipped. ; False - Which of these keywords do they have equipped. True - Which of these keywords do they NOT have equipped. Keyword[] Function GetWornKeywords(Actor akActor, Keyword[] akKeywords, Bool abReverse = false) Global Native ; Count the number of equipped items with any of the supplied keywords. ; Items that cover multiple slots only count once. ; Covers all armor slots + left/right hands. ; abReverse: False -> Count equipped keywords. ; True -> Count keywords the actor doesn't have equipped. Int Function CountEquippedItemsWithKeywords(Actor akActor, Keyword[] akKeywords, Bool Reverse = false) Global Native ; Get a list of all equipped items on an actor matching at least one of the supplied keywords. ; Reverse = false: Match to keywords. ; Reverse = true: Return only items that have none of the supplied keywords. Form[] Function GetEquippedItemsWithKeywords(Actor akActor, Keyword[] akKeywords, Bool Reverse = false) Global Native
Raycasting / Crosshair / Detection:
Spoiler
; -- Crosshair -- ; Return the object reference under the crosshairs. ; Unlike Game.GetCurrentCrosshairRef() this doesn't need to be very close to the player. ; And it also returns most objects - not just actors or activatables. ObjectReference Function GetExtendedCrosshairRef(Float MaxDistance = 10000.0) Global Native ; Same as above but it just returns the distance to the object. Float Function GetExtendedCrosshairDistance(Float MaxDistance = 10000.0) Global Native ; Returns the x, y, z coordinates of where a ray cast collides with either a static or terrain. Float[] Function GetCrosshairGroundHit(Float MaxDistance = 10000.0) Global Native ; Casts a ray out maxDistance from the camera. At the end of that ray then casts another ray downwards MaxDropDistance ; at SafetyAngle. Returns either the coordinates of any collision along the way or the end coordinates ; of the downward ray. ; ActorOffsetMult: If the crosshair ray hits an NPC, how far behind them to place the target point. ; 0.0 = at the hit point, 1.0 = 128 units behind, 2.0 = 256 units behind. (Mainly intended for my Blink mod) Float[] Function GetCrosshairGroundBelow(Float MaxDistance = 512.0, Float MaxDropDistance = 256.0, Float SafetyAngle = 5.0, Float ActorOffsetMult = 0.0) Global Native ; -- Actor Raycasts -- ; Like GetCrosshairGroundBelow but emits from an actor's position rather than the camera. ; Returns [x, y, z] coordinates of ground below the endpoint, or empty array if no ground found. ; actor: The actor to cast from. ; CastHeightMult: Origin height as a fraction of actor height. 0.0 = feet, 1.0 = top of head, 0.8 = ~eye height. ; MaxDistance: How far forward to cast the ray. ; MaxDropDistance: Max distance to drop downward to find ground (0.0 = unlimited). ; SafetyAngle: Angle in degrees for drop ray (0.0 = straight down, 45.0 = angled back toward actor). ; ActorOffsetMult: If the crosshair ray hits an NPC, how far behind them to place the target point. ; 0.0 = at the hit point, 1.0 = 128 units behind, 2.0 = 256 units behind. ; Use 0.0 if you don't care about NPC avoidance. ; UseCameraDirection: true = cast in the direction the camera is looking, false = cast in the direction the actor is facing. ; FlattenRay: true = ignore vertical aim, ray travels parallel to flat ground regardless of camera/actor pitch. Float[] Function GetActorGroundBelow(Actor akActor, Float CastHeightMult, Float MaxDistance = 512.0, Float MaxDropDistance = 256.0, Float SafetyAngle = 5.0, Float ActorOffsetMult = 0.0, Bool UseCameraDirection = false, Bool FlattenRay = true) Global Native ; Uses 'Ray Casts' between actors to determine if there is a clear path between them. ; Specify how many ray casts you want to use. Higher = better accuracy but increased cost. Default = 5 ; Rays are cast dynamically at various heights depending on the size of the actors but 20% from the bottom to 10% from the top. ; Rays collide with static objects (like walls, tables, counters) and other actors. ; Note that this doesn't necessarily mean that there is a navigatable path between them but ; only that there is probably a clear line of sight between them (navmeshes!). ; As I understand it, traditional LOS checks check that LOS exists between eye nodes. So it usually will ; return true even if there's a table or counter etc in the way. ; WidthCoverageMultiplier: This offsets rays to the left and right horizontally to try to detect if there's a clear 'tunnel' and ; not just a clear straight line. Rays are cast (from bottom to top): center, left, right, left, right, left ; WidthCoverageMultiplier = 0.0 -> Straight line detection only. ; WidthCoverageMultiplier = 0.5 -> Rays span 50% of actor width total. ; WidthCoverageMultiplier = 1.0 -> Rays span 100% of actor width total (covers the full actor). ; WidthCoverageMultiplier = 2.0 -> Rays span 200% of actor width total (extends beyond actor). ; You can decide yourself how strict the path check should be by: ; GetClearPathCountBetweenActors(akActorA, akActorB, 5, 1.0) == 5 -> Should be fully clear ; GetClearPathCountBetweenActors(akActorA, akActorB, 8, 0.6) == 7 -> Might be clear ; GetClearPathCountBetweenActors(akActorA, akActorB, 10, 2.0) == 0 -> Definitely blocked Int Function GetClearPathCountBetweenActors(Actor akActorA, Actor akActorB, Int RayCount = 5, Float WidthCoverageMultiplier = 0.6) Global Native ; Return true if two actors are facing each other. ; Threshold: How narrowly the actors must be facing each other. ; 0 -> Must be perfectly aligned (Probably never happen). ; 45 -> Within a 45° cone (quite strict). ; 90 -> Within a 90° cone (moderate). ; 120 -> Within a 120° cone (generous). ; 180 -> Any direction (always passes). ; MinDistance: How close the actors need to be to even qualify as facing. Bool Function AreActorsFacing(Actor akActor1, Actor akActor2, Float Threshold, Float MinDistance = 512.0) Global Native
Location / Cell:
Spoiler
; Whether this cell is loaded or not. Bool Function IsCellLoaded(Cell akCell) Global Native ; Moves the player to akCell. ; Unlike Debug.CenterOnCell this can move you to cells without any editor ID. ; Works for internal and external. Though there's no guarantee where exactly you'll be placed. Function MoveToCell(Cell akCell) Global Native ; Papyrus IsCleared() resets. This doesn't. Bool Function WasLocationEverCleared(Location akLoc) Global Native ; Returns the location assigned to a cell. ; Many cells (exterior wilderness in particular) won't have any assigned location. ; Most interior cell should have some location assigned. Location Function GetCellLocation(Cell akCell) Global Native ; Returns [x, y] grid coordinates of an exterior cell. ; Returns empty array for interior cells or if coordinates unavailable. Int[] Function GetCellCoords(Cell akCell) Global Native ; Traverses parentLoc chain to find the top-level world location ; Returns None if akLoc is None or a cycle is detected Location Function GetWorldLocation(Location akLoc) Global Native ; Get all the cells that are assigned to this location. Cell[] Function GetLocationCells(Location akLoc) Global Native ; Returns true if the location has a keyword matching the given editorID string Bool Function LocationHasKeywordString(Location akLoc, String asEditorID) Global Native ; Returns all keywords assigned to a location. Keyword[] Function GetLocationKeywords(Location akLocation) Global Native ; Returns the 'center' marker associated with a location. ; This is assigned to the location in the creation kit but it's optional and can be 'None' - 'MNAM' field in TesEdit. ; ClimbParent: If enabled and akLoc has no center marker then will continue getting parent locations until a center marker is found. ; ClimbBackstop - FormList of locations climbing must not resolve into (Eg: Hold-level locations). Reaching one stops the climb and ; returns None for that entry. ObjectReference Function GetLocationCenterMarker(Location akLoc, Bool ClimbToParent = False, FormList ClimbBackstop = None) Global Native ; Array version ; KeepNones: False = Discard locations where a center marker could not be resolved (Shorten returned array). ; True = Return a 'None' at the array index where the location center could not be resolved (equal length array). ObjectReference[] Function GetLocationCenterMarkers(Location[] akLocs, Bool KeepNones = True, Bool ClimbParents = False, FormList ClimbBackstop = None) Global Native ; Similar to GetLocationCenters but customizable. ; Checks akLocs Editor IDs against CentersQuest alias names. Returns the reference for that alias if the names match. ; The quest serves both as a 'lookup table' and to keep your marker refs persistent so they can always be resolved. ObjectReference[] Function GetMgfCenters(Location[] akLocs, Quest akCentersQuest, Bool KeepNones = True, Bool ClimbParents = False, FormList ClimbBackstop = None) Global Native ; Returns the 'Horse Marker' associated with akLoc. Also optional and can be 'None'. ; 'NAM0' field in TesEdit. ObjectReference Function GetLocationHorseMarker(Location akLoc, Bool ClimbToParent = False, FormList ClimbBackstop = None) Global Native ; Array version. ObjectReference[] Function GetLocationHorseMarkers(Location[] akLocs, Bool KeepNones = True, Bool ClimbParents = False, FormList ClimbBackstop = None) Global Native ; Returns all object references of a specific type assigned to a location (Eg: Boss, BossContainer, JarlThrone etc). ; Unloaded references may not be returned - Best to be in the location when calling this. ; akType = None = Return all references regardless of type. ObjectReference[] Function GetLocationRefsByType(Location akLoc, LocationRefType akType) Global Native ; Sorts actors by confidence of name match against cell/location names. ; ExcludeNoMatch: False = return all actors. True: Remove non matches. ; Eg: ActorsByCellNameMatch(BelethorsGeneralGoodsCell, [Sigurd, Belethor] would return: ; ExcludeNoMatch = false: [Belethor, Sigurd] ; true: [Belethor] Actor[] Function ActorsByCellNameMatch(Cell akCell, Actor[] akActors, bool ExcludeNoMatch = true) Global Native
Crime:
Spoiler
; Dumps debug info to the MGF log. Function DumpCrimeData() Global Native ; Returns a deduplicated list of all owners of stolen items in akRef's inventory. ; Owner may be a Faction or an Actor base. Form[] Function GetAllStolenItemOwners(ObjectReference akRef) Global Native ; Returns stolen items from akRef's inventory. ; akOwner: Actor Bases or Factions you want to check for stolen forms. ; CountEach: True = One entry per individual item (stack expanded). False = Deduplicate forms. Form[] Function GetStolenItems(ObjectReference akRef, Form[] akOwners, Bool CountEach = True) Global Native ; Returns the value of stolen goods tracked by the engine for the player. ; This is the total lifetime value. Not the value since the player was last arrested. ; akFaction = None sums across all factions. ; Mode: 0 = total, 1 = witnessed (caught), 2 = unwitnessed. Int Function GetTotalStolenValue(Faction akFaction, Int Mode = 0) Global Native ; Returns factions the engine is tracking for stolen goods against. Faction[] Function GetFactionsWithStolenGoods() Global Native
Doors:
Spoiler
; Returns true if akDoor is a load door (links to another cell). bool Function IsLoadDoor(ObjectReference akDoor) Global Native ; Returns the paired door ref on the other side of a load door. ObjectReference Function GetLinkedDoor(ObjectReference akDoor) Global Native ; Returns the location that a load door leads to. Location Function GetLoadDoorDestinationLocation(ObjectReference akDoor) Global Native ; Returns the arrival position (this side) [x, y, z] when travelling through this door. ; Returns an empty array if akDoor is not a load door. ; Not sure on practical use but it's data you didn't have access to before... Float[] Function GetLoadDoorArrivalPos(ObjectReference akDoor) Global Native ; Returns the arrival rotation (this side) [x, y, z] when travelling through this door. ; Returns an empty array if akDoor is not a load door. ; Not sure on practical use but it's data you didn't have access to before... Float[] Function GetLoadDoorArrivalRot(ObjectReference akDoor) Global Native ; Teleports akActor to the arrival marker position of akDoor. ; akDoor must be a load door. Returns false if it is not, or if the destination cannot be resolved. ; Does not fire activate events for the door. Nor does the door need to be unlocked. ; Probably more useful for moving/spawning actors at a cell entrance in a convincing manner than moving the player to a cell. ; If used on a door that is not currently loaded then you'll be placed inside the door because SetPosition runs during the load screen. ; If you need to go to a door in another cell try: ; MoveTo(Door) ; Put you in the right cell ; Utility.Wait(0.01) ; Wait for load screen to finish ; _MGF_Util.TeleportToDoorMarker(Door) ; now move to door marker Bool Function TeleportToDoorMarker(Actor akActor, ObjectReference akDoor) Global Native ; Returns all persistent/loaded load door refs at the given location. ; IncludeChildLocs: True = include doors in child locations. ; ExternalDoors: 0 = Any load doors, 1 - External load doors only, 2 - Internal load doors only. ; External is defined as the linked door being in a cell flagged as External. ObjectReference[] Function GetLocationLoadDoors(Location akLoc, bool IncludeChildLocs = false, Int ExternalDoors = 0) Global Native
Beds:
Spoiler
; Return true if the kCanSleep flag is set. Bool Function IsSleepFurniture(ObjectReference akBed) Global Native ; Returns the number of 'slots' a furniture item has. ; IE: Forge, cooking pot, single beds = 1. Double beds, wide benches = 2(+?) ; Extracts 'Num Positions' from BSFurnitureMarkerNode in the nif (Positions array size). ; ObjRef's 3D must be loaded for accurate results. Int Function GetFurnitureSlots(ObjectReference ObjRef) Global Native ; Returns either the ActorBase (direct owner) or Faction (shared ownership) that owns this bed. Form Function GetBedOwner(ObjectReference akBed) Global Native ; Returns the actor currently using this furniture object. Actor[] Function GetFurnitureOccupants(ObjectReference akFurniture) Global Native ; Finds all 'bed' furniture in the current cell. ObjectReference[] Function FindBedsInCell() Global Native ; Returns true if akActor has a sleep package that targets this bed. ; Checks both base actor packages and alias packages. Bool Function ActorSleepPackageTargetsBed(Actor akActor, ObjectReference akBed) Global Native ; Attempt to trace through akActor's AI packages to find their assigned bed. ; Searches both alias packages and actor base packages. ; Bed persistence is this functions weakness. ; If PlayerRef.GetParentCell() == akActor.GetEditorCell() is your best shot for an accurate read. ; Function returns ALL beds from all packages. Usually the first element is the best choice (alias package) ; The reverse function (Bed -> Actor) is in _MGF_Main - GetBedUsers() ObjectReference[] Function GetActorBeds(Actor akActor) Global Native
0
0 Comments
Recommended Comments
There are no comments to display.