Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#26 2012-09-03 01:51:00

511/700

Re: Pokemon Gold Learning Scripting - Need some clarification

theoblivinator wrote:

Now in Johto Map if I give the person I created a flag bit of 4, is that going to look at Bit Table 1 or Bit Table 2?

Table 1. This is not a Johtomap thing, but behavior of the game engine.

#27 2012-09-03 02:17:30

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 19/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Ah I see. Guess I need to find a different flag to use for hiding my new person. Thanks for helping me out though, I'm learning quite a bit about the mechanics of the game and such.

Offline

#28 2012-09-03 04:03:55

Miksy91
Member
Registered: 2010-10-16
Post 1,077/2,311

Re: Pokemon Gold Learning Scripting - Need some clarification

It's easy to keep up with which flags are set and unset if you write all of the scripts from scratch like I do.
If you're going to add more which is probably the best thing to do in your occasion, you'll just have to find which are unused and which not.

You could always take out a couple of hidden items from the game and use their flags for additional scripts.

Offline

#29 2012-09-04 19:24:10

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 20/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Well once again I was to hasty and didn't do a good job at my testing.

In my script Lance talks to you after you get your first Pokemon and leave Elm's lab. It is a one time event. Thanks to the help I got, I was able to complete the script and hide Lance before and after the event happened. Thing is when I left the map and re-entered it Lance was standing there still. I didn't really know why this was happening, I figured it had to do with the trigger for the map being set to 0x2, but there wasn't anything in the script header of the map for 0x2, just 0x0 and 0x1.

I managed to come up with my own solution though. I just moved the script header for the map and added another trigger to it. The trigger I added does the same thing as the one I created for the map when the trigger is 0x0, it just hides Lance's character. Nothing to fancy, just repointing the data took a little while.

But yeah I have finally finished my first custom event for the game. Took a long while but I learned a lot from it, and next time it won't be so bad. Thanks again everyone!

Here is a video link of the event I added: http://www.youtube.com/watch?v=N7XD-o_trwA

Last edited by theoblivinator (2012-09-04 20:02:48)

Offline

#30 2012-09-12 19:47:22

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 25/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Alright I decided to bump this thread instead of creating another, I hope that is okay.

I have a pretty big idea right now, but I'm not sure -
1.) Is it possible?
2.) If it is how would I start it?

I'm working in the Ruins of Alph right now. I want to create and event that when you enter the ruins the first time after getting the 1st Gym Badge Lance will approach you and start a conversation, much like the deal I did in New Bark Town.

The problem I have right now is that there are two entrances to the Ruins. So is it possible to script the event to take place only once on the map, no matter what entrance you use to enter the ruins? If it is, what commands in PKSV would you use to do this?

By the way I was planning on doing this through the triggers in the Script Header, not with trigger tiles. I think I already know how I would do it with trigger tiles, but using the Script Header to run everything is much more clean I think.

Offline

#31 2012-09-13 04:11:35

Miksy91
Member
Registered: 2010-10-16
Post 1,099/2,311

Re: Pokemon Gold Learning Scripting - Need some clarification

theoblivinator wrote:

Alright I decided to bump this thread instead of creating another, I hope that is okay.

I have a pretty big idea right now, but I'm not sure -
1.) Is it possible?
2.) If it is how would I start it?

Doable, and easy.

theoblivinator wrote:

I'm working in the Ruins of Alph right now. I want to create and event that when you enter the ruins the first time after getting the 1st Gym Badge Lance will approach you and start a conversation, much like the deal I did in New Bark Town.

The problem I have right now is that there are two entrances to the Ruins. So is it possible to script the event to take place only once on the map, no matter what entrance you use to enter the ruins? If it is, what commands in PKSV would you use to do this?

This time, I'm not going to explain you a list of scripting codes which can be used how to do it but here are some tips:
1) Think of a way for the event to happen when you've obtained the 1st gym badge (and what happens when this event has been gone through)
2) Think of a way to check on which warp (or actually, in which location) the player is currently at
3) Create the script
4) Set some bit from table 1 (for part 1)

If you've played DF, you'll notice one of the university's rooms use scripting similar to this.

The in-game scripting system provides all that you need to accomplish doing this. In other words, assembly is not needed.

