Jump to content

MCGUFIN

  • entries
    10
  • comments
    0
  • views
    735

Events


Monoman1

77 views

MGF broadcasts a number of useful events. 

 

Game Events: 

Spoiler

Load Order Change: 

Spoiler

Event sent whenever there's been some modification to the game's load order since the last save. Full description in the 'Load Order Monitor' section of the blog. 

 

See script: _MGF_Util

Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_LoadOrderChanged", "On_MGF_LoadOrderChanged")
EndEvent

Event On_MGF_LoadOrderChanged(Bool OrderChanged, Bool ModsAdded, Bool ModsRemoved, Bool ModsModified)
    ; OrderChanged - The order has simply changed since last load. 
    ; ModsAdded - Mods were added since the last load. 
    ; ModsRemoved - Mods were removed since last load. 
    ; ModsModified - At least one of the plugin files has been modified since the last load. 
    
    ; All these flags are set individually -> ModsAdded and ModsRemoved could both be true!
      
	String[] ModsAdded = _MGF_Util.GetAddedMods()
	String[] ModRemoved = _MGF_Util.GetRemovedMods() 
	String[] ModModified = _MGF_Util.GetModifiedMods()

	String[] PrevOrder = _MGF_Util.GetPreviousLoadOrder()
	String[] CurOrder = _MGF_Util.GetCurrentLoadOrder()
EndFunction

 

 

Player Load Game Event: 

Spoiler

This is just a simple relay of the vanilla OnPlayerLoadGame event. It's just for convenience - saves you setting up a player alias + script to do it yourself. 

 

See script: _MGF_MainPlayerAlias


Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_PlayerLoadsGame", "On_MGF_PlayerLoadsGame")
EndEvent

Event On_MGF_PlayerLoadsGame(string eventName, string strArg, float numArg, Form sender)
	; Game was loaded. 
EndEvent

 

 

Do Once Per Game Session: 

Spoiler

Sometimes you want to do something only once per game load. This fires once on the first game load. After that, for the event to fire again the game must be exited and restarted. 

See script: _MGF_MainPlayerAlias

Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_DoOncePerGameSession", "On_MGF_DoOncePerGameSession")
EndEvent

Event On_MGF_DoOncePerGameSession(string eventName, string strArg, float numArg, Form sender)
	Debug.Messagebox("_MGF_DoOncePerGameSession")
EndEvent

 

 

Game Time Updates Begin: 

Spoiler

Due to an odd quirk in papyrus, RegisterForUpdateGameTime() will fail silently when quest MQ101 stage is < 240. Use this event to begin your GameTime updates. 

See script: _MGF_MQ101Kicker

Usage: 

Event OnInit()
	If (Game.GetFormFromFile(0x03372B, "Skyrim.esm") as Quest).GetStage() >= 240 ; MQ101
    	; MQ101 is already at or greater than stage 240 - Ok to begin updates. 
        RegisterForSingleUpdateGameTime(1.0)
	Else
		; RegisterForUpdateGameTime() will fail silently.
		RegisterForModEvent("_MGF_MQ101_Stage240", "On_MGF_MQ101_Stage240")
EndEvent

Event On_MGF_MQ101_Stage240(string eventName, string strArg, float numArg, Form sender)
	; MQ101 has changed stage to >= 240 - Ok to being game time updates. 
	UnRegisterForModEvent("_MGF_MQ101_Stage240") ; Won't get the event again but in the interest of tidyness. 
	RegisterForSingleUpdateGameTime(1.0)
EndEvent

Event OnUpdateGameTime()
	; Do update stuff
EndEvent

 

 

Player combat state change: 

Spoiler

Just a standard player combat state change event using spell state detection. There must be a million mods doing this (= multiple spells/scripts doing the same thing). Maybe let's just do it once and relay to any mod that needs it...

Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_PlayerCombatState", "On_MGF_PlayerCombatState")
EndEvent

Event On_MGF_PlayerCombatState(string eventName, string strArg, float numArg, Form sender)
	If numArg == 1.0
		Debug.Messagebox("Combat start")
	Else
		Debug.Messagebox("Combat ended")
	EndIf
EndEvent

 

 

Player Ragdoll Event:

Spoiler

While the player is in a ragdoll state doing certain things are pretty dangerous, especially playing animations etc. You can use this event to gate your own script. MGF also includes a built in global that's automatically updated with the player's ragdoll state if you need a CK condition: _MGF_PcIsRagDolled

 

