Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2011-11-05 22:25:55

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

A script I'm working on.

So in working on the Christmas Hack, I'm finding myself wanting a command to teach the last Pokemon in your party a move, so that you can give a pokemon knowing a particular technique. Well, I'm not skilled enough at ASM to add a proper one, as I've never taken the time to teach myself, but I'm developing another system to do it using the ordinary scripting system, and I thought I would share it here. That way other hacks can do the same thing, and you guys can help me spot any errors in the code you may have noticed. I haven't inserted this yet to test it, wanting to get a good solid proof read in before I take the time to do that.

Please note, this is not the proper syntax for any script editor as I do not use script editors, I use a hex editor, but I have instead written the hex value of the command, and a description of what it does beside it so you don't have to jump back and forth to the scripting compendium to look it over. So without further ado, here is the current code.


In the event (after the give pokemon script):

15-LoadVariable
XX-Move For Pokemon to Know
01-Call
XXYYZZ-TeachToLastPokemon




TeachToLastPokemon (Inserted somewhere else)

1A - Copy RAM to Address
D174 - Address (RAM2)
1C-CheckCode
01-PokemonInParty
06 01 - If 1 Pokemon in Party
XXXX - Goto "TeachPokemon1"
06 02 - If 2 Pokemon in Party
XXXX - Goto "TeachPokemon2"
06 03 - If 3 Pokemon in Party
XXXX - Goto "TeachPokemon3"
06 04 - If 4 Pokemon in Party
XXXX - Goto "TeachPokemon4"
06 05 - If 5 Pokemon in Party
XXXX - Goto "TeachPokemon5"
06 06 - If 6 Pokemon in Party
XXXX - Goto "TeachPokemon6"
90 - ReturnCode2

TeachPokemon1

19 -Copy address to RAM
D174 - Address (RAM2)
1A-Copy RAM to address
DA2E-Address (3rd Skill)
90-ReturnCode2

TeachPokemon2

19 -Copy address to RAM
D174 - Address (RAM2)
1A-Copy RAM to address
DA5E-Address (3rd Skill)
90-ReturnCode2

TeachPokemon3

19 -Copy address to RAM
D174 - Address (RAM2)
1A-Copy RAM to address
DA8E-Address (3rd Skill)
90-ReturnCode2

TeachPokemon4

19 -Copy address to RAM
D174 - Address (RAM2)
1A-Copy RAM to address
DABE-Address (3rd Skill)
90-ReturnCode2

TeachPokemon5

19 -Copy address to RAM
D174 - Address (RAM2)
1A-Copy RAM to address
DAEE-Address (3rd Skill)
90-ReturnCode2

TeachPokemon6

19 -Copy address to RAM
D174 - Address (RAM2)
1A-Copy RAM to address
DB1E-Address (3rd Skill)
90-ReturnCode2

Offline

#2 2011-11-06 01:26:22

310/700

Re: A script I'm working on.

Why are you saving the attack to $D174? Seems like you could just write from RAM2 directly, since nothing (?) modifies it in between. Also, it assumes that the monster has at least two attacks, which may not be the case.

Seems like it could work, but it would definitely benefit from some ASM. Finding the attack learning code common to TMs, level‐ups, and evolutions would give the same advantages (choosing which attack to replace, not replacing HMs, works no matter how many attacks the monster already has).

#3 2011-11-06 01:51:06

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

Re: A script I'm working on.

Basically I copy it to and from RAM2 because most of the commands just dealt with RAM or a ram address, and wasn't seeing one to copy from RAM2 directly. The load variable command just loads it to RAM, and the check how many pokemon are in party command returns that value to RAM as well, and it was a way to load it first before we check how many pokemon, and keep up with it. Maybe I overlooked the code to write from RAM2 directly though.

And true, it does assume 2 attacks. In the places I would be using it this would work, but admittedly this wouldn't be the best way. I could maybe modify it with a separate variable to define which skill you wanted to set though. And yes, it would greatly benefit from ASM if I could ever get around to getting down to learning it.

Offline

#4 2011-11-06 06:51:56

Miksy91
Member
Registered: 2010-10-16
Post 576/2,308

Re: A script I'm working on.

Why don't you just use command 1B ?
With it, you can directly copy the move-byte to the unused skill slot.

Also, to make this work properly, all of the "TeachPkmn" commands should contain checks whether their move skill slots are 00 or not.
So yeah, make fully-functioning "TeachPkmn1" first and then just copy all its data five times and change the pointers.


Besides, you could also make it so that if the pokemon, you're wanting to teach the technique, has four moves, you could decide which move to replace / make it say it for example that it replaces the 3rd move and you're able to return to pokemon menu and change the moves around before taking the taught move.

Last edited by Miksy91 (2011-11-06 06:58:02)

Offline

#5 2011-11-06 08:12:04

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

Re: A script I'm working on.

