The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script Issues scripting a trainer battle

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old July 25th, 2018 (5:50 PM). Edited July 25th, 2018 by Hillsy13.
Hillsy13's Avatar
Hillsy13 Hillsy13 is offline
 
Join Date: Aug 2016
Gender: Male
Posts: 157
Been toying around with adding in some trainer battles to pokemon emerald but have ran into an issue. Basically, whatever script I write for the trainer to say before the battle, if its longer than say 20 characters, cuts off and the defeated script will show up overlapping it. just to clarify that I'm making sure to have enough space in the dialogue box and always use \n \l and \p when appropriate. Also when I re-open the script in XSE, it has been altered to how it appears in game. Any help would be appreciated.
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old July 25th, 2018 (6:44 PM). Edited July 25th, 2018 by BirdstarCat13.
BirdstarCat13 BirdstarCat13 is offline
 
Join Date: Nov 2017
Gender: Male
Posts: 476
Would you mind showing the script? Kind of hard to fix what can't be seen. Would be nice to see both what you're typing and the compiled version.
__________________
-------------------------
I hate signatures that are just a line of text without any clear division. You weirdos know who you are ;)
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old July 26th, 2018 (12:18 AM).
Bladecraft's Avatar
Bladecraft Bladecraft is offline
It's written "Bladecraft" on my forehead.
 
Join Date: Feb 2017
Gender: Male
Nature: Calm
Posts: 83
For FR:
Code:
 #dynamic 0x800000
#org @battle
trainerbattle 0x0 0xbattle 0x0 @intro @defeat
msgbox @beaten 0x6
release
end

#org @intro
= I'll say this at the start.

#org @defeat
= I'll say this at the end/lof the battle.

#org @beaten
= After you fought me I'll/lsay this when we talk.
For EM:
Code:
 #dynamic 0x800000
#freespace 0xFF
#org @battle
trainerbattle 0x0 0xbattle 0x0 @intro @defeat
msgbox @beaten 0x6
release
end

#org @intro
= I'll say this at the start.

#org @defeat
= I'll say this at the end/lof the battle.

#org @beaten
= After you fought me I'll/lsay this when we talk.
The only thing I can think of is that you're overwriting stuff due to not using dynamic offsets.
The above are examples that should work, I've given both for FR and EM though EM is superior.

Try filling in the blank to see if it works, also if any of this is unfimiliar then check out diegoisawesome's xse tutorial.
__________________
Rule #0: Always Make a Backup




Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old July 26th, 2018 (4:55 AM).
BirdstarCat13 BirdstarCat13 is offline
 
Join Date: Nov 2017
Gender: Male
Posts: 476
Quote:
Originally Posted by Bladecraft View Post
For FR:
I've given both for FR and EM though EM is superior.
Incorrect but whatever
__________________
-------------------------
I hate signatures that are just a line of text without any clear division. You weirdos know who you are ;)
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old July 27th, 2018 (7:31 AM). Edited July 27th, 2018 by Hillsy13.
Hillsy13's Avatar
Hillsy13 Hillsy13 is offline
 
Join Date: Aug 2016
Gender: Male
Posts: 157
Still having the same issue as before.
Before compiling the script looks like this:
Spoiler:
'---------------
#org 0xE3E610
lock
faceplayer
trainerbattle 0x2 0x1 0x0 0x8E3E63A 0x8E3E654 0x8E3E625
'---------------
#org 0xE3E625
msgbox 0x8E3E667 MSG_FACE '"Until next time[.]"
fadescreen 0x1
setflag 0x79
hidesprite 0x6
fadescreen 0x0
release
end


'---------
' Strings
'---------
#org 0xE3E63A
= I'm confident in my skills.\lLets battle!

#org 0xE3E654
= Wow I lost...

#org 0xE3E667
= Until next time[.]

But once it's been compiled I open it back up and it looks like this:
Spoiler:
'---------------
#org 0xE3E610
lock
faceplayer
trainerbattle 0x2 0x1 0x0 0x8E3E63A 0x8E3E654 0x8E3E625
'---------------
#org 0xE3E625
msgbox 0x8E3E667 MSG_FACE '"Until next time[.]"
fadescreen 0x1
setflag 0x79
hidesprite 0x6
fadescreen 0x0
release
end


'---------
' Strings
'---------
#org 0xE3E63A
= I'm confident in my skillsWow I lost...

#org 0xE3E654
= Wow I lost...

#org 0xE3E667
= Until next time[.]


As you can see, the text from before the battle is continually overwritten. No clue why.
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old July 27th, 2018 (11:23 AM).
Zeturic's Avatar
Zeturic Zeturic is offline
 
Join Date: Mar 2007
Posts: 787
Quote:
Originally Posted by Hillsy13 View Post
Still having the same issue as before.
Before compiling the script looks like this:
Spoiler:
'---------------
#org 0xE3E610
lock
faceplayer
trainerbattle 0x2 0x1 0x0 0x8E3E63A 0x8E3E654 0x8E3E625
'---------------
#org 0xE3E625
msgbox 0x8E3E667 MSG_FACE '"Until next time[.]"
fadescreen 0x1
setflag 0x79
hidesprite 0x6
fadescreen 0x0
release
end


