Gw Temp

Menu

Tutorial - 'Multiplayer System in Rm2k3' by Axel

An item about RPGMaker 2000 posted on

Blurb

Axel teaches us how to make a multiplayer system in the normally limited engine!

Body

A new tutorial from me! This is a new multiplayer system. It’s kinda like the old one, but this one’s better.
With this multiplayer system you can play with up to 4 players on the same time. Every player can walk in every direction and has his own action button. Player 2, 3 and 4 can’t walk out of the screen.

You need:
Ø rm2k(3)
Ø an event for player 2, an event for player 3 and an event for player 4 in every map
Ø 3 variables and for every player 4 more
Ø … to know how variables, input key, fork conditionings and coordinates work

Index
Step 1 The needed explanations about this tutorial
Step 2 First event commands with explaining
Step 3 Second event commands with explaining
Step 4 Complete first common event
Step 5 Action button
Step 6 Explaining other common events and ending tutorial

Step 1 The needed explanations about this tutorial
Well, if you want to use this system in your game you must now create a new game and use it, or only use this in not more than a few maps. That’s because in every map event 0001 must be player 2. In every map event 0002 must be player 3 and in every map event 0003 must be player 4, even in maps where those players doesn’t participate. Otherwise this won’t work! In maps where those players don’t participate you should create those events, without a graphic.
Now for the explanations of the event conditions. In this tutorial we will use input key and fork conditionings for checking which button you’ve pressed. For checking if the player doesn’t walk out of the screen, we must use the coordinates. If you do not know how these work, do not try this tutorial, then this will be too hard for you.
So now, we will work in a common event. We will need one common event for every player. Also, every player will use 4 variables.
So now the explanations about this tutorial are done, let’s go to the explanations about the event commands.

Step 2 First event commands with explaining
First, create event 0001 in the first map. Second, create the common event for player 2.
As you already read we will use coordinates for checking if the players don’t walk out of the screen. So first, let’s store the heroes coordinates in V[0001: X position hero] and V[0002: Y position hero], and the coordinates of player 2 (so that’s the coordinates of EV0001) in V[0003: X position player 2] and V[0004: Y position player 2].
So now we will make an input key. First, think of which button you want player 2 to use to walk. In this tutorial, player 2 can walk to the left with 1, down with 2, up with 3 and right with 4 and the action button is 5.
Put the input key. Store it in V[0005: Player 2 buttons]. Wait for the key stroke and just check the buttons you want player 2 to use (so in this tutorial the numbers).
Then check if that button is the button you want player 2 to use to walk to the left. So in this tutorial we will check now if we pressed button number 1. We must check then if that variable is 11 ( the number + 10). And then… the more difficulty part starts.

The event commands till now:
<>Variable: V[0001: X position hero] Set, Hero, X coord.
<>Variable: V[0002: Y position hero] Set, Hero, Y coord.
<>Variable: V[0003: X position player 2] Set, Player 2, X coord.
<>Variable: V[0004: Y position player 2] Set, Player 2, Y coord.
<>Input key: V[0005: Player 2 walks]
<>If: V[0005: Player 2 walks], 11

Step 3 Second event commands with explaining
Okay, so now we have checked the coordinates, and we checked if player 2 has pressed the button for walking to the left.
We know, if you walk to the left, your X-coordinate changes. It decreases with 1. So for checking if player 2 doesn’t walk so far to the left that he walks out of the screen, we must check if the X-coordinate of player 2 isn’t that much different from the X-coordinate from the hero. He can walk 9 squares from the hero to the left at highest.
But how do we check that? We will need an extra variable for that: V[0006: X hero + – X player2]. First we must set it to the X-coordinate of the hero. We must check if the X-coordinates aren’t higher than 8. 8, not 9, because if it is 8 and you walk to the left it is 9. If it is 9 and you walk to the left you walk out of the screen. Because your X-coordinates decreases with 1 when you walk to the left, we must decrease variable 0006 with 8. If you can’t follow this, read this again. It’s very important for you to understand this, otherwise you can’t complete this tutorial!
Now we have the X-coordinate of player 2 and this new variable, which is the maximum player 2 can walk in X-coordinates. So player 2 can’t walk to the left if the difference between his X-coordinate and the heroes X-coordinate is too big. That means: Player 2 can only walk to the left if that new variable (variable 6) is less than the X-coordinate of player 2 (variable 3). If variable 6 is not less than variable 3, player 2 can’t walk to the left, so we should let him face to the left.

The event commands till now:
<>Variable: V[0001: X position hero] Set, Hero, X coord.
<>Variable: V[0002: Y position hero] Set, Hero, Y coord.
<>Variable: V[0003: X position player 2] Set, Player 2, X coord.
<>Variable: V[0004: Y position player 2] Set, Player 2, Y coord.
<>Input key: V[0005: Player 2 walks]
<>If: V[0005: Player 2 walks], 11
…<>Variable: V[0006: X hero + – X player2] Set, Hero, X coord.
…<>Variable: V[0006: X hero + – X player2] –, 8
…<>If: V[0006: X hero + – X player2], V[0003], (<)
……<>Move event: Player 2 , Move left
……<>