theoblivinator wrote:

By the way I was planning on doing this through the triggers in the Script Header, not with trigger tiles. I think I already know how I would do it with trigger tiles, but using the Script Header to run everything is much more clean I think.

That's also what you pretty much want to do because there is a limit in how many triggered scripts can be called from First Part of the script header (table in 25:4000).

Last edited by Miksy91 (2012-09-13 04:13:33)

Offline

#32 2012-09-13 04:26:08

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 27/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Hmmmm....

I could edit Falkner's so script that when he gives you the gym badge or TM (I don't think it would matter) that it also sets the trigger for the Ruin's of Alph map using the "activate trigger from afar" command.

Then no matter what entrance you use to enter the map, as long as the trigger has been set, the script can run. Then it will just be a matter of determining how to have Lance move to you, since you can be in two different locations. I'm not sure how to check which location you are at yet... but I see how I would use that, any tips?

Last edited by theoblivinator (2012-09-13 04:27:06)

Offline

#33 2012-09-13 05:51:46

Miksy91
Member
Registered: 2010-10-16
Post 1,100/2,311

Re: Pokemon Gold Learning Scripting - Need some clarification

I have a feeling this will do.

checkbit1 0x100
if false @script1
return

@script1
checkbit2 0x1A
if true @script2
return

@script2
checkcode 0x12 (Writes x-location of player in RAM)
if = 0x10 @script3
return

@script3
Stuff that happens when you encounter Lance...
setbit1 0x100
return

Last edited by Miksy91 (2012-09-13 05:52:59)

Offline

#34 2012-09-14 05:58:15

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 28/98

Re: Pokemon Gold Learning Scripting - Need some clarification

I understand most of the script that you've posted. I think I want to try and do it differently. I also have a few questions about your script too if you don't mind answering.

Right now I want to handle this event in the Ruins of Alph just like I did with the event in New Bark Town, since that is what I'm most familiar with. So after you beat Falkner I added this to his script after he gives you the TM.

domaptrigger 0x3 0x22 0x1

So this will set the trigger value on the Ruins of Alph map to 0x1, allowing my event to take place when you enter it, no matter what entrance you use.

checkbit1 0x100
if false @script1
return

I understand this. This is just to make sure the event hasn't happened again. I don't think I'll be using this though since everything is on triggers. I think mine would look like this.

checktriggers (13)
if = 0x0 @Hide Lance
end (90)

checktriggers (13)
if = 0x1 @New Lance Script
end (90)

checktriggers (13)
if = 0x2 @Hide Lance
end (90)

@Hide Lance
disappear 0x4 (6D 04) {Lance is person 4 in this map}
end (90)

@New Lance Script
checkcode 0x12........

I'm fairly confident that will work, because that is exactly how my New Bark Town script is set up and that works perfectly. Now for the part I'm confused at...

@script2
checkcode 0x12 (Writes x-location of player in RAM)
if = 0x10 @script3
return

I know that the checkcode 12 is going to write the x-location into RAM. I don't know how to compare it to another value. Is that what you are doing with the "if =0x10" function? Are you comparing the x-value to 0x10, and if it is the same then move onto Script3? If that is the case then would something like this work?

@New Lance Script
checkcode 0x12
if = 0x8 @LanceMovement1 {8 is the X-Position if you used the Northern Gate to enter the Ruins of Alph}
else @LanceMovement2
rest of the script
dotrigger 0x2
end

@LanceMovement1
Commands to have Lance move to the Northern Gate to meet you
Return

@LanceMovement2
Commands to have move to the Eastern Gate to meet you
Return

That is how I'm thinking it will look. I'll test it in the morning but maybe if you can see anything wrong with it, or if I'm doing something wrong you could give me a heads up to work around it somehow. Thanks again Misky for all your help, you're awesome! :)

Last edited by theoblivinator (2012-09-14 06:02:14)

Offline

#35 2012-09-14 06:15:53

Miksy91
Member
Registered: 2010-10-16
Post 1,102/2,311

Re: Pokemon Gold Learning Scripting - Need some clarification

Everything works perfectly fine expect for the fact you're using decimal values in domaptrigger and it should check for position 0x7 instead of 0x8 ;)
So yeah, there is nothing wrong with the logic of the script.

