Time based Nurse Joy greetings - Pawkkie/Team-Aquas-Asset-Repo GitHub Wiki

By PCG.

This tutorial goes over editing Nurse Joy's scripts in inc format.

shortenedpokecentermain

Updated the gettime macro

In asm/macros/event.inc

(this does nothing, so its optional)

-	@ Sets the values of variables VAR_0x8000, VAR_0x8001, and VAR_0x8002 to the current hour, minute, and second.
+	@ Sets the values of variables VAR_0x8000, VAR_0x8001, VAR_0x8002 and VAR_0x8003 to the current hour, minute, second and day of week.
	.macro gettime
	.byte 0x2e
	.endm

In src/scrcmd.c

bool8 ScrCmd_gettime(struct ScriptContext *ctx)
{
    RtcCalcLocalTime();
    gSpecialVar_0x8000 = gLocalTime.hours;
    gSpecialVar_0x8001 = gLocalTime.minutes;
    gSpecialVar_0x8002 = gLocalTime.seconds;
+    gSpecialVar_0x8003 = GetTimeOfDay();
}

Now using the macro gettime returns TIME_MORNING, TIME_DAY, TIME_EVENING or TIME_NIGHT.

Note: since include/rtc.h is not included in data/event_scripts.s, you can't use these constants. Instead, you should use their constant value 0, 1, 2 and 3 respectively, or move the constants to another file such as include/constants/global.h

Editing the texts

In data/text/pkmn_center_nurse.inc

- gText_WouldYouLikeToRestYourPkmn::
-	.string "Hello, and welcome to\n"
-	.string "the POKéMON CENTER.\p"
-	.string "We restore your tired POKéMON\n"
-	.string "to full health.\p"

+ gText_NurseIntro_Morning::
+	.string "Good morning!\n"
+	.string "Welcome to our POKéMON CENTER.\p"
+	.string "Would you like to rest your POKéMON?$"

+ gText_NurseIntro_Day::
+	.string "Good day!\n"
+	.string "Welcome to our POKéMON CENTER.\p"
+	.string "Would you like to rest your POKéMON?$"

+ gText_NurseIntro_Evening::
+	.string "Good evening!\n"
+	.string "Welcome to our POKéMON CENTER.\p"
+	.string "Would you like to rest your POKéMON?$"

+ gText_NurseIntro_Night::
+	.string "Good evening! You're out late.\n"
+	.string "Welcome to our POKéMON CENTER.\p"
+	.string "Would you like to rest your POKéMON?$"

Optional text edits I have made.

- gText_IllTakeYourPkmn::
-	.string "Okay, I'll take your POKéMON\n"
-	.string "for a few seconds.$"
-
- gText_WeHopeToSeeYouAgain::
-	.string "We hope to see you again!$"

+ gText_IllTakeYourPkmn::
+	.string "Okay, this'll take a sec.$"
+
+ gText_TakeCareStaySafeOutThere::
+	.string "Take care and stay safe out there!$"

Below is for Gold Trainer Card.

- gText_YouWantTheUsual::
-	.string "I'm delighted to see you, {PLAYER}!\n"
-	.string "You want the usual, am I right?$"

+ gText_YouWantTheUsual_Morning::
+	.string "I hope you're having\n"
+	.string "a great morning, {PLAYER}!\p"
+	.string "You want the usual, am I right?$"

+ gText_YouWantTheUsual_Day::
+	.string "I hope you're having\n"
+	.string "a great day, {PLAYER}!\p"
+	.string "You want the usual, am I right?$"

+ gText_YouWantTheUsual_Evening::
+	.string "I hope you're having\n"
+	.string "a great evening, {PLAYER}!\p"
+	.string "You want the usual, am I right?$"

+ gText_YouWantTheUsual_Night::
+	.string "How's your night going, {PLAYER}?\n"
+	.string "You want the usual, am I right?$"
- gText_WeHopeToSeeYouAgain2::
-	.string "We hope to see you again!$"

+ gText_TakeCareStaySafeOutTherePlayer::
+	.string "Take care and stay safe out there,\n"
+	.string "{PLAYER}!$"

Editing the scripts

In data/scripts/pkmn_center_nurse.inc

Common_EventScript_PkmnCenterNurse::
	lock
	faceplayer
	setvar VAR_0x8004, 0
+	gettime
	specialvar VAR_RESULT, CountPlayerTrainerStars
	goto_if_eq VAR_RESULT, 4, EventScript_PkmnCenterNurse_GoldCard
