Form - powerof3/PapyrusExtenderSSE GitHub Wiki

Functions

Getters

EvaluateConditionList

  • Evaluates condition lists for spells/potions/enchantments/mgefs and returns if they can be fullfilled
bool Function EvaluateConditionList(Form akForm, ObjectReference akActionRef, ObjectReference akTargetRef) global native

ClearRecordFlag

Function ClearRecordFlag(Form akForm, int aiFlag) global native

GetConditionList

  • Builds a list of conditions present on the form. Index is for spells/other forms that have lists with conditions
  • Some conditions may be skipped (conditions that require non player references, overly complex conditions involving packages/aliases)
String[] Function GetConditionList(Form akForm, int aiIndex = 0) global native

GetDescription

  • Gets form description text, if any
String Function GetDescription(Form akForm) global native

GetFormEditorID

String Function GetFormEditorID(Form akForm) global native

GetFormModName

  • Get name of the mod the form originates from (or was last modified by)
String Function GetFormModName(Form akForm, bool abLastModified) global native

GetScriptsAttachedToForm

  • Get all non-base scripts attached to this form
String[] Function GetScriptsAttachedToForm(Form akForm) global native

IsFormInMod

  • Returns whether the form is part of mod
bool Function IsFormInMod(Form akForm, String asModName) global native

IsGeneratedForm

  • Returns whether the form is temporary (ie. has a formID beginning with FF)
bool Function IsGeneratedForm(Form akForm) global native

IsRecordFlagSet

bool Function IsRecordFlagSet(Form akForm, int aiFlag) global native

IsScriptAttachedToForm

  • returns whether the form has script attached. If scriptName is empty, it will return if the form has any non-base scripts attached
bool Function IsScriptAttachedToForm(Form akForm, String asScriptName) global native

Setters

AddKeywordToForm

  • Adds keyword to form. Fails if the form doesn't accept keywords.
Function AddKeywordToForm(Form akForm, Keyword akKeyword) global native

MarkItemAsFavorite

  • Favorites item (must be in inventory) or spell/shout
Function MarkItemAsFavorite(Form akForm) global native

ReplaceKeywordOnForm

  • Replaces given keyword with new one on form. Only lasts for a single gaming session. [ported from DienesTools].
Function ReplaceKeywordOnForm(Form akForm, Keyword akKeywordAdd, Keyword akKeywordRemove) global native

RemoveKeywordOnForm

  • Removes keyword from form.
bool Function RemoveKeywordOnForm(Form akForm, Keyword akKeyword) global native

RemoveConditionList

  • Removes conditions on the form that were found in the condition list . This is not serialized.
  • Index is for spell/magic item effects
Function RemoveConditionList(Form akForm, int aiIndex, string[] asConditionList) global native

SetConditionList

  • Append the condition list to this form. This is not serialized.
  • Index is for spell/magic item effects
Function SetConditionList(Form akForm, int aiIndex, string[] asConditionList) global native

SetRecordFlag

  • Set record flag
Function SetRecordFlag(Form akForm, int aiFlag) global native

UnmarkItemAsFavorite

  • Unfavorites item (must be in inventory) or spell/shout
Function UnmarkItemAsFavorite(Form akForm) global native

Events

Called from PO3_Events_Form script. Script using these events must extend Form

Actor Fall Long Distance

  • Fires when the actor falls enough distance to take fall damage
  • Script must extend ObjectReference in order to recieve this event
Function RegisterForActorFallLongDistance(Form akForm) global native	
Function UnregisterForActorFallLongDistance(Form akForm) global native

Event OnActorFallLongDistance(Actor akTarget, float afFallDistance, float afFallDamage)
EndEvent

Actor Kill

Function RegisterForActorKilled(Form akForm) global native	
Function UnregisterForActorKilled(Form akForm) global native

Event OnActorKilled(Actor akVictim, Actor akKiller)
EndEvent

Actor Reanimate

  • Start fires when actor is reanimated and Stop when reanimate effect is dispelled
  • Script must extend ObjectReference in order to recieve this event
Function RegisterForActorReanimateStart(Form akForm) global native	
Function UnregisterForActorReanimateStart(Form akForm) global native

Function RegisterForActorReanimateStop(Form akForm) global native	
Function UnregisterForActorReanimateStop(Form akForm) global native

Event OnActorReanimateStart(Actor akTarget, Actor akCaster)
EndEvent

Event OnActorReanimateStop(Actor akTarget, Actor akCaster)
EndEvent

Actor Resurrect

  • Fires when the target has been resurrected via script or console command
  • Script must extend ObjectReference in order to recieve this event
