Give quest on mod startup?

Post » Fri May 27, 2011 3:51 pm

How can I get my quest to be given to the player as soon as the player enters the world? Can I do that through scripting or do I have to attach it to a world trigger?
User avatar
BaNK.RoLL
 
Posts: 3451
Joined: Sun Nov 18, 2007 3:55 pm

Post » Fri May 27, 2011 10:02 am

If you want the quest to immediately show up when the player starts the game, a simple script like this will do the job. Make it a quest script and attach it to your quest. This script assumes your quest's ID is MyQuest and the first stage is 10.

scn aaMyQuestScriptshort DoOnceBegin GameModeIf (DoOnce == 0)   setstage MyQuest 10   set DoOnce to 1endifEnd

User avatar
Jessica Raven
 
Posts: 3409
Joined: Thu Dec 21, 2006 4:33 am

Post » Fri May 27, 2011 9:56 am

Rather than DoOnce, I would use "StopQuest MyQuest" to stop it from running altogether.
User avatar
Charleigh Anderson
 
Posts: 3398
Joined: Fri Feb 02, 2007 5:17 am

Post » Fri May 27, 2011 9:35 am

Rather than DoOnce, I would use "StopQuest MyQuest" to stop it from running altogether.

DoOnce is better for scripts that are attached to objects? StopQuest is the better method for quests that run at start-up?
User avatar
Rach B
 
Posts: 3419
Joined: Thu Mar 08, 2007 11:30 am

Post » Fri May 27, 2011 7:43 pm

DoOnce is better for scripts that are attached to objects? StopQuest is the better method for quests that run at start-up?
Object scripts run every frame in GameMode and cannot be stopped entirely, however their 'expense' can be reduced after they've done their thing.
Spoiler
scn ObjectSCPTInt bDoOnceBegin GameMode	If bDoOnce		Return	Else		;Do 'expensive stuff		Set bDoOnce to 1	EndIfEnd
Quest scripts can be stopped altogether, so...
Spoiler
scn QuestSCPTInt bDoOnceBegin GameMode	;Do 'expensive stuff	StopQuest QUSTEnd
...Is much like...
Spoiler
scn QuestSCPTInt bDoOnceBegin GameMode	If bDoOnce		StopQuest	Else		;Do 'expensive stuff		Set bDoOnce to 1	EndIfEnd
...but the latter is more concise and will end sooner.

Since we can control how often a quest script runs, it can be useful to separate 'fast' and 'slow' code...
Spoiler
scn QuestSCPTInt bQuickeningBegin GameMode	If (bQuickening != Criterion)		Set bQuickening to (bQuickening == 0)		If bQuickening			SetQuestDelay QUST 0		Else			SetQuestDelay QUST .01		EndIf	ElseIf bQuickening		;Fast Code	Else		;Slow Code	EndIfEnd

User avatar
Samantha Pattison
 
Posts: 3407
Joined: Sat Oct 28, 2006 8:19 pm

Post » Fri May 27, 2011 6:58 pm

Rather than DoOnce, I would use "StopQuest MyQuest" to stop it from running altogether.


If he wants the quest to still be active (and be able to reference the quest script for other things) the DoOnce bit is more appropriate, since you don't want to stop it running completely.
User avatar
Suzie Dalziel
 
Posts: 3443
Joined: Thu Jun 15, 2006 8:19 pm

Post » Fri May 27, 2011 3:44 pm

Object scripts run every frame in GameMode and cannot be stopped entirely, however their 'expense' can be reduced after they've done their thing.

Okay, that's what I thought.

I used the DoOnce method when attaching to OnLoad for some objects in FO:3 (along with Disable/MarkForDelete). I'll need to change my Random Snow Globes to also use StopQuest (I structured it as a DoOnce, but may have also put in the StopQuest line) as that mod is done with a one-time quest to shuffle the snow globe locations.
User avatar
Andres Lechuga
 
Posts: 3406
Joined: Sun Aug 12, 2007 8:47 pm

Post » Fri May 27, 2011 9:35 am

Also make sure you check the box in the quest window that says 'Running from start', or 'starts on' or something. Sorry, I dont have the geck open and I cant think of these exact term. :P Its on the main page where you pick quest delay and the ID, and name of it. Its something for making the quest on instantly, without you having to start it via another script.
User avatar
Angelina Mayo
 
Posts: 3427
Joined: Wed Jan 24, 2007 4:58 am

Post » Fri May 27, 2011 8:12 am

If he wants the quest to still be active (and be able to reference the quest script for other things) the DoOnce bit is more appropriate, since you don't want to stop it running completely.


I figured it was likely to be a one shot kind of thing. ;)

I should point out too that it was fairly common to set stage 10 and complete the quest. I would recommend against completing the quest now since there is an achievement for completing quests. Using a message to show the mod is loaded is probably better.
User avatar
CYCO JO-NATE
 
Posts: 3431
Joined: Fri Sep 21, 2007 12:41 pm


Return to Fallout: New Vegas