The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Script How to activate a flag after 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 January 29th, 2017 (12:25 AM).
Jehowi Jehowi is offline
Your Master Superior
 
Join Date: May 2009
Location: Belgium
Age: 31
Gender:
Nature: Careful
Posts: 61
At the moment, I'm trying to make a script where you have to battle two other opponents before the third opponent becomes available for battle. I'm using flags for this.

What happens now, is that I have to talk to the person I defeated first before the flag gets activated. What am I doing wrong?

This is the script

#dyn 0x740000
#org @start
'-----------------------------------
checkflag 0x238
if true jump @flagalreadyset
trainerbattle 0x0 0x9 0x0 @begin @defeat
setflag 0x238 ---> this flag only gets activated when I talk to the trainer after battle, it doesn't get activated automatically after battle.
end

#org @flagalreadyset
msgbox @sensei ' You've been lucky. I...
callstd MSG_LOCK ' Built-in lock command
end

#org @begin
= You? Beat me? Hah! I can smash\nrocks with my bare fists!

#org @defeat
= But that doesn't make me a great\ntrainer...

#org @sensei
= You've been lucky. I wonder if\nyou could beat sensei too.
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old January 29th, 2017 (4:28 AM).
Phantom Phoenix's Avatar
Phantom Phoenix Phantom Phoenix is offline
Lost on the road of life
 
Join Date: Oct 2015
Location: ???
Age: 26
Gender: Male
Nature: Calm
Posts: 167
Code:
#dyn 0x740000
#org @start
'-----------------------------------
checkflag 0x238
if true jump @flagalreadyset
trainerbattle 0x1 0x9 0x0 @begin @defeat @after
end

#org @after
setflag 0x238
end

#org @flagalreadyset
msgbox @sensei ' You've been lucky. I...
callstd MSG_LOCK ' Built-in lock command
end
#org @begin
= You? Beat me? Hah! I can smash\nrocks with my
bare fists!
#org @defeat
= But that doesn't make me a great\ntrainer...
#org @sensei
= You've been lucky. I wonder if\nyou could beat
sensei too.
This will work.
You have to use trainerbattle 0x1 not 0x0 if you want to do something after the battle is finished .
0x1 will give you another parameter which I labeled as @after .
__________________
Pokemon XYZ Version
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old January 29th, 2017 (5:56 AM). Edited January 29th, 2017 by Jehowi.
Jehowi Jehowi is offline
Your Master Superior
 
Join Date: May 2009
Location: Belgium
Age: 31
Gender:
Nature: Careful
Posts: 61
Quote:
Originally Posted by Phantom Phoenix View Post
Code:
#dyn 0x740000
#org @start
'-----------------------------------
checkflag 0x238
if true jump @flagalreadyset
trainerbattle 0x1 0x9 0x0 @begin @defeat @after
end

#org @after
setflag 0x238
end

#org @flagalreadyset
msgbox @sensei ' You've been lucky. I...
callstd MSG_LOCK ' Built-in lock command
end
#org @begin
= You? Beat me? Hah! I can smash\nrocks with my
bare fists!
#org @defeat
= But that doesn't make me a great\ntrainer...
#org @sensei
= You've been lucky. I wonder if\nyou could beat
sensei too.
This will work.
You have to use trainerbattle 0x1 not 0x0 if you want to do something after the battle is finished .
0x1 will give you another parameter which I labeled as @after .
Thank you so much. I figured it had something to do with that, as for a rematch, i had to change the id to 0x3. Do you have any idea what the other numbers do in the trainer code? I mean the number that has to get changed...
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old January 30th, 2017 (9:13 AM).
Blah's Avatar
Blah Blah is offline
Free supporter
 
Join Date: Jan 2013
Location: Unknown Island
Gender: Male
Posts: 1,924
Why not make an optimization and use the actual trainer flag instead of a brand new flag?
__________________
...
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:17 AM.