Difference between revisions of "Quest Script"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jog
imported>Jog
Line 104: Line 104:


== Events ==
== Events ==
*Event [[OnReset - ObjectReference|OnReset]]()
'''Event [[OnReset - ObjectReference|OnReset]]()'''
**Event received when this quest is started up (either the first time or subsequent times - this will fire in parallel with your startup stage!).
*Event received when this quest is started up (either the first time or subsequent times - this will fire in parallel with your startup stage!).


These events are fired in parallel with the quest's startup stage, and are only fired if this quest is started by a story manager event.
 
*Event [[OnStoryActivateActor - Quest|OnStoryActivateActor]](Location akLocation, ObjectReference akActor)
----
**Sent when this quest is started by an activate actor story manager event.
''These events are fired in parallel with the quest's startup stage, and are only fired if this quest is started by a story manager event.''
*Event [[OnStoryAddToPlayer - Quest|OnStoryAddToPlayer]](ObjectReference akOwner, ObjectReference akContainer, Location akLocation, Form akItemBase, int aiAcquireType)
----
**Sent when this quest is started by an add to player story manager event.
'''Event [[OnStoryActivateActor - Quest|OnStoryActivateActor]](Location akLocation, ObjectReference akActor)'''
*Event [[OnStoryArrest - Quest|OnStoryArrest]](ObjectReference akArrestingGuard, ObjectReference akCriminal, Location akLocation, int aiCrime)
*Sent when this quest is started by an activate actor story manager event.
**Sent when this quest is started by an arrest story manager event.
 
*Event [[OnStoryAssaultActor - Quest|OnStoryAssaultActor]](ObjectReference akVictim, ObjectReference akAttacker, Location akLocation, int aiCrime)
'''Event [[OnStoryAddToPlayer - Quest|OnStoryAddToPlayer]](ObjectReference akOwner, ObjectReference akContainer, Location akLocation, Form akItemBase, int aiAcquireType)'''
**Sent when this quest is started by an assault actor story manager event.
*Sent when this quest is started by an add to player story manager event.
*Event [[OnStoryBribeNPC - Quest|OnStoryBribeNPC]](ObjectReference akActor)
 
**Sent when this quest is started by a bribe NPC story manager event.
'''Event [[OnStoryArrest - Quest|OnStoryArrest]](ObjectReference akArrestingGuard, ObjectReference akCriminal, Location akLocation, int aiCrime)'''
*Event [[OnStoryCastMagic - Quest|OnStoryCastMagic]](ObjectReference akCastingActor, ObjectReference akSpellTarget, Location akLocation, Form akSpell)
*Sent when this quest is started by an arrest story manager event.
**Sent when this quest is started by a cast magic story manager event.
 
*Event [[OnStoryChangeLocation - Quest|OnStoryChangeLocation]](ObjectReference akActor, Location akOldLocation, Location akNewLocation)
'''Event [[OnStoryAssaultActor - Quest|OnStoryAssaultActor]](ObjectReference akVictim, ObjectReference akAttacker, Location akLocation, int aiCrime)'''
**Sent when this quest is started by a change location story manager event.
*Sent when this quest is started by an assault actor story manager event.
*Event [[OnStoryCraftItem - Quest|OnStoryCraftItem]](ObjectReference akBench, Location akLocation, Form akCreatedItem)
 
**Sent when this quest is started by a craft item story manager event.
'''Event [[OnStoryBribeNPC - Quest|OnStoryBribeNPC]](ObjectReference akActor)'''
*Event [[OnStoryCrimeGold - Quest|OnStoryCrimeGold]](ObjectReference akVictim, ObjectReference akCriminal, Faction akFaction, int aiGoldAmount, int aiCrime)
*Sent when this quest is started by a bribe NPC story manager event.
**Sent when this quest is started by a crime gold story manager event.
 
*Event [[OnStoryCure - Quest|OnStoryCure]](Form akInfection)
'''Event [[OnStoryCastMagic - Quest|OnStoryCastMagic]](ObjectReference akCastingActor, ObjectReference akSpellTarget, Location akLocation, Form akSpell)'''
**Sent when this quest is started by a cure story manager event.
*Sent when this quest is started by a cast magic story manager event.
*Event [[OnStoryDialogue - Quest|OnStoryDialogue]](Location akLocation, ObjectReference akActor1, ObjectReference akActor2)
 