See Script: _MGF_UnRagdoller

 

Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_RagDollEvent", "On_MGF_RagDollEvent")
EndEvent

Event On_MGF_RagDollEvent(string eventName, string strArg, float numArg, Form sender)
	If numArg == 0.0
		Debug.Messagebox("Ragdoll begin")
	ElseIf numArg == 1.0
		Debug.Messagebox("Ragdoll end")
	EndIf
EndEvent

 

 

Thane Event:

Spoiler

MGF sends an event whenever the player becomes Thane of a hold. There's also a built in global that's automatically updated when you become Thane and as you travel between holds: _MGF_PcIsThaneHere. 

See script: _MGF_ForkThane

Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_PlayerBecameThane", "On_MGF_PlayerBecameThane")
EndEvent

Event On_MGF_PlayerBecameThane(string eventName, string strArg, float numArg, Form sender)
	; strArg = The hold name with any whitespace removed. These are the same as the HoldState names that LocOps/LocTrack uses. 
    ; numArg = The hold index as defined in LocationMap.json. 
	Debug.Messagebox("Player became Thane of " + strArg + " - " + numArg)
EndEvent

 

 


Location Events:

Spoiler

Room Change:

Spoiler
Event fired whenever ObjRef moves between rooms in an interior cell. 

; Register a form for reference room change events. 
; Registrations survive save + reload. 
; Event On_MGF_ActorRoomChange(Actor akActor, Int OldRoom, Int NewRoom)
; akActor: The actor that changed room. 
; OldRoom: The index of the room akActor came from. 
; NewRoom: The index of the room akActor is now in. 
Function RoomTrackActor(Form akForm, ObjectReference ObjRef) Global Native

; Unregister this for reference for room change events. 
Function RoomUntrackActor(Form akForm, ObjectReference ObjRef) Global Native

; Untrack all references. 
Function RoomUntrackAll(Form akForm) Global Native

; Is this reference registered for room change events on this form. 
Bool Function RoomIsTrackedActor(Form akForm, ObjectReference akRef) Global Native

See script: _MGF_Util

Usage:
Event OnInt()
	_MGF_Util.RoomTrackActor(Self, PlayerRef)
EndEvent

Event On_MGF_ActorRoomChange(Actor akActor, Int OldRoom, Int NewRoom)
Debug.Messagebox("Actor changed room. \nActor: " + akActor.GetDisplayName() + \
										"\nNewRoom: " + NewRoom + \
										"\nOldRoom: " + OldRoom + \
										"\n\nAdjacent Rooms: " + _MGF_Util.RoomGetAdjacentRooms(NewRoom))
EndEvent

 

 

Cell Change: 

Spoiler

Just a straight up cell change event. If you're using Mcgufin as a master and need cell change events then might as well use Mcgufins'.
It's implemented natively so no magic effect and no invisible object following you around and it has a practical event payload. 

 

See script: _MGF_Util

 

Usage:

Event OnInit()
    _MGF_Util.RegisterForCellChange(Self)
EndEvent

Event On_MGF_CellChange(Cell akCell, Location akLocation, WorldSpace akWorldspace, bool abInterior)
    ; Cell changed.
EndEvent

 


Area Change: 

Spoiler

Event fired whenever the player changes area. Area here is defined as a logical group of locations. RiverwoodRiverwoodTrader, RiverwoodSleepingGiantInn, RiverwoodAlvorsHouse & the exterior area surrounding Riverwood are all part of the 'RiverwoodLocation' area as far as MGF is concerned. So moving between these locations doesn't fire an event. But as soon as you wander off far enough down the road or teleport to a new location you'll get this event. 

See script: _MGF_LocTrack

Usage:

RegisterForModEvent("_MGF_LocTrack_AreaChange", "On_MGF_LocTrack_AreaChange")

Event On_MGF_LocTrack_AreaChange(string eventName, string strArg, float numArg, Form sender)
	; Do area stuff.
    ; strArg = AreaStateName
	; numArg = Location index in LocationMap.json
	GoToState(strArg) ; strArg is the location editor name. Eg: WhiterunLocation
EndEvent

State WhiterunLocation
	Event OnBeginState()
		; Set up stuff for Whiterun
	EndEvent
	
	Function GetLocalInnkeeper()
		Return Hulda
	EndFunction
	
	Event OnEndState()
		; Tear down stuff for Whiterun
	EndEvent
