View Single Post
Old 19th August 2014, 03:26 AM  
Dark Sneasel
Anti-Swag
 
Join Date: Oct 2013
Location: Miami, FL
Age: 18
Posts: 42
Dark Sneasel
Default Controllable Boats in Gen 3 Games

In my hack, I needed a scene in which the player gets on multiple boats. However, I didn't want to go with the same old thing as in RSE, where someone drives the boat for you, I decided to make a few scripts where you control the boat! I'm gonna share it here, and explain it for others to use. Now, I usually don't ask for credit, but if you decide to use this, please credit me, it took me a while to make this.

Anyways, here's a few things to note before you get started:
  • If the player has surf and/or fly in his/her party, this will cause problems, so I suggest disabling them, or making events like these happen before (s)he has access to those things.
  • You need a fair amount of scripting knowledge to do this. I will be going over some things, but I'd preffer you don't copy and paste.

Okay, now let's get started. Here's what I mean by controllable boats:



(You can't really tell since that's a video, but the player controls it after he gets on)

Okay, let's get started. First of all, here is my map and the events in it.

Spoiler:


Don't mind the person events and warps at the top left side of the map, and the mess everywhere, I just haven't done a lot of work in this map yet.

I'm also going to admit that some script tiles were just added later due to mistakes on my part, after all, this was my first time making the boat scripts.

I will only be going over how to make two; if you want more, you're gonna have to do it yourself.



Those things are necessary for the first boat.

Okay, first, let's look at the script for the person event with the black outline. Here is his script:

Code:
'---------------
#org 0xE5FAE1
lock
faceplayer
checkflag 0x8BB
if 0x1 goto 0x8E5FBCC
msgbox 0x8E5FB6A MSG_YESNO '"Sometimes people need to get to\nt..."
compare LASTRESULT 0x1
if 0x1 goto 0x8E64A82
msgbox 0x8E5FB53 MSG_NORMAL '"Arr[.] That's a shame!"
release
end

'---------------
#org 0xE5FBCC
msgbox 0x8E5FBD7 MSG_NORMAL '"Arr[.] I love me boat!"
release
end

'---------------
#org 0xE64A82
clearflag 0x8C0
setvar 0x4060 0x1
hidesprite 0x6
hidesprite 0x3
hidesprite 0x5
setflag 0x1233
setflag 0x1234
setflag 0x1235
setflag 0x1236
applymovement 0x1 0x8E5FB50
waitmovement 0x0
applymovement 0x1 0x8E5FB50
hidesprite 0x1
applymovement MOVE_PLAYER 0x8E5FB50
waitmovement 0x0
applymovement MOVE_PLAYER 0x8E5FB50
waitmovement 0x0
applymovement MOVE_PLAYER 0x8E5FB50
waitmovement 0x0
hidesprite 0xFF
hidesprite 0x4
showsprite 0x4
release
end


'---------
' Strings
'---------
#org 0xE5FB6A
= Sometimes people need to get to\nthe other parts of the islands.\lWanna use me boat to get there?

#org 0xE5FB53
= Arr[.] That's a shame!

#org 0xE5FBD7
= Arr[.] I love me boat!


'-----------
' Movements
'-----------
#org 0xE5FB50
#raw 0x8 'Step Down (Normal)
#raw 0xFE 'End of Movements
0x1 = the old guy
0xFF = player
0x4 = boat


Okay, so you will see that there are a lot of hidesprites and setflags. Don't mind some of those, that was because I did more boats than I will in this tutorial. Now I'm going to explain the script in detail.

Code:
'---------------
#org 0xE5FAE1
lock
faceplayer
checkflag 0x86A //fifth gym flag, I'm pretty sure. This is a check if player already has it, and if he/she does then there is no need for the script/
if 0x1 goto 0x8E5FBCC
msgbox 0x8E5FB6A MSG_YESNO '"Sometimes people need to get to\nt..."
compare LASTRESULT 0x1
if 0x1 goto 0x8E64A82 //the actual getting on the boat and stuff
msgbox 0x8E5FB53 MSG_NORMAL '"Arr[.] That's a shame!"
release
end
Now let's take a look at this part:

Code:
'---------------
#org 0xE64A82
clearflag 0x8C0 //running shoes flag. It's enabled again when you get off.
setvar 0x4060 0x1 //There will be script tiles in the water that are activated if that var is set to 1.
hidesprite 0x6 //other boat
hidesprite 0x3 //other boat
hidesprite 0x5 //other boat
setflag 0x1233 //flag for other boat
setflag 0x1234 //flag for other boat
setflag 0x1235 //flag for other boat
setflag 0x1236 //flag for other boat
applymovement 0x1 0x8E5FB50
waitmovement 0x0
applymovement 0x1 0x8E5FB50
hidesprite 0x1
applymovement MOVE_PLAYER 0x8E5FB50
waitmovement 0x0
applymovement MOVE_PLAYER 0x8E5FB50
waitmovement 0x0
applymovement MOVE_PLAYER 0x8E5FB50
waitmovement 0x0
hidesprite 0xFF
hidesprite 0x4
showsprite 0x4
release
end
(The boat and the old guy's flag is 1232)

Now. let's take a look at the script tile in the water. Keep in mind that the script only happens if var 0x4060 = 0x1.

Code:
'---------------
#org 0xE63302
lock
msgbox 0x8E63323 MSG_YESNO '"Do you wanna get off the boat?"
compare LASTRESULT 0x1
if 0x1 goto 0x8E63344
release
end

'---------------
#org 0xE63344
msgbox 0x8E63378 MSG_KEEPOPEN '"See ya, matey!"
setflag 0x8C0 //running shoes
setvar 0x4060 0x0 //sets the var back
showsprite 0xFF 
fadescreen 0x1
clearflag 0x1232 //old man's and boat's flag
showsprite 0x1 //old man
showsprite 0x4 //boat
closeonkeypress
warpmuted 0x0 0x2 0x7 0xF 0x11 //This HAS to be there. I'll explain it soon.
fadescreen 0x0
release
end


'---------
' Strings
'---------
#org 0xE63323
= Do you wanna get off the boat?

#org 0xE63378
= See ya, matey!
Now let's take a look at the warp in there. (warp #7 in my map)
Put a warp tile the place where you want the player to get off after choosing. Make sure to put it on a tile that does NOT have the warp behavior byte.

Now in the previous script, you saw this:

warpmuted 0x0 0x2 0x7 0xF 0x11

Warp muted goes like this:

warpmuted 0x(bank) 0x(bank) 0x(warp #) 0x(X) 0x(Y)

I don't think I have to explain much there.

Now, if you were to put those scripts in a rom, and test them out, they would work perfectly. But that is just for one boat, now we have to do another boat!



First of all, let's focus on the two easiest ones, the ones in the water.

I made them have the same script offset. (They only happen when var 0x4060 = 1)

Code:
'---------------
#org 0xE63DAD
lock
msgbox 0x8E63323 MSG_YESNO '"Do you wanna get off the boat?"
compare LASTRESULT 0x1
if 0x1 goto 0x8E63DD4
release
end

'---------------
#org 0xE63DD4
msgbox 0x8E63378 MSG_KEEPOPEN '"See ya, matey!"
setflag 0x8C0
setvar 0x4060 0x0
showsprite 0xFF
fadescreen 0x1
clearflag 0x1232
showsprite 0x4
showsprite 0x1
setflag 0x1233
hidesprite 0x6
closeonkeypress
warpmuted 0x0 0x2 0x8 0x1D 0x19
fadescreen 0x0
release
end


'---------
' Strings
'---------
#org 0xE63323
= Do you wanna get off the boat?

#org 0xE63378
= See ya, matey!
I don't think I need to explain that. (there is a warpmuted in that area, my bad for not showing it, oops)

Now let's take a look at the other script tile. (happens when var 0x4060 = 0.)

Code:
'---------------
#org 0xE5FEEB
lock
msgbox 0x8E5FD01 MSG_YESNO '"[green_em]Hmm[.] I need to find a ..."
compare LASTRESULT 0x1
if 0x1 goto 0x8E5FFB6
release
end

'---------------
#org 0xE5FFB6
pokenavcall 0x8E5FD50 '"Arr[.] Ye need a ride? I'll be\nth..."
waitmsg
goto 0x8E63477

'---------------
#org 0xE63477
clearflag 0x8C0 //running shoes
setvar 0x4060 0x1
special 0x116 //0x113 for FR
applymovement MOVE_CAMERA 0x8E5FD7F
waitmovement 0x0
applymovement 0x1 0x8E5FB50
waitmovement 0x0
applymovement 0x1 0x8E5FB50
hidesprite 0x1 //old guy
applymovement MOVE_CAMERA 0x8E5FCF3
applymovement 0x4 0x8E5FCF3
waitmovement 0x0
special 0x117 //0x114 in FR
msgbox 0x8E5FCD0 MSG_NORMAL '"Get on, ye kid!"
applymovement MOVE_PLAYER 0x8E5FCCD
waitmovement 0x0
applymovement MOVE_PLAYER 0x8E5FCCD
fadescreen 0x1
hidesprite 0xFF
setflag 0x1232 //flag for old guy and boat #1
hidesprite 0x4 //boat #1
clearflag 0x1233 //flag for boat #2
hidesprite 0x6 //boat #2
showsprite 0x6
fadescreen 0x0
release
end


'---------
' Strings
'---------
#org 0xE5FD01
= [green_em]Hmm[.] I need to find a way\nthere. Should I call the old man\lwith the boat?

#org 0xE5FD50
= Arr[.] Ye need a ride? I'll be\nthere in a sec!

#org 0xE5FCD0
= Get on, ye kid!


'-----------
' Movements
'-----------
#org 0xE5FD7F
#raw 0x9 'Step Up (Normal)
#raw 0x9 'Step Up (Normal)
#raw 0x9 'Step Up (Normal)
#raw 0x9 'Step Up (Normal)
#raw 0xA 'Step Left (Normal)
#raw 0xA 'Step Left (Normal)
#raw 0xA 'Step Left (Normal)
#raw 0xA 'Step Left (Normal)
#raw 0xA 'Step Left (Normal)
#raw 0xA 'Step Left (Normal)
#raw 0xA 'Step Left (Normal)
#raw 0xA 'Step Left (Normal)
#raw 0xFE 'End of Movements

#org 0xE5FB50
#raw 0x8 'Step Down (Normal)
#raw 0xFE 'End of Movements

#org 0xE5FCF3
#raw 0x8 'Step Down (Normal)
#raw 0x8 'Step Down (Normal)
#raw 0x8 'Step Down (Normal)
#raw 0x8 'Step Down (Normal)
#raw 0xB 'Step Right (Normal)
#raw 0xB 'Step Right (Normal)
#raw 0xB 'Step Right (Normal)
#raw 0xB 'Step Right (Normal)
#raw 0xB 'Step Right (Normal)
#raw 0xB 'Step Right (Normal)
#raw 0xB 'Step Right (Normal)
#raw 0xB 'Step Right (Normal)
#raw 0xFE 'End of Movements

#org 0xE5FCCD
#raw 0xA 'Step Left (Normal)
#raw 0xFE 'End of Movements
So I think that's about it. I'll be happy to answer any questions

And lastly, I wanna thank Josefig for giving me the idea of doing warpmuted for getting off the boat
Dark Sneasel is offline  
Likes ~Mustafa~, MakoReactor liked this post