User:PROXiCiDE/CreateAdvancedQuestBook

< User:PROXiCiDE
Revision as of 11:19, 17 February 2013 by imported>PROXiCiDE (Created page with "== Creating a Advanced Quest Book == This script allows you to advance to the next quest stage only if the player has the book in the inventory while it is being read by the p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Creating a Advanced Quest BookEdit

This script allows you to advance to the next quest stage only if the player has the book in the inventory while it is being read by the player

;=================================================================================
; Properties
;=================================================================================
Quest Property pQuest Auto
{The quest}
Int Property nStagePrequisite Auto
{Quest stage requirement}
Int Property nStageToSet Auto
{Advances the quest to this stage}

;=================================================================================
; Events
;=================================================================================
Bool bInPlayerInventory = False
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
	bInPlayerInventory = False
	If akNewContainer && akNewContainer == Game.GetPlayer()
		bInPlayerInventory = True
	EndIf
EndEvent

Event OnRead()
	If pQuest.GetStage() == nStagePrequisite
		If bInPlayerInventory 
			pQuest.SetStage(nStageToSet)
		Else
			; Player did not read the book in inventory
			; Do stuff here
		EndIf
	EndIf
EndEvent