Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2012-09-29 19:46:28

goodman
Member
Registered: 2011-07-18
Post 13/14

Need help with some script using hex

Hi, I was checking out the Trigger Data in New Bark Town using Pokemon Crystal and noticed something. When you follow the 2byte pointer of the Trigger Data you can see all the codes used in the trigger event (the music starting, the lady telling you to not go out without a pokemon, the follow script, etc) but I didn't noticed any code that tell the game when the script should STOP running. I wanted to know how the games know when a Trigger should stop running.

Here's the structure of the trigger data I'm talking about (took it from http://hax.iimarck.us/files/scriptingcodes_eng.htm)

[Number][Y position][X position][00][Script pointer (2byte)][00][00]

This is the Trigger I whose 2byte script I followed

[00][09][01][00][4140][00][00]

And here's the script of the Trigger.

[7F][Music no (2byte)] [76][Person][Facing] [47] [4C][2byte text pointer] [54] [49] [76][Person][Facing] [69][Person][2byte pointer to moving data] [76][Person][Facing] [47] [4C][2byte text pointer] [54] [49] [70][Person2][Person1] [69][Person][2byte pointer to moving data] [71] [47] [4C][2byte text pointer] [54] [49] [0F][xxyy] [91]

(Some codes are different than in Gold and Silver because Crystal added 1 more code between Gold/silver's code 52 and 51)

I expected to see a bittable check code (codes 31, 32, 33, 34, 35 or 36) since this Trigger stops working once you get your first Pokemon, but there's nothing like that and I'm confused.

Pls help. I need to know this because I want to add another Trigger to New Bark Town and I need to know how to make it so the game knows when to start playing the trigger and when to stop.

Last edited by goodman (2012-09-29 19:55:19)

Offline

#2 2012-09-29 20:11:25

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

Re: Need help with some script using hex

Trigger events are run based on the [Number] byte. This is usually referred to as the "Trigger Timing" or something similar. This is why for a map's triggers to work, it has to be entered in the trigger table. That is where the game keeps up with which "Number" each map with triggers is on. By default, this is 00. That means triggers like this one in New Bark that have 00 for their timing number will run from the start, and will stop running when a script changes the trigger timing to something else. In this case, when you get your first Pokemon, it runs a command that changes the timing for New Bark to 01 instead of 00, so the triggers no longer stop you from leaving.

If you wanted the new trigger to run once you had your Pokemon, you would set its number to 01, and to make THAT one stop, something would need to change the timing to 02 (although you could technically have it check for a flag like a normal script, using the trigger timing is the way they are intended to work.)

Last edited by Mateo (2012-09-29 20:12:51)

Offline

#3 2012-09-29 22:02:50

goodman
Member
Registered: 2011-07-18
Post 14/14

Re: Need help with some script using hex

Mateo wrote:

Trigger events are run based on the [Number] byte. This is usually referred to as the "Trigger Timing" or something similar. This is why for a map's triggers to work, it has to be entered in the trigger table. That is where the game keeps up with which "Number" each map with triggers is on.

Trigger table? is there something like that? where I can check it? I guess I need to modify the table (maybe repoint it) in order to add a new [number] that starts and ends whenever I want.

Mateo wrote:

If you wanted the new trigger to run once you had your Pokemon, you would set its number to 01, and to make THAT one stop, something would need to change the timing to 02 (although you could technically have it check for a flag like a normal script, using the trigger timing is the way they are intended to work.)

So let's take Route 32 for example (it has 2 different Triggers). If I put one Trigger there with 00 it would trigger at the same time as the Trigger with number 00 and it would stop at the same time, and if I put it 01 the same would happen for 01, but if I put 02 as the number, if would start whenever Trigger number 01 stops and it wouldn't stop until I manually change it (or make it check for a flag which I dont know how to do)

I remember that 1 year ago or so I tried adding a trigger to my ROM and I ended up playing around with the byte 31-36, making it so the sprites involved in the Trigger event would disappear from the map at certain points and so preventing it from happening. Another question would be if that was just pure luck or it is actually possible to modify the sprites and events involved in the trigger event to make it stop whenever you like without having to touch the Trigger Table.

Offline

#4 2012-09-30 04:06:39

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

Re: Need help with some script using hex

I might be reading it wrong, but it looks like you are thinking that trigger timings are universal, when they are actually set independently for each Map. New Bark Town can be on time 02 and Route 29 can be on 00 and Cherrygrove can be on 03 if it wanted to be, since they are all stored in separate places. All triggers on a particular map check the timing byte for that map and work off that.

You don't have to mess with the trigger table if you are putting triggers on a map that already has them. If you want to look at the trigger table, the offset is listed in the Useful Offsets thread. Each entry has the map bank and map no, and a pointer to the ram address used to store that map's trigger timing. If you are only adding triggers on a map that already has them, like New Bark Town and the routes that already have triggers, you won't have to change the table at all. You would only need to modify the table if you wanted to add triggers to a map that doesn't already have them.

Offline

Board footer

Powered by FluxBB