Jump to content

Recommended Posts

Posted

Hello!

I am making a small quest and there is a dialogue where NPC told me "Come tomorrow". So I need to push the quest somehow to the next stage when 24 hours will pass.

I am new in scripting and I have already spent three days trying to set it up. I have found similar question here https://forums.nexusmods.com/index.php?/topic/1323969-need-help-with-a-script-update-time/

and some hints in other places but I am unable to combine them in a working script. I suppose the script should use Event OnUpdateGameTime() and/or GameHour, GameDay and other scaring things, and I have tried several scripts but they did not work. The only thing I understand is that scripting definitely is not my strong side.

But I know there are people here that could solve it within minutes. If someone will do me a favor and write a script and provide it with clear instructions how to make it work I would appreciate it very much.

The current stages of my quest are as follows:

Stage 10

I came to fisherman to thank him and offer a reward

Stage 50

(there are several options of reward, that is why the stage number is 50 and not 20)

I gave 1000 gold to fisherman and he in return promised to build fish hatchery for me. He said it will be done tomorrow.

Objective: wait 24 hours

Stage 55

As 24 hours have passed I have to meet with fisherman.

etc

 

That is what I have now (it does not work). First, the script attached to the quest. The name of the quest is aaThanks2Pit

Scriptname AS_TimerScript extends Quest

 

 

Event OnUpdateGameTime()

GameTime = GetCurrentGameTime()

GameHoursPassed = ((GameTime - (GameTime As Int)) * 24)

 

SetStage(55)

GotoState("")

EndEvent

EndState

Quest Property aaThanks2Pit Auto

 

And second, the Papyrus fragment at stage 50

SetObjectiveCompleted(10)

Alias_AliasPit.GetReference().AddItem(Gold001, 1000)

Game.GetPlayer().RemoveItem(Gold001, 1000)

SetObjectiveDisplayed(55)

 

aaThanks2Pit.RegisterForSingleUpdateGameTime(24)

aaThanks2Pit.GotoState("waitForUpdate")

SetObjectiveDisplayed(60)

SetStage(55)

 

 

 

 

 

Posted (edited)

You have an EndState but no "State waitForUpdate" statement. In addition, the state waitForUpdate doesn't exist on a generic quest. Use (aaThanks2Pit as AS_TimerScript).GotoState("waitForUpdate").

Edited by foamyesque
Posted (edited)

Maybe the next script phrases kick you in the right direction.

 

AS_TimerScript

  Reveal hidden contents

 

 

fragment code as suggestion, how to do that?

  Reveal hidden contents

 

Edited by ReDragon2013
Posted (edited)
  On 4/26/2017 at 1:36 AM, ReDragon2013 said:

Maybe the next script phrases kick you in the right direction.

 

....

Thank you very much for your suggestions. It worked! Thank you once again!

Edited by andycanon
Posted
  On 4/25/2017 at 5:57 PM, foamyesque said:

You have an EndState but no "State waitForUpdate" statement. In addition, the state waitForUpdate doesn't exist on a generic quest. Use (aaThanks2Pit as AS_TimerScript).GotoState("waitForUpdate").

Thank you for reply.

As for "State waitForUpdate" I just forget to copy it, this line exists in the original code.

But I cannot compile the fragment with this line:

(aaThanks2Pit as AS_TimerScript).GotoState("waitForUpdate")

Posted (edited)

maybe you have not really understand:

; caused by fragment codeline: 
((self as Quest) as AS_TimerScript).RegisterForSingleUpdateGameTime(24.0)

if you really need states you have to do that:

  Reveal hidden contents

 

fragment code should look as follow:

((self as Quest) as AS_TimerScript).gotoState("waitForUpdate")
((self as Quest) as AS_TimerScript).RegisterForSingleUpdateGameTime(24.0)
Edited by ReDragon2013
Posted
  On 4/26/2017 at 4:38 PM, ReDragon2013 said:

 

maybe you have not really understand:

; caused by fragment codeline: 
((self as Quest) as AS_TimerScript).RegisterForSingleUpdateGameTime(24.0)

if you really need states you have to do that:

  Reveal hidden contents

 

fragment code should look as follow:

((self as Quest) as AS_TimerScript).gotoState("waitForUpdate")
((self as Quest) as AS_TimerScript).RegisterForSingleUpdateGameTime(24.0)

Well, I have to admit I really have not understand that. That is why I have asked for a clear instructions and thank you for giving me them.

More to say, it seems I do not understand scripting at all, this is definitely not my territory. I have a lot of ideas about quest and dialogues and scenes but when it comes to technical side of all these things I spent two or three days for single stage and it makes me lose courage. Then I go and kill some draugrs and return back to work refreshed)

  • 1 year later...
  • Community Manager
Posted

There's a cleaner way to do this, you need the dialogue/AI packs conditioned as follows:

 

Let's say you call your GlobalVariable "QuestDelay".

 

GetGlobalValue - QuestDelay <= GameDaysPassed
GetGlobalValue - QuestDelay != 0

 

So when you want to start the delay you can do it with the following line

QuestDelay.Value = (Utility.GetCurrentGameTime() + 1)
; sets global to current day +1

Where possible, avoid registering for update. If the papyrus engine gets overloaded, the update registration may drop, causing a stall in your quest.

 

Unless you specifically want the stage to fire, when you're randomly out in the wilderness? If so registering may be the best way.

  • Recently Browsing   0 members

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