'---------
' Strings
'---------
#org 0xE3E63A
= I'm confident in my skills.\lLets battle!

#org 0xE3E654
= Wow I lost...

#org 0xE3E667
= Until next time[.]

But once it's been compiled I open it back up and it looks like this:
Spoiler:
'---------------
#org 0xE3E610
lock
faceplayer
trainerbattle 0x2 0x1 0x0 0x8E3E63A 0x8E3E654 0x8E3E625
'---------------
#org 0xE3E625
msgbox 0x8E3E667 MSG_FACE '"Until next time[.]"
fadescreen 0x1
setflag 0x79
hidesprite 0x6
fadescreen 0x0
release
end


'---------
' Strings
'---------
#org 0xE3E63A
= I'm confident in my skillsWow I lost...

#org 0xE3E654
= Wow I lost...

#org 0xE3E667
= Until next time[.]


As you can see, the text from before the battle is continually overwritten. No clue why.
You're trying to put in text that is too long.

The text for "I'm confident in my skills" is stored immediately before "Wow I lost". If you do the math, 0xE3E654 - 0xE3E63A = 26. So you only have room for 26 characters (actually 25, because there's an implicit string terminator byte too that you'll need). Your text is significantly longer than that.

Repoint your "I'm confident in my skills" text somewhere else.

If you're going to use static offsets, you need to make sure you double check the sizes involved so you don't accidentally overwrite whatever happens to be after the thing you're modifying in the ROM. Never overwrite X with Y if Y uses more bytes than X.
Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old July 27th, 2018 (12:55 PM).
BirdstarCat13 BirdstarCat13 is offline
 
Join Date: Nov 2017
Gender: Male
Posts: 476
Quote:
Originally Posted by Hillsy13 View Post
Still having the same issue as before.
Before compiling the script looks like this:
Spoiler:
'---------------
#org 0xE3E610
lock
faceplayer
trainerbattle 0x2 0x1 0x0 0x8E3E63A 0x8E3E654 0x8E3E625
'---------------
#org 0xE3E625
msgbox 0x8E3E667 MSG_FACE '"Until next time[.]"
fadescreen 0x1
setflag 0x79
hidesprite 0x6
fadescreen 0x0
release
end


'---------
' Strings
'---------
#org 0xE3E63A
= I'm confident in my skills.\lLets battle!

#org 0xE3E654
= Wow I lost...

#org 0xE3E667
= Until next time[.]

But once it's been compiled I open it back up and it looks like this:
Spoiler:
'---------------
#org 0xE3E610
lock
faceplayer
trainerbattle 0x2 0x1 0x0 0x8E3E63A 0x8E3E654 0x8E3E625
'---------------
#org 0xE3E625
msgbox 0x8E3E667 MSG_FACE '"Until next time[.]"
fadescreen 0x1
setflag 0x79
hidesprite 0x6
fadescreen 0x0
release
end


'---------
' Strings
'---------
#org 0xE3E63A
= I'm confident in my skillsWow I lost...

#org 0xE3E654
= Wow I lost...

#org 0xE3E667
= Until next time[.]


As you can see, the text from before the battle is continually overwritten. No clue why.
Use dynamic offsets lmao
__________________
-------------------------
I hate signatures that are just a line of text without any clear division. You weirdos know who you are ;)
Reply With Quote
  #8   Link to this post, but load the entire thread.  
Old July 27th, 2018 (10:35 PM).
Bladecraft's Avatar
Bladecraft Bladecraft is offline
It's written "Bladecraft" on my forehead.
 
Join Date: Feb 2017
Gender: Male
Nature: Calm
Posts: 83
As I speculated, your problem was not using dynamic offsets.
Let's explain your problem thoroughly:
Offsets:
Whenever you type the line "#org [anything]" you're specifying an offset. That means, where the code to run the script will be written in the game's memory.
You can write "#org 0xE3E63A" and that would work fine with careful planning.
However, dynamic offsets are when you use XSE's free space function instead.

Using dynamic offsets is easy. Look at my example from the last post.
Basically instead of writing 0xE3E63A you type @intro
And whenever you would reference the message box there you would again type @intro
You of course do this whenever you would write "#org something"
Look here for more info:
https://www.pokecommunity.com/showthread.php?t=164276
It's the thread I suggested last time, unfortunately you haven't done what I said last time because otherwise you problem would have been solved.

Last but not least, I have no idea what trainerbattle 0x2 is
If I'm not mistaken:
0x0 is regular trainer
0x1 is with a script after you win
0x4 double battle
0x6 double battle with script after you win

All in all your problems are annoying yet minimal. The thread I've supplied should be able to supply answers to all of your questions within the next month only by itself if you look for long enough.

Hope this fixes your problem, good luck.
__________________
Rule #0: Always Make a Backup




Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:20 AM.