**Sent when this quest is started by a dialogue story manager event.
'''Event [[OnStoryChangeLocation - Quest|OnStoryChangeLocation]](ObjectReference akActor, Location akOldLocation, Location akNewLocation)'''
*Event [[OnStoryDiscoverDeadBody - Quest|OnStoryDiscoverDeadBody]](ObjectReference akActor, ObjectReference akDeadActor, Location akLocation)
*Sent when this quest is started by a change location story manager event.
**Sent when this quest is started by a discover dead body story manager event.
 
*Event [[OnStoryEscapeJail - Quest|OnStoryEscapeJail]](Location akLocation, Form akCrimeGroup)
'''Event [[OnStoryCraftItem - Quest|OnStoryCraftItem]](ObjectReference akBench, Location akLocation, Form akCreatedItem)'''
**Sent when this quest is started by an escape jail story manager event.
*Sent when this quest is started by a craft item story manager event.
*Event [[OnStoryFlatterNPC - Quest|OnStoryFlatterNPC]](ObjectReference akActor)
 
**Sent when this quest is started by a flatter NPC story manager event.
'''Event [[OnStoryCrimeGold - Quest|OnStoryCrimeGold]](ObjectReference akVictim, ObjectReference akCriminal, Faction akFaction, int aiGoldAmount, int aiCrime)'''
*Event [[OnStoryHello - Quest|OnStoryHello]](Location akLocation, ObjectReference akActor1, ObjectReference akActor2)
*Sent when this quest is started by a crime gold story manager event.
**Sent when this quest is started by a hello story manager event.
 
*Event [[OnStoryIncreaseLevel - Quest|OnStoryIncreaseLevel]](int aiNewLevel)
'''Event [[OnStoryCure - Quest|OnStoryCure]](Form akInfection)'''
**Sent when this quest is started by an increase level story manager event.
*Sent when this quest is started by a cure story manager event.
*Event [[OnStoryIncreaseSkill - Quest|OnStoryIncreaseSkill]](string asSkill)
 
**Sent when this quest is started by an increase skill story manager event.
'''Event [[OnStoryDialogue - Quest|OnStoryDialogue]](Location akLocation, ObjectReference akActor1, ObjectReference akActor2)'''
*Event [[OnStoryInfection - Quest|OnStoryInfection]](ObjectReference akTransmittingActor, Form akInfection)
*Sent when this quest is started by a dialogue story manager event.
**Sent when this quest is started by an infection story manager event.
 
*Event [[OnStoryIntimidateNPC - Quest|OnStoryIntimidateNPC]](ObjectReference akActor)
'''Event [[OnStoryDiscoverDeadBody - Quest|OnStoryDiscoverDeadBody]](ObjectReference akActor, ObjectReference akDeadActor, Location akLocation)'''
**Sent when this quest is started by an intimidate NPC story manager event.
*Sent when this quest is started by a discover dead body story manager event.
*Event [[OnStoryJail - Quest|OnStoryJail]](ObjectReference akGuard, Form akCrimeGroup, Location akLocation, int aiCrimeGold)
 
**Sent when this quest is started by a jail story manager event.
'''Event [[OnStoryEscapeJail - Quest|OnStoryEscapeJail]](Location akLocation, Form akCrimeGroup)'''
*Event [[OnStoryKillActor - Quest|OnStoryKillActor]](ObjectReference akVictim, ObjectReference akKiller, Location akLocation, int aiCrimeStatus, int aiRelationshipRank)
*Sent when this quest is started by an escape jail story manager event.
**Sent when this quest is started by a kill actor story manager event.
 
*Event [[OnStoryNewVoicePower - Quest|OnStoryNewVoicePower]](ObjectReference akActor, Form akVoicePower)
'''Event [[OnStoryFlatterNPC - Quest|OnStoryFlatterNPC]](ObjectReference akActor)'''
**Sent when this quest is started by a new voice power story manager event.
*Sent when this quest is started by a flatter NPC story manager event.
*Event [[OnStoryPickLock - Quest|OnStoryPickLock]](ObjectReference akActor, ObjectReference akLock)
 
**Sent when this quest is started by a pick lock story manager event.
'''Event [[OnStoryHello - Quest|OnStoryHello]](Location akLocation, ObjectReference akActor1, ObjectReference akActor2)'''
*Event [[OnStoryPayFine - Quest|OnStoryPayFine]](ObjectReference akCriminal, ObjectReference akGuard, Form akCrimeGroup, int aiCrimeGold)
*Sent when this quest is started by a hello story manager event.
**Sent when this quest is started by a pay fine story manager event.
 
