Counting the days

Post » Thu Feb 04, 2010 5:59 pm

I would like to have a timed quest where the player has a certain number of weeks/days to achieve a task

I've managed to do quests like the come back and see me tomorrow or in a couple of days where I just adding a day to get a certain figure but this time I want the quest giver to say how many weeks the player has to complete the task and then when asked in dialog they can tell the player how many days are left to go - except for when it gets close to the final seven days then i want a journal entry to be added for each day left to go.

Now I can understand setting up a day counter on the NPC but how do i connect that to a global so I can get the correct journal entries to be added?

Any help will be greatly appreciated :)
User avatar
Karen anwyn Green
 
Posts: 3448
Joined: Thu Jun 15, 2006 4:26 pm

Post » Thu Feb 04, 2010 6:42 pm

I'm not sure how you were planning on setting up a day counter, but the method I would use is outlined in MWSFD - here is a version of the script, edited slightly by me:

Begin illuminiel_day_counterShort currentDayif ( currentDay != Day ) ;whenever Day changes (presumably increasing)…	set currentDay to Day	set illuminiel_days_left to illuminiel_days_left - 1 ;decrease days remainingendifEnd


This script requires you to create a global variable called "illuminiel_days_left". The initial value of this variable should be set to the number of days that the player has to complete the task.

Then, once the player has been given the task, you can just use the command:
Startscript "illimuniel_day_counter"

This will start the days counting down, and your global variable can be used to get the number of days remaining.

To get the journal entries working, you can just add a section to the script before the last line that would look something like this:

if ( "illuminiel_days_left" == 7 )	Journal "illuminiel_journal_days" 10elseif ( "illuminiel_days_left" == 6 )	Journal "illuminiel_journal_days" 20elseif ( "illuminiel_days_left" == 5 )	Journal "illuminiel_journal_days" 30elseif ( "illuminiel_days_left" == 4 )	Journal "illuminiel_journal_days" 40elseif ( "illuminiel_days_left" == 3 )	Journal "illuminiel_journal_days" 50elseif ( "illuminiel_days_left" == 2 )	Journal "illuminiel_journal_days" 60elseif ( "illuminiel_days_left" == 1 )	Journal "illuminiel_journal_days" 70endif


This is untested, but hopefully it makes sense - good luck! :)

- Danjb
User avatar
Stat Wrecker
 
Posts: 3511
Joined: Mon Sep 24, 2007 6:14 am

Post » Thu Feb 04, 2010 11:41 am

Thanks Danjb for replying

I have ended up altering the Clavus mercenary contract script from tribunal to do what I want

I still need to test it but it looks like this:

Begin BM_Times_up;based on Bethesda's Calvus mercenary script with additions by Illuminiel;this global script records the start day of meeting Fleur, and the days left in her tourshort setup				;if setup has been doneshort scriptday				;for decrementing days left in Fleur's tourshort reminder				;to remind player Fleur's tour is nearly over;short BM_FleurDay			;the day you begin the tour; a global variable;short BM_Fleur_Days_left		;days left in Fleur's Tour; a global variable;short Fleur_time			;variable in Fleur's companion script, set in dialogue to 1if ( setup == 0 )	if ( "BM_FLeur".Fleur_time == 1) 			set BM_FleurDay to Day		set setup to 1		set BM_Fleur_Days_left to 66			endifendifif ( MenuMode == 1 )	Returnendifif ( "BM_FLeur"->ondeath == 1 )	stopscript BM_Times_up	returnendifif ( "BM_FLeur".Fleur_time == 1) 		;count down the days left on the tour and check to see if the tour is over	if ( BM_FleurDay != Day )		if (scriptday != Day )			set BM_Fleur_Days_left to ( BM_Fleur_Days_left - 1 )			set scriptday to Day		endif	endifendif;;;;;;;;;; Count down to the endif ( BM_Fleur_Days_left == 7 )	if ( reminder == 0 )		set reminder to 1		Messagebox "This is Fleur's last week in Morrowind." "Ok"		Journal BM_Goodbye 1	endifendifif ( BM_Fleur_Days_left == 3 )	if ( reminder == 1 )		set reminder to 2		Messagebox "Fleur has three days left in Morrowind." "Ok"		Journal BM_Goodbye 2	endifendifif ( BM_Fleur_Days_left == 1 )	if ( reminder == 2 )		set reminder to 3		Messagebox "Today Fleur will leave Morrowind." "Ok"		Journal BM_Goodbye 3	endifendifend BM_Times_up

User avatar
Robyn Lena
 
Posts: 3338
Joined: Mon Jan 01, 2007 6:17 am

Post » Thu Feb 04, 2010 3:11 pm

Alright, nicely done - hope it works!
User avatar
Queen Bitch
 
Posts: 3312
Joined: Fri Dec 15, 2006 2:43 pm


Return to III - Morrowind