EndState

State RiverwoodLocation
	Event OnBeginState()
		; Set up stuff for Riverwood
	EndEvent
	
	Function GetLocalInnkeeper()
		Return Orgnar
	EndFunction
	
	Event OnEndState()
		; Tear down stuff for Riverwood
	EndEvent
EndState

 

Hold Change: 

Spoiler

Event fires whenever the player moves between the 9 different holds of Skyrim. Even works out in the wilderness (Requires XCLR region patch). The holds as I've mapped them don't extend to the far reaches of the map. So you can be in the Skyrim world and also not be in any of the nine holds. 

See script: _MGF_LocTrack

Usage:

RegisterForModEvent("_MGF_LocTrack_HoldChange", "On_MGF_LocTrack_HoldChange")

Event On_MGF_LocTrack_HoldChange(string eventName, string strArg, float numArg, Form sender)
	; Do hold stuff.
    ; strArg = HoldStateName as defined in LocationMap.json
	; numArg = Hold index as defined in LocationMap.json
	GoToState(strArg) ; strArg is the hold name with any white space removed. Eg: "The Pale" -> "ThePale". So it can be used in state names
EndEvent

State Whiterun
	Event OnBeginState()
		; Player entered Whiterun hold
	EndEvent

	Function GetJarlHere()
		Return Balgruuf
	EndFunction
	
	Event OnEndState()
		; Player left Whiterun hold
	EndEvent
EndState

State TheRift
	Event OnBeginState()
		; Player entered The Rift hold
	EndEvent
	
	Function GetJarlHere()
		Return Laila
	EndFunction
	
	Event OnEndState()
		; Player left The Rift hold
	EndEvent
EndState

 

 

World Change: 

Spoiler

Event fires whenever the player moves between worlds. MGF defines worlds in a more human geographical fashion. 

See script: _MGF_LocTrack

Usage: 

RegisterForModEvent("_MGF_LocTrack_WorldChange", "On_MGF_LocTrack_WorldChange")

Event On_MGF_LocTrack_WorldChange(string eventName, string strArg, float numArg, Form sender)
	; Do world change stuff
    ; strArg = WorldStateName as defined in LocationMap.json
	; numArg = World index as defined in LocationMap.json
	GoToState(strArg) ; strArg is the world name with any white space removed. Eg: "The Soul Cairn" -> "TheSoulCairn". So it can be used in state names
EndEvent

State TheSoulCairn
	Event OnBeginState()
		; Player entered The Soul Cairn
	EndEvent

	Event OnEndState()
		; Player left The Soul Cairn
	EndEvent
EndState

 

 

Approaching Area: 

Spoiler

Event fires when a locations center marker has been attached to a cell. Note that I don't do any filtering on the distance to the marker so that you can decide the context of the event. But you probably don't want to accept this event if you're simply exiting from a building in the area so a sensible default filter is numArg >= 8000.0. This typically means that you've walked into the area. 

See script: _MGF_LocTrack

Usage: 

RegisterForModEvent("_MGF_LocTrack_ApproachingArea", "On_MGF_LocTrack_ApproachingArea")

Event On_MGF_LocTrack_ApproachingArea(string eventName, string strArg, float numArg, Form sender)
	; strArg = AreaStateName - See LocationMap.json 'locationstates'
	; numArg = The distance to the marker
	; sender = The marker object reference
EndEvent

 

 

Departing Area: 

Spoiler

Event fires when an areas center marker has been unattached from a cell. At default ugridsToLoad departing usually occurs around the 12000 - 15000 distance mark. Distance to the marker when entering an internal cell will be astronomically high even if the marker is just outside the door.

 

See script: _MGF_LocTrack

Usage: 

RegisterForModEvent("_MGF_LocTrack_DepartedArea", "On_MGF_LocTrack_DepartedArea")

Event On_MGF_LocTrack_DepartedArea(string eventName, string strArg, float numArg, Form sender)
	; strArg = AreaStateName - See LocationMap.json 'locationstates'
	; numArg = The distance to the marker
	; sender = The marker object reference
EndEvent

 

 

 

Collision Events:

Spoiler

 

Knock:

Spoiler

Event sent when the player collides with a physics object. Vanilla has a version of this but the exact conditions/reset are a mystery. 

 