-	msgbox gText_WouldYouLikeToRestYourPkmn, MSGBOX_YESNO
-	goto_if_eq VAR_RESULT, YES, EventScript_PkmnCenterNurse_HealPkmn
-	goto_if_eq VAR_RESULT, NO, EventScript_PkmnCenterNurse_Goodbye
+	switch VAR_0x8003
+	case 0, EventScript_PkmnCenterNurse_NurseIntro_Morning
+	case 1, EventScript_PkmnCenterNurse_NurseIntro_Day
+	case 2, EventScript_PkmnCenterNurse_NurseIntro_Evening
+	case 3, EventScript_PkmnCenterNurse_NurseIntro_Night
	end

+ EventScript_PkmnCenterNurse_NurseIntro_Morning::
+	msgbox gText_NurseIntro_Morning, MSGBOX_YESNO
+	goto_if_eq VAR_RESULT, YES, EventScript_PkmnCenterNurse_HealPkmn
+	message gText_TakeCareStaySafeOutThere
+	return

+ EventScript_PkmnCenterNurse_NurseIntro_Day::
+	msgbox gText_NurseIntro_Day, MSGBOX_YESNO
+	goto_if_eq VAR_RESULT, YES, EventScript_PkmnCenterNurse_HealPkmn
+	message gText_TakeCareStaySafeOutThere
+	return

+ EventScript_PkmnCenterNurse_NurseIntro_Evening::
+	msgbox gText_NurseIntro_Evening, MSGBOX_YESNO
+	goto_if_eq VAR_RESULT, YES, EventScript_PkmnCenterNurse_HealPkmn
+	message gText_TakeCareStaySafeOutThere
+	return

+ EventScript_PkmnCenterNurse_NurseIntro_Night::
+	msgbox gText_NurseIntro_Night, MSGBOX_YESNO
+	goto_if_eq VAR_RESULT, YES, EventScript_PkmnCenterNurse_HealPkmn
+	message gText_TakeCareStaySafeOutThere
+	return

Below is for Gold Trainer Card.

+ EventScript_PkmnCenterNurse_AskForUsual::
-	msgbox gText_YouWantTheUsual, MSGBOX_YESNO
-	goto_if_eq VAR_RESULT, YES, EventScript_PkmnCenterNurse_GoldCardHealPkmn
-	message gText_WeHopeToSeeYouAgain2
-	return
+	switch VAR_0x8003
+	case 0, EventScript_PkmnCenterNurse_AskForUsual_Morning
+	case 1, EventScript_PkmnCenterNurse_AskForUsual_Day
+	case 2, EventScript_PkmnCenterNurse_AskForUsual_Evening
+	case 3, EventScript_PkmnCenterNurse_AskForUsual_Night
	end

+ EventScript_PkmnCenterNurse_AskForUsual_Morning::
+	msgbox gText_YouWantTheUsual_Morning, MSGBOX_YESNO
+	goto_if_eq VAR_RESULT, YES, EventScript_PkmnCenterNurse_GoldCardHealPkmn
+	message gText_TakeCareStaySafeOutTherePlayer
+	return

+ EventScript_PkmnCenterNurse_AskForUsual_Day::
+	msgbox gText_YouWantTheUsual_Day, MSGBOX_YESNO
+	goto_if_eq VAR_RESULT, YES, EventScript_PkmnCenterNurse_GoldCardHealPkmn
+	message gText_TakeCareStaySafeOutTherePlayer
+	return

+ EventScript_PkmnCenterNurse_AskForUsual_Evening::
+	msgbox gText_YouWantTheUsual_Evening, MSGBOX_YESNO
+	goto_if_eq VAR_RESULT, YES, EventScript_PkmnCenterNurse_GoldCardHealPkmn
+	message gText_TakeCareStaySafeOutTherePlayer
+	return

+ EventScript_PkmnCenterNurse_AskForUsual_Night::
+	msgbox gText_YouWantTheUsual_Night, MSGBOX_YESNO
+	goto_if_eq VAR_RESULT, YES, EventScript_PkmnCenterNurse_GoldCardHealPkmn
+	message gText_TakeCareStaySafeOutTherePlayer
+	return

And that's it, enjoy. :)

Here's my commit with some minor alterations, if you'd like to refer it. https://github.com/PCG06/pokeemerald-hack/commit/df7e26f78ce5bd8c4c1223c9d4d9f4f3dbd5298d