Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-08-02 02:50:08

Maniac379
Member
Registered: 2015-01-15
Post 15/107

[G/S/C] Flags to appear and disappear?

So I implemented my first standing Pokemon script.  It works great.  I removed a hidden item, took it's flag, and using JohtoMap set the Pokemon to the item flag.  I directed the script and everything correctly and it does not reappear after fighting.

What I want though is for the Pokemon to only be visible after a certain point in the game?  So basically I guess I want a check before the game will even show the sprite to begin with?  Is this possible to have 2 such checks?  I guess maybe it could be related to a specific given item if nothing else...like how in Gold Lugia will not appear until given the correct item?

I notice that the old man in Pewter city writes a few bits when he gives you the item but I don't see Lugia/Ho-Oh checking for those same bits?

EDIT:  Actually about my pokemon script, it would be great if I could change the map sprite....?  And possibly which direction the sprite faces?  The JohtoMap sprite options for the map bank do not have what I want...

Last edited by Maniac379 (2016-08-02 02:51:07)


---
Pokémon White Crystal
A simple quality of life and gameplay improved hack

Offline

#2 2016-08-02 21:48:53

Miksy91
Member
Registered: 2010-10-16
Post 2,286/2,315

Re: [G/S/C] Flags to appear and disappear?

You can for example give the pokemon a generic flag like FF FF or 00 00 (which is a flag that is reset every time you enter a new map).
Along with this, you need to put stuff in the map's script header to call a script that hides the pokemon if it's already battled against, or is not supposed to be seen. And when you battle it, you simply set the flag that you want to use for marking that the pokemon is already battled with.

In case the pokemon will be in outside map, you'll have to make room for its sprite in the sprite sheet used by the maps in that map bank.

Offline

#3 2016-08-02 21:58:57

Maniac379
Member
Registered: 2015-01-15
Post 16/107

Re: [G/S/C] Flags to appear and disappear?

It sounds like for the sprite I could replace an unused sprite in the existing sprite sheet to accomplish what I want.  I do not know where this is.

Putting that in the map script header sounds perfect, I should be able to come up with the script to do that, but how do I determine where to put it.  Where do I find the map script header?  If I go to map properties in Johtomap, it gives the map script location.  Is this it?  There's no room there so I presume I will just have to repoint to empty space, copy whatever was there before and add in my script?

I am still curious if I can change the direction sprites are facing.


---
Pokémon White Crystal
A simple quality of life and gameplay improved hack

Offline

#4 2016-08-02 23:44:06

Maniac379
Member
Registered: 2015-01-15
Post 17/107

Re: [G/S/C] Flags to appear and disappear?

I tried to edit the map script header for Route 10:

Original Map Script
0x141714
00 00 52
1C 57 0C

//0x141200
//84 91 7F Play Sound
//8F Return


New Map Script
0x143F61
00 61 7F
1C 57 Checks 57??

//0x143F61
//84 91 7F Play Sound
//6E 02 Show Zapdos
//31 4F 07 Check bit 74F, Flag to spawn
//08 81 7F If not set do this
//31 A3 00 Check bit A3 00, Flag that already spawned
//09 81 7F
//8F Return

////0x143F81
////6D 02 90Hide Zapdos //8F did not work here either

When I have JohtoMap compile the script it looks fine.  But when I go to the map in game - it crashes...

EDIT:  Removing all of my original script, simply repointing 00 00 52 to 00 61 7F with the same original play sound script crashes the game

EDIT2:  By leaving 00 00 52 alone and repoint either at 0x141200 or the 1C 57 0C does not crash the game.  However putting in the script 6D 02 to hide Zapdos who is set to FF FF flag, will not work.  My script of Zapdos fight uses 6D 02 to hide it and works, reloading the map does not hide Zapdos

Last edited by Maniac379 (2016-08-03 23:01:42)


---
Pokémon White Crystal
A simple quality of life and gameplay improved hack

Offline

#5 2016-08-12 21:51:23

Miksy91
Member
Registered: 2010-10-16
Post 2,287/2,315

Re: [G/S/C] Flags to appear and disappear?

