Tsukihime 1,487 Posted May 23, 2012 (edited) Player Switch Author: Tsukihime 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! 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. 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. 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 August 12, 2012 by Tsukihime 10 Death10, KayDgirl91, MizukiH and 7 others reacted to this Share this post Link to post Share on other sites
+ Novem 344 Posted May 23, 2012 This is brilliant! I don't think I've ever seen anything like this Tsukihime! Nice work. Share this post Link to post Share on other sites
Wendell 81 Posted May 23, 2012 Amazing, I've never seen anything like this before. Imagine which type of puzzles you can do with this. Share this post Link to post Share on other sites
Tsukihime 1,487 Posted May 23, 2012 (edited) 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. 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 May 23, 2012 by Tsukihime Share this post Link to post Share on other sites
Sly 10 Posted May 25, 2012 I was going to do this using events. I wonder if the script will be easier? Good work. Share this post Link to post Share on other sites
Tsukihime 1,487 Posted May 25, 2012 (edited) 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 May 25, 2012 by Tsukihime Share this post Link to post Share on other sites
Maus Merryjest 17 Posted June 19, 2012 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
Tsukihime 1,487 Posted June 19, 2012 Not for this script, since it is completely separating players and storing all of the players' information in each player object (eg: what party they control) Here is one of the first scripts I wrote: http://www.rpgmakervxace.net/topic/3127-multiple-party-management-script/ But I pretty much abandoned it. Share this post Link to post Share on other sites
+ Novem 344 Posted August 8, 2012 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
Xypher 176 Posted August 8, 2012 There's a setting in the module to turn off idle wandering Share this post Link to post Share on other sites
+ Novem 344 Posted August 8, 2012 Gotcha, thanks Xypher! Share this post Link to post Share on other sites
MizukiH 0 Posted August 9, 2012 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
Tsukihime 1,487 Posted August 9, 2012 (edited) 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 August 9, 2012 by Tsukihime Share this post Link to post Share on other sites
MizukiH 0 Posted August 9, 2012 ...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 Share this post Link to post Share on other sites
Tsukihime 1,487 Posted August 9, 2012 (edited) 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 August 9, 2012 by Tsukihime Share this post Link to post Share on other sites
MizukiH 0 Posted August 9, 2012 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
Tsukihime 1,487 Posted August 10, 2012 Fixed the bug. I commented out some code that refreshed the map for some reason but I don't remember why. Share this post Link to post Share on other sites
MizukiH 0 Posted August 10, 2012 works perfectly now, thank you ^^, stay awesome : D Share this post Link to post Share on other sites
Dark Messiah 1 Posted August 10, 2012 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
Elise-chan 9 Posted August 11, 2012 Brilliant script, gives me the tool to make the puzzles I always wanted(^;_;^) Will try this out ASAP when I get homeOwO Share this post Link to post Share on other sites
Tsukihime 1,487 Posted August 12, 2012 (edited) 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. Edited August 12, 2012 by Tsukihime Share this post Link to post Share on other sites
ultima8online 0 Posted October 8, 2012 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
Tsukihime 1,487 Posted October 8, 2012 Press the A button. Share this post Link to post Share on other sites
raisedfromthedead 4 Posted October 8, 2012 this is awesome. I could make a completely different game/quest for each person, or make each one have to complete their goals to win the game. Share this post Link to post Share on other sites
ultima8online 0 Posted October 10, 2012 Doh! I'm an idiot Tsukihime.. thanks, i was pressing x... Share this post Link to post Share on other sites