Tsukihime

Player Switch - Multiple players

56 posts in this topic

Player Switch

Author: Tsukihime

 

AMBps.jpg

 

Overview

 

This script provides you the ability to switch players in-game.

Unlike adding/removing party members to give the illusion that you're working with different people, this script allows you to create completely separate players that have nothing to do with each other.

 

All inventories are separate from each other (until I implement shared inventory), they have their own parties, possibly even their own HUD's.

 

Features

  • Real-time player switching
  • Other players are drawn on the map where you left them
  • Idle players move around randomly
  • Can set up players to say random things
  • Check whether any player is at an event position, or whether a specific player is at an event position.

 

Usage

 

By default, you have one player: you.

You begin by creating a new player, giving an actor ID as the party leader for that player

 

$game_players.create_player(2)

 

You can also choose some custom start position (map Id, x, y) by specifying them when creating the player

 

$game_players.create_player(2, 1, 5, 6)

 

This means you want the player initialized with actor 2 to be placed at map 1 at position (x=5,y=6)

 

Once your player is created, the script will set up all of your party information and your actor information for your new player.

 

Now on the game map, when you press the A key (in-game "X"), it will open the player-switch menu where you can switch players

 

Your other players on the same map will randomly move around and you can even talk to them!

 

pqIkq.jpg

 

The script also supports managing multiple players when it comes to eventing.

 

 

 

These are meant for event conditional branches.

 

1: check for players at position

 

If you want to check whether there are any players at the event's position, you can write

 

any_players_here?

 

This allows you say, have one player stand on a button to keep a door open, switch to another player, and then walk through the door before it closes.

 

hEB8i.jpg

 

2: check for specific player's position

 

Maybe that button can only be pressed by a specific player.

You would write

 

player_here?(player_id)

 

The condition is only satisfied when the specific player is standing at the current event's position.

 

 

 

You also have the option of using moghunter's character select scene for the player switching.

 

W8VpY.jpg

 

You'll need to download a modified char select script as well as placing the resources inside the Graphics/System folder.

 

The actor pictures should be placed in the Pictures folder, using the following filename format

 

<FACE_NAME>-<FACE_INDEX + 1>

 

For example

 

"Actor4-1"

"Monster2-2"

 

It relies on the face pictures, which I think makes sense because if you don't have a face picture, what's the point in having a portrait?

 

Note that ruby is 0-indexed, so the first face is index 0, so I just increased it by 1.

 

Download

 

Script: http://db.tt/WpTtP2yA

 

Modified moghunter's character select: http://db.tt/D6gYYMVF

Resources for the character select scene: http://db.tt/k7zRv7Wl

 

Notes

 

This script provides the basic functionality for player-switching.

I am aiming for full switching functionality where all of the other players are treated as events and you can talk to them and stuff.

 

I would like to create puzzles where you have to control multiple players. For example, maybe you need to step on two buttons at the same time, but this clearly isn't possible with only one player. The solution would be to switch players and coordinate them together. However, that will have to wait until I work out the details.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

I've set it up so that if there are only two players in the game, then pressing the player-switch button will immediately switch to the other player.

 

This allows you to develop fast-paced puzzles where you need to be able to coordinate players quickly and accurately. Like maybe when you push a button, a door opens for 5 seconds and you need to get the other player through.

 

I'm thinking of binding the 1,2,3,4,5 keys to each player as well, but not sure.

 

I'm currently looking into ways to "un-group" and "re-group" actors into separate players and back into a single player. When you talk to one of your other members, they will ask whether you want to "join up" or something.

 

You should also be able to disable certain players from being selected, for example if they are unavailable in the story.

 

Also, two new features available for events.

These are meant for event conditional branches.

 

1: check for players at position

 

If you want to check whether there are any players at the event's position, you can write

 

any_players_here?

 

This allows you say, have one player stand on a button to keep a door open, switch to another player, and then walk through the door before it closes.

 

hEB8i.jpg

 

2: check for specific player's position

 

Maybe that button can only be pressed by a specific player.

You would write

 

player_here?(player_id)

 

The condition is only satisfied when the specific player is standing at the current event's position.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

I think an evented solution to replicate the "any player here?" functionality would be a little messy because it's basically activating a switch when you stand on the button, and then turning it off when you move away from the tile ONLY if you move away through normal walking means...not actor switching or anything.

 

This script also seems to be unsafe. I have experienced crashing and not sure if it's because my computer sucks or the script is doing bad things. I really should let the interpreter handle the switching.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

This is a brilliant script, Tsukihime. Is there any chance there could be an offshoot of it for different party groups? Instead of multiple individual players, the gamer could switch between, say, parties A, B and C which already have a pre-determined number of members?

Share this post


Link to post
Share on other sites

I was wondering, is it possible to disable random movement by inactive players? The puzzle I'm planning is all about positioning, and if they are moving it eliminates the point. I haven't actually used the script yet, so maybe it's already in there. I was just wondering pre-download.

Share this post


Link to post
Share on other sites

I'm not really aware of using scripts... do you simply add the script into the script editor, under materials...and then you do the call? (also the call means adding "$game_players.create_player(2)" into the "script" within events...? )...and if i just said is correct and that is all you must do ...i get an error saying something about the game_interpreter...saying there's an error, "that i cannot add a new key into hash during iteration". Maybe i'm missing something? Or a lot of "somethings" xD...... please enlighten me if you may ^u^? if not... ok :< :3

Share this post


Link to post
Share on other sites

Yes, that's all you do.

 

I've seen that error before but not sure why it would occur when you're creating a new player. Do you have parallel events running in the background? What scripts are you using.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

...actually ...the event itself was on parallel event ;-;...>u<'...didn't know that shouldn't be there >u>'' ...but THANK YOU VERY MUCH ^u^. It works now :3...though i have to "talk to the event" to make it occur, is there any way to make it start at the beginning?(since autorun and parallel process are a no) and again thank you, also an awesome script :3. I might use it when i learn some more about rpg maker, and actually make a game, if that is ok ^u^...of course will give credits :3. Again awesome job :3, will check more of your scripts :D

Share this post


Link to post
Share on other sites

Just turn on a self-switch after you create the players, create a new page with no commands but require self-switch to be turned on.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Thank you, solved that :3...and hopefully last question. The players do not appear on screen until i click the "A" button, then all three are on screen. Is it supposed to be that way? ^^

Share this post


Link to post
Share on other sites

I've seen this before in a PS2 game called Obscure 2, and I thought it was pretty awesome. Especially when each party member had their own special traits that you could utilize for the puzzle. I don't have much use for this in my current project, but I will say I think this is an excellent concept.

Share this post


Link to post
Share on other sites

Here, modified Moghunter's character select as a "better" scene for switching players (download section of the first post)

 

You will need to download a copy of the modified character select script and some layout resources.

 

Instructions are the same as what he wrote in his script.

 

The leader of the party is used for the stats and pictures. Doesn't show the rest of the party, though I guess I could but the design doesn't really allow for any extra little sprites lol

 

The large picture uses the following filename format:

 

<FACE_NAME>-<FACE_INDEX + 1>

 

If you have the Ace bonus pack you'll see that the portrait names are like

 

"Actor4-1", "Actor4-2"

 

So I just based it on that.

post-6060-0-45494800-1344800405_thumb.jpg

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Sorry, Im having an issure when i try to use this script. I put the line in to create the player, and it works, But when i try to switch parties with the 'X' button, it takes me to the character screen.. ie inventory stats ect.. but gives no option to switch to another player... I hope im being specific enough..

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.