P.S
I was trying to tell you to do it without using "triggers" because I thought you're going to put the script in the unown chamber room. In this case, using scripts of the first part is a better idea because the map already has trigger events of the first part.

theoblivinator wrote:

That is how I'm thinking it will look. I'll test it in the morning but maybe if you can see anything wrong with it, or if I'm doing something wrong you could give me a heads up to work around it somehow. Thanks again Misky for all your help, you're awesome! :)

No problem :)
If you run into problems later on, let me know and I'll be here to answer (in case what you're asking is "practically possible" to be done).

For easier "comparison".

D20D - X position 
D20E - Y Position 
DA00 - What Map Bank you are on. 
DA01 - What Map number you are on.

Also, you can see here that all "checkcode 0x12" does is to load the variable in D20D into D173 (and could be changed with 19 0D D2 if wanted to).

Last edited by Miksy91 (2012-09-14 06:19:22)

Offline

#36 2012-09-25 20:35:23

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 38/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Well after lots of working and testing I managed to finally complete the script. It works 100% no matter what entrance you use to enter the Ruins of Alph. I ended up using trigger tiles as I couldn't get the script to work right in the script header. I'm sure it is possible, I just couldn't figure it out.

Anyways there is still a slight glitch with my script and after troubleshooting I have no idea where it comes from.

The first part of the script looks like this:

#org 0x113204
'-----------------------------------
checkbit1 0x3B
if false 0x720C ' 0x11320C
loadmovesprites
end

After the script is done, I use the command setbit1 0x3B, which according to this thread is an unused bit in the bit table.

The problem I am having after the event is all done and bit 0x3B is set, whenever you step on the trigger tile again, the map glitches slightly. Like parts of the map shift up and down, and it looks rather strange. Here is a picture of what it looks like.

This is before you step on the trigger: hm.png

This is after you step on the trigger: eh.png

I think it has to do something with the first part of my script, but I have no idea why graphics would be affected by stepping on it. Any idea as to what might be causing this? If needed I can post to rest of my script if someone suspects the error is caused by something else.

Offline

#37 2012-09-26 06:13:21

Miksy91
Member
Registered: 2010-10-16
Post 1,118/2,311

Re: Pokemon Gold Learning Scripting - Need some clarification

