Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2013-06-18 16:56:36

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 67/411
Website

Need help with a person script (pkmn crystal)

What I want to achieve is to prevent the player from entering the violet gym until he has beaten the "last sage" in the sprout tower. I've been able to create a new person event myself repointing all the stuff I needed and now I have a guy standing in front of the gym's door telling me the text I wanted him to tell me. However, I don't how to make it not show once you have beaten the sages in sprout tower. My first thought was to do something with a checkitem of hm flash but I think it isn't done that way.

This is the first script I attempt to do from scratch and I'm really stuck. Any help would be appreciated.

Last edited by Crystal_ (2013-06-18 16:57:17)

Offline

#2 2013-06-18 17:03:10

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

Re: Need help with a person script (pkmn crystal)

In every person event, at the end is either FF FF (always shown) or a BitNo (hidden if that BitNo is set). You would just set the BitNo in his event (NOT in his script, the event itself) to have the same BitNo that the elder sets when you beat him. That way, the gym will be blocked but once you have beaten the elder, the person will disappear allowing you to enter the gym.

Offline

#3 2013-06-18 17:41:58

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 68/411
Website

Re: Need help with a person script (pkmn crystal)

Oh man that was a real quick answer! So I had most of it done it seems. According to pokecrystal one of the bits set by sage li when you beat it is $0014. It seemed to work when I changed FF FF to the two bytes swapped, that is, to 14 00. Could you please comfirm if I did it right?

Also, is there an easy way to do the exact opposite? You know, so that I keep the "same guy" (another person but with the same sprite) but in a different position, with a different movement and with a different text so that it doesn't look like the guy disappears magically after you beat the sprout tower.

Offline

#4 2013-06-18 17:59:21

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

Re: Need help with a person script (pkmn crystal)

The way the game does things like that is:
The first guy (that blocks your path) is shown at first, and hidden when a flag is set by the elder.
The second guy (where he moves to) is hidden at first (by giving him a flag that is already set) and he is shown later, by having the elder clear a flag as well.

Several of these flags that are set from the start and then reset later are set during the script in the player's room if I remember. So you could edit that to have it set another flag to use for hiding and showing the other guy later. Also, it sounds like you did it right but you can always test it to see for sure.

Offline

#5 2013-06-18 18:25:47

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 69/411
Website

Re: Need help with a person script (pkmn crystal)

http://datacrystal.romhacking.net/wiki/Pokemon_Gold:_Flags wrote:

F900 = Unused (Part of Celadon Diner's Scripts)
FA00 = Unused

So it seems I can use either of these two? I'd rather be 100% sure so that I don't break anything.

Also, it sounds like you did it right but you can always test it to see for sure.

Yeah, I had tested it but asked for confirmation just in case!

Offline

#6 2013-06-18 18:33:07

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

Re: Need help with a person script (pkmn crystal)

I know that F900 is used for the leftovers in Celadon Diner, and I don't know about FA00. I know that flag list has a few artifacts from Koolboyman's notes (since there are references to cigarettes and power rangers and other things from Prism that were left in). In Gold, I know you can use a trick to get a lot of unused flags, by starting with a high (but specific) number for the flag, you can make it point to an unused area of RAM and know that it won't interfere with anything. BUT since I'm not as familiar with Crystal, I don't know if the same location is unused or not. Miksy91 or someone else might know though, and be able to clarify for you better.

Offline

#7 2013-06-18 18:57:06

Tulcakelumë
Member
From: Portugal
Registered: 2013-02-01
Post 19/23

Re: Need help with a person script (pkmn crystal)

I was going to ask the same question, but with Sprout Tower inaccessible until you beat Violet Gym. I knew it had to do with flags, but I couldn't understand how to do it. Thanks Mateo.
I only don't understand what you mean by "[there is] a trick to get a lot of unused flags by starting with a high (but specific) number for the flag", where can I manipulate the flags' number?

Last edited by Tulcakelumë (2013-06-18 19:09:58)

Offline

#8 2013-06-18 19:08:04

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

Re: Need help with a person script (pkmn crystal)

No problem!

Offline

#9 2013-06-18 19:34:47

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 70/411
Website

Re: Need help with a person script (pkmn crystal)

For some reason it isn't working (the part to make the other guy show AFTER i beat the sprout tower); let me share with you what I have done because I guess I'm missing something.

I redefined the talk to mom script where there was space and i added a setbit for f900. Then I changed the pointer in the two scripts that call this script to point to the script i had just redefined.
Then i did the same for the sageli script (but the other way around because it is a clearbit). Anyway the part that is not working is the other one, since the guy never disappears.
I edited the event of the guy so that instead of FF FF the number of the flag is f900.

Did I miss something? I've checked all the changes three times and I think that what I have made no mistakes in what I have done. Thanks in advance.


On another note, are the flags located in the ram in crystal in the same place as in gold? Because maybe knowing what bit is the flag f900 in the ram could help me localize where is the mistake.

Last edited by Crystal_ (2013-06-18 19:38:03)

Offline

#10 2013-06-18 19:42:18

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

Re: Need help with a person script (pkmn crystal)

Let's see.
The mom script should set bit F900 like you said.
The Sage should still set Bit 1400 (or whatever it was) in addition to clearing F900.
The guy in front of the door should have 1400 as his bitno.
The guy next to the door or wherever you want him to move to should have bitno F900.

That way, when you first come to town, F900 is set and 1400 is not set, so the guy will be in front of the door and the other one is hidden.
When you beat the Sage, those bits are set and cleared, so the guy in front of the door should disappear and the guy next to it should show up.

If you want the person to say/do the same thing in both places that he stands, you would just have both person events call the same script. Or you could make them load different scripts, so he says different things once you have beaten the Sage. Whether you make him say different things or not, this way involves having two separate person events. (This is how Gamefreak did it with the guy who blocks Dragon's Den). I hope this helps.

Offline

#11 2013-06-18 20:44:33

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 71/411
Website

Re: Need help with a person script (pkmn crystal)

It looks like the mistake is that my game is still loading the old mom script for some reason. I redid the mom script at offset 7b700 adding the new setbit. I changed the two "jumps"  that point to the mom script to point to the new mom script instead (new pointer: 77 00) but for some reason it's still loading the old mom script.

More specifically, I edited the two jumps at lines 32 and 114 (the two that jump to mom script) to jump to the new script. But still, the game keeps loading the old script (i know it because if i mess it up the game crashes). This is actually getting annoying lol.

EDIT: It looks like the second jump does actually call the new script. If i'm not mistaken this jump is part of the script that loads if you talk to your mom directly instead of moving in front of her

EDIT 2: Found that the problem is that when she has to move one step to talk to you the script loaded is not the new one because the script called in this case was another (or others). It moves to script 7a4f2 in this case I think. Will try to come up with a solution...

EDIT again lol: I added a jump to the new script at 7a4f2 and I think I have fixed it. I guess then, that it was going to the old script because there was no jump to any other script so it jumped to whatever script came next. (yeah you all already knew that I suppose but I didnt :P)

Just comfirming that it works 100%. Thanks Mateo for all your help!! :)

Last edited by Crystal_ (2013-06-18 21:49:10)

Offline

#12 2013-06-18 22:10:18

Miksy91
Member
Registered: 2010-10-16
Post 1,747/2,305

Re: Need help with a person script (pkmn crystal)

I'm kinda tired right now and really don't feel like spending much time posting here but since Mateo mentioned me somewhere between the messages, I guess I'll do.

The thing is, I really don't know what parts of the ram memory are used in Crystal and where there could be free space for adding flags (although, I'd assume there is a bit of free space before DF00 but I can be totally wrong).