The script header is documented here: https://hax.iimarck.us/files/scriptingc … #Scripthdr
It says that the header consists of two parts, and is of form:
[Number of pointers in part one (1b)][Pointer to script data (2b)]00 00[Pointer to next (2b)]00 00 etc. That ""Number1" *" there is just for mentioning that you need to write the following stuff as many times as you set byte [Number1 of pointers] to.

The first part is related to using trigger events and having the map being mentioned in trigger table starting at 0x94000. This is not what you really need to do here, so use the second part for the script instead. This means that you can set [Number1 of pointers] to 00, and so there are no pointers (or 00 00) following it. The second part of the script header will start right away after this 00 byte.

The second part of the script header works in a similar way. If you for example wanted to have two different scripts from second part being executed when you enter the map, you could write "02 xx ptr(2b) yy ptr(2b)" where xx and yy stand for "Numbers" that are related to "Status of map" in that table. In this case, you only need one pointer here which makes this of form "01 xx ptr(2b" where xx can probably be 02 for instance. That's what I have used a lot in DE anyway.

So all in all, the map's script as johtomap shows it should point to structure "00 01 02 Pointer(2b)" and then you just put your script in the location where Pointer(2b) points to. The script will have to end with byte 8F like you have also tried to do. Also, if you have problems with some parts of code not being executed, try putting "applymovement 0x0 @notDoAnything" and in @notDoAnything just "end" movement code. I have done this several times in occasions when I want to execute lots of stuff (especially moving and printing text I believe) from the second part of the script header.

The scripts called from first part of the script header seems to function always correctly even without this kind of a trick, but those sort of require the map to be defined in trigger table in 0x94000 and reserve one byte of ram memory just for telling, what's the state of trigger events in this map. In case you don't need trigger events in the map that activate when you step on trigger tiles, I wouldn't recommend using the first part of the script header. Especially when doing rom hacking and not playing with disassembly which you can most likely edit to get more free ram space a bit easier.

Offline

#6 2016-08-15 03:46:33

Maniac379
Member
Registered: 2015-01-15
Post 19/107

Re: [G/S/C] Flags to appear and disappear?

Ok I'm trying to understand this better.  Johtomap tells me for Route 10 the map script is located:

Original Map Script
0x141714
00 00 52 1C 57 0C 10 00 00 8A 80 8D 93

I will want to come back to triggers but this map doesn't have any triggers on it as you mention, "[Number1 of pointers] to 00, and so there are no pointers (or 00 00) following it."  If I'm looking at the right spot that would be the 00 00 52 1C....the first 00 says no pointers but then there is still a 2b pointer to script?  The second part of the script header mentions each script taking up 8 bits...which I guess could be 57 0C 10 00 00 8A 80 8D somehow but I don't see it........

Can you help me understand what is already here in this script header first, I think that's where I'm lost right now.


---
Pokémon White Crystal
A simple quality of life and gameplay improved hack

Offline

#7 2016-08-15 15:16:13

Miksy91
Member
Registered: 2010-10-16
Post 2,290/2,315

Re: [G/S/C] Flags to appear and disappear?

Accidentally I wrote that part of my post pretty confusingly that you quoted here as well. What I meant is that the first part of the script header is just byte 00. If it was for example 01, it would have a 2-byte pointer along with bytes 00 00 following it before the second part of the script header starts.

And here the second part of the script header is also just 00 making the whole header "00 00". Change the header to "00 01 02 Pointer(2b)" instead to call a script that is run every time you enter the map like I mentioned above:

Miksy91 wrote:

So all in all, the map's script as johtomap shows it should point to structure "00 01 02 Pointer(2b)" and then you just put your script in the location where Pointer(2b) points to. The script will have to end with byte 8F like you have also tried to do. Also, if you have problems with some parts of code not being executed, try putting "applymovement 0x0 @notDoAnything" and in @notDoAnything just "end" movement code. I have done this several times in occasions when I want to execute lots of stuff (especially moving and printing text I believe) from the second part of the script header.

Also what you probably want to do is to relocate the script header elsewhere where you have room for inputting new stuff. Now there is already script data that is used by some event in address 0x141716 (straight after the script header). The script data here is "52 1C 57" which is a simple script that loads font, prints text data starting at 0x14171C and then the script simply ends. Most likely a signpost event.

