Help - Search - Members - Calendar
Full Version: [VX Ace] Player Switch - Managing multiple players
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS3-Submissions
Tsukihime
Player Switch
Author: Tsukihime

Large Image


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.
  • Immediately switch if there are only two players.


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

CODE
$game_players.create_player(2)


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!



Eventing conditions

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

CODE
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.



2: check for specific player's position

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

CODE
player_here?(player_id)


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


Download

Script: http://db.tt/WpTtP2yA

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.

In terms of aesthetics, maybe this would probably be a better menu lol
http://atelier-rgss.com/RGSS/Menu/ACE_Menu07.html
Night_Runner
I have to hand it to you, this is pretty awesome happy.gif

I did manage to get an error, when I had 3 players created (the starting one, and created two extra ones using script calls) I went to the Scene_Switch to change actors, and when I selected one the error:
CODE
Line 291: NoMethodError; undefined method 'fadeout' for #<Scene_Switch>


I also found a bit of a bug, Say you have HeroA and HeroB.
If you play as HeroA, and press the 'A' button as you walk onto a transfer quick event, you change to HeroB, but you then transport to where HeroA was about to transfer.
I think this may cause problems on maps where you split the party up to go in 2 directions, and by hitting the 'A' button an the right time you suddenly have both hero's next to each other.

But I do have to hand it to you, when I saw that the other players are drawn where you left them I got really, really excited!

One other thing I was going to ask, when you create a new player, they immediately move to the Player's original starting position at the start of the game, is there a way to add some more parameters, so you can create the new player at a specific set of co-ordinates on a specific map?
Tsukihime
I've added features for custom start position (map, x, y)

CODE
create_player(actor_id, ?start_map, ?start_x, ?start_y)


By default they are system defaults.

For the transfer, I've made it so that it doesn't happen if the map's interpreter is running.

For the fade-out, I should probably have it wait until it goes back to Scene_Map, sort of like how transfers have to first reserve a transfer before it actually happens.

I've updated the script with a couple game system options which can be accessed and modified at run-time through $game_system.

-switch_disabled: if true, prevents switching. Default false
-switch_fade: if true, fades the screen before switching. Default true
-player_roam: idle players' movement types. Default 0

0 for fixed
1 for random
2 for approach
3 is custom, but I haven't implemented anything for you to specify that kind of thing.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.