diff options
author | growlie777 <69436917+growlie777@users.noreply.github.com> | 2020-08-10 08:26:01 -0400 |
---|---|---|
committer | growlie777 <69436917+growlie777@users.noreply.github.com> | 2020-08-10 08:26:01 -0400 |
commit | 077c5c0947ad68d98a7db2ee38b4b133af8a51d1 (patch) | |
tree | fc0588a06dce2c14acfeec018d379e0274a2ea96 | |
parent | 325913a35173b80804e9428b17f2855edae63f91 (diff) |
Created How To Add a Pocket PC (markdown)
-rw-r--r-- | How-To-Add-a-Pocket-PC.md | 241 |
1 files changed, 241 insertions, 0 deletions
diff --git a/How-To-Add-a-Pocket-PC.md b/How-To-Add-a-Pocket-PC.md new file mode 100644 index 0000000..b4e8bfe --- /dev/null +++ b/How-To-Add-a-Pocket-PC.md @@ -0,0 +1,241 @@ +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](#1-add-the-pocket-pc-as-a-key-item) +2. [Add the New PocketPCFunction To Handle Using the PC](#2-add-the-New-PocketPCFunction-To-Handle-Using-the-PC) +3. [Get the PocketPC from Elms Aide](#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](../blob/master/constants/item_constants.asm): + +```diff + const WATER_STONE ; 18 +- const ITEM_19 ; 19 ++ const POCKET_PC ; 19 + const HP_UP ; 1a +``` + +Edit [data/items/names.asm](../blob/master/data/items/names.asm): + +```diff + db "WATER STONE@" +- db "TERU-SAMA@" ++ db "POCKET PC@" + db "HP UP@" +``` + +Edit [data/items/descriptions.asm](../blob/master/data/items/descriptions.asm): + +```diff + dw WaterStoneDesc +- dw TeruSama2Desc ++ dw PocketPCDesc + dw HPUpDesc + + ... + +-TeruSama2Desc: +- db "?@" ++PocketPCDesc: ++ db "Access the PC" ++ next "right here!@" +``` + +Edit [data/items/attributes.asm](../blob/master/data/items/attributes.asm): + +```diff +-; 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](../blob/master/engine/items/item_effects.asm): + +Replace the old slot: +```diff + dw EvoStoneEffect ; WATER_STONE +- dw NoEffect ; ITEM_19 ++ dw PocketPCEffect ; POCKET_PC + dw VitaminEffect ; HP_UP +``` +Add the new effect: +```diff + ItemfinderEffect: + farcall ItemFinder + ret + ++ PocketPCEffect: ++ farcall PocketPCFunction ++ ret +``` + +And last, edit [data/items/catch_rate_items.asm](../blob/master/data/items/catch_rate_items.asm): + +You wont need two Pocket PC's! +```diff + 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](../blob/master/engine/items/item_effects.asm) + +This will be done in the [engine/events/overworld.asm](../blob/master/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: + +```diff +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: + +```diff ++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](../blob/master/maps/ElmsLab.asm) + +First we add the new call to both events: +```diff +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: +```diff +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: +```diff +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.
\ No newline at end of file |