Jump to content

Is there something wrong with this timer script?


antstubell

Recommended Posts

This timer sets NPC's quest to 40, which in turn allows a conditioned (GetStage Quest == 40) package to be run. NPC doesn't wait.

 

 

Float Property TimeToPass Auto
Quest Property MyQuest Auto
Int Property StageToSet Auto

Function MyTimer()
RegisterForSingleUpdateGameTime(TimeToPass)
EndFunction

Event OnUpdateGameTime()
MyQuest.Setstage(StageToSet)
UnregisterForUpdateGameTime()

EndEvent

 

Name of script - My_Timer_SetQstStage

Properties

TimeToPass = 0.5

StageToSet = 40

Quest = Name of the quest this timer script is in.

 

Stage 30 papyrus fragment -

Debug.Notification ("timer started")
kmyquest.MyTimer()

 

Link to comment
Share on other sites

What do you mean by "the NPC doesn't wait"? Are you saying that the package runs even if the stage is not yet at 40?

 

Also doesn't kmyquest simply return the parent quest of the stage fragment? If so, it won't run the timer properly. You'll need to cast it into the script.

(kmyquest as My_Timer_SetQstStage).MyTimer()

 

But if the NPC is running the package without the timer running to set the stage, then there is probably a different issue that needs to be resolved as well.

Link to comment
Share on other sites

I tried GetStage Questname != 20 AND

GetStage Questname != 30 AND

 

NPC still runs the package when the quest stage is at either stage 20 or stage 30.

Doesn't make sense. The first package is set to run at < 10 and it does perfectly. The next package in the stack is set to run at == 20, that runs too. I have notifications telling me what stage the quest is currently at so I know the NPC is ignoring the condition(s).

 

EDIT: Tried using a global variable that is 1 before timer starts and 2 after. NPC still runs the package when the global is 1 even though the package is conditioned to GetGlobalValue MyGlobal == 2.

 

This sucks.

Edited by antstubell
Link to comment
Share on other sites

I've conditioned quest alias packages before and they seem to work. Your conditions seem a bit odd, though. To me they say if the quest is not at stage 20 or 30, run this package. At stage 0 they could start running it. They may not stop running it afterwards.

 

I tend to just need an NPC to run a package at 1 particular quest stage, so I condition it Get Stage MyQuest == MyStage.

 

When I hit that stage to be sure they don't carry on using any earlier package, I type this into the stage fragment...

 

Alias_MyAliasName.GetActorRef().EvaluatePackage()

 

When that stage fragment runs, they should run through their packages and pick that one to start. Any other packages must either be conditioned not to run at that stage, run at different stages or ordered correctly in the stack so that this is the one my NPC will use after evaluating.

 

Edit: having said that, that's what I did to make sure one NPC moved to wait for the player at stage 150 of a quest. The package was conditioned to be valid for stage 150. At the end of the conversation, he automatically went back to sandboxing, which is his lowest package in his list of quest alias packages and the only one viable at that time. I didn't need to script him to re-evaluate.

 

NPCs do re-evaluate packages when theey are in the loaded cell, though. ie when the player is near. I used the line of script to have him in position before the player entered his cell at stage 150.

Link to comment
Share on other sites

@cumbrianlad

If you read the top of this thread you'll see I said that setting the package, on the actor, to run at GetStage QuestName == 40 didn't work. Ishara suggested adding conditions that make it so the package cannot run at any other stage except 40, which is what == 40 should do.

Since then I've moved all packages to the actor's alias and redone the packages (changed the linear opening storyline of the NPC) and see how it goes from there.

You see this NPC has a linear story at the beginning. Player encounters NPC, is told to follow him. NPC proceeds to a house where he searches for a key (in a watering can, see my other thread), finds key and enters house. That's 3 packages NPC must do. Then the final package will be NPC goes home and sandboxes. I THINK this package should go directly on the actor because as of this moment I don't have any more 'scripted' actions for him and will probably end quest, this quest, here. If I'm wrong please advise.

Edited by antstubell
Link to comment
Share on other sites

  • Recently Browsing   0 members

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