Function RegisterForActorResurrected(Form akForm) global native	
Function UnregisterForActorResurrected(Form akForm) global native

Event OnActorResurrected(Actor akTarget, bool abResetInventory)
EndEvent

Books Read

Function RegisterForBookRead(Form akForm) global native	
Function UnregisterForBookRead(Form akForm) global native

Event OnBookRead(Book akBook)
EndEvent

Cell Fully Loaded

  • Can fire multiple times in exteriors, for each cell that is fully loaded.
Function RegisterForCellFullyLoaded(Form akForm) global native	
Function UnregisterForCellFullyLoaded(Form akForm) global native

Event OnCellFullyLoaded(Cell akCell)
EndEvent

Critical Hit

  • Player only event
Function RegisterForCriticalHit(Form akForm) global native	
Function UnregisterForCriticalHit(Form akForm) global native

Event OnCriticalHit(Actor akAggressor, Weapon akWeapon, bool abSneakHit)
EndEvent

Disarmed

Function RegisterForDisarmed(Form akForm) global native	
Function UnregisterForDisarmed(Form akForm) global native

Event OnDisarmed(Actor akSource, Weapon akTarget)
EndEvent

Dragon Soul Absorb

Function RegisterForDragonSoulGained(Form akForm) global native	
Function UnregisterForDragonSoulGained(Form akForm) global native

Event OnDragonSoulGained(float afSouls)
EndEvent

On Hit Ex

  • Registers for hit events provided they match the filters (or not)
  • Script must extend ObjectReference in order to recieve this event
  • See Fallout 4's RegisterForHitEvent for parameter definitions (Aliases are not allowed, only forms)
  • akAggressorFilter also accepts race
Function RegisterForHitEventEx(Form akForm, Form akAggressorFilter = None, Form akSourceFilter = None, Form akProjectileFilter = None, int aiPowerFilter = -1, int aiSneakFilter = -1, int aiBashFilter = -1, int aiBlockFilter = -1, bool abMatch = true) global native	

Function UnregisterForHitEventEx(Form akForm, Form akAggressorFilter = None, Form akSourceFilter = None, Form akProjectileFilter = None, int aiPowerFilter = -1, int aiSneakFilter = -1, int aiBashFilter = -1, int aiBlockFilter = -1, bool abMatch = true) global native

Function UnregisterForAllHitEventsEx(Form akForm) global native
	