Anyway, what comes to other things like having two person events in the same map which "describe" the same person and his possible location (and script data) depending on another event (in this case, beating the last sage in Sprout T.), I'd go for another way to solve the problem.

This method only requires checking whether Sage Li is beaten and hide/show the two person events accordingly. What you want to do is give them both the bit number FF FF for instance (or something between 00 00 and 07 00, I often use these myself). What you need to do is call another script from the map's Script Header that does the following;

checkbit1 [SageLi]
if true @beaten
disappear [guyNotAtTheDoor]
return

@beaten
disappear [guyAtTheDoor]
return

Now, what you're doing is really simple and gives the same result as using two flags. But this way, you can save one flag for some other purpose so I totally recommend starting to do things like this.

Offline

#13 2013-06-18 22:24:16

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 72/411
Website

Re: Need help with a person script (pkmn crystal)

checkbit1 [SageLi]
if true @beaten
disappear [guyNotAtTheDoor]
return

@beaten
disappear [guyAtTheDoor]
return

My first idea was to do something like that, but with a checkitem of Flash instead of a checkbit (I guess the result would be the same) and then use the disappear command. However, I then thought for some reason that this command makes the person disappear only after you actually talk to it. But know thinking about its counterpart command appear, yeah, this wouldnt make any sense.

Needless to say that doing what you are saying would be ALOT easier to do...

But oh well, i'm not going back for this one. I'm proud of what i have achieved today, somehow... I'll take note for future scripts though!

Offline

#14 2013-06-18 22:43:53

Miksy91
Member
Registered: 2010-10-16
Post 1,748/2,305

Re: Need help with a person script (pkmn crystal)

You shouldn't check for whether the player is holding a certain item in pocket since there is always a possibility in storing that into PC.
Good programmer always takes notice of even the smallest errors that someone might run into (even if those had to be caused intentionally by the user's actions). ;)

Anyway, the thing is that you want to call that script from the script header. In other words, before you're able to control the player on that specific map, the change has already taken place and thus, one of the two people is always hidden in that map.

Last edited by Miksy91 (2013-06-18 22:44:28)

Offline

#15 2013-06-18 22:55:21

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

Re: Need help with a person script (pkmn crystal)

Miksy's way is definitely better than mine (as usual, lol). I just went with how Gamefreak did it in Blackthorn City.

Then again, I'm not really a programmer either. I've never formally studied any programming language or took a single class on the subject. My degree is in English Literature (and I had a lot of focus on Creative Writing), with a minor in Criminal Justice. I taught myself to script in GSC by reading the compendium and by looking at how Gamefreak did things in the original game, with nothing else to go on really. The tools I've written were only possible because I picked up a copy of "Teach yourself Visual Basic 6 in 24 hours" from a thrift shop. The programming aspect of hacking isn't really as much fun to me as it is to people like Miksy91, its just a means to an end for me. The part I enjoy is telling a story with the game (which is sometimes hindered by the tediousness of scripting everything to make it work). Also mapping, designing tilesets and graphics, and things like that are fun as well. But scripting and the like are often very tedious to me.

So I guess what I'm getting at there is: I help where I can, but I'm not at all surprised if someone else can do it in a "better" way than I do it, and I'll try to point people in the direction of someone who can help more too.

Last edited by Mateo (2013-06-18 22:59:29)

Offline

#16 2013-06-18 23:08:20

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 73/411
Website

Re: Need help with a person script (pkmn crystal)

You shouldn't check for whether the player is holding a certain item in pocket since there is always a possibility in storing that into PC.

ouch my bad thought hms and key items couldn't be deposited in the pc!

Offline

Board footer

Powered by FluxBB