*Event [[OnStoryPlayerGetsFavor - Quest|OnStoryPlayerGetsFavor]](ObjectReference akActor)
'''Event [[OnStoryIncreaseLevel - Quest|OnStoryIncreaseLevel]](int aiNewLevel)'''
**Sent when this quest is started by a player gets favor story manager event.
*Sent when this quest is started by an increase level story manager event.
*Event [[OnStoryRelationshipChange - Quest|OnStoryRelationshipChange]](ObjectReference akActor1, ObjectReference akActor2, int aiOldRelationship, int aiNewRelationship)
 
**Sent when this quest is started by a relationship change story manager event.
'''Event [[OnStoryIncreaseSkill - Quest|OnStoryIncreaseSkill]](string asSkill)'''
*Event [[OnStoryRemoveFromPlayer - Quest|OnStoryRemoveFromPlayer]](ObjectReference akOwner, ObjectReference akItem, Location akLocation, Form akItembase, int aiRemoveType)
*Sent when this quest is started by an increase skill story manager event.
**Sent when this quest is started by a remove from player story manager event.
 
*Event [[OnStoryScript - Quest|OnStoryScript]](Keyword akKeyword, Location akLocation, ObjectReference akRef1, ObjectReference akRef2, int aiValue1, int aiValue2)
'''Event [[OnStoryInfection - Quest|OnStoryInfection]](ObjectReference akTransmittingActor, Form akInfection)'''
**Sent when this quest is started by a script story manager event.
*Sent when this quest is started by an infection story manager event.
*Event [[OnStoryServedTime - Quest|OnStoryServedTime]](Location akLocation, Form akCrimeGroup, int aiCrimeGold, int aiDaysJail)
 
**Sent when this quest is started by a served time story manager event.
'''Event [[OnStoryIntimidateNPC - Quest|OnStoryIntimidateNPC]](ObjectReference akActor)'''
*Event [[OnStoryTrespass - Quest|OnStoryTrespass]](ObjectReference akVictim, ObjectReference akTrespasser, Location akLocation, int aiCrime)
*Sent when this quest is started by an intimidate NPC story manager event.
**Sent when this quest is started by a trespass story manager event.
 
'''Event [[OnStoryJail - Quest|OnStoryJail]](ObjectReference akGuard, Form akCrimeGroup, Location akLocation, int aiCrimeGold)'''
*Sent when this quest is started by a jail story manager event.
 
'''Event [[OnStoryKillActor - Quest|OnStoryKillActor]](ObjectReference akVictim, ObjectReference akKiller, Location akLocation, int aiCrimeStatus, int aiRelationshipRank)'''
*Sent when this quest is started by a kill actor story manager event.
 
'''Event [[OnStoryNewVoicePower - Quest|OnStoryNewVoicePower]](ObjectReference akActor, Form akVoicePower)'''
*Sent when this quest is started by a new voice power story manager event.
 
'''Event [[OnStoryPickLock - Quest|OnStoryPickLock]](ObjectReference akActor, ObjectReference akLock)'''
*Sent when this quest is started by a pick lock story manager event.
 
'''Event [[OnStoryPayFine - Quest|OnStoryPayFine]](ObjectReference akCriminal, ObjectReference akGuard, Form akCrimeGroup, int aiCrimeGold)'''
*Sent when this quest is started by a pay fine story manager event.
 
'''Event [[OnStoryPlayerGetsFavor - Quest|OnStoryPlayerGetsFavor]](ObjectReference akActor)'''
*Sent when this quest is started by a player gets favor story manager event.
 
'''Event [[OnStoryRelationshipChange - Quest|OnStoryRelationshipChange]](ObjectReference akActor1, ObjectReference akActor2, int aiOldRelationship, int aiNewRelationship)'''
*Sent when this quest is started by a relationship change story manager event.
 
'''Event [[OnStoryRemoveFromPlayer - Quest|OnStoryRemoveFromPlayer]](ObjectReference akOwner, ObjectReference akItem, Location akLocation, Form akItembase, int aiRemoveType)'''
*Sent when this quest is started by a remove from player story manager event.
 
'''Event [[OnStoryScript - Quest|OnStoryScript]](Keyword akKeyword, Location akLocation, ObjectReference akRef1, ObjectReference akRef2, int aiValue1, int aiValue2)'''
*Sent when this quest is started by a script story manager event.
 
