• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Script Help Thread (DO NOT REQUEST SCRIPTS)

Status
Not open for further replies.

Xatoku

Game Developer
451
Posts
15
Years
Would this work:
Spoiler:

It should, but i suggest you take the @ask script and change the one that says 0x2 to @please instead of @ ask, 'cuz it's too reptitive if the player says no. Also change the msgbox scripts to have the boxset # after, msgbox @can 0x5 for example, 'cuz the new XSE has a new way of scripting msgbox's.


My Question:

I have a script that works fine but whenever the sprite the player talks to to trigger the event is off of the screen it goes back to it's original position.
 
Last edited:

Pheya

Is very excited about HH & SS.
80
Posts
16
Years
  • Seen Jan 2, 2010
Where do I fill in the flag # for a "green S" tile? Such as in "People ID" by people.
Thanks in advance.
 

Pheya

Is very excited about HH & SS.
80
Posts
16
Years
  • Seen Jan 2, 2010
Okay, for example, instead of using setflag 0x1012, I must use setvar 0x1012
 

Pheya

Is very excited about HH & SS.
80
Posts
16
Years
  • Seen Jan 2, 2010
Code:
#dynamic 0x800000

#org @start
lockall
applymovement 0x2 @walktoFF
applymovement 0xFF @!
waitmovement 0x0
message @aquagrunt 0x6
clearflag 0x828
waitmovement 0x0
applymovement 0x2 @run
waitmovement 0x0
applymovement 0x1 @help
waitmovement 0x0
message @oldmangives 0x6
waitmovement 0x0
givepokemon 0x4 0x5 0x0 0x0 0x0 0x0
fanfare 0x13E
message @3 0x4
waitfanfare
closeonkeypress
setflag 0x828
message @4 0x5
compare LASTRESULT 0x1
if 0x1 gosub @name
message @5 0x6
waitmovement 0x0
applymovement 0x1 @toplace
setvar 0x3F7 0x3F7
release
end

#org @name
call 0x1A74EB
return

#org @done
message @6 0x6
release
end

#org @aquagrunt
= [purple_fr][player]: What? BRENDAN?\pGRUNT: No, I'm a AQUA grunt.\n[player]: But you look like BRENDAN.\pGRUNT: He's the AQUA leader.\nHe makes us wear these clothes.\pBut that's not why I'm here!\nI'll take that POKéMON, thank you.\p[PLAYER]: HEY! Give it back!\nGRUNT: Hm, no.

#org @oldmangives
= I saw what happend.\nTake my CHARMANDER.

#org @3
= [black_fr]You received a Charmander!

#org @4
= [black_fr]Would you like to give a\nnickname to Charmander?

#org @5
= I'm sure you will get your\nold POKéMON back.

#org @6
= Are you taking good care\nof Charmander?

#org @walktoFF
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0xFE

#org @!
#raw 0x62
#raw 0xFE

#org @run
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0xFE

#org @help
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x02
#raw 0xFE

#org @toplace
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x00
#raw 0xFE

What's wrong in this script? When I step on the S tile, my game freezes.
 

destinedjagold

You can contact me in PC's discord server...
8,593
Posts
16
Years
  • Age 33
  • Seen Dec 23, 2023
Spoiler:

What's wrong in this script? When I step on the S tile, my game freezes.

have you set the unknown and the var values to 00|03 and 40|57 or something like that?
 

Pheya

Is very excited about HH & SS.
80
Posts
16
Years
  • Seen Jan 2, 2010
Unkown: 0003
Var. Number: 6F00
Var. Value: 0000
Unknown (second time) 00|03

And my script offset.
 

iTeruri

iAm
277
Posts
17
Years
Edit: I forgot! It's made with XSE and the rom is Fire Red (US BPRE).

The following script is kina long and hard to understand if you don't know what it does.

Code:
#dynamic 0x800000

#org @start
compare 0x7007 0x0
if 0x1 goto @1
compare 0x7007 0x1
if 0x1 goto @2
compare 0x7007 0x2
if 0x1 goto @3
compare 0x7007 0x3
if 0x1 goto @4
compare 0x7007 0x4
if 0x1 goto @5
compare 0x7007 0x5
if 0x1 goto @6
compare 0x7007 0x6
if 0x1 goto @7
compare 0x7007 0x7
if 0x1 goto @8
compare 0x7007 0x8
if 0x1 goto @9
compare 0x7007 0x9
if 0x1 goto @10
compare 0x7007 0xA
if 0x1 goto @11
compare 0x7007 0xB
if 0x1 goto @12
end

