Jump to content

Scripting - Issue with getting a quest to start


SirBeasty

Recommended Posts

I am trying to create a mod, and currently I am trying to get a quest script to work after I pick up a certain item. I have managed to get the item to start the quest when I pick it up, but the quest script won't do what it is supposed to do, which currently is show a message box saying that it started.

Here is the script for the item:
Scriptname SirBeastEviriGemScript extends ReferenceAlias


;---------Variables
MiscObject Property GhostGem Auto

Actor Property Player Auto


;-----Events

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)

If(akNewContainer == Player)
debug.messageBox("Item picked up.")
if GetOwningQuest().GetStage() < 20
GetOwningQuest().setStage(20)
EndIf
ElseIf(akNewContainer != Player)
debug.messageBox("Item put away.")
if GetOwningQuest().GetStage() > 10
GetOwningQuest().setStage(10)
EndIf
EndIf

EndEvent




And here is the script for the quest:
Scriptname SirBeastEviriBoonQuestScript extends Quest


import utility

;--------Variables------
MiscObject Property GhostGem Auto

Perk Property AttackBuff Auto

Actor Property Player Auto

Int Property Random Auto

Int Property coin Auto

Quest Property EviriBoonQuest Auto

;----Events


Event OnStoryAddToPlayer(ObjectReference akOwner, ObjectReference akContainer, Location akLocation, Form akItemBase, \
int aiAcquireType)
if akItemBase == GhostGem
if EviriBoonQuest.getStage() == 20
debug.MessageBox("Quest has started")
coin = 1
While coin == 1
Player.AddPerk(AttackBuff)
utility.wait(3)
random = utility.randomint(1, 5)
if random == 1
Debug.MessageBox("Perk 1 was added")
elseif random == 2
Debug.MessageBox("Perk 2 was added")
elseif random == 3
Debug.MessageBox("Perk 3 was added")
elseif random == 4
Debug.MessageBox("Perk 4 was added")
elseif random == 5
Debug.MessageBox("Perk 5 was added")
else
Debug.MessageBox("No perk was added")
EndIf
If EviriBoonQuest.getStage() == 10
coin = 0
EndIf
EndWhile
EndIf
EndIf
EndEvent




Thank you for the help.


Edit: The first script actually doesn't work to start the quest, so I tried to attach another script directly to the item. It worked the first time but not the second time.

Scriptname SirBeastEviriTestScript extends ObjectReference

import utility

;------Variables----------

Actor Property Player Auto

Perk Property AttackBuff Auto

MiscObject Property GhostGem Auto

Int Property random Auto

Int Property coin Auto

Quest Property EviriBoonQuest Auto

;-----Events


Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)

EviriBoonQuest.start()
If(akNewContainer == Player)
debug.messageBox("Item picked up and perk added.")
EviriBoonQuest.setStage(20)
ElseIf(akNewContainer != Player)
debug.messageBox("Item put away and perk removed.")
EviriBoonQuest.setStage(10)
EndIf

EndEvent

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...