Reviving Pokémon from Fossils (Gen I) - pret/pokecrystal GitHub Wiki

Contents

  1. Introduction
  2. Adding the items
  3. Defining the script constants and event flags
  4. Adding the script

1. Introduction

In generation I, there used to be a scientist in the Cinnabar Lab Fossil Room that gave you an Omanyte, a Kabuto or an Aerodactyl after being given a Helix Fossil, a Dome Fossil or an Old Amber, respectively. This tutorial aims to emulate that behaviour by providing a script which makes an NPC take away one fossil and give the player the corresponding fossil Pokémon. There are also comments in the code to change that instead of the player having to leave the room there is no delay and the player immediately receives the Pokémon.

2. Adding the items

Firstly, you need to add the three fossils to the game as items following this tutorial. Please make sure to fully follow that tutorial to ensure all essential item data is present in the game.

The tutorial assumes the following item constants are defined anywhere in /constants/item_constants.asm:

-	const ITEM_93      ; 93
+	const OLD_AMBER    ; 93
-	const ITEM_94      ; 94
+	const DOME_FOSSIL  ; 94
-	const ITEM_95      ; 95
+	const HELIX_FOSSIL ; 95

3. Defining the script constants and event flags

In the actual script, you need to set a flag so the game knows you gave the fossil to the NPC and to clear it again when you received the revived Pokémon. To achieve that, the tutorial assumes the following event flags are defined anywhere in /constants/event_flags.asm:

; Johto hidden items
	const EVENT_TIN_TOWER_4F_HIDDEN_MAX_POTION
	const EVENT_TIN_TOWER_5F_HIDDEN_FULL_RESTORE
	const EVENT_TIN_TOWER_5F_HIDDEN_CARBOS
	const EVENT_BURNED_TOWER_1F_HIDDEN_ETHER
-	const_skip ; unused in Crystal
+	const EVENT_GAVE_SCIENTIST_OLD_AMBER
-	const_skip ; unused in Crystal
+	const EVENT_GAVE_SCIENTIST_DOME_FOSSIL
-	const_skip ; unused in Crystal
+	const EVENT_GAVE_SCIENTIST_HELIX_FOSSIL
	const EVENT_NATIONAL_PARK_HIDDEN_FULL_HEAL

The script also adds a menu in the dialogue where you can choose which fossil to present to the NPC. Basically, the menu is a copy of the Goldenrod Move Tutor as seen below. The tutorial therefore assumes the following script constants are defined anywhere in /constants/script_constants.asm:

; MoveTutor setval arguments
	const_def 1
	const MOVETUTOR_FLAMETHROWER ; 1
	const MOVETUTOR_THUNDERBOLT  ; 2
	const MOVETUTOR_ICE_BEAM     ; 3
+
+; FossilScientist setval arguments
+	const_def 1
+	const REVIVE_OLD_AMBER    ; 1
+	const REVIVE_DOME_FOSSIL  ; 2
+	const REVIVE_HELIX_FOSSIL ; 3

4. Adding the script

The dialogue of the script is taken from pokered's /text/CinnabarLabFossilRoom.asm and only slightly altered. To make an NPC take a fossil and give you the corresponding Pokémon, add the following script to an NPC in any [*.asm] file in /maps:

+FossilScientist:
+	faceplayer
+	opentext
+	checkevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 ; remove the next two lines to immediately receive the fossil
+	iftrue .GaveScientistFossil
+	checkevent EVENT_GAVE_SCIENTIST_OLD_AMBER
+	iftrue .GiveAerodactyl
+	checkevent EVENT_GAVE_SCIENTIST_DOME_FOSSIL
+	iftrue .GiveKabuto
+	checkevent EVENT_GAVE_SCIENTIST_HELIX_FOSSIL
+	iftrue .GiveOmanyte
+	writetext FossilScientistIntroText
+	waitbutton
+	loadmenu .MoveMenuHeader
+	verticalmenu
+	closewindow
+	ifequal REVIVE_OLD_AMBER, .OldAmber
+	ifequal REVIVE_DOME_FOSSIL, .DomeFossil
+	ifequal REVIVE_HELIX_FOSSIL, .HelixFossil
+	sjump .No
+
+.OldAmber
+	checkitem OLD_AMBER
+	iffalse .No
+	getmonname STRING_BUFFER_3, AERODACTYL
+	writetext FossilScientistMonText
+	promptbutton
+	setevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 ; remove this to immediately receive the fossil
+	setevent EVENT_GAVE_SCIENTIST_OLD_AMBER
+	takeitem OLD_AMBER
+	writetext FossilScientistGiveText
+	waitbutton
+	sjump .GaveScientistFossil
+
+.DomeFossil:
+	checkitem DOME_FOSSIL
+	iffalse .No
+	getmonname STRING_BUFFER_3, KABUTO
+	writetext FossilScientistMonText
+	promptbutton
+	setevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 ; remove this to immediately receive the fossil
+	setevent EVENT_GAVE_SCIENTIST_DOME_FOSSIL
+	takeitem DOME_FOSSIL
+	opentext
+	writetext FossilScientistGiveText
+	waitbutton
+	sjump .GaveScientistFossil
+
+.HelixFossil:
+	checkitem HELIX_FOSSIL
+	iffalse .No
+	getmonname STRING_BUFFER_3, OMANYTE
+	writetext FossilScientistMonText
+	promptbutton
+	setevent EVENT_TEMPORARY_UNTIL_MAP_RELOAD_1 ; remove this to immediately receive the fossil
+	setevent EVENT_GAVE_SCIENTIST_HELIX_FOSSIL
+	takeitem HELIX_FOSSIL
+	writetext FossilScientistGiveText
+	waitbutton
+	sjump .GaveScientistFossil
+
+.No
+	writetext FossilScientistNoText
+	waitbutton
+	closetext
+	end
+
+.GaveScientistFossil:
+	writetext FossilScientistTimeText
+	waitbutton
+	closetext
+       ; older versions will use FadeBlackQuickly below instead
+	; special FadeOutToBlack ; uncomment the next five lines to immediately receive the fossil
+	; special ReloadSpritesNoPalettes
+	; playsound SFX_WARP_TO
+	; waitsfx
+	; pause 35
+	end ; replace this with "sjump FossilScientist" to immediately receive the fossil
+
+.GiveAerodactyl:
+	readvar VAR_PARTYCOUNT
+	ifequal PARTY_LENGTH, .NoRoom
+	clearevent EVENT_GAVE_SCIENTIST_OLD_AMBER
+	writetext FossilScientistDoneText
+	promptbutton
+	getmonname STRING_BUFFER_3, AERODACTYL
+	writetext FossilScientistReceiveText
+	playsound SFX_CAUGHT_MON
+	waitsfx
+	waitbutton
+	writetext FossilScientistMonText
+	givepoke AERODACTYL, 30
+	closetext
+	end
+
+.GiveKabuto:
+	readvar VAR_PARTYCOUNT
+	ifequal PARTY_LENGTH, .NoRoom
+	clearevent EVENT_GAVE_SCIENTIST_DOME_FOSSIL
+	writetext FossilScientistDoneText
+	promptbutton
+	getmonname STRING_BUFFER_3, KABUTO
+	writetext FossilScientistReceiveText
+	playsound SFX_CAUGHT_MON
+	waitsfx
+	waitbutton
+	writetext FossilScientistMonText
+	givepoke KABUTO, 30
+	closetext
+	end
+
+.GiveOmanyte:
+	readvar VAR_PARTYCOUNT
+	ifequal PARTY_LENGTH, .NoRoom
+	clearevent EVENT_GAVE_SCIENTIST_HELIX_FOSSIL
+	writetext FossilScientistDoneText
+	promptbutton
+	getmonname STRING_BUFFER_3, OMANYTE
+	writetext FossilScientistReceiveText
+	playsound SFX_CAUGHT_MON
+	waitsfx
+	waitbutton
+	writetext FossilScientistMonText
+	givepoke OMANYTE, 30
+	closetext
+	end
+
+.NoRoom:
+	writetext FossilScientistPartyFullText
+	waitbutton
+	closetext
+	end
+
+.MoveMenuHeader:
+	db MENU_BACKUP_TILES ; flags
+	menu_coords 0, 2, 15, TEXTBOX_Y - 1
+	dw .MenuData
+	db 1 ; default option
+
+.MenuData:
+	db STATICMENU_CURSOR ; flags
+	db 4 ; items
+	db "OLD AMBER@"
+	db "DOME FOSSIL@"
+	db "HELIX FOSSIL@"
+	db "CANCEL@"
+
+FossilScientistIntroText:
+	text "Hiya!"
+
+	para "I am important"
+	line "doctor!"
+
+	para "I study here rare"
+	line "#MON fossils!"
+
+	para "You! Have you a"
+	line "fossil for me?"
+	done
+
+FossilScientistNoText:
+	text "No! Is too bad!"
+
+	para "You come again!"
+	done
+
+FossilScientistPartyFullText:
+	text "No! Is too bad!"
+
+	para "Your party is"
+	line "already full!"
+	done
+
+FossilScientistTimeText:
+	text "I take a little"
+	line "time!"
+
+	para "You go for walk a"
+	line "little while!"
+	done
+
+FossilScientistDoneText:
+	text "Where were you?"
+
+	para "Your fossil is"
+	line "back to life!"
+	done
+
+FossilScientistMonText:
+	text "Oh! That is"
+	line "a fossil!"
+
+	para "It is fossil of"
+	line "@"
+	text_ram wStringBuffer3
+	text ", a"#

+
+	para "#MON that is"
+	line "already extinct!"
+
+	para "My Resurrection"
+	line "Machine will make"
+	cont "that #MON live"
+	cont "again!"
+	done
+
+FossilScientistGiveText:
+	text "So! You hurry and"
+	line "give me that!"
+
+	para "<PLAYER> handed"
+	line "over the fossil."
+	done
+
+FossilScientistReceiveText:
+	text "<PLAYER> received"
+	line "@"
+	text_ram wStringBuffer3
+	text "!"
+	done

Technically, you are done! However, there is no way yet to actually receive the fossils in game. You can either make an NPC gift them you directly (the same way some Gym Leaders give you a TM, for example) or make them appear while smashing rocks as in HG/SS following this tutorial.

⚠️ **GitHub.com Fallback** ⚠️