Last edited by Miksy91 (2016-08-15 15:21:09)

Offline

#8 2016-08-15 22:48:11

Maniac379
Member
Registered: 2015-01-15
Post 20/107

Re: [G/S/C] Flags to appear and disappear?

I'm sorry this is taking me so long to get to work....

I repointed the script header and did this:

0x143F31
00                                        //No triggers
01 02 81 7F                          //Points to map script
52 1C 57                              //Other script data?
0C 10 00 00 8A 80 8D 93       //Copied this because didn't know how far to copy original, needs this to work

0x143F81
6D 02 8F                             //Hide Zapdos, I know it's 02 because the Zapdos script correctly hides him after battle

It will not hide Zapdos though from the map?  I simplified my map script to simply this and it will not hide Zapdos whose flag is FF FF.

I tried maybe when you say Pointer(2b) I need to put a pointer byte in front so I put 00 01 02 03 81 7F but that crashes the game....


---
Pokémon White Crystal
A simple quality of life and gameplay improved hack

Offline

#9 2016-08-16 19:27:44

Miksy91
Member
Registered: 2010-10-16
Post 2,291/2,315

Re: [G/S/C] Flags to appear and disappear?

Don't copy the folllowing stuff
"52 1C 57                              //Other script data?
0C 10 00 00 8A 80 8D 93       //Copied this because didn't know how far to copy original, needs this to work"

since it's totally unrelated to the script header.

What you have written there should hide person event 0 as JohtoMap shows it. The reason why it is hiding event number 0 in Johtomap is because you'll have to subtract 2 from the byte (02) you have there to refer to that person event. If you wanted to hide person event whose number would be 1 in Johtomap, you would write byte 03 here after 6F.

You sure Zapdos is event number 0 ? If it is and the map's secondary map header shows that the Map's Script is located at 0x143F31, then it should work.

Last edited by Miksy91 (2016-08-16 19:31:49)

Offline

#10 2016-08-17 00:04:11

Maniac379
Member
Registered: 2015-01-15
Post 21/107

Re: [G/S/C] Flags to appear and disappear?

Yeah I am sure....Here's a screenshot proof

https://drive.google.com/open?id=0B9hBm … 1NySTktbVE


---
Pokémon White Crystal
A simple quality of life and gameplay improved hack

Offline

#11 2016-08-18 17:08:52

Miksy91
Member
Registered: 2010-10-16
Post 2,292/2,315

Re: [G/S/C] Flags to appear and disappear?

Try giving the event flag number 00 00 (by inputting 0 in both flag index and flag bit). That is a flag (along with all the other flags until number 0x0008 or (08 00)) which you can re-use for every in game map. I usually use these flags for hiding events through map's script header myself, so it's somewhat possible FF FF won't do the trick here.

In case you're wondering why you can re-use these 8 flags for every in game map, this is because those flags are reset every time you enter a map (and before scripts from script header are executed).

Last edited by Miksy91 (2016-08-18 17:10:05)

Offline

#12 2016-08-18 22:50:17

Maniac379
Member
Registered: 2015-01-15
Post 22/107

Re: [G/S/C] Flags to appear and disappear?

YESS!! :)

That flag changed worked!  And my script works perfectly so that he only shows up after a certain flag is checked and he won't show up again if you've fought him!  Thank you so much!

Only thing left is to figure out how to change the spriteset

EDIT: Figured out it's super easy to change what's in the sprite set with JohtoMap :)

Last edited by Maniac379 (2016-08-19 00:55:58)


---
Pokémon White Crystal
A simple quality of life and gameplay improved hack

Offline

#13 2016-08-20 10:40:46

Miksy91
Member
Registered: 2010-10-16
Post 2,293/2,315

Re: [G/S/C] Flags to appear and disappear?

Maniac379 wrote:

YESS!! :)

That flag changed worked!  And my script works perfectly so that he only shows up after a certain flag is checked and he won't show up again if you've fought him!  Thank you so much!

Only thing left is to figure out how to change the spriteset

EDIT: Figured out it's super easy to change what's in the sprite set with JohtoMap :)

Nice to hear you got the problem sorted out :)

Offline

Board footer

Powered by FluxBB