See script: _MGF_Util


Usage: 

Event OnInit()
	_MGF_Util.RegisterForKnockOver(Self)
EndEvent

Event On_MGF_KnockOver(ObjectReference akRef, float afForce, float afSpeed, float afMass)
	;	akRef	- The object collided with. 
	;	afForce	- Physics impulse magnitude. 
	;	afSpeed	- Player's speed at moment of collision. 
	;	afMass	- Base object weight (0 for weightless/static objects). 
	Debug.Messagebox("On_MGF_KnockOver\nakRef: " + akRef + "\nafForce: " + afForce + "\nafSpeed: " + afSpeed + "\nWeight: " + afMass)
EndEvent

 

 

Actor: 

Spoiler

Event sent when the player makes contact with another actor. Again vanilla has a version of this but the internals are super opaque. Note that this is the sensitive version - Event is sent immediately on any contact! You may prefer the 'persist' event. 

 

See script: _MGF_Util

 

Usage: 

Event OnInit()
	_MGF_Util.RegisterForActorCollide(Self)
EndEvent

Event On_MGF_ActorCollide(ObjectReference akRef, float afImpactSpeed, float afSpeed, float afHitAngle, float afFacingAngle)
	;	akRef			- The actor contacted. 
	;	afSpeed			- Player's speed at collision. 
	;	afImpactSpeed	- Player speed directed toward the actor. Low impact speed vs afSpeed = glancing collision. 
	;	afHitAngle		- Where on actor contact was made: +1 = face, -1 = back, 0 = side. 
	;	afFacingAngle	- Relative orientation: -1 = face-to-face, +1 = same direction. 
    
    ; Quick approximate reference: 
    ; HitAngle	FacingAngle		Situation
	; 	≈+1			≈-1			Face-to-face collision - player hit actor's front, both facing each other
	; 	≈+1			≈+1			Player backed into actor's face - player facing away, actor facing player's back
	;	≈-1			≈-1			Back-to-back - player backed into actor's back, both facing away from each other
	;	≈-1			≈+1			Player snuck up behind - hit actor's back, both facing same way
	;	0			any			Side collision  player clipped past them. 
	Debug.Messagebox("On_MGF_ActorCollide\nakRef: " + akRef + "\nafImpactSpeed: " + afImpactSpeed + "\nafHitAngle: " + afHitAngle + "\nafFacingAngle: " + afFacingAngle)
EndEvent

 

 

Actor Persist: 

Spoiler

Event sent when the player 'pushes' against an actor. This requires the player to continuously push into the actor for a certain amount of time before the event fires. Less sensitive than the regular actor collision event. 

See script: _MGF_Util

Usage: 

Event OnInit()
	_MGF_Util.RegisterForActorPersist(Self)
EndEvent

Event On_MGF_ActorPersist(ObjectReference akRef, float afDuration, float afHitAngle, float afFacingAngle)
	;	akRef		- The actor being pushed against. 
	;	afDuration	- Seconds of sustained contact so far. 
	;	afHitAngle		- Where on actor contact was made: +1 = face, -1 = back, 0 = side. 
    ;	afFacingAngle	- Relative orientation: -1 = face-to-face, +1 = same direction. 
    
    ; Quick approximate reference:
	; HitAngle	FacingAngle		Situation
	; 	≈+1			≈-1			Face-to-face collision - player hit actor's front, both facing each other
	; 	≈+1			≈+1			Player backed into actor's face - player facing away, actor facing player's back
	;	≈-1			≈-1			Back-to-back - player backed into actor's back, both facing away from each other
	;	≈-1			≈+1			Player snuck up behind - hit actor's back, both facing same way
	;	0			any			Side collision  player clipped past them. 
	Debug.Messagebox("On_MGF_ActorPersist: " + "\nakRef: " + akRef + "\nafDuration: " + afDuration + "\nafHitAngle: " + afHitAngle + "\nafFacingAngle: " + afFacingAngle)
EndEvent

 

 

Stand On Furniture: 

Spoiler

Event fires whenever the player stands on a furniture object. Again vanilla has a version of this that fires inconsistently. 

See script: _MGF_Util

Usage: 

Event OnInit()
	_MGF_Util.RegisterForStandOnFurniture(Self)
EndEvent

Event On_MGF_StandOnFurniture(ObjectReference akRef)
	; akRef - What was stood on. 
	Debug.Messagebox("On_MGF_StandOnFurniture\nakRef: " + akRef)
