Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → Create new trainers? [And other scripts] // updated: [2013-01-24]

#51 2013-01-21 16:12:43

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

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Their bit numbers are probably set to 0 when when you leave the ship or when you enter the ship next time.
That's what the Bit Number there is for, storing data in ram memory of whether the trainer has been beaten already or not.

Offline

#52 2013-01-21 16:21:45

Skurbert
Member
Registered: 2012-12-16
Post 30/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Miksy91 wrote:

Their bit numbers are probably set to 0 when when you leave the ship or when you enter the ship next time.
That's what the Bit Number there is for, storing data in ram memory of whether the trainer has been beaten already or not.


Ok. I'm gonna move one step ahead and try placing a new trainer on the ship. Wish me luck! :-)

Offline

#53 2013-01-21 20:03:34

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

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

No it won't work like that.
I didn't mean that generally the game checks for the bit numbers of every single person event defined as trainer and reset them.

How it probably works is that when you simply leave the ship or return there, several bit numbers are set to 0 (="are being reseted") which happen to be used for the trainers out there. It wouldn't have made any sense trying to program it any more complicated way than that.

Edit:
You can decompile the scripts used by trigger events in the Olivine and Vermilion port, that are used for entering the ship.
There you can see how the bit numbers of all those trainers inside the ship are being reseted (with clearbit1 command).

So try decompiling scripts from the following offsets, there you have them:
0x16C01E, 0x16C52C

Last edited by Miksy91 (2013-01-21 20:12:18)

Offline

#54 2013-01-23 22:57:11

Skurbert
Member
Registered: 2012-12-16
Post 31/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Miksy91 wrote:

So try decompiling scripts from the following offsets, there you have them:
0x16C01E, 0x16C52C

Oh.. Okay! I will check them out!

At the moment, I have added 20 new trainers to the game, everyone with new text. I did a little "trick" and renamed bugcatcher don to "guy" or "boy" so it's more convincing than facing 5 "bugcatcher don" 5 times in a row. Same for "sage" - First renamed to "dude". But that sounded ridiculously awkward so I choose "monk" instead. "Sage Monk wants to battle" sounds convincing enough.

Btw, I got stuck when I tried to add trainers for the sprout tower. First I was about to write for help again. But then I decided to solve it by myself for once. And I did! I reflected on what you said earlier: Rom Banks. 20x46f5 got reverted to 10x46f5 (something like that) and therefore pointed wrong. So what to do? Answer: Change pointer destination. Am I making sense? It worked and everything pointed correctly. Different rom banks for inside/outside/caves/houses/whatever, and there we go. So far, 5 new trainers has been added to the sprout tower. More are yet to come!

One thing that annoys me though is the fact that there seem to be a limited amount of trainers to be added in an area. 15 seems to be the limit. If more are added to the area; They won't show up. And if even more are added, then the game will reset once the player has entered the area. I Google'd on this, but found nothing about it! Can this limit be breached?

This is not a problem in small cramped areas. But in large open areas where i wanna fill the hole path with trainers, this can be limiting (for example: Route 32). A workaround could be to remove objects, but that would'nt be too fun either. I want to keep stuff, not remove them.

I have a vision with this: I Want to keep the integrity of Pokemon Silver, but give it a lot more, make if feel much fruity and fresh. I Remember when I played Pokemon Yellow (my first pokemon-game!). You had recently defeated Brock and went eastwards
to route 3. The road was filled with trainers. I called it a "trainer area". Such areas is what I'm trying to recreate in my hack.

Maybe I should start a thread in the "idea-forum" instead, but I just wanna share you my wisdom. ;-) I have improved!



Btw, I sound like a broken record: But is there ANY way to increase the amount of money the player can hold? Or at least the
"bank mom"? There should be some hex values for that, shouldn't it? I read about it somewhere. And I know it was increased in a FireRed hack by adding hex values.

Last edited by Skurbert (2013-01-23 23:03:14)

Offline

#55 2013-01-24 07:42:18

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

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

The amount of money that can be hold can be increased really easily, I've tried doing that before.
Just search for 999999 in hex and you should run into it. But the problem is that most menus (if not all) support only showing at maximum 6 digit number as money.

Offline

