The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary ROM Hacking (https://www.pokecommunity.com/forumdisplay.php?f=284)
-   -   Script Can't Rebattle Scripted Trainer (https://www.pokecommunity.com/showthread.php?t=434130)

Pokeeng April 26th, 2020 4:39 PM

Can't Rebattle Scripted Trainer
 
So in my hack I have a trainer where he will walk up to you and battle you when you step on the tile. If you beat him, he disappears and the roadblock I set up disappears as well which is what I want. However, if you lose to him, you can't rechallenge him and the roadblock can't move. How can I fix this?

Lance Koijer 2.0 April 26th, 2020 11:27 PM

Quote:

Originally Posted by Pokeeng (Post 10151489)
So in my hack I have a trainer where he will walk up to you and battle you when you step on the tile. If you beat him, he disappears and the roadblock I set up disappears as well which is what I want. However, if you lose to him, you can't rechallenge him and the roadblock can't move. How can I fix this?

You should clear his trainer flag.

Pyxal April 27th, 2020 1:39 AM

Quote:

Originally Posted by Pokeeng (Post 10151489)
So in my hack I have a trainer where he will walk up to you and battle you when you step on the tile. If you beat him, he disappears and the roadblock I set up disappears as well which is what I want. However, if you lose to him, you can't rechallenge him and the roadblock can't move. How can I fix this?

Paste the script here.

Pokeeng April 27th, 2020 12:45 PM

'---------------

#org 0x80377D

msgbox 0x88037F2 MSG_NORMAL '"Good. That makes two. Soon Jirachi..."

msgbox 0x880383A MSG_NORMAL '"[blue_fr]I think someone is here."

msgbox 0x8803876 MSG_NORMAL '"Seems we have a guest.\pTake care ..."

applymovement 0x2 0x8803873

waitmovement 0x2

applymovement MOVE_PLAYER 0x88038A9

waitmovement 0xFF

applymovement 0x2 0x88038AE

waitmovement 0x2

applymovement 0x1 0x88038BA

waitmovement 0x1

hidesprite 0x2

setvar 0x4046 0x4

setflag 0x1246

trainerbattle 0x2 0x8 0x0 0x88038C2 0x88038E2 0x88037DD

release

end



'---------------

#org 0x8037DD

msgbox 0x88038F7 MSG_NORMAL '"[blue_fr]Hm. I'll have to tell the..."

fadescreen 0x1

setflag 0x1248

hidesprite 0x1

fadescreen 0x0

release

end





'---------

' Strings

'---------

#org 0x8037F2

= Good. That makes two. Soon Jirachi\nwill come straight to us.



#org 0x80383A

= [blue_fr]I think someone is here.



#org 0x803876

= Seems we have a guest.\pTake care of that for me.



#org 0x8038C2

= [blue_fr]Just following orders.



#org 0x8038E2

= This is a problem.



#org 0x8038F7

= [blue_fr]Hm. I'll have to tell the\nothers.





'-----------

' Movements

'-----------

#org 0x803873

#raw 0x0 'Face Down

#raw 0xFE 'End of Movements



#org 0x8038A9

#raw 0x1D 'Step Down (Fast)

#raw 0x1D 'Step Down (Fast)

#raw 0x1F 'Step Left (Fast)

#raw 0x3 'Face Right

#raw 0xFE 'End of Movements



#org 0x8038AE

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x13 'Step Right (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0xFE 'End of Movements



#org 0x8038BA

#raw 0x13 'Step Right (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x2 'Face Left

#raw 0xFE 'End of Movements

Pyxal April 27th, 2020 12:53 PM

Quote:

Originally Posted by Pokeeng (Post 10151850)
'---------------

#org 0x80377D

msgbox 0x88037F2 MSG_NORMAL '"Good. That makes two. Soon Jirachi..."

msgbox 0x880383A MSG_NORMAL '"[blue_fr]I think someone is here."

msgbox 0x8803876 MSG_NORMAL '"Seems we have a guest.\pTake care ..."

applymovement 0x2 0x8803873

waitmovement 0x2

applymovement MOVE_PLAYER 0x88038A9

waitmovement 0xFF

applymovement 0x2 0x88038AE

waitmovement 0x2

applymovement 0x1 0x88038BA

waitmovement 0x1

hidesprite 0x2

setvar 0x4046 0x4

setflag 0x1246

trainerbattle 0x2 0x8 0x0 0x88038C2 0x88038E2 0x88037DD

release

end



'---------------

#org 0x8037DD

msgbox 0x88038F7 MSG_NORMAL '"[blue_fr]Hm. I'll have to tell the..."

fadescreen 0x1

setflag 0x1248

hidesprite 0x1

fadescreen 0x0

release

end





'---------

' Strings

'---------

#org 0x8037F2

= Good. That makes two. Soon Jirachi\nwill come straight to us.



#org 0x80383A

= [blue_fr]I think someone is here.



#org 0x803876

= Seems we have a guest.\pTake care of that for me.



#org 0x8038C2

= [blue_fr]Just following orders.



#org 0x8038E2

= This is a problem.



#org 0x8038F7

= [blue_fr]Hm. I'll have to tell the\nothers.





'-----------

' Movements

'-----------

#org 0x803873

#raw 0x0 'Face Down

#raw 0xFE 'End of Movements



#org 0x8038A9

#raw 0x1D 'Step Down (Fast)

#raw 0x1D 'Step Down (Fast)

#raw 0x1F 'Step Left (Fast)

#raw 0x3 'Face Right

#raw 0xFE 'End of Movements



#org 0x8038AE

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x13 'Step Right (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0xFE 'End of Movements



#org 0x8038BA

#raw 0x13 'Step Right (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x10 'Step Down (Normal)

#raw 0x2 'Face Left

#raw 0xFE 'End of Movements

Instead of using "trainerbattle 0x2", use "trainerbattle 0x3".

Pokeeng April 27th, 2020 1:35 PM

I may have to rewrite it because it's giving me a too many parameters error when I change it to 0x9 but not if I leave it at 0x2. I'll rewrite it and try what you said. Would I be having it call the same flag as the script or a different flag to signal the blockade to disappear?

Pyxal April 27th, 2020 3:30 PM

Quote:

Originally Posted by Pokeeng (Post 10151882)
I may have to rewrite it because it's giving me a too many parameters error when I change it to 0x9 but not if I leave it at 0x2. I'll rewrite it and try what you said. Would I be having it call the same flag as the script or a different flag to signal the blockade to disappear?

Oh man... I feel generous right now. You can do something else and I will rewrite it correctly some time later and send it.

Pokeeng April 27th, 2020 3:53 PM

I did rewrite it and it still doesn't let me rematch him but the roadblock does move and he does vanish if I lose. I'm half considering leaving this in and it just be a match that if you lose, you lose. I tried comparing it to something like Gary in Silph Co. or on SS Anne and I may just have to settle.

If you did do that for me though, that would be incredible and I would be so grateful.

Pyxal April 27th, 2020 5:46 PM

Quote:

Originally Posted by Pokeeng (Post 10151923)
I did rewrite it and it still doesn't let me rematch him but the roadblock does move and he does vanish if I lose. I'm half considering leaving this in and it just be a match that if you lose, you lose. I tried comparing it to something like Gary in Silph Co. or on SS Anne and I may just have to settle.

If you did do that for me though, that would be incredible and I would be so grateful.

So you want to be able to re-battle him? After whiting out?

Pokeeng April 27th, 2020 6:07 PM

Yes

Pyxal April 27th, 2020 6:41 PM

Quote:

Originally Posted by Pokeeng (Post 10151958)
Yes

Oh, okay. Be right back.

Pyxal April 27th, 2020 7:13 PM

Quote:

Originally Posted by Pokeeng (Post 10151958)
Yes

Here you go:
Code:

#dynamic 0x(Your Offset)

#org @start
lock
msgbox @msg1 0x2
msgbox @msg2 0x2
msgbox @msg3 0x2
waitmsg
applymovement 0x2 @move1
waitmovement 0x0
applymovement 0xFF @move2
waitmovement 0x0
applymovement 0x2 @move3
waitmovement 0x0
applymovement 0x1 @move4
waitmovement 0x0
hidesprite 0x2
msgbox @ext 0x2
trainerbattle 0x3 0x148 0x0 @after
msgbox @msg5 0x2
fadescreen 0x1
setflag 0x1248
hidesprite 0x1
fadescreen 0x0
setvar 0x4046 0x4
setflag 0x1246
release
end

'---------
' Strings
'---------

#org @msg1
= Good. That makes two. Soon Jirachi\nwill come straight to us.

#org @msg2
= [blue_fr]I think someone is here.

#org @msg3
= Seems we have a guest.\pTake care of that for me.

#org @ext
= [blue_fr]Just following orders.

#org @after
= This is a problem.

#org @msg5
= [blue_fr]Hm. I'll have to tell the\nothers.

'-----------
' Movements
'-----------

#org @move1
#raw 0x0 'Face Down
#raw 0xFE 'End of Movements

#org @move2
#raw 0x1D 'Step Down (Fast)
#raw 0x1D 'Step Down (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x3 'Face Right
#raw 0xFE 'End of Movements

#org @move3
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0xFE 'End of Movements

#org @move4
#raw 0x13 'Step Right (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x2 'Face Left
#raw 0xFE 'End of Movements


Remember, "trainerbattle 0x3" checks this type of scenario. Oh, and I changed the battle to my fitting. I forgot to correct it. Sorry!
Hope this clears things up!

Pokeeng April 27th, 2020 7:36 PM

It definitely works! Thank you so much! Unfortunately the dialogue remains with the hidesprites still in effect but I can work around that to make it fit. You've definitely helped me with figuring it out for future scripts as well. Thanks again!

Pyxal April 27th, 2020 7:38 PM

Quote:

Originally Posted by Pokeeng (Post 10152016)
It definitely works! Thank you so much! Unfortunately the dialogue remains with the hidesprites still in effect but I can work around that to make it fit. You've definitely helped me with figuring it out for future scripts as well. Thanks again!

Oh, for that, you just need to assign a value to the person event and after using "hidesprite", you set the flag of the same number as the value of the Person ID.

Pokeeng April 27th, 2020 7:47 PM

So that would have the NPC I battle standing in the spot he walked to when I return?

Pyxal April 27th, 2020 7:52 PM

Quote:

Originally Posted by Pokeeng (Post 10152020)
So that would have the NPC I battle standing in the spot he walked to when I return?


Like this:
Code:

#dynamic 0x(Your Offset)

#org @start
lock
msgbox @msg1 0x2
msgbox @msg2 0x2
msgbox @msg3 0x2
waitmsg
applymovement 0x2 @move1
waitmovement 0x0
applymovement 0xFF @move2
waitmovement 0x0
applymovement 0x2 @move3
waitmovement 0x0
applymovement 0x1 @move4
waitmovement 0x0
hidesprite 0x2
setflag 0x(whatever Person ID the "0x2" person event has)
msgbox @ext 0x2
trainerbattle 0x3 0x148 0x0 @after
msgbox @msg5 0x2
fadescreen 0x1
setflag 0x1248
hidesprite 0x1
setflag 0x(whatever Person ID the "0x1" person event has)
fadescreen 0x0
setvar 0x4046 0x4
setflag 0x1246
release
end

'---------
' Strings
'---------

#org @msg1
= Good. That makes two. Soon Jirachi\nwill come straight to us.

#org @msg2
= [blue_fr]I think someone is here.

#org @msg3
= Seems we have a guest.\pTake care of that for me.

#org @ext
= [blue_fr]Just following orders.

#org @after
= This is a problem.

#org @msg5
= [blue_fr]Hm. I'll have to tell the\nothers.

'-----------
' Movements
'-----------

#org @move1
#raw 0x0 'Face Down
#raw 0xFE 'End of Movements

#org @move2
#raw 0x1D 'Step Down (Fast)
#raw 0x1D 'Step Down (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x3 'Face Right
#raw 0xFE 'End of Movements

#org @move3
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0xFE 'End of Movements

#org @move4
#raw 0x13 'Step Right (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x2 'Face Left
#raw 0xFE 'End of Movements



Pokeeng April 27th, 2020 8:14 PM

The dialogue still seems to plays out no matter what I try. I really do appreciate your help but you don't have to keep trying. I'll try and figure a way out to make it work.

Pyxal April 27th, 2020 8:59 PM

Quote:

Originally Posted by Pokeeng (Post 10152029)
The dialogue still seems to plays out no matter what I try. I really do appreciate your help but you don't have to keep trying. I'll try and figure a way out to make it work.

Which dialogue are you talking about, though?

Pokeeng April 27th, 2020 9:05 PM

The dialogue that plays out before the battle

Pyxal April 27th, 2020 9:17 PM

Quote:

Originally Posted by Pokeeng (Post 10152045)
The dialogue that plays out before the battle

But you can just remove the pointers, right?
EDIT: Oh, okay. You mean the dialogue screen remains there?

Pokeeng April 27th, 2020 9:24 PM

Specifically, the script will play out like normal and then when I lose and go back, the script will replay itself when I step on the designated tile but the one that gets hidden first is still hidden upon going back and his dialogue plays like normal

Pokeeng April 27th, 2020 9:25 PM

I believe I have the non compiled script if that might help

Pyxal April 27th, 2020 9:40 PM

Quote:

Originally Posted by Pokeeng (Post 10152049)
Specifically, the script will play out like normal and then when I lose and go back, the script will replay itself when I step on the designated tile but the one that gets hidden first is still hidden upon going back and his dialogue plays like normal

There is a way around this. But you can also make the script as though the other person is watching the battle. Or just:
Code:

#dynamic 0x(Your Offset)

#org @start
lock
checkflag 0x(WHATEVER YOU WANT)
if 0x1 goto @already
msgbox @msg1 0x2
msgbox @msg2 0x2
msgbox @msg3 0x2
waitmsg
applymovement 0x2 @move1
waitmovement 0x0
applymovement 0xFF @move2
waitmovement 0x0
applymovement 0x2 @move3
waitmovement 0x0
applymovement 0x1 @move4
waitmovement 0x0
hidesprite 0x2
setflag 0x(whatever Person ID the "0x2" person event has)
msgbox @ext 0x2
setflag 0x(WHATEVER YOU WANT, BUT SHOULD BE SAME AS THE ONE ABOVE IN "checkflag")
trainerbattle 0x3 0x8 0x0 @after
msgbox @msg5 0x2
fadescreen 0x1
setflag 0x1248
hidesprite 0x1
setflag 0x(whatever Person ID the "0x1" person event has)
fadescreen 0x0
setvar 0x4046 0x4
setflag 0x1246
release
end

#org @already
msgbox @ext2 0x2
trainerbattle 0x3 0x8 0x0 @after
msgbox @msg5 0x2
fadescreen 0x1
setflag 0x1248
hidesprite 0x1
setflag 0x(whatever Person ID the "0x1" person event has)
fadescreen 0x0
setvar 0x4046 0x4
setflag 0x1246
release
end

'---------
' Strings
'---------

#org @msg1
= Good. That makes two. Soon Jirachi\nwill come straight to us.

#org @msg2
= [blue_fr]I think someone is here.

#org @msg3
= Seems we have a guest.\pTake care of that for me.

#org @ext
= [blue_fr]Just following orders.

#org @ext2
= [blue_fr]Hunh? You came back?\nWhy you...

#org @after
= This is a problem.

#org @msg5
= [blue_fr]Hm. I'll have to tell the\nothers.

'-----------
' Movements
'-----------

#org @move1
#raw 0x0 'Face Down
#raw 0xFE 'End of Movements

#org @move2
#raw 0x1D 'Step Down (Fast)
#raw 0x1D 'Step Down (Fast)
#raw 0x1F 'Step Left (Fast)
#raw 0x3 'Face Right
#raw 0xFE 'End of Movements

#org @move3
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x13 'Step Right (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0xFE 'End of Movements

#org @move4
#raw 0x13 'Step Right (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x10 'Step Down (Normal)
#raw 0x2 'Face Left
#raw 0xFE 'End of Movements



Pokeeng April 27th, 2020 9:52 PM

It definitely worked! He does remain in his starting position when you go back but I should be able to solve that with a movement script added to the dialogue.

Pokeeng April 27th, 2020 10:16 PM

Good news! It works perfectly now. Thank you so much for all your help and time and I will make sure to credit you when it's done in a few months!


All times are GMT -8. The time now is 2:21 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.