Event OnHitEx(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
EndEvent

Item Crafted

  • Player only event
Function RegisterForItemCrafted(Form akForm) global native	
Function UnregisterForItemCrafted(Form akForm) global native

Event OnItemCrafted(ObjectReference akBench, Location akLocation, Form akCreatedItem)
EndEvent

Item Harvested

  • Player only event
Function RegisterForItemHarvested(Form akForm) global native	
Function UnregisterForItemHarvested(Form akForm) global native

Event OnItemHarvested(Form akProduce)
EndEvent

Level Increase

Function RegisterForLevelIncrease(Form akForm) global native	
Function UnregisterForLevelIncrease(Form akForm) global native

Event OnLevelIncrease(int aiLevel)
EndEvent

Location Discovery

Function RegisterForLocationDiscovery(Form akForm) global native	
Function UnregisterForLocationDiscovery(Form akForm) global native

Event OnLocationDiscovery(String asRegionName, String asWorldspaceName)
EndEvent

Magic Effect Apply Ex

  • Script must extend ObjectReference in order to recieve this event
  • akEffectFilter : matching magic effect, keyword, or a formlist containing keywords/magic effects. Filter can be NONE (but then it'll be the same as a regular OnMagicApply event)
  • abMatch : if true, the filter must match the hit, if false it must NOT match it (inverted filter)
  • bApplied will return if the magic effect was successfully applied or not
Function RegisterForMagicEffectApplyEx(Form akForm, Form akEffectFilter, bool abMatch) global native	
Function UnregisterForMagicEffectApplyEx(Form akForm, Form akEffectFilter, bool abMatch) global native
Function UnregisterForAllMagicEffectApplyEx(Form akForm) global native
	
Event OnMagicEffectApplyEx(ObjectReference akCaster, MagicEffect akEffect, Form akSource, bool abApplied)
EndEvent

Object Grab/Release

  • Doesn't work with telekinesis and when the player grabs the same object in a row
Function RegisterForObjectGrab(Form akForm) global native	
Function UnregisterForObjectGrab(Form akForm) global native

Event OnObjectGrab(ObjectReference akObjectRef)
EndEvent

Event OnObjectRelease(ObjectReference akObjectRef)
EndEvent

Object Loaded/Unloaded

  • Not all objects fire this event. It is somewhat inconsistent.
Function RegisterForObjectLoaded(Form akForm, int formType) global native	
Function UnregisterForObjectLoaded(Form akForm, int formType) global native
Function UnregisterForAllObjectsLoaded(Form akForm) global native
	
Event OnObjectLoaded(ObjectReference akRef, int aiFormType)
EndEvent

Event OnObjectUnloaded(ObjectReference akRef, int aiFormType)
EndEvent

On Weapon Hit

  • Event OnHit except weapons only AND the aggressor recieves this event for each target hit by it
  • Script must extend ObjectReference in order to recieve this event
  • Use SKSE's LogicalAnd to check if hit flag is set
  • Statics have no hit flags (0)
Hit Flags Values
kBlocked 1
kBlockWithWeapon 2
kBlockCandidate 4
kCritical 8
kCriticalOnDeath 16
kFatal 32
kDismemberLimb 64
kExplodeLimb 128
kCrippleLimb 256
kDisarm 512
kDisableWeapon 1024
kSneakAttack 2048
kIgnoreCritical 4096
kPredictDamage 8192
kBash 16384
kTimedBash 32768
kPowerAttack 65536
kMeleeAttack 262144
kRicochet 524288
kExplosion 1048576
Function RegisterForWeaponHit(Form akForm) global native	
Function UnregisterForWeaponHit(Form akForm) global native
	
Event OnWeaponHit(ObjectReference akTarget, Form akSource, Projectile akProjectile, Int aiHitFlagMask)
EndEvent

On Magic Hit

  • Event OnHit except for magic AND aggressor recieves this event for each target hit by it
  • Script must extend ObjectReference in order to recieve this event
Function RegisterForMagicHit(Form akForm) global native	
Function UnregisterForMagicHit(Form akForm) global native
	
Event OnMagicHit(ObjectReference akTarget, Form akSource, Projectile akProjectile)
EndEvent

On Projectile Hit

  • Event OnHit except for projectiles AND the aggressor recieves this event for each target hit by it
  • Script must extend ObjectReference in order to recieve this event
Function RegisterForProjectileHit(Form akForm) global native	
Function UnregisterForProjectileHit(Form akForm) global native
	
Event OnProjectileHit(ObjectReference akTarget, Form akSource, Projectile akProjectile)
EndEvent

Quest Start/Stop

Function RegisterForQuest(Form akForm, Quest akQuest) global native	
Function UnregisterForQuest(Form akForm, Quest akQuest) global native
Function UnregisterForAllQuests(Form akForm) global native

Event OnQuestStart(Quest akQuest)
EndEvent

Event OnQuestStop(Quest akQuest)
EndEvent

Quest Stage Change

Function RegisterForQuestStage(Form akForm, Quest akQuest) global native	
Function UnregisterForQuestStage(Form akForm, Quest akQuest) global native
Function UnregisterForAllQuestStages(Form akForm) global native

Event OnQuestStageChange(Quest akQuest, Int aiNewStage)
EndEvent

Shout Attack

  • Player only event
Function RegisterForShoutAttack(Form akForm) global native	
Function UnregisterForShoutAttack(Form akForm) global native

Event OnPlayerShoutAttack(Shout akShout)
EndEvent

Skill Increase

  • 4.5.6 - Event had its params changed from String to Int as a workaround for only the first registered event recieving any events
  • See Actor Values for list of skills
Function RegisterForSkillIncrease(Form akForm) global native	
Function UnregisterForSkillIncrease(Form akForm) global native

Event OnSkillIncrease(Int aiSkill)
EndEvent

Soul Trap

  • Event will fire after OnDying/OnDeath
  • Will not fire if using mods that bypass vanilla soul trap method
Function RegisterForSoulTrapped(Form akForm) global native	
Function UnregisterForSoulTrapped(Form akForm) global native
	
Event OnSoulTrapped(Actor akVictim, Actor akKiller)
EndEvent

Spell Learned

  • Event is disabled in AE due to crashes
Function RegisterForSpellLearned(Form akForm) global native	
Function UnregisterForSpellLearned(Form akForm) global native
	
Event OnSpellLearned(Spell akSpell)
EndEvent

Weather Change

Function RegisterForWeatherChange(Form akForm) global native	
Function UnregisterForWeatherChange(Form akForm) global native
	
Event OnWeatherChange(Weather akOldWeather, Weather akNewWeather)
EndEvent