#56 2013-01-24 11:31:56

Skurbert
Member
Registered: 2012-12-16
Post 32/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

jwibagi wrote:

This won't help you too much but here's the explanation why you can't have more than a certain number of events on a map.

I understand that feeling you are talking about, and love the enthusiasm. Especially when I finished beating Brock using Butterfree, I'd want to train my Pikachu so I'd devote one session to "clearing up" a trainer space.

* Yellow was also my first Pokemon game. You might catch me talk about how I love Yellow from post to post.

That was actually very helpfull! One solution could be to "chop of" areas and cut them in two. But that will mess up the map connections and confuse even more. I'm not ready for that... yet! Just an idea.

And yes, exactly that feeling I'm talking about! Indeed the enthusiasm is high, believe or not, after reading my first posts in this thread; I actually think hex-editing is a lot of fun now! Not the hex-editing in itself, but the RESULT from it! And adding trainers or items to the game and just feel the game grow bigger and bigger is just an extraordinary feeling.

The answer to everything is "it's possible with Assembly" or something of the sort. You'll have to cross your fingers to have someone with ASM knowledge help you out.

And there's always the option to learn it yourself.

True. I guess I'll have to skip this for so long. It's not priority Nr.1, but I usually hate limitations, and the Money and Coin Case limitations are very disturbing. At least, that's what I think. Grinding for money is as fun as grinding the Pokemon Levels.


Miksy91 wrote:

The amount of money that can be hold can be increased really easily, I've tried doing that before.
Just search for 999999 in hex and you should run into it. But the problem is that most menus (if not all) support only showing at maximum 6 digit number as money.

Yes! It was diffucult to fint the adress but here it is: 5daf6 (Search: FF58.. I think!)
I messed around with the numbers, but the result were, as you said, quite bizarre. I actually manage to LOWER the amount to 66329 instead of increasing it. I think it requires some repointing too, since there are no space to insert hex-values (need som spare 00 which is not the case here). I'm not really good at this so I will skip this for a while.

It would be interesting to hear how you did it. Did you found a workaround?


Later on I'm gonna try adding a bank in Goldenrod City. It will make the city somewhat more alive and is a fun way to experiment with warp points and hex-values. I also intend to copy the "move tutor" concept from Pokemon Crystal. Remember him?

But first: Add more trainers to route 32.

Last edited by Skurbert (2013-01-24 11:53:53)

Offline

#57 2013-01-24 13:24:42

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

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Can't tell where you came up with FF58 but if you convert decimal 999999 into hexadecimal, a calculator should show F423F.
The maximum amount of money that can be hold at the time should be stored in 0x1624C.
It would make no sense changing that to anything else though, at least that's what I think (unless one would want to decrease that to 99999 for instance instead).

To add a bank in the game, you could use asm routine similar to that of used for making mom store your money.
Also, you could make it a more simple way making player choose from a list, how much money to store or withdraw (like $1, $10, $100, $1000, $10000) at the time and call the same script for asking this again until B button is pressed or something. You'll find out more in time though.

Last edited by Miksy91 (2013-01-24 13:25:59)

Offline

#58 2013-01-24 14:38:25

Skurbert
Member
Registered: 2012-12-16
Post 33/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Miksy91 wrote:

Can't tell where you came up with FF58 but if you convert decimal 999999 into hexadecimal, a calculator should show F423F.
The maximum amount of money that can be hold at the time should be stored in 0x1624C.
It would make no sense changing that to anything else though, at least that's what I think (unless one would want to decrease that to 99999 for instance instead).

To add a bank in the game, you could use asm routine similar to that of used for making mom store your money.
Also, you could make it a more simple way making player choose from a list, how much money to store or withdraw (like $1, $10, $100, $1000, $10000) at the time and call the same script for asking this again until B button is pressed or something. You'll find out more in time though.

I like when you say "think"! Then there's a possibility it CAN work! :D FF58 was because you told me to search for a hex of 999999 and it found thousands of results. So instead I searched for the "Pokemon Yen"-symbol which should be "58". And FF = 9. Right? FF58 = 9 Yen. So that's how I found it. I Know. It's stupid, but I tried at least :D

