Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-11-27 22:58:00

~Red
Member
Registered: 2010-10-16
Post 268/276

AddPartyMon HELP

Tried altering Route22.asm to remove the rival's first battle and replace it with him giving you a pokemon. Cannot get GivePokemon or AddPartyMon to work. Not sure I know how they work either. Can someone give me an explanation? I've looked at CeladonMansionFloor 5 and OaksLab but cannot figure it out.

Offline

#2 2016-11-27 23:07:44

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,434/3,465

Re: AddPartyMon HELP

db $08 ; asm
lb bc, EEVEE, 25 ; species, level
call GivePokemon
jr nc, .noRoom
ld a, HS_CELADON_MANSION_5_GIFT ; which event to hide (the pokeball on the table)
ld [wcc4d], a (needs to be stored here for the predef)
predef HideObject
.noRoom
jp TextScriptEnd

Giving a Pokemon is pretty simple, I'm not sure which part you're getting confused by.

Load bc with the Species and Level
call GivePokemon
jr nc to what happens if receiving the Pokemon failed (no room for it).

Offline

#3 2016-11-27 23:12:50

~Red
Member
Registered: 2010-10-16
Post 269/276

Re: AddPartyMon HELP

Mateo wrote:

Giving a Pokemon is pretty simple, I'm not sure which part you're getting confused by.

Load bc with the Species and Level
call GivePokemon
jr nc to what happens if receiving the Pokemon failed (no room for it).


Route22Script1: ; 50f62 (14:4f62)
ld a, [wd730]
bit 0, a
ret nz
ld a, [wcf0d]
cp $1
jr nz, .asm_50f78 ; 0x50f6d $9
ld a, $4
ld [wd528], a
ld a, $4
jr .asm_50f7a ; 0x50f76 $2
.asm_50f78
ld a, $c
.asm_50f7a
ld [$ff8d], a
ld a, $1
ld [$ff8c], a
call SetSpriteFacingDirectionAndDelay
xor a
ld a, $1
ld [$ff8c], a
call DisplayTextID
lb bc, EEVEE, 5
call GivePokemon
jr nc, .asm_ohsht
.asm_ohsht
ld [wJoyIgnore], a
ld a, $2
ld [W_ROUTE22CURSCRIPT], a
ret

This causes the game to show the first line of text and then lock up.

Offline

#4 2016-11-27 23:24:02

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 3,435/3,465

Re: AddPartyMon HELP

Well, the code for giving the Pokemon looks solid, so there's probably another issue there. Probably a careless mistake that isn't immediately jumping out at me. I'll look into it.

Offline

#5 2016-11-27 23:31:06

~Red
Member
Registered: 2010-10-16
Post 270/276

Re: AddPartyMon HELP

Mateo wrote:

Well, the code for giving the Pokemon looks solid, so there's probably another issue there. Probably a careless mistake that isn't immediately jumping out at me. I'll look into it.

If it helps, script2 is left unchanged.

Offline

#6 2016-11-28 06:08:01

Fotomac
Member
Registered: 2015-10-25
Post 255/293

Re: AddPartyMon HELP

I think I might be able to incorporate that idea into my hack... that is, when it's more serviceable. After that debacle with the glitch items, I don't want to include any untested code in any release of my hack, in case it crashes the game. By that token, it needs a bit more work. But at least we know where to begin.

That said, what in script2 could be causing problems with that one?

Offline

#7 2016-11-30 00:34:11

Danny-E 33
Administrator
Registered: 2012-06-09
Post 998/1,023

Re: AddPartyMon HELP

One issue I notice is that your jump after the call to GivePokemon is not appropriate:

jr nc, .asm_ohsht
.asm_ohsht

Whether or not the jump is taken, the next instruction to be executed is the instruction immediately following the jump.
When GivePokemon fails (when the carry flag is not set) you need to jump to somewhere different to handle that case (print a different message, whatever).


Red Hack: Pokémon Prototype

Total number of registered users: 7000+
Total number of active users: ~12

Offline

Board footer

Powered by FluxBB