EndEvent

 

 

Wall Collision: 

Spoiler

Event sent when the player collides with a wall. No vanilla equivalent. 
 

See script: _MGF_Util

 

Usage: 

Event OnInit()
	_MGF_Util.RegisterForWallCollide(Self)
EndEvent

Event On_MGF_WallCollide(ObjectReference akRef, float afSpeed, float afImpactSpeed, float afObjectHeight, int aiFormType, float afNormalX, float afNormalY, float afNormalZ)
	;   akRef          	 The object hit
	;   afSpeed        	 Raw player speed
	;   afImpactSpeed  	 Speed directed into the surface (scale of impact)
	;   afObjectHeight 	 Top of object relative to player height: <0.5=low, 1.0=head height, 2.0+=tall wall
	; 	aiFormType 		 Base object form type as int
	;   afNormalX/Y/Z  	 Surface normal pointing away from wall (invert for push direction)

	Debug.Messagebox("On_MGF_WallCollide\nakRef: " + akRef + "\nafSpeed: " + afSpeed + "\nafImpactSpeed: " + afImpactSpeed + \
					"\nafObjectHeight: " + afObjectHeight + "\naiFormType: " + aiFormType + "\nafNormalX: " + afNormalX + \
					"\nafNormalY: " + afNormalY + "\nafNormalZ: " + afNormalZ)
EndEvent

 

 


Pregnancy Event (See also blog section 'Pregnancy Fork'): 

Spoiler

These events are fired for all supported pregnancy mods no matter which one is installed. As of writing, supported mods are: 
Beeing Female NG. 
Fertility Mode Tweaks & Fixes. 
Fertility Mode Reloaded. 
(But not base BF or FM)

 

Conception Event: 

Spoiler

Sent whenever an actor has conceived. 

See script: _MGF_ForkPregnancy

Usage: 
 

Event OnInit()
	RegisterForModEvent("_MGF_Preg_Conceived", "On_MGF_Preg_Conceived")
EndEvent

Event On_MGF_Preg_Conceived(Form Mother, Form Father, Int NumBabies)
	Debug.Messagebox("On_MGF_Preg_Conceived: \nMother: " + _MGF_Util.GetFormName(Mother) + "\nFather: " + _MGF_Util.GetFormName(Father) + "\nNumBabies: " + NumBabies)
EndEvent

 

 

Labor Event: 

Spoiler

Sent whenever an actor enters 'labor'

 

See script: _MGF_ForkPregnancy

 

Usage: 
 

Event OnInit()
	RegisterForModEvent("_MGF_Preg_LaborStarted", "On_MGF_Preg_LaborStarted")
EndEvent

Event On_MGF_Preg_LaborStarted(Form Mother, Form Father, Int NumBabies)
	Debug.Messagebox("On_MGF_Preg_LaborStarted: \nMother: " + _MGF_Util.GetFormName(Mother) + "\nFather: " + _MGF_Util.GetFormName(Father) + "\nNumBabies: " + NumBabies)
EndEvent

 

 

Birth Event: 

Spoiler

Sent whenever an actor 'gives birth'. 

See script: _MGF_ForkPregnancy

Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_Preg_Birthed", "On_MGF_Preg_Birthed")
EndEvent

Event On_MGF_Preg_Birthed(Form Mother, Form Father, Int NumBabies, Form Baby)
	Debug.Messagebox("On_MGF_Preg_Birthed: \nMother: " + _MGF_Util.GetFormName(Mother) + "\nFather: " + _MGF_Util.GetFormName(Father) + "\nNumBabies: " + NumBabies)
EndEvent

 

 

Abort event:

Spoiler

Sent whenever a pregnancy is aborted. Because most mods do not transmit abort events there may be a slight delay on this event (up to 1 game hour). 

 

See script: _MGF_ForkPregnancy

 

Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_Preg_Aborted", "On_MGF_Preg_Aborted")
EndEvent

Event On_MGF_Preg_Aborted(Form Mother, Form Father)
	Debug.Messagebox("On_MGF_Preg_Aborted: \nMother: " + _MGF_Util.GetFormName(Mother) + "\nFather: " + _MGF_Util.GetFormName(Father))
EndEvent

 

 

 

Crafting:

Spoiler

Sent whenever the player crafts something. 