……<>Move event: Player 2 , Face left
……<>




Step 4 Complete first common event
So, now we made player 2 can walk to the left. But of course player 2 can walk in other directions too. Now, we will make that player 2 can walk down. So we first should check if that variable V[0005: player 2 walks] is 12 (or if you use another key, check if it is another number). If you walk down, your Y position will slightly increase with 1. So we should create a new variable, for checking if the Y-coordinate of player 2 isn’t that much different from the heroes. We should create V[0007: Y hero + – Y player2]. First, we set it to the Y-position of the hero. Player 2 can’t walk more than 6 squares down compared with the heroes Y-position. When you walk down your Y position increases so we should variable 7 count up with 6. If that new variable is more than the variable of the Y position of player 2, player 2 can walk down. If not, player 2 should face down.
Player 2 can also walk up. So we should check if V[0005: player 2 walks] is 13 (or another key). When you walk up your Y position decreases. Set V[0007: Y hero + – Y player2] to the heroes Y position. Now first think. Do you want that player 2 can walk so that’s he completely in sight, or walk till the upper square, so that you can only see him half? Decrease the variable with 5 for completely in sight, decrease the variable with 6 for the upper square. Player 2 can only walk up if variable 7 is less than his Y position. If not he faces up.
Player 2 can walk right. Check is variable 5 is 14. When you walk right your X position increases. Set variable 6 to the heroes X position. Count up with 9. If variable 6 is more than the X position of player 2, player 2 walks to the right. If not, he faces right.
At last, player 2 has an action button. Do not place anything for this in this common event.

The event commands till now:
<>Variable: V[0001: X position hero] Set, Hero, X coord.
<>Variable: V[0002: Y position hero] Set, Hero, Y coord.
<>Variable: V[0003: X position player 2] Set, Player 2, X coord.
<>Variable: V[0004: Y position player 2] Set, Player 2, Y coord.
<>Input key: V[0005: Player 2 walks]
<>If: V[0005: Player 2 walks], 11
…<>Variable: V[0006: X hero + – X player2] Set, Hero, X coord.
…<>Variable: V[0006: X hero + – X player2] –, 8
…<>If: V[0006: X hero + – X player2], V[0003], (<)
……<>Move event: Player 2 , Move left
……<>

……<>Move event: Player 2 , Face left
……<>



…<>If: V[0005: player 2 walks], 12
……<>Variable: V[0007: Y hero + – Y player2] Set, Hero, Y coord.
……<>Variable: V[0007: Y hero + – Y player2] +, 6
……<>If: V[0007: Y hero + – Y player2], V[0004] (>)
………<>Move event: Player 2, Move down
………<>
……
………<>Move event: Player 2, Face down
………<>
……
……<>

……<>If: V[0005: Player 2 walks], 13
………<>Variable: V[0007: Y hero + – Y player2] Set, Hero, Y coord.
………<>Variable: V[0007: Y hero + – Y player2] –, 6
………<>If: V[0007: Y hero + – Y player2], V[0004], (<)
…………<>Move event: Player 2, Move up
…………<>
………
…………<>Move event: Player 2, Face up
…………<>
………
………<>
……
………If: V[0005: Player 2 walks], 14
…………<>Variable: V[0006: X hero + – X player2] Set, Hero, X coord.
…………<>Variable: V[0006: X hero + – X player2] +, 9
…………<>If: V[0006: X hero + – X player2], V[0003] (>)
……………<>Move event: Player 2 , Move right
……………<>
…………
……………<>Move event: Player 2 , Face right
……………<>
…………
End if, till the end of the event commands

Step 5 Action button
This is very simple. If you want an event player 2 can “open”, just set it to “on hero’s touch” and “below hero”. In the event commands, you just do:
<>Input key: V[0005: Player 2 walks]
<>If: V[0005: Player 2 walks], 15
And after this you place what should happen. Ready!

Step 6 Explaining other common events and ending tutorial
You just make the same common event for player 3. You just have to change
Ø the variables. Create new variables (X coord, Y coord, X hero + – X player3, Y hero + – Y player3 and Player 3 walks).
Ø the input keys. Just give him the keys 6, 7, 8, 9, and 0 for example.
Ø the move event. Do not let player 2 walk, but player 3.
And do the very same for player 4. Then you finished this tutorial. There’s just one thing you must NOT forget: In every map in your game, EV0001 has to be player 2, EV0002 has to be player 3 and EV0003 has to be player 4. In maps where those player don’t play, place invisible events for them.

If you’ve understood all this you can also create objects you can control. Just do not use a common event but a normal event.

This new multiplayer system has been written by Axel. If you have any critic, suggestions or found any bugs, let me know somehow (on the forum for example).
I hope this has helped you… Now on to the next tutorial!

Axel