Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-02-02 14:56:43

narabuster
New member
Registered: 2016-01-21
Post 2/9

Pokered- Pointing to Trainer's party?

I need help with actually initiating a trainer battle. I've been able to call for Agatha's battle in a map where she's not supposed to be fought. I added her as a trainer to fight in the Pokemon Tower 6th floor, and in the first script, I test a coordinate tile and if the player was on that tile...

ld a, OPP_AGATHA
ld [wCurOpponent], a

During execution (granted it compiled successfully), I go to that coordinate and the battle starts.
Agatha's sprite scrolls in, and the battle begins.
The problem is the battle music is a normal battle music instead of the Gym Leader battle music. Also, the only pokemon that Agatha has is a Missingno. I'm assuming that I'm not calling her battle correctly.
Does anybody know how to call her battle with a correct pointer?

Offline

#2 2016-02-02 16:19:52

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

Re: Pokered- Pointing to Trainer's party?

All you are doing is loading her trainer class, then starting the battle with whatever junk value is still hanging around in wTrainerNo so she isn't loading a valid team. Try loading a valid party number into wTrainerNo after the code you posted, and see if it works better. For example:

ld a, 1
ld [wTrainerNo], a

should load the first trainer party associated with her class, which is normally the only one. If you added a second entry for her class, so it isn't using the same team as the Elite Four, you would put 2 instead of 1 there or whatever number it needed to be.


Another place you could look for help with this sort of thing would be the rival battles, since they call a trainer battle and have to declare both his class and his team before starting the battle, since they are not a "normal" trainer event like the ones you find in most places. Hopefully between those two suggestions you can get something working.

Last edited by Mateo (2016-02-02 16:21:43)

Offline

#3 2016-02-03 00:06:41

narabuster
New member
Registered: 2016-01-21
Post 3/9

Re: Pokered- Pointing to Trainer's party?

Thanks Mateo!
I didn't really know how to use wTrainerNo properly, but I originally assumed that it pointed to a trainer's number, so it would only apply to normal trainers. Glad to see that I was wrong, however.

There's still one more issue. Since I have already established the trainer class and its number, is there any additional way to trigger the Gym Leader Battle music for Agatha like it does normally? Using only [wCurOpponent] and [wTrainerNo] didn't trigger the gym leader music.
However, using [wGymLeaderNo] does trigger the music. But I'm not really sure how to use that since using

ld a, OPP_AGATHA
ld [wCurOpponent], a
ld a, 1                           ;or ld a, $1
ld [wGymLeaderNo], a

just gave me the Agatha battle with the Missingno again. Any ideas on where I'm going wrong?

Offline

#4 2016-02-03 00:20:48

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

Re: Pokered- Pointing to Trainer's party?

You wouldn't use wGymLeaderNo instead of the other one, but you might try using it in addition to it.

Offline

#5 2016-02-03 01:09:11

narabuster
New member
Registered: 2016-01-21
Post 4/9

Re: Pokered- Pointing to Trainer's party?

Thanks again, Mateo!

The battle initiates perfectly now. Your help is very appreciated! :D

Offline

#6 2016-02-03 01:25:24

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

Re: Pokered- Pointing to Trainer's party?

No problem!

Offline

#7 2016-02-03 23:44:04

comet
Member
Registered: 2012-04-09
Post 624/672

Re: Pokered- Pointing to Trainer's party?

Agatha doesn't have the gym leader music normally.

wGymLeaderNo also controls special moves, so using a value of 1 will give her second Pokemon Bide. If you want to change what music plays, you should edit PlayBattleMusic.

Offline

#8 2016-02-06 14:08:47

narabuster
New member
Registered: 2016-01-21
Post 5/9

Re: Pokered- Pointing to Trainer's party?

I actually didn't realize that Agatha's battle didn't play the Gym Battle theme. Thanks for clearing that up, comet.

I assume that Agatha's pokemon have no Lone Attacks? I modified her trainer party anyways, so I guess that doesn't matter.

If I don't want Agatha's pokemon to have any special/lone attacks but I still want the Gym Leader battle music to play, should I just set the [wGymLeaderNo] to a null ($ff) value? Or is that not going to compile correctly?

Offline

#9 2016-02-06 15:23:47

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

Re: Pokered- Pointing to Trainer's party?

You should just never write to wGymLeaderNo in your script at all.


Red Hack: Pokémon Prototype

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

Offline

#10 2016-02-06 18:36:25

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

Re: Pokered- Pointing to Trainer's party?

I couldn't remember exactly how LoneAttackNo worked in vanilla Red, since I swapped the custom move format in Red++ a while back, so that was my bad. Should have told him that at first.

Offline

#11 2016-02-10 14:22:47

narabuster
New member
Registered: 2016-01-21
Post 6/9

Re: Pokered- Pointing to Trainer's party?

I simply used

ld a, OPP_AGATHA
ld [wCurOpponent], a
ld a, $ff
ld [wGymLeaderNo], a

and the problem was solved. The second pokemon that Agatha has no longer uses Bide or any of the other lone/special moves. It behaves as normal. And the gym leader music still plays.

I guess this pretty much solves my problem. Thanks for the help everyone.

Offline

#12 2016-02-11 23:53:11

comet
Member
Registered: 2012-04-09
Post 625/672

Re: Pokered- Pointing to Trainer's party?

It just means the lone move (and which pokemon gets it) is undefined. The lone moves table has less than 255 entries (way less), so the 255th entry will read from unrelated data. The end result is that this will overwrite some byte somewhere in wram. This is ok if you aren't worried about untraceable bugs that come and go at random.

Offline

Board footer

Powered by FluxBB