See script: _MGF_Util

 

Usage: 
 

Event OnInit()
	_MGF_Util.RegisterForItemCrafted(Self)
EndEvent

Event On_MGF_ItemCrafted(Form CreatedItem, Form Recipe, int Quantity, Keyword BenchKeyword)
	; CreatedItem - The item crafted by the player. 
    ; Recipe - the actual recipe used to craft CreatedItem. 
    ; Quantity - The number of 'CreatedItem's crafted. 
    ; BenchKeyword - The keyword assocaiated with the workbench used to craft the item ('BNAM').
EndEvent

 

 

Reference Load: 

Spoiler

Register an ObjectReference for load/unload and/or CellAttach/CellDetach events without having to populate an alias with it. This is intended for lightweight, temporary, or sporadic tracking of references — not as a replacement for long-lived quest aliases. If you need to permanently monitor a fixed set of references for the lifetime of a quest, aliases are generally still the better choice. Unlike aliases there is nothing in here keeping your references 'alive' (persistent). 

 

Event names are automatically prefixed with "_MGF_RefLoad_". Dual event name registrations so you can decide if you want to handle both Load and Unload event separately or handle both via a single event. Empty strings are ignored (Eg: If you provide only a LoadEventName but no UnloadEventName then you'll only get load events & vice versa). 

 

Multiple mods can register the same ref. Multiple references can be registered to the same event - You could register both Ulfberth and Adrianne to "_MGF_RefLoad_Warmaidens" and you'll get events for both refs with the one event handle. This is also a reason to keep your event handle unique! In this example it would probably be better to register your event as "_MGF_RefLoad_MyMod_Warmaidens" to avoid collisions with other registrations. 

 

Parameters:
 

akRef           - ObjectReference to track
LoadEventName   - Event suffix for the "entered" transition (Load, or CellAttach if TrackMode selects it).
UnloadEventName - Event suffix for the "left" transition (Unload, or CellDetach if TrackMode selects it).
TrackMode       - 0 = 	Load/Unload (3D loaded) events only [default]. The ref is guaranteed to be fully loaded - (Get3D(), position, etc. all valid).
                  1 = 	CellAttach/Detach events only. Fires earlier than Load/Unload, but the ref's 3D may not exist yet at that point 
						don't rely on Get3D()/position/animation state here.
                  2 = 	Both. Same callback fires for all four transitions; use strArg to tell them apart. 
                  		I'm not sure why you would want this but the option is there. 

 

Event payload: 

eventName: Your registered event name. 
strArg: Event type - "Load" / "Unload" / "CellAttach" / "CellDetach". 
numArg: 0.0 = Unload / CellDetach. 1.0 = Load / CellAttach. 
sender: The reference you registered. Theoretically CAN BE NONE for Unload/CellDetach - for non-persistent refs. 
Though I have not yet seen that behavior. 

 

 

See script: _MGF_Util

Usage (dual event handler): 

Function SomeFunction()
	RegisterForModEvent("_MGF_RefLoad_MyMod_AdrianneLoad", "On_MGF_RefLoad_MyMod_AdrianneLoad")
	RegisterForModEvent("_MGF_RefLoad_MyMod_AdrianneUnload", "On_MGF_RefLoad_MyMod_AdrianneUnload")
	_MGF_Util.RegisterRefLoadEvents(AdrianneRef, "MyMod_AdrianneLoad", "MyMod_AdrianneUnload")
EndFunction
		
Event On_MGF_RefLoad_MyMod_AdrianneLoad(string eventName, string strArg, float numArg, Form sender)
	ObjectReference AdrianneRef = sender as ObjectReference
	; Adrianne has loaded
EndEvent
		
Event On_MGF_RefLoad_MyMod_AdrianneUnload(string eventName, string strArg, float numArg, Form sender)
	; Adrianne has unloaded - null-check sender before using it, it can be None
	If sender
		ObjectReference AdrianneRef = sender as ObjectReference
	EndIf
EndEvent

 

Usage (single event handler)

Function SomeFunction()
	RegisterForModEvent("_MGF_RefLoad_MyMod_SomeContainer", "On_MGF_RefLoad_MyMod_SomeContainer")
	_MGF_Util.RegisterRefLoadEvents(SomeContainerRef, "MyMod_SomeContainer", "MyMod_SomeContainer")
EndFunction
		
Event On_MGF_RefLoad_MyMod_SomeContainer(string eventName, string strArg, float numArg, Form sender)
	ObjectReference SomeContainerRef = sender as ObjectReference
	If numArg == 0.0
		; SomeContainerRef has unloaded - null-check sender before using it
	ElseIf numArg == 1.0
	; SomeContainerRef has loaded
EndIf
		EndEvent

 

 

Actors Meet Event:

Spoiler

This event fires whenever two Npcs get close enough to each other. This is an Npc <-> Npc interaction (opportunity) event. 

 

Npcs that are dead, disabled, in combat or in scenes are filtered. There is a built in cooldown to greetings between Npcs. There is a longer cooldown on greetings between the same Npc pair. Creatures are NOT filtered. Use the MeetingType parameter if you require a particular pairing. In the case of MeetingType = 1 (Npc <-> Creature), the actors are sorted internally. Actor A1 is always the Npc and Actor A2 is always the creature. 

See script: _MGF_Util

 

Usage: 
 

Event OnInit()
	RegisterForModEvent("_MGF_ActorsMeet", "On_MGF_ActorsMeet")
EndEvent

Event On_MGF_ActorsMeet(Int MeetingType, Actor A1, Actor A2, Bool IsStationary1, Bool IsStationary2, Float NpcDistance, Float PlayerDistance, Bool NpcsAreFacing, Bool PlayerHasLOS)
	MeetingType: 	0 = Npc <-> Npc. 
					1 = Npc <-> Creature. 
					2 = Creature <-> Creature. 
	A1 = Actor1. 
	A2 = Actor2. 
	IsStationary1 = True if Actor A1 is not moving. 
	IsStationary2 = True if Actor A2 is not moving. 
	NpcDistance = The distance between the two Npcs. 
	PlayerDistance = The distance between the player and Actor1. Just to give you an idea of how far away.
	NpcsAreFacing = Whether or not the two Npcs are roughly facing each other. 
	PlayerHasLOS = Player has line of sight to Actor1. 
EndEvent

 

 

Service Events:

Spoiler

_MGF_PAE_State_Begin Event: 

Spoiler

Sent when the player enters a 'service' state. 
 

See script: _MGF_PlayerAnimEventsAlias

Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_PAE_State_Begin", "On_MGF_PAE_State_Begin")
EndEvent

Event On_MGF_PAE_State_Begin(string eventName, string strArg, float numArg, Form sender)
	; strArg = the type of service. 
	Debug.Messagebox("_MGF_PAE_State_Begin: " + strArg)
EndEvent

 

Possible service states: 

"Empty"
"Tray"
"ReturnTray"
"WaterBucketFill"
"WaterBucketPour"
"WaterBucket"
"DirtyWaterBucket"
"CumBucket"
"CumBucketHalf"
"PoseHandsBehindBack"
"PoseHandAboveHead"
"PoseOnAllFours"
"PlayDrum"
"PlayLute"
"PlayFlute"

 

 

On_MGF_PAE_State_End:

Spoiler

Sent when the player exits a 'service state'. 

 

See script: _MGF_PlayerAnimEventsAlias

Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_PAE_State_End", "On_MGF_PAE_State_End")
EndEvent

Event On_MGF_PAE_State_End(string eventName, string strArg, float numArg, Form sender)
	; strArg - The service the player stopped doing. 
    ; numArg - Whether it ended normally or not. 
    ;			1 - Normal. 
    ;			0 - Bad exit. Dropped tray / bucket etc. 
	Debug.Messagebox("_MGF_PAE_State_End: " + strArg + " - " + numArg)
EndEvent

 

 

_MGF_PAE_EmptyBucket: 

Spoiler

Player emptied the contents of the bucket they were carrying. 

 

See script: _MGF_PlayerAnimEventsAlias

Usage: 

Event OnInit()
	RegisterForModEvent("_MGF_PAE_EmptyBucket", "On_MGF_PAE_EmptyBucket")
EndEvent

Event On_MGF_PAE_EmptyBucket(string eventName, string strArg, float numArg, Form sender)
	; strArg - The service state that's ending. You can determine the bucket being emptied by this. 
	Debug.Messagebox("_MGF_PAE_EmptyBucket: " + strArg)
EndEvent

 

 

 

More....

 

Edited by Monoman1

0 Comments


Recommended Comments

There are no comments to display.

×
×
  • Create New...