MODULE: CharacterSelections

Started by nims, Mon 06/04/2015 14:53:55

Previous topic - Next topic

nims

Use this script to allow the user to play with 12 (max) different characters.
You can add players that must be enabled later, and cannot used initially in the game.
Also you can share inventory items between all players.

Note: Make sure you have added the GUI "gCharacterSelection" to your game to allow the user to choose a new player.

This GUI is shown when you call:
Code: ags
CS.ShowGui();

You can tie it to a button on your GUI.

The following code adds the players to your game:
Code: ags

function initialize_world_selector() {
btnCharacterSelection.Visible=false;
    //Enable the starting players the player can choose
    CS.AddCharacter(1, 1, cPlayer1);
    CS.AddCharacter(2, 2, cPlayer2);
    CS.AddCharacter(3, 3, cPlayer3,false );
}


You have the following functions available:
Code: ags

function AddCharacter(int aCharacterNumber, int aStartingRoom, Character *aPlayer, bool aEnabled =true); //This adds a player to the game
function EnableCharacter(int aCharacterNumber); //This enables the button to go to a world
function DisableCharacter(int aCharacterNumber); //This disables the button to go to a world
function SetAsPlayer(int aCharacterNumber); //This changes the current player
function ShowGui(); //This opens the character selection GUI
function AddSharedInventory(InventoryItem *aItemToAdd); //This adds an inventory item to all the players
function LoseSharedInventory(InventoryItem *aItemToAdd); //This loses an inventory item to all the players


Download the module here.

Mehrdad

My official site: http://www.pershaland.com/

SMF spam blocked by CleanTalk