'''Event [[OnStoryServedTime - Quest|OnStoryServedTime]](Location akLocation, Form akCrimeGroup, int aiCrimeGold, int aiDaysJail)'''
*Sent when this quest is started by a served time story manager event.
 
'''Event [[OnStoryTrespass - Quest|OnStoryTrespass]](ObjectReference akVictim, ObjectReference akTrespasser, Location akLocation, int aiCrime)'''
*Sent when this quest is started by a trespass story manager event.


== Related Fragments ==
== Related Fragments ==
*[[Quest Stage Fragments]]
*[[Quest Stage Fragments]]

Revision as of 13:02, 20 February 2012


Extends: Form Script

Script for the manipulation of quests.

Definition

ScriptName Quest extends Form

Properties

None

Global Functions

None

Member Functions

Function CompleteAllObjectives()

  • Completes all a quests objectives.

Function CompleteQuest()

  • Flags this quest as completed.

Function FailAllObjectives()

  • Flags all quest objects as failed.

Alias Function GetAlias(int aiAliasID)

  • Obtains the Alias attached to this quest associated with the specified ID.

int Function GetCurrentStageID()

  • Obtains the highest completed stage on this quest.

int Function GetStage()

  • Alias for GetCurrentStageID().

bool Function GetStageDone(int aiStage)

  • Alias for IsStageDone().

bool Function IsActive()

  • Is this quest "active"? (Tracked by the player).

bool Function IsCompleted()

  • Returns whether this quest is completed or not.

bool Function IsObjectiveCompleted(int aiObjective)

  • Obtains whether the specified objective is completed or not.

bool Function IsObjectiveDisplayed(int aiObjective)

  • Obtains whether the specified objective is displayed or not.

bool Function IsObjectiveFailed(int aiObjective)

  • Obtains whether the specified objective is failed or not.

bool Function IsRunning()

  • Returns whether this quest is currently running or not.

bool Function IsStageDone(int aiStage)

  • Checks to see if the specified stage is done or not.

bool Function IsStarting()

  • Returns whether this quest is currently enabled but not running yet.

bool Function IsStopping()

  • Returns whether this quest is currently not enabled anymore but still shutting down.

bool Function IsStopped()

  • Returns whether this quest is currently fully stopped.

bool Function ModObjectiveGlobal(float afModValue, GlobalVariable aModGlobal, int aiObjectiveID, float afTargetValue, bool abCountingUp, bool abCompleteObjective, bool abRedisplayObjective)

  • Mods a global variable in a threadsafe way. Optional parameters allow automatic redisplay and completion (or failure) of a quest objective using this global variable.

Function Reset()

  • Resets this quest.

Function SetActive(bool abActive)

  • Sets or clears this quest as "active". (Tracked by the player)

bool Function SetCurrentStageID(int aiStageID)

  • Sets the quest to the requested stage, returning true if it succeeded.

Function SetObjectiveCompleted(int aiObjective, bool abCompleted)

  • Sets whether the specified objective is completed or not.

Function SetObjectiveDisplayed(int aiObjective, bool abDisplayed)

  • Sets whether the specified objective is displayed or not.

Function SetObjectiveFailed(int aiObjective, bool abFailed)

  • Sets whether the specified objective is failed or not.

bool Function SetStage(int aiStage)

  • Alias of SetCurrentStageID().

bool Function Start()

  • Starts this quest.

Function Stop()

  • Stops the quest.

bool Function UpdateCurrentInstanceGlobal(GlobalVariable aUpdateGlobal)

  • Updates the value for the given global for the quest's current instance.

Events

Event OnReset()

  • Event received when this quest is started up (either the first time or subsequent times - this will fire in parallel with your startup stage!).



These events are fired in parallel with the quest's startup stage, and are only fired if this quest is started by a story manager event.


Event OnStoryActivateActor(Location akLocation, ObjectReference akActor)

  • Sent when this quest is started by an activate actor story manager event.

Event OnStoryAddToPlayer(ObjectReference akOwner, ObjectReference akContainer, Location akLocation, Form akItemBase, int aiAcquireType)

  • Sent when this quest is started by an add to player story manager event.

Event OnStoryArrest(ObjectReference akArrestingGuard, ObjectReference akCriminal, Location akLocation, int aiCrime)

  • Sent when this quest is started by an arrest story manager event.