#org @reset
sound 0x4B
movesprite 0x1 0x8 0x11
setvar 0x7007 0x0
end

#org @1
compare 0x800C 0x4
if 0x1 goto @1b
goto @reset
end

#org @1b
applymovement 0x1 @1move
setvar 0x7007 0x1
end

#org @1move
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0x10
#raw 0xFE

#org @2
compare 0x800C 0x4
if 0x1 goto @2b
goto @reset
end

#org @2b
applymovement 0x1 @2move
waitmovement 0x1
setvar 0x7007 0x2
end

#org @2move
#raw 0x13
#raw 0xFE

#org @3
compare 0x800C 0x4
if 0x1 goto @3b
goto @reset
end

#org @3b
applymovement 0x1 @3move
waitmovement 0x1
setvar 0x7007 0x3
end

#org @3move
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @4
compare 0x800C 0x4
if 0x1 goto @4b
goto @reset
end

#org @4b
applymovement 0x1 @4move
waitmovement 0x1
setvar 0x7007 0x4
end

#org @4move
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0xFE

#org @5
compare 0x800C 0x2
if 0x1 goto @5b
goto @reset
end

#org @5b
applymovement 0x1 @5move
waitmovement 0x1
setvar 0x7007 0x5
end

#org @5move
#raw 0x11
#raw 0xFE

#org @6
compare 0x800C 0x2
if 0x1 goto @6b
goto @reset
end

#org @6b
applymovement 0x1 @6move
waitmovement 0x1
setvar 0x7007 0x6
end

#org @6move
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0x12
#raw 0xFE

#org @7
compare 0x800C 0x2
if 0x1 goto @7b
goto @reset
end

#org @7b
applymovement 0x1 @7move
waitmovement 0x1
setvar 0x7007 0x7
end

#org @7move
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @8
compare 0x800C 0x4
if 0x1 goto @8b
goto @reset
end

#org @8b
applymovement 0x1 @8move
waitmovement 0x1
setvar 0x7007 0x8
end

#org @8move
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0xFE

#org @9
compare 0x800C 0x2
if 0x1 goto @9b
goto @reset
end

#org @9b
applymovement 0x1 @9move
waitmovement 0x1
setvar 0x7007 0x9
end

#org @9move
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0xFE

#org @10
compare 0x800C 0x3
if 0x1 goto @10b
goto @reset
end

#org @10b
applymovement 0x1 @10move
waitmovement 0x1
setvar 0x7007 0xA
end

#org @10move
#org 0x12
#org 0x12
#org 0x12
#org 0x12
#raw 0xFE

#org @11
compare 0x800C 0x4
if 0x1 goto @11b
goto @reset
end

#org @11b
applymovement 0x1 @11move
waitmovement 0x1
setvar 0x7007 0xB
end

#org @11move
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0x13
#raw 0xFE

#org @12
compare 0x800C 0x2
if 0x1 goto @12b
goto @reset
end

#org @12b
applymovement 0x1 @12move
waitmovement 0x1
hidesprite 0x1
setvar 0x7007 0xC
setvar 0x8004 0x0
setvar 0x8005 0x3
setvar 0x8006 0x4
setvar 0x8007 0x2
special 0x136
pause 0x1E
sound 0x4B
setflag 0x3F7
addvar 0x7005 0x1
end

#org @12move
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x11
#raw 0x60
#raw 0xFE

What is does:
It's a puzzle, you have to move the Deoxys triangle around the map. You have to face the right way in order to move the triangle, if you don't it resets itself.
1: Right
2: Right
3: Right
4: Right
5: Up
6: Up
7: Up
8: Right
9: Up
10: Left
11: Down
12: Up
If you talk to it faceing the wrong direction, it goes to reset.

It goes wrong when you have to talk to the triangle for the tenth time (facing left). I can't figure out what's wrong :/

The script is set up in this way:
Goto a part of the script acording to the var 0x7007. 0x7007 keeps track of the number of times you talked to the triangle.
Check if you face the correct way, if you do continue in the b part, if you don't: reset the puzzle.
Move the triangle and set the new var.
12 is special, this ends the puzzle and hides the triangle.

