Periodic Events
The following is an API for creating periodic events, that will be executed alongside DD's via the same staggered system (To avoid too many events from spamming the player, the system staggers events depending on how many there are, and what the current update interval is). Furthermore, these events will automatically be included in the MCM menu, so that the player may control their probability for occurance.
Each new event requires a new script that extends either zadBaseEvent, or zadBaseLinkedEvent. The former is a standard event. The latter will automatically be called when any other linked event is called. This is used for the moment for Cursed plugs and the like (If mana drain procs on the plug, it will also vibrate).
Your new script must be attached to the PlayerRef, which will probably be housed in a quest that you create as a container for your new events.
Several functions exist within zadBaseEvent that you will want to extend to define your own event behavior:
bool Function HasKeywords(actor akActor)
Override this function instead of Filter, if your event does not require more advanced filtering. This function must be used for linked events, or your event will always be called. Most events will override this function, instead of Filter.
Return Value | Description |
---|---|
True | akActor has the required keywords to begin this event. |
False | Do not process this event. |
bool Function HasKeywords(actor akActor)
return (akActor.WornHasKeyword(libs.zad_DeviousHarness) )
EndFunction
Function Execute(actor akActor)
Override this function to change behavior when your event is called.
Function Execute(actor akActor)
libs.NotifyPlayer("The posture collar uncomfortably continues to train you to keep a more refined posture.")
EndFunction
Bool Function Filter(actor akActor, int chanceMod = 0)
Overriding this function permits a modder to more precisely control the conditions under which their event can fire. You must && your return value with Parent.Filter(akActor, chanceMod).
Return Value | Description |
---|---|
True | Execute this event. |
False | Do not execute this event. |
Bool Function Filter(actor akActor, int chanceMod=0)
int arousal = libs.Aroused.GetActorExposure(akActor)
float CombatModifier = 1
if akActor.GetCombatState() == 1
CombatModifier = 0.5
EndIf
if arousal >= libs.ArousalThreshold("Desperate")
chanceMod += 20
ElseIf arousal >= libs.ArousalThreshold("Horny")
chanceMod += 10
EndIf
return (arousal >= libs.ArousalThreshold("Desire")) && Parent.Filter(akActor, (chanceMod * combatModifier) as Int)
EndFunction
The following mod-events are now used:
- DeviousEvent is automatically sent whenever any event is executed.
- DeviousEventLinked is automatically sent whenever a device with a linked effect keyword is executed (Probably internal use only). *zadRegisterEvents may be sent to force the framework to dump / reregister all periodic events. This will not reset stored MCM configuration values.