PDA

View Full Version : Game Maker - RPG Party script


rm2kdude
March 13th, 2010, 02:52 PM
This is a script I created for my RPG and works like a charm! This can be modified for any type of rpg be it POKEMON, general FF system"which this is based on" etc.

I rarely comment as I generally create a script for a specific purpose so make sure your scripts are neatly named!

scr_party_int

globalvar actor, level, party_member_removed, main_actor;
//Call actor names, and stats
scr_party();


scr_party " This script is 100% completed but only 1 character is fully coded atm"

//Set Party Stats
global.maxparty = 0; // Max party variable.
//Son Goku
actor[0,0] = "Son Goku"; // Name
actor[0,1] = 1 // Level
actor[0,2] = 70; // HP
actor[0,3] = 70 // HP Max
actor[0,4] = 0 // SP
actor[0,5] = 20 // SP Max
actor[0,6] = 5; // Strength
actor[0,7] = 9; // Power
actor[0,8] = 5; // Defence
actor[0,9] = 4; // Speed
actor[0,10] = 0; // XP
actor[0,11] = 0; // Slot number
//Vegeta
acotr[1,0] = "Vegeta";
actor[1,11] = 0; // Slot number

//Handle Levels
/*
2D Arrays
0 = Goku
1 = Vegeta
2 = Kuririn
3 = Goten
4 = Trunks
5 = Piccolo
6 = Tienshinhan
*/

//Variables
global.glevel = 0;

{
level[0,1] = 500;
level[0,2] = 1200;
level[0,3] = 2000;
level[0,4] = 2800;
level[0,5] = 3500;
}

// Place all attack icon scripts below here.
scr_goku_icons();


scr_main_actor " using numbers to identify a character or person"especially pokemon" will make coding this script much much easier"

/*
actor cheat list
1 = Goku
2 = Vegeta
*/

if actor[0,11] = 1
{
main_actor = 1;
}
if actor[1,11] = 1
{
main_actor = 2;
}


scr_player

// This just gets the correct player.

globalvar main_player, ally, ally1, main_pos

if actor[0,11] = 1
{
main_player = 0;
}
else if actor[1,11] = 1
{
main_player = 1
}
// repeat for other characters

// set the x/y for the hero
main_pos = obj_hero;


scr_ally "Since pokemon has over 400 characters use identifiers such as numbers because there are soo many party slot abilities with a number that high"

// This just gets the correct player.

if actor[0,11] = 2
{
ally = 0;
}
else if actor[1,11] = 2
{
ally = 1;
}


// repeat for other characters


This is where the fun begins, adding and removing a player, I'll just give you my script names for reference.

scr_goku_add

/*
Usage:
scr_goku_add();
*/

//check to see if Goku is already in your party
if global.maxparty < 3 // make sure you can't add more than 3 party members at a time.
{
if actor[0,11] >= 1
{
actor[0.11] = actor[0,11] // keep the same slot number
}
else
{
// check other slots.
if actor[1,11] = 0
{
actor[0,11] = 1
}
else if actor[1,11] = 1
{
actor[0,11] = 2
}
else if actor[1,11] = 2
{
actor[0,11] = 3
}
global.maxparty = global.maxparty + 1; // add to the maxparty variable, so you can't cheat. Muahahaha!
gcur_icon = 0;
scr_main_actor();
if global.maxparty >= 3
{
global.maxparty = 3;
}
}
}


scr_goku_remove

/*
Usage:
scr_goku_remove();
*/
if global.maxparty < 3 // make sure you can't add more than 3 party members at a time.
{
if actor[0,11] >= 1
{
actor[0,11] -=1; // remove 1 party slot
}
party_member_removed = true;
global.maxparty = global.maxparty - 1; // add to the maxparty variable, so you can't cheat. Muahahaha!
if global.maxparty < 0
{
global.maxparty = 0;
}
}


scr_vegeta_add

/*
Usage:
scr_vegeta_add();
*/

//check to see if Goku is already in your party
if global.maxparty < 3 // make sure you can't add more than 3 party members at a time.
{
if actor[1,11] >= 1
{
actor[1.11] = actor[1,11] // keep the same slot number
}
else
{
// check other slots.
if actor[0,11] = 0
{
actor[1,11] = 1
}
else if actor[0,11] = 1
{
actor[1,11] = 2
}
else if actor[0,11] = 2
{
actor[1,11] = 3
}
global.maxparty = global.maxparty + 1; // add to the maxparty variable, so you can't cheat. Muahahaha!
scr_main_actor();
if global.maxparty >= 3
{
global.maxparty = 3;
}
}
}


scr_vegeta_remove

/*
Usage:
scr_vegeta_remove();
*/
if global.maxparty < 3 // make sure you can't add more than 3 party members at a time.
{
if actor[1,11] >= 1
{
actor[1,11] -=1; // remove 1 party slot
}
global.maxparty = global.maxparty - 1; // add to the maxparty variable, so you can't cheat. Muahahaha!
party_member_removed = true;
if global.maxparty < 0
{
global.maxparty = 0;
}
}


The script below retains each slot.

scr_retain_slots

/*
This script does nothing more than correct a players slot
So if Goku was slot 1, and Vegeta was slot 2.
Than Vegeta's slot would be slot 1.
*/

// Correct Vegeta
if (!keyboard_check(vk_space))
{
if actor[0,11] <= 1
{
actor[1,11] -= 1;
party_member_removed = false;
}
if actor[0,11] >=1
{
actor[1,11] -= 1;
party_member_removed = false;
}
// make slots "0" if they were slot 1.
if actor[0,11] < 0
{
actor[0,11] = 0;
}
if actor[1,11] < 0
{
actor[1,11] = 0;
}
}


Pew... that's a lot of code for JUST 2 players and will be well larger for like 6-12 members but anything that exceeds 3"like my system, can be changed obviously" will need a party swapping system kinda like PHS from Final Fantasy VII which is what I'm talking about. In Pokemon you need to go to your PC to exchange, be creative and create a switch system with your pokedex which friends is super easy to code in GM!

Pokedex example!

Scr_Pokedex

globalvar seen // Than a number for EACH pokemon + a saw variable so if #25 is seen in battle its;

on start of battle
if Pikachu_seen=false { seen = seen + 1; Pikachu_seen=true; }
else if Pikachu_seen=true { seen = seen; }


That's basically the fundamental coding for a Pokedex..

Just remember this, even though this "looks" easy just like any other script it's not, it's very complex and when adding characters it's even MORE complex.

RPGs in Game Maker are NOT easier but I will say the CODING in Game Maker for a Poke game for a custom engine is 100* easier than if you just went and did it in Ruby. Oh, you'd be done with a Poke engine in 5-7 days if you know what you're doing. Based on 4 hr days.

Enjoy the script!

Mrchewy
March 13th, 2010, 07:18 PM
Seems like a pretty tight script you've got there. I'm sure quite a few people who aren't using RPG Maker will find this extremely useful.

rm2kdude
March 14th, 2010, 11:19 PM
Thanks! The script took forever to get it working.. and because almost all aspects of the RPG Party system is done it's suuuper easy to code a stats menu for your RPG!