I know the script is kinda big, but if you spot the error you would help me a lot!

Thanks in advance.
 

Larsie13

Guest
0
Posts
Spoiler:
I don't see any error, but what about telling exactly WHAT goes wrong? That'll help us figuring out what might cause it.
 

Pheya

Is very excited about HH & SS.
80
Posts
16
Years
  • Seen Jan 2, 2010
I don't see any error, but what about telling exactly WHAT goes wrong? That'll help us figuring out what might cause it.
Teruri said:
It goes wrong when you have to talk to the triangle for the tenth time (facing left). I can't figure out what's wrong :/

That's the problem he is facing.
 

iTeruri

iAm
277
Posts
17
Years
I don't see any error, but what about telling exactly WHAT goes wrong? That'll help us figuring out what might cause it.

When you talk to it for the tenth time and you're facing left the game freezes. If you talk to it and you're facing any other way, the puzzles resets itself.
 

Larsie13

Guest
0
Posts
When you talk to it for the tenth time and you're facing left the game freezes. If you talk to it and you're facing any other way, the puzzles resets itself.
Hmm, I can't really see anything wrong with it. Did you try decompiling to see if there were any errors while compiling, or delete the script, and recompile it?
 

iTeruri

iAm
277
Posts
17
Years
I recompiled it several times, sometimes changing some things around. Everythings works until you have to do it the tenth time. I don't know what's wrong. It might be something with the var, I really don't know.
 

Larsie13

Guest
0
Posts
I recompiled it several times, sometimes changing some things around. Everythings works until you have to do it the tenth time. I don't know what's wrong. It might be something with the var, I really don't know.
Well, I checked real closely, and found the error. It's kind of hard to notice, but:
Code:
#org @10move
[B]#org[/B] 0x12
[B]#org[/B] 0x12
[B]#org[/B] 0x12
[B]#org[/B] 0x12
#raw 0xFE
Seems obvious what the problem is, no?
 

RaycrowX

Beginning ROM Hacker
36
Posts
14
Years
I have a couple questions about flags and variables:

Where within the ROM are they located?

If I do setflag 0x5000, is that the same as setvar 0x5000 0x1? Basically, do they occupy the same area?

I've had no problem with vars 0x5000 and over because they are initialized to zero. But I've had a lot of trouble with flags because it seems like they aren't initialized to zero. Are they supposed to be, and if not, how do I deal with this?

Help would be much appreciated. Thanks.
 

ckret2

usually pronounced "secret 2"
518
Posts
15
Years
Two questions, one about trainerbattle and one about flags.

I have a quick question about trainerbattle in FireRed. I'm trying to make a trainerbattle script that activates when you step on a tile: two trainers walk up to you, talk to you, a double battle starts, and after the battle the script continues so that the proper flags are set and things like that. My problem is I don't know how to do a double battle that has dialogue that continues after the battle ends.

Here's how I've basically got it formatted so far, with all the extraneous stuff taken out:

Spoiler:

My problem is with the "trainerbattle 0x??" part. I know that using 0x0 will make it like a normal trainerbattle with a trainer who sees you, walks up to you, and after the battle doesn't talk to you unless you talk to it. Using 0x1 makes it like a gym leader trainerbattle, so that they'll keep talking to you after the battle is over. Looking through the FireRed script dump, I think using 0x4 makes it a double trainerbattle like Twins and Young Couples use (and it looks like 0x7 is for Vs. Seeker double battles?), but they don't talk to you after the battle ends unless you talk to them. So I need a way to get them to do that.

The only thing I've found is in the script dump for Ruby: the Tate and Liza battle uses "trainerbattle 0x8", so I'm thinking maybe that's a gym-style double battle, where the script continues after the battle ends? However, "trainerbattle 0x8 isn't used at all in the FireRed script dump, so I don't know if my script would work if I used it on a FireRed hack. Does anyone else know?

And a quick question about flags: when I started my hack, I tried to use setflag 0x1 for the first event, but discovered that if I left the room and came back in, the flag had been cleared. Now I think I might have use for a flag that will automatically clear itself when you leave the room, if I want an event to repeat. So, would using flag 0x1 work for that, or do you think that it might be glitchy and dangerous to use, and better off left alone?
 
Status
Not open for further replies.
Back
Top