Skip to content

How To Add a Pocket PC

growlie777 edited this page Aug 10, 2020 · 2 revisions

This tutorial is for how to add a Pocket PC that you can use at any time to access the PC without having to go to the PokeCenter.

Contents

  1. Add the Pocket PC as a Key Item
  2. Add the New PocketPCFunction To Handle Using the PC
  3. Get the PocketPC from Elms Aide

1. Add the Pocket PC as a Key Item

This section is similar to adding any normal item and can be carried out the same way until you get to the attributes:

To start with, we'll implement the Pocket PC's essential data. :

Edit constants/item_constants.asm:

 	const WATER_STONE  ; 18
-	const ITEM_19      ; 19
+	const POCKET_PC    ; 19
 	const HP_UP        ; 1a

Edit data/items/names.asm:

 	db "WATER STONE@"
-	db "TERU-SAMA@"
+	db "POCKET PC@"
 	db "HP UP@"

Edit data/items/descriptions.asm:

 	dw WaterStoneDesc
-	dw TeruSama2Desc
+	dw PocketPCDesc
 	dw HPUpDesc

 	...

-TeruSama2Desc:
-	db   "?@"
+PocketPCDesc:
+	db   "Access the PC"
+	next "right here!@"

Edit data/items/attributes.asm:

-; ITEM_19
-	item_attribute $9999, HELD_NONE, 0, NO_LIMITS, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
+; POCKET_PC
+	item_attribute 0, HELD_NONE, 0, CANT_TOSS, KEY_ITEM, ITEMMENU_CLOSE, ITEMMENU_NOUSE

Edit engine/items/item_effects.asm:

Replace the old slot:

 	dw EvoStoneEffect      ; WATER_STONE
-	dw NoEffect            ; ITEM_19
+	dw PocketPCEffect      ; POCKET_PC
 	dw VitaminEffect       ; HP_UP

Add the new effect:

        ItemfinderEffect:
	farcall ItemFinder
	ret

+	PocketPCEffect:
+	farcall PocketPCFunction
+	ret

And last, edit data/items/catch_rate_items.asm:

You wont need two Pocket PC's!

 TimeCapsule_CatchRateItems:
-	db ITEM_19, LEFTOVERS
 	...

2. Add the New PocketPCFunction To Handle Using the PC

Now we need to create the PocketPCFunction that we added to the engine/items/item_effects.asm

This will be done in the engine/events/overworld.asm

Here we have the base of the function, it is handled similarly to the BikeFunction as we want different scripts to trigger based on whether we are using from the Bag or when it is Registered using the Select button:

RodNothingText:
	text_far _RodNothingText
	text_end

UnusedNothingHereText: ; unused
	text_far _UnusedNothingHereText
	text_end

+PocketPCFunction:
+	call .LoadPocketPC
+	and $7f
+	ld [wFieldMoveSucceeded], a
+	ret
+	
+.LoadPocketPC:
+	ld a, [wPlayerState]
+	ld hl, Script_LoadPocketPC
+	ld de, Script_LoadPocketPC_Register
+	call .CheckIfRegistered
+	call QueueScript
+	ld a, $1
+	ret
+	
+.CheckIfRegistered:
+	ld a, [wUsingItemWithSelect]
+	and a
+	ret z
+	ld h, d
+	ld l, e
+	ret

Next we need to add the two scripts that will be run depending on the scenario:

+Script_LoadPocketPC:
+	reloadmappart
+	special UpdateTimePals
+	special PokemonCenterPC
+	reloadmappart
+	end
+
+Script_LoadPocketPC_Register:
+	special PokemonCenterPC
+	reloadmappart
+	end
	
Script_GetOnBike:
	reloadmappart
	special UpdateTimePals
	loadvar VAR_MOVEMENT, PLAYER_BIKE

The difference in the two is when using from the Bag we need to move to the overworld, done with reloadmappart.

In both cases we use the PokemonCenterPC function which has its own special pointer, this will then just act like you were standing in front of the PC in the Pokemon Center!

Then after you have done everything in the PC and exit we have reloadmappart to properly load the map once more.

3. Get the PocketPC from Elms Aide

Now we need to actually get the item into your inventory, one place that makes sense is right after you get your starter.

Getting the PocketPC before you get any Pokemon causes it to crash when accessing the PC, this is solved by just getting it after you get a Pokemon.

So we just need to edit the script for when you get your first Potion to also give the PocketPC. This is done in this file: maps/ElmsLab.asm

First we add the new call to both events:

ElmJumpRightScript:
	applymovement ELMSLAB_ELM, ElmJumpRightMovement
	opentext
	end

AideScript_WalkPotion1:
	applymovement ELMSLAB_ELMS_AIDE, AideWalksRight1
	turnobject PLAYER, DOWN
	scall AideScript_GivePotion
+	scall AideScript_GivePocketPC
	applymovement ELMSLAB_ELMS_AIDE, AideWalksLeft1
	end

AideScript_WalkPotion2:
	applymovement ELMSLAB_ELMS_AIDE, AideWalksRight2
	turnobject PLAYER, DOWN
	scall AideScript_GivePotion
+	scall AideScript_GivePocketPC
	applymovement ELMSLAB_ELMS_AIDE, AideWalksLeft2
	end

Then we add the script and move the end scene to our new script:

AideScript_GivePotion:
	opentext
	writetext AideText_GiveYouPotion
	promptbutton
	verbosegiveitem POTION
	writetext AideText_AlwaysBusy
	waitbutton
	closetext
-	setscene SCENE_ELMSLAB_NOTHING
	end

+AideScript_GivePocketPC:
+	opentext
+	writetext AideText_GetPocketPCText
+	promptbutton
+	giveitem POCKET_PC
+	writetext AideText_PocketPCInfoText
+	waitbutton
+	closetext
+	setscene SCENE_ELMSLAB_NOTHING
+	end

Add last we add the new text used when giving the PocketPC:

ElmsLabPCText:
	text "OBSERVATIONS ON"
	line "#MON EVOLUTION"

	para "…It says on the"
	line "screen…"
	done
	
+AideText_GetPocketPCText:
+	text "Oh, I have"
+	line "this for you"
+
+	para "too! It's a"
+	line "Pocket PC!"
+	done
+	
+AideText_PocketPCInfoText:
+	text "Use this"
+	line "to manage"
+
+	para "your party."
+	done

Now you have a whole scene added to get your PocketPC! This can be added anywhere else you would like instead of here, just make sure it is after you get your starter.

Clone this wiki locally