FISHING SYSTEM

Want to reward button mashing? Here's how!

What I'm providing here is just a bare bones coding for a Legend of Zelda: Ocarina of Time style fishing mini game. So what exactly does that mean? It means that you will have to fill in where you want your animations/pictures. This is just how your game will function.

Everything here will be tied to one large map event, so map accordingly! Go ahead and make the first page below hero and autostart.

Begin your event by placing a Label (just use Label 1) at the top (found on the third page of the event commands). First of all, you need to cast your rod, which is triggered by your Action button (let's call it the spacebar for now, which is tied to the number 5). Go ahead and use a Key Input Processing command, checking only the action button, followed by a conditional branch that checks for a variable value for the corresponding key. After casting, we will then determine if the player lands a fish or if nothing but water comes up. You could, of course, have alternative items that pop up instead of fish, but for now we'll just work with getting fish or nothing at all. A simple randomized variable will give us what we're looking for. So the code doesn't go farther than we want, put a Jump to Label command (Label 1) after the conditional branch. I know I'm speaking in abstracts here, but take a look at the code we have thus far:

Label 1

Key Input Processing *This checks for the key you're pressing*
Branch if Var[0001:Fishing] is equal to 5 *or the number that corresponds to your key*
Variable Oper Var[0002:FishType] set Rand 1-5 *use whatever range you'd like*
Jump to Label 1


All we have done here is throw out our line and rolled the dice to see what kind of fish we have. For this case, we'll have "1" give us a fish and the other numbers give us nothing.

First, go back into your conditional branch and Jump to Label 2. Right after the "Jump to Label 1" command, put Label 2. I know it's messy, but here's what you're looking at:

 Label 1

Key Input Processing *This checks for the key you're pressing*
Branch if Var[0001:Fishing] is equal to 5 *or the number that corresponds to your key*
Variable Oper Var[0002:FishType] set Rand 1-5 *use whatever range you'd like*
Jump to Label 2
Jump to Label 1
Label 2


Adding to the bottom of our commands, put a conditional branch that checks for your fish. In our example, we use the value "1" to represent getting a fish and the number "2" through "5" to represent getting absolutely nothing. It doesn't matter which instance you check for first, but we will check for getting nothing in this tutorial. I would put a wait command here just for aesthetics. After all, who would want to get a failure message the second they put the rod in the water? Immediately after the wait, give them the failure message and ask if they'd like to try again. If they do, Jump to Label 1. If they do not, Jump to Label 3. We don't have it yet, but we'll be putting Label 3 at the very bottom of the event.

I realize that this isn't exactly like Ocarina of Time, but if you would like your players sitting there waiting for a fish, that's fine by me.

Here's what we got so far:

  Label 1

Key Input Processing *This checks for the key you're pressing*
Branch if Var[0001:Fishing] is equal to 5 *or the number that corresponds to your key*
Variable Oper Var[0002:FishType] set Rand 1-5 *use whatever range you'd like*
Jump to Label 2
Jump to Label 1
Label 2
Branch if Var[0002:FishType] is equal to or greater than 2 *your failure range*
Wait 5.0 seconds
Message: Doesn't seem to be a bite, try again?
Show Choices (Of course, No thank you)
Of course handler
Jump to Label 1
No thank you handler
Jump to Label 3


Now comes the tricky part, actually catching the fish. If you are unfamiliar with OoT, you effectively press your action button repeatedly to catch. With a little bit of trickery, we can make this work in an event.

Outside of your failure branch, put a new branch for your success range, which in our case is just the value "1." Again, I would put a wait command here for realism. Go ahead and show your animation for the fish getting to the line here too. After this, go ahead and alerty your player with a message that they have a fish on the line. Give them the instructions here as well. Finally, set timer 1 (or timer 2, doesn't matter) to the time the player has to button mash and then start the timer. Before I go further, here's what we have.

*Note* Sometimes rm2k3 has a hard time handling small time values like this. To play it safe, you can set the timer to 2 Minutes and use 1 minute, 50 seconds as the stopping point.*Note*

   Label 1

Key Input Processing *This checks for the key you're pressing*
Branch if Var[0001:Fishing] is equal to 5 *or the number that corresponds to your key*
Variable Oper Var[0002:FishType] set Rand 1-5 *use whatever range you'd like*
Jump to Label 2
Jump to Label 1
Label 2
Branch if Var[0002:FishType] is equal to or greater than 2 *your failure range*
Wait 5.0 seconds
Message: Doesn't seem to be a bite, try again?
Show Choices (Of course, No thank you)
Of course handler
Jump to Label 1
No thank you handler
Jump to Label 3
Branch if Var[0002:FishType] is equal to 1 *your success range*
Wait 5.0 seconds
Message: Something's on the line! Press spacebar repeatedly to bring it up!
Set Timer 1: 10 seconds
Start Timer 1


Still inside this latest conditional branch, put a Loop. Inside of the loop, start by adding a conditional branch that checks if the timer is at zero (or the higher value that I talked about in the note above). If it is, break the loop. After that conditional branch, put a Key Input Processing command that again is checking for your action key. Make sure that "Wait Until Pressed" is checked. Go ahead and make another conditional branch that checks for the corresponding number. For this example, we can go ahead and reuse our previous "Fishing" variable. Inside of that conditional branch, increase a new variable by +1. This will check to see how many times the player mashes that button. Here's the code!

	Label 1

Key Input Processing *This checks for the key you're pressing*
Branch if Var[0001:Fishing] is equal to 5 *or the number that corresponds to your key*
Variable Oper Var[0002:FishType] set Rand 1-5 *use whatever range you'd like*
Jump to Label 2
Jump to Label 1
Label 2
Branch if Var[0002:FishType] is equal to or greater than 2 *your failure range*
Wait 5.0 seconds
Message: Doesn't seem to be a bite, try again?
Show Choices (Of course, No thank you)
Of course handler
Jump to Label 1
No thank you handler
Jump to Label 3
Branch if Var[0002:FishType] is equal to 1 *your success range*
Wait 5.0 seconds
Message: Something's on the line! Press spacebar repeatedly to bring it up!
Set Timer 1: 10 seconds
Start Timer 1
Loop
Branch if Timer 1 is 0
Break Loop
Key Input Processing
Branch if Var[0001:Fishing] is 5 *your action key value*
Variable Oper Var[0003:Mashing] +1
End Loop


Last few steps! Make a new conditional branch outside of that one that checks if your Mashing variable is enough to catch a fish! For this example, let's say that you needed to press the action key 20 times to catch the fish. If the condition is met, immediately set your Mashing variable to 0 and do whatever you want do demonstrate that the player caught a fish. If the condition is not met, still set the Mashing variable to 0 and handle as necessary. In this case, we'll ask the player if he wants to try again in both instances.

After that conditional branch, put Label 3 and whatever exit handler you want. I can be relatively certain that you'll be teleporting out of this map, but do whatever fits your game. Here is the final code, good job!

	 Label 1

Key Input Processing *This checks for the key you're pressing*
Branch if Var[0001:Fishing] is equal to 5 *or the number that corresponds to your key*
Variable Oper Var[0002:FishType] set Rand 1-5 *use whatever range you'd like*
Jump to Label 2
Jump to Label 1
Label 2
Branch if Var[0002:FishType] is equal to or greater than 2 *your failure range*
Wait 5.0 seconds
Message: Doesn't seem to be a bite, try again?
Show Choices (Of course, No thank you)
Of course handler
Jump to Label 1
No thank you handler
Jump to Label 3
Branch if Var[0002:FishType] is equal to 1 *your success range*
Wait 5.0 seconds
Message: Something's on the line! Press spacebar repeatedly to bring it up!
Set Timer 1: 10 seconds
Start Timer 1
Loop
Branch if Timer 1 is 0
Break Loop
Key Input Processing
Branch if Var[0001:Fishing] is 5 *your action key value*
Variable Oper Var[0003:Mashing] +1
End Loop
Branch if Var[0001:Mashing] is 20 *times needed to get fish*
Variable Oper Var[0003:Mashing] set 0
Message: You caught a fish! Try again?
Item Fish 1 Add
Else Handler
Variable Oper Var[0003:Mashing set 0
Message: It got away! Try again?
Show Choices (Again!, No thanks)
Again! handler
Jump to Label 1
No thanks handler
Jump to Label 3
Label 3
Hide Screen
Teleport (off map)
Show Screen


And that is how it's done!

Posts

Pages: 1
This looks pretty solid. It seems like it would be pretty easy to modify, as well, to be exactly like OoT or really any other features you could think of to add to a fishing system.
Pages: 1