Well I don't want it to ask about replacing a move because I was creating this so you can be given a pokemon that knows a special move already that it couldn't learn normally. Such as the Extremespeed Dratini in Crystal, as Gold has no command to do that that I'm aware of.

But that would be a handy option for making move tutors.

As for 1B, that would be handy for loading it to RAM2 ahead of time instead of swapping back and forth, you're right. I'll try to rework some of this tomorrow like you guys have suggested.

Offline

#6 2011-11-06 08:27:23

Miksy91
Member
Registered: 2010-10-16
Post 578/2,308

Re: A script I'm working on.

Well, then that's easy as you already know which moves it knows at that particular level and then just switch one of the moves afterwards.
*I had hard time understanding what you meant in the first sentence

Last edited by Miksy91 (2011-11-06 08:27:49)

Offline

#7 2011-11-06 10:59:15

Sawakita
Administrator
Registered: 2010-10-16
Post 221/364

Re: A script I'm working on.

Mateo wrote:

Well I don't want it to ask about replacing a move because I was creating this so you can be given a pokemon that knows a special move already that it couldn't learn normally. Such as the Extremespeed Dratini in Crystal, as Gold has no command to do that that I'm aware of.

I'm not sure I understood exactly what you want to do: you want to give a pokemon and edit one of its moves, or you want to edit one of the moves of one pokemon that the player already has?
If it's the former, you probably already know how many attacks it knows (because you choose its level, right?) and so you don't need a specific routine to evaluate which, among the 4 attacks, you have to overwrite. But there's a bigger problem, because if the player already has 6 pokemon and then you give him another one it will be sent to a PC box and the RAM locations in your script will be wrong.

Offline

#8 2011-11-06 17:03:32

311/700

Re: A script I'm working on.

Sawakita wrote:
Mateo wrote:

Well I don't want it to ask about replacing a move because I was creating this so you can be given a pokemon that knows a special move already that it couldn't learn normally. Such as the Extremespeed Dratini in Crystal, as Gold has no command to do that that I'm aware of.

I'm not sure I understood exactly what you want to do: you want to give a pokemon and edit one of its moves, or you want to edit one of the moves of one pokemon that the player already has?
If it's the former, you probably already know how many attacks it knows (because you choose its level, right?) and so you don't need a specific routine to evaluate which, among the 4 attacks, you have to overwrite. But there's a bigger problem, because if the player already has 6 pokemon and then you give him another one it will be sent to a PC box and the RAM locations in your script will be wrong.

This is true in RBY but not in GSC. In GSC, you will simply get an error message if your party is full.

Mateo wrote:

Well I don't want it to ask about replacing a move because I was creating this so you can be given a pokemon that knows a special move already that it couldn't learn normally. Such as the Extremespeed Dratini in Crystal, as Gold has no command to do that that I'm aware of.

Have you looked at the Extremespeed Dratini script? Does it use a Crystal‐only command (and if so, what is it)?

#9 2011-11-06 18:11:49

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 1,000/3,471

Re: A script I'm working on.

It has been a while since I looked at it, but I seem to remember it using a Crystal only command. I think it was an additional 0F command or something. But I'll look back into it, like I really should have done before I started coding this.

Also, @Sawakita, I was wanting to give you a pokemon knowing a particular move, and I felt that the best way to do that would be to give it to you, then silently teach it the move, instead of trying to modify the actual Give Pokemon script, which I couldn't do without ASM. And yes, since I would be controlling the level, I would know how many moves it had ahead of time.

Offline

#10 2011-11-06 20:06:26

Sawakita
Administrator
Registered: 2010-10-16
Post 222/364

Re: A script I'm working on.

IIMarckus wrote:

This is true in RBY but not in GSC. In GSC, you will simply get an error message if your party is full.

A-ha! Fair enough, then.

Offline

#11 2011-11-06 22:17:34

313/700

Re: A script I'm working on.

The script checks BitTable 1, flag 00C1, then runs the 0F‐command 0094. The ASM for this is at 22:7170, and overwrites the moveset with one of two 00‐terminated arrays at 22:71C4.

  • Wrap

  • Thunder Wave

  • Twister

  • Extremespeed

  • Wrap

  • Leer

  • Thunder Wave

  • Twister

Looks like it might not be suited for your purpose. Doesn’t seem worth the trouble to port the command over (to me, anyway).

(For future reference, 03:4029 is the array of pointers to 0F‐commands in Crystal.)

#12 2011-11-06 22:32:50

Mateo
Member
From: The Sims 4
Registered: 2009-11-25
Post 1,005/3,471

Re: A script I'm working on.

Ah, thanks for checking this out! You're right, probably not well suited for it. But that's alright. In all honesty, it's not entirely necessary that I get this done for the christmas hack, as it would mainly be for gimicky type things, but I wanted to post this here now to get the community developed open-source thing going on, and because I thought other people might have better uses for it. But then again, Extremespeed Dratini was a gimick too, so thats all it could really ever be used for haha.

Offline

Board footer

Powered by FluxBB