You shouldn't be using "loadmovesprites". It's used to replace the font in ram with walking sprites of the people in that map but not only that but also close text box (which "closetext" does not do, it's more like "wait for key press" type of a command). So take "loadmovesprites" out and you're good to go.

Funny thing is that I also thought in the beginning that it has something to do with ending all scripts but it doesn't.

Last edited by Miksy91 (2012-09-26 06:14:13)

Offline

#38 2012-09-26 06:36:12

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 39/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Ah well that was a rather simple fix. Thanks Miksy! Since this thread is in the tutorial thread perhaps it would be beneficial to post the final version of the script that took me so long to write. Well here it is!

#org 0x113204
'-----------------------------------
checkbit1 0x3B
if false 0x720C ' 0x11320C
end

#org 0x11320C
'-----------------------------------
checkbit1 0x8
if true 0x7214 ' 0x113214
end

#org 0x113214
'-----------------------------------
checkcode 0x12
if == 0x7 0x7221 ' 0x113221
checkcode 0x12
if == 0xC 0x7236 ' 0x113236
end

#org 0x113221
'-----------------------------------
moveperson 0x4 0xC 0x8
appear 0x4
applymovement 0x4 0x722E ' 0x11322E
2jump 0x7263 ' 0x113263

#org 0x113263
'-----------------------------------
loadfont
2writetext 0x72E6 ' 0x1132E6
closetext
checkcode 0x12
if == 0x7 0x7275 ' 0x113275
checkcode 0x12
if == 0xC 0x728B ' 0x11328B
end

#org 0x113275
'-----------------------------------
loadmovesprites
follow 0x4 0x0
applymovement 0x4 0x7281 ' 0x113281
stopfollow
2jump 0x72D1 ' 0x1132D1

#org 0x1132D1
'-----------------------------------
loadfont
2writetext 0x74CF ' 0x1134CF
closetext
applymovement 0x4 0x72E4 ' 0x1132E4
disappear 0x4
playsound 0x23
setbit1 0x3B
loadmovesprites
end

#org 0x113236
'-----------------------------------
checkcode 0x13
if == 0x14 0x7243 ' 0x113243
checkcode 0x13
if == 0x15 0x7256 ' 0x113256
end

#org 0x113243
'-----------------------------------
moveperson 0x4 0xB 0x10
appear 0x4
applymovement 0x4 0x7250 ' 0x113250
2jump 0x7263 ' 0x113263

#org 0x113256
'-----------------------------------
moveperson 0x4 0xB 0x11
appear 0x4
applymovement 0x4 0x7250 ' 0x113250
2jump 0x7263 ' 0x113263

#org 0x11328B
'-----------------------------------
checkcode 0x13
if == 0x14 0x7298 ' 0x113298
checkcode 0x13
if == 0x15 0x72B4 ' 0x1132B4
end

#org 0x113298
'-----------------------------------
loadmovesprites
follow 0x4 0x0
applymovement 0x4 0x72A4 ' 0x1132A4
stopfollow
2jump 0x72D1 ' 0x1132D1

#org 0x1132B4
'-----------------------------------
loadmovesprites
follow 0x4 0x0
applymovement 0x4 0x72C0 ' 0x1132C0
stopfollow
2jump 0x72D1 ' 0x1132D1


#org 0x1132E6
= I removed this text for spoilers. You'll have to play the hack when it is finished to see what it says! :)

#org 0x1134CF
= My searching has\nled me here.\pI'll explain\nmore inside.\pLets go!\e


#org 0x11322E
M step_left step_left step_left step_left step_up step_left look_up end

#org 0x113281
M step_right step_right step_down step_right step_right step_right step_right step_right look_up end

#org 0x1132E4
M step_up end

#org 0x113250
M step_down step_down step_down step_down look_right end

#org 0x1132A4
M step_up step_up step_up step_right step_right step_up step_up step_up step_right step_up step_up step_up step_up step_up step_up end

#org 0x1132C0
M step_up step_up step_up step_up step_right step_right step_up step_up step_up step_right step_up step_up step_up step_up step_up step_up end

I'm sure there are ways to make it more efficient and optimized but you know the saying "If it works, there is no reason to fix it!"

Last edited by theoblivinator (2012-09-26 06:36:57)

Offline

#39 2012-10-14 21:14:13

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 42/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Uh I need some help again. Still working on Pokemon Gold.

I've been working on a script for several hours and I just can't get it to work out.

I'm using the scripting command "checkcode 0x12" to check the X-position of your character on the map. It looks like this:

#org 0x122B70
'-----------------------------------
disappear 0x2
moveperson 0x2 0x15 0x7
appear 0x2
loadfont
2writetext 0x6C7C ' 0x122C7C
closetext
loadmovesprites
applymovement 0x0 0x6B8F ' 0x122B8F
checkcode 0x12
if == 0xF 0x6B8C ' 0x122B8C
2jump 0x6B93 ' 0x122B93
end

But for whatever reason the checkcode part of the command is not working at all. I found out it was the checkcode part because I made the 2jump command a comment and tried the script and the script stopped after the checkcode command.

Here is an image of how I'm trying to call the script. The script should run when you step on the circled trigger tile. Everything runs well up until the checkcode command and I'm at lost as to why it isn't working. I'm positive that the x position should be 0xF....

cherrygrovehelp.png

Any help or ideas? I probably just missed something very small here...

Last edited by theoblivinator (2012-10-15 02:19:29)

Offline

#40 2012-10-15 01:49:29

Tauwasser
Member
Registered: 2010-10-16
Post 311/448

Re: Pokemon Gold Learning Scripting - Need some clarification

I get 0x10 when I count the trees...

cYa,

Tauwasser

Offline

#41 2012-10-15 02:18:59

theoblivinator
Member
From: Iowa
Registered: 2012-08-20
Post 43/98

Re: Pokemon Gold Learning Scripting - Need some clarification

Like I said, I knew it was something very small and stupid on my part. Thanks.

Offline

Board footer

Powered by FluxBB