Yeah, 1624C. Hexadecimal. No wonder i never found it. There's no 999999 anywhere to be seen! I used the search function in GoldFinger. Epic fail!

Yes, that's exactly how i was thinking  it: Using the "mom" as a base, and use the small "exchange coins for prices"-room in Celadon, copying the code from there. What annoys me to no end is the fact that there is no "Create new room"-function in Johto Map. The utility can add new objects, warp points, but rooms? No. That's a real shame. Instead I have to find the stupid hex-code for the room and do lots of repointing and calculation. And I'm not ready for that yet. I mean, how am I gonna know what code to copy if i don't even know where and WHAT the code is? It's like finding a coin in a forest. So for long, I will only add new trainers and objects to the game. Maybe some small events. We'll see.

EDIT: http://www.statman.info/conversions/hexadecimal.html

Here is what someone wrote on a forum: "if money was only a 2-byte value, you could only have 0xFFFF = 65535 money per time."

999999   = f423f
9999999 = 98967f

Allright, testing several codes and see if anything works. 66329 is a evil combination! :( Stupid. It uses three 2-bytes but still shows up 66329! You were right, Miksy91. This was a tough nut to crack! We must find a solution for this at once! The new pokemon games can store 9 999 999. I know they are using a completely different engine and stuff, but maybe we can look and see how they did there? There just have to be a way to round this.

EDIT: YES!! I manage to get the player to hold 2 000 000. And like you said before, the 7th number gets messed up. But still: The player can now hold 2 000 000 Cash! The bugged graphic can get annoying though. Miksy, what are your suggestions? Because there must be some hex value somewhere that can "force" the thing to show 7 numbers instead of 6? Or is it hardcoded?
The Code: 1e 84 80 (offset: 1624c)


Where is coin case numbers stored? Must be easier to change it to 999 999 for instance.
162e2?

And where's the offset for player's mom? Because there's a bug: The player can't deposit money at all now. :D

Last edited by Skurbert (2013-01-24 17:17:29)

Offline

#59 2013-01-24 19:40:54

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

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Skurbert wrote:

I like when you say "think"! Then there's a possibility it CAN work! :D FF58 was because you told me to search for a hex of 999999 and it found thousands of results. So instead I searched for the "Pokemon Yen"-symbol which should be "58". And FF = 9. Right? FF58 = 9 Yen. So that's how I found it. I Know. It's stupid, but I tried at least :D

Yeah, 1624C. Hexadecimal. No wonder i never found it. There's no 999999 anywhere to be seen! I used the search function in GoldFinger. Epic fail!

FF stands for "9" in text. But this issue is completely different; as you're looking for some kind of limit of a value, that can't be "in terms of text".
The reason why FF is used for "9" though is because of it being part of its graphics pointer. Graphics of "9" are loaded in $8FF0 when font is loaded. That's the reason why writing "FF" has something to do with printing "9".

Skurbert wrote:

Yes, that's exactly how i was thinking  it: Using the "mom" as a base, and use the small "exchange coins for prices"-room in Celadon, copying the code from there. What annoys me to no end is the fact that there is no "Create new room"-function in Johto Map. The utility can add new objects, warp points, but rooms? No. That's a real shame. Instead I have to find the stupid hex-code for the room and do lots of repointing and calculation. And I'm not ready for that yet. I mean, how am I gonna know what code to copy if i don't even know where and WHAT the code is? It's like finding a coin in a forest. So for long, I will only add new trainers and objects to the game. Maybe some small events. We'll see.

I wouldn't personally use Johtomap for adding new events to maps as that way, you can't control where it repoints data. Not only that but it also leaves the original data as leftover data which is kind of a stupid way of doing the job.

To expand the amount of maps, you'd have to do something with the Primary Headers I think. Not something you'd really want to try to accomplish, at least not as of now.

Skurbert wrote:

Allright, testing several codes and see if anything works. 66329 is a evil combination! :( Stupid. It uses three 2-bytes but still shows up 66329! You were right, Miksy91. This was a tough nut to crack! We must find a solution for this at once!

66329 ? What's that about?

Skurbert wrote:

EDIT: YES!! I manage to get the player to hold 2 000 000. And like you said before, the 7th number gets messed up. But still: The player can now hold 2 000 000 Cash! The bugged graphic can get annoying though. Miksy, what are your suggestions? Because there must be some hex value somewhere that can "force" the thing to show 7 numbers instead of 6? Or is it hardcoded?

There is most likely a code for telling the game to print a 6 digit number at maximum which could be changed to 7 if wanted to. Assembly job.
But this wouldn't solve anything though, at least I don't think it would.


All in all, I wouldn't bother trying to make it possible to have more money than 999 999. What's the general purpose?
Besides, this would require lots of additional coding to make a possibility. And no, I don't know what you should write and where to accomplish that, and don't feel like taking time to find out either.

The reason why your mom's asm routine is buggy has something to do with the value 0F 42 3F being modified obviously. After all, that routine has also the money limit set to 999 999 so the routine is probably located in the same rom bank.

Offline

#60 2013-01-24 20:11:21

595/700

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Blindly changing constants in the ROM is not the right way to do this. It leads to strange bugs that you can’t debug or fix, as you’ve noticed.

The right way is to think about what exactly you need to do, and do it. So what exactly do we need to do? Well, player’s money is a 3‐byte value in RAM (not ROM) from $d84e–d850 (in Crystal), and Mom’s money is a 3‐byte value from $d851–d853 (in Crystal). To allow up to ¥9,999,999 to be stored in these, we need to account for all the edge cases:

  1. Any code that increases these values will check against ¥999,999. These checks need to be changed to ¥9,999,999.

  2. Any code that converts these values from numbers to text strings might need fixing (it might stop at six digits, causing a bugged leftmost tile—I haven’t checked if this actually happens).

  3. Any place in the game that displays these values will need space on the screen for an extra digit. This means the start of the string will need to be moved to the left, and maybe window borders will need to be expanded in size.

So how do we find the above cases? For the first case, open BGB’s debugger, set a write watchpoint against the relevant RAM locations, and play through the game as normal until you do something that updates the value (winning a battle, selling an item, withdrawing from Mom’s bank…). BGB will jump to the debugger as soon as the values are written and you’ll be able to see the ASM around it.

The other cases are similar… in the second case, use a read watchpoint instead, and for the third case, set a write watchpoint against the tilemap location where the money is printed.

#61 2013-01-24 21:10:22

comet
Member
Registered: 2012-04-09
Post 100/673

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

crystal uses several buffers for the tilemap. the one that's usually written to is at $c4a0. a useful way to find this in gold would be to check the bg map and tile ids in the vram viewer and look for similar structures between $c000-$cfff (wram bank 0). note that $c000-$c100 is reserved for the stack and $c100-$c2c0 contains sound data.

Offline

#62 2013-01-25 04:48:19

Skurbert
Member
Registered: 2012-12-16
Post 34/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Thank you, guys. This sort of explains everything. The 7th-digit-problem still remains to be solved. I'll do as you say and leave it for a while. But I will come back to it later.

For creating a new map: I did a little "cheat". ;-) Instead of creating a new room, I used a old one and expanded it, used the open area, tiled it and put some people there. Warps to the doors and... VOILA! It works!

I Don't know if this will get me some problems later on (you never know with this stuff..) but it works smoothly now. I have a new house to use!

Offline

#63 2013-01-25 04:51:04

Munchulax
Member
From: Somewhere in Johto
Registered: 2011-08-10
Post 234/410

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Skurbert wrote:

For creating a new map: I did a little "cheat". ;-) Instead of creating a new room, I used a old one and expanded it, used the open area, tiled it and put some people there. Warps to the doors and... VOILA! It works!