Event OnStoryAssaultActor(ObjectReference akVictim, ObjectReference akAttacker, Location akLocation, int aiCrime)

  • Sent when this quest is started by an assault actor story manager event.

Event OnStoryBribeNPC(ObjectReference akActor)

  • Sent when this quest is started by a bribe NPC story manager event.

Event OnStoryCastMagic(ObjectReference akCastingActor, ObjectReference akSpellTarget, Location akLocation, Form akSpell)

  • Sent when this quest is started by a cast magic story manager event.

Event OnStoryChangeLocation(ObjectReference akActor, Location akOldLocation, Location akNewLocation)

  • Sent when this quest is started by a change location story manager event.

Event OnStoryCraftItem(ObjectReference akBench, Location akLocation, Form akCreatedItem)

  • Sent when this quest is started by a craft item story manager event.

Event OnStoryCrimeGold(ObjectReference akVictim, ObjectReference akCriminal, Faction akFaction, int aiGoldAmount, int aiCrime)

  • Sent when this quest is started by a crime gold story manager event.

Event OnStoryCure(Form akInfection)

  • Sent when this quest is started by a cure story manager event.

Event OnStoryDialogue(Location akLocation, ObjectReference akActor1, ObjectReference akActor2)

  • Sent when this quest is started by a dialogue story manager event.

Event OnStoryDiscoverDeadBody(ObjectReference akActor, ObjectReference akDeadActor, Location akLocation)

  • Sent when this quest is started by a discover dead body story manager event.

Event OnStoryEscapeJail(Location akLocation, Form akCrimeGroup)

  • Sent when this quest is started by an escape jail story manager event.

Event OnStoryFlatterNPC(ObjectReference akActor)

  • Sent when this quest is started by a flatter NPC story manager event.

Event OnStoryHello(Location akLocation, ObjectReference akActor1, ObjectReference akActor2)

  • Sent when this quest is started by a hello story manager event.

Event OnStoryIncreaseLevel(int aiNewLevel)

  • Sent when this quest is started by an increase level story manager event.

Event OnStoryIncreaseSkill(string asSkill)

  • Sent when this quest is started by an increase skill story manager event.

Event OnStoryInfection(ObjectReference akTransmittingActor, Form akInfection)

  • Sent when this quest is started by an infection story manager event.

Event OnStoryIntimidateNPC(ObjectReference akActor)

  • Sent when this quest is started by an intimidate NPC story manager event.

Event OnStoryJail(ObjectReference akGuard, Form akCrimeGroup, Location akLocation, int aiCrimeGold)

  • Sent when this quest is started by a jail story manager event.

Event OnStoryKillActor(ObjectReference akVictim, ObjectReference akKiller, Location akLocation, int aiCrimeStatus, int aiRelationshipRank)

  • Sent when this quest is started by a kill actor story manager event.

Event OnStoryNewVoicePower(ObjectReference akActor, Form akVoicePower)

  • Sent when this quest is started by a new voice power story manager event.

Event OnStoryPickLock(ObjectReference akActor, ObjectReference akLock)

  • Sent when this quest is started by a pick lock story manager event.

Event OnStoryPayFine(ObjectReference akCriminal, ObjectReference akGuard, Form akCrimeGroup, int aiCrimeGold)

  • Sent when this quest is started by a pay fine story manager event.

Event OnStoryPlayerGetsFavor(ObjectReference akActor)

  • Sent when this quest is started by a player gets favor story manager event.

Event OnStoryRelationshipChange(ObjectReference akActor1, ObjectReference akActor2, int aiOldRelationship, int aiNewRelationship)

  • Sent when this quest is started by a relationship change story manager event.

Event OnStoryRemoveFromPlayer(ObjectReference akOwner, ObjectReference akItem, Location akLocation, Form akItembase, int aiRemoveType)

  • Sent when this quest is started by a remove from player story manager event.

Event OnStoryScript(Keyword akKeyword, Location akLocation, ObjectReference akRef1, ObjectReference akRef2, int aiValue1, int aiValue2)

  • Sent when this quest is started by a script story manager event.

Event OnStoryServedTime(Location akLocation, Form akCrimeGroup, int aiCrimeGold, int aiDaysJail)

  • Sent when this quest is started by a served time story manager event.

Event OnStoryTrespass(ObjectReference akVictim, ObjectReference akTrespasser, Location akLocation, int aiCrime)

  • Sent when this quest is started by a trespass story manager event.

Related Fragments