I Don't know if this will get me some problems later on (you never know with this stuff..) but it works smoothly now. I have a new house to use!

It won't cause a problem, because even the original games used this method of mapping for some places (Goldenrod City's underground entrance comes to mind).


“To live is the rarest thing in the world. Most people exist, that is all.” ― Oscar Wilde

Offline

#64 2013-01-25 21:23:50

Skurbert
Member
Registered: 2012-12-16
Post 35/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Munchulax wrote:
Skurbert wrote:

For creating a new map: I did a little "cheat". ;-) Instead of creating a new room, I used a old one and expanded it, used the open area, tiled it and put some people there. Warps to the doors and... VOILA! It works!

I Don't know if this will get me some problems later on (you never know with this stuff..) but it works smoothly now. I have a new house to use!

It won't cause a problem, because even the original games used this method of mapping for some places (Goldenrod City's underground entrance comes to mind).

Glad to hear. I actually used Diglet-cave for inspiration. Another thing I learned all through trial-and-error was to create and edit a new signpost. I had to fix the code and understand the pointers like 1000 times but now I know EXACTLY how to do it. The "first time" is always difficult, isn't it? Frustrating, but fun when you finaly get it!

Remember how Safari Zone was closed down in kanto? I created a door to the building. It will now house team rockets new hideout. Basically, Kanto is more of a "free roam" region and it desperatly needs a storyline. So I will add the team rocket hideout in Fuchsia (I'm already on the 3rd floor) and then I will re-open the Silph-tower in Saffron. This could all be created through the all-rooms-in-the-same-building-trick. I have learned to use warp-points correctly.

I always try to google before asking questions here. But this I couldnt find an answer for: How do I remove people from the map once I've defeated a trainer (or activating a script?) I want team rocket to f**k off once they have been defeated in Fuchsia. Especially when the player have spanked Giovanni's butt, I want the screen to flash and then everyone is gone and the music changes. Don't say ASM.. I will start crying :P

I also plan to re-open the "closed for renovation Pewter Museum". I mean come on? Is it necessary to remove the door when "renovating" a building?? That could only increase the cost. Tip: Just lock the door...

Anyways, here are some ideas. I don't know which ones that are the most difficult but I'm improving, slow but steady. I get better for everyday and I really really love this game.

Last edited by Skurbert (2013-01-25 21:26:10)

Offline

#65 2013-01-25 21:57:12

Munchulax
Member
From: Somewhere in Johto
Registered: 2011-08-10
Post 235/410

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Skurbert wrote:

Remember how Safari Zone was closed down in kanto? I created a door to the building. It will now house team rockets new hideout. Basically, Kanto is more of a "free roam" region and it desperatly needs a storyline. So I will add the team rocket hideout in Fuchsia (I'm already on the 3rd floor) and then I will re-open the Silph-tower in Saffron. This could all be created through the all-rooms-in-the-same-building-trick. I have learned to use warp-points correctly.

I also plan to re-open the "closed for renovation Pewter Museum". I mean come on? Is it necessary to remove the door when "renovating" a building?? That could only increase the cost. Tip: Just lock the door...

That always confused me.

I remember when I played Gold on my GameBoy and I got to the Safari Zone, and the sign said that the Warden in traveling abroad, so the Safari Zone is closed. I was like, "What, is he traveling with his door?" 'cause I found it odd that the door just wasn't there anymore.  Same thing for the Pewter Museum, except I was thinking "How do the workers get in to the Museum so they can renovate it?" :P


“To live is the rarest thing in the world. Most people exist, that is all.” ― Oscar Wilde

Offline

#66 2013-01-26 03:30:32

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

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Sorry, I'm literally drunk when posting here so there we go...

The bit number can be set for each people event with those boxes Johtomap shows as Flag Index and Flag Bit I think. If the bit number for a certain persont event is set, that person event won't be shown when the map is entered.
The "universal" bit number for most people events is FFFF which is always "unset".

Offline

#67 2013-07-16 00:38:58

Skurbert
Member
Registered: 2012-12-16
Post 37/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

OK, I'm back!

This is what I have done:

+ Added 53 new trainers.
+ Added 24(1) new items to pick up.
+ Added some people that just talks a lot of shit. Presumably to fill out the barren towns in Kanto.
+ Sprout Tower is now jampacked with trainers (Sages).
+ Recently learned by trial&error (and through Tauwasser's Compendium) to fight a Pokemon like MewTwo.
+ Added a Team Rocket Lair in Fuchsia. Thirteen Rockets can be battled. Only Giovanni is left to add.
+ Added a House between Route 11/12 to catch up with the design in R/B/Y.

What I need to do:

* Figure out a way to implement the tileset for the Pewter Museum so it shows up in the list, etc.
* Open the Pewter Museum + Ticket Fees (Presumably through ASM)
* Add more Trainers.
* Add more People to talk to.
* Add Giovanni.
* Make areas larger by expanding the map. But I'm not ready for that task yet.
* Figure out a way to expand the money from 999,999 to 99,999,999 and also add a bank in both Kanto and Johto (propably by hiring a hacker that knows ASM, lol!)
* Move Tutor resembling the one in Pokemon Crystal, but with a wider range of moves.
* More people that gives you stuff like berries (thank you Miksy91 for your Youtube-guide, it was very helpful!)
* Flesh out Kanto to such an extent so that R/B/Y-kanto feels lame in comparison.

GRIND GRIND GRIND! :-)

Last edited by Skurbert (2013-07-16 00:41:22)

Offline

#68 2013-07-16 04:10:23

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

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Ticket fees are done through a normal script. Stolen from Secrets and Rumours. You would obviously want to use your own offsets since I don't even know what bank you would have Pewter Museum's events in. You might even want to tweak it, who knows.

Trigger that catches you when you walk by the counter.

#org 0x142660
'-----------------------------------
applymovement 0x0 0x6623 ' 0x142623
loadfont
special 0x50
2writetext 0x6682 ' 0x142682
yesorno
if false 0x6627 ' 0x142627
checkmoney 0x0 0x320000
if false 0x6631 ' 0x142631
2writetext 0x66E4 ' 0x1426E4
closetext
loadmovesprites
applymovement 0x0 0x6625 ' 0x142625
end

#org 0x142627
'-----------------------------------
2writetext 0x670B ' 0x14270B
closetext
loadmovesprites
applymovement 0x0 0x6625 ' 0x142625
end

#org 0x142631
'-----------------------------------
takemoney 0x0 0x320000
2writetext 0x671C ' 0x14271C
closetext
loadmovesprites
dotrigger 0x1
end


#org 0x142682
= Welcome to the\nPEWTER MUSEUM OF\lSCIENCE\hF2\pIt's $50 for a\nchild's ticket\hF2\pWould you like to\ncome in?\e


#org 0x1426E4
= I'm sorry, you\ndon't have enough\lmoney\hF2\e


#org 0x14270B
= Ok, come again!\e


#org 0x14271C
= Alright, thanks!\nEnjoy the museum!\e


#org 0x142623
M look_right end

#org 0x142625
M step_down end

Trigger that I put on top of the carpet tiles for exiting:

#org 0x14261E
'-----------------------------------
dotrigger 0x0
end

At least that's how I did it in Secrets and Rumours, and it required no ASM at all. Basically it just involved:

Asking if the player wants to come in (normal text and yes/no commands)
Checking how much money the player had on hand
Letting them in and subtracting the money if they have enough, if not then kick them out.
Disabling the triggers so you can walk around in there without being bothered by the clerk.
Re-enabling the triggers when you leave.

Last edited by Mateo (2013-07-16 04:12:49)

Offline

#69 2013-07-16 12:55:50

Skurbert
Member
Registered: 2012-12-16
Post 43/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Ah! Allright, thanks! I will check this out.

(Is it possible to do this directly into HEX without using PKSV, btw?)

Offline

#70 2013-07-16 13:59:30

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

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Skurbert wrote:

Ah! Allright, thanks! I will check this out.

(Is it possible to do this directly into HEX without using PKSV, btw?)

You can write all kinds of script instructions with a hex editor. In fact, PKSV compiles those script instructions you write with it in byte-form in the game. So it's practically doing the same thing as you re-writing data with a hex editor.

Using PKSV is way more user-friendly though and most instructions are easy to guess.

Offline

#71 2013-07-16 14:32:56

Skurbert
Member
Registered: 2012-12-16
Post 44/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Ok, good to know.

Also: How does the "hidden item"-system work? I didn't found any information about this in the Compendium. For example, i tried to "copy" the code for the hidden Rare Candy on Cinnabar Island, but it always messes up. This is the code:

0x1389A2

FE 00 20 4C 47 00

Note that if I try to pick up the Rare Candy on Cinnabar, it works. But when I try to do it anywhere else, like New Bark Town, the game freezes. What is wrong and have does it work?

Offline

#72 2013-07-16 20:05:55

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

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Color|Function:

The byte is split in 2x 4 bit.

The first half of 4 bits determines the color:

00 = standard color (from Person table)
<> 00 = color from a sprite palette

The second half of 4 bits determines the function:

00 = regular script event : script pointer points to script

01 = Give item : script pointer points to this structure:

[Item no.][Amount]

The people event must have a bit no or else this can be accessed freely again and again!

02 = Trainer: scriptpointer points to this structure:

[Bit no. (2byte)][Trainer group][Trainer][2byte pointer to Text when seen][2byte pointer to text when trainer beaten][2byte pointer to script when lost (0000=Blackout)][2byte pointer to script if won/talked to again]

The bit no. tell the game later on if the trainer has been beaten already (bit = 1) or not (bit = 0). All Bit no. of BitTable1.

People events that are used as item balls use the Color|Function byte's (8 bits) second half of bits as 1 (like stated here, 01). Johtomap shows this as the event's Type. So all item balls are Type 1.

As you can see, all scripts used by people events of Type 1 point to the structure above, [Item no.][Amount].


And right after I said this, I noticed this wasn't your problem at all!
But hidden items are signpost events and work also with having a different Function byte for the signpost from Function byte 00 which starts executing normal script data. For hidden items, this Function byte is 07.

Signposts:

[Y position][X position][Function][Script pointer (2byte)]

■ Function: 

(insert stuff explaining Function bytes 00 to 06 here...)

07 = If bit of BitTable1 is not set, then item is given.
Script pointer to [Bit-Nr. (2byte)][Item no.]

So for example for that hidden Rarecandy on Cinnabar Island, due to the Function byte of this hidden item being 07, it points to this kind of a structure in which [Bit-Nr. (2-byte)] is "FE 00" and [Item no.] is "20".


The reason why you can't copy paste this same code anywhere you like is due how GB/C pointers work. You could check out my video tutorials if you feel like knowing more :)

Last edited by Miksy91 (2013-07-16 20:07:08)

Offline

#73 2013-07-16 21:34:29

Skurbert
Member
Registered: 2012-12-16
Post 45/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Ah! That makes sense. But what I don't understand is why JohtoMap points DIRECTLY to 0x1389A2 and works on Cinnabar, but not on another place? I understand there is some pointers somewhere, but why is JohtoMap pointing to 0x1389A2 and not to the pointer itself?

Also: What is the command used when a trainer talks to HIRO directly after the battle, like the Gym Leaders or Elite Four. 64 or 66? I don't understand what means in the Compendium. I have only used 65 so far, but I want to make the trainer talk to HIRO and then dissapear.

Offline

#74 2013-07-16 21:49:44

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

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Johtomap doesn't "point" to that offset. What it actually shows is the Script Pointer which is the 2-byte value (= "pointer"), but also the offset where the pointer points to. The offset itself 0x1389A2 comes from the fact that the offset is calculated by knowing where the event itself is located. In this case, the signpost event is located somewhere between 0x138000 and 0x13BFFF in rom, and thus, that script pointer, which happens to be A2 49, points to offset 0x1389A2.
For example for New Bark Town, events are located in another rom bank, and so it's impossible with a 2-byte script pointer to point to script data which is in this rom bank that Cianwood's outside map uses.

If you make the script pointer used in trainers' data point to byte 65, that makes it work so that nothing will happen after the battle and its script will only activate if you talk to it yourself after the battle has ended. If you don't put that 65 there, the script will be run through straight after the battle.

Offline

#75 2013-07-16 22:57:12

Skurbert
Member
Registered: 2012-12-16
Post 46/95

Re: Create new trainers? [And other scripts] // updated: [2013-01-24]

Oh.. yes you are right! Off course! The Rom bank is completely different! I will try to write my own code for the location and see if it works better this time. There are no limits how many hidden items that can be placed on the map?

Ok, so just by removing the pointer to 65 and [65], the code works?

[Bit nr] [trainer] [pointer to text 1] [pointer to text 2] [00] [00] [47] [4C] [Pointer to after text] [53] [49] [90]

Anyway... I will test it.

Offline

  • Index
  • → Help/Question
  • → Create new trainers? [And other scripts] // updated: [2013-01-24]

Board footer

Powered by FluxBB