I thought since I haven't been able to find the time to really contribute to the gaming community,that I would really like to be apart of, I will post what I have achieved. though not very much but i hope it is useful to someone

This is my very first scripting attempt. My game demo is almost ready and of course i have scripted so much more than this. I'm sure I may have left out some important scripts that may make this more understandable but I am not sure of which ones.

Here's the variables I used.
Code:


var hp = 0; //Hit Points
var mp = 1; //Magic Points
var pp = 2; //Power Points
var au = 3; //Special use
var st = 4; //Strength
var df = 5; //Defense
var mg = 6; //Magic
var md = 7; //Magic Defense
var ag = 8; //Agility
var lk = 9; //Luck
var ev = 10; //Evasion
var ac = 11; //Accuracy
var cur_hp = 12;
var cur_mp = 13;
var cur_pp = 14;
var d_stats[15] = 125,0,0,0,30,40,19,10,30,20, 8,25,125, 0,0;//Status holds all the values
var m_stats[15] = 100,0,0,0,25,30,28,20,36,12,15,38,100, 0,0;
var t_stats[15] = 150,0,0,0,45,50, 0, 5,18, 8,11,19,150, 0,0;

var status[15]; //Needs to carry the status between players. Constant exchange between this variable and the players.

var enemy_stats[15]; //enemies'
var prm_dfndr_stats[15] = 100,20,5,2,25,30,5,10,20,10,5,18,100,20,5; //one of my random enemies
var ultra_prim_def_stats[15] = 1000,500,250,0,70,58,100,80,62,96,88,79,1000,500,250; //My boss

var exp_per_lvl[98]; //99 levels holding the experience points for each
var lvl_up_check; //checks to see if you are due for a level up

//Current Experience
var d_cur_exp = 0; //Character 1
var m_cur_exp = 1;
var t_cur_exp = 2;
var experience[3]; //array of the three characters experience
var plyr_exp; // keeps track of the current player

var d_cur_lvl = 0; //Current level character 1
var m_cur_lvl = 1;
var t_cur_lvl = 2;
var levels[3] = 1,1,1; // each at level 1
var plyr_lvl; //keeps track of the current players level



Now place this script somewhere early in a function. I put mine in the main starting function.
Code:

fuction main()
{
............
var i = 1; //Our counter
while(i != 99)
{
exp_per_lvl[i] = (pow(i,2)) * 100;
i += 1;
wait(1);
}
.............
}



Here's the dirty work. I call it after each battle is finished. Plus I have a script for how much a character gains in experience from each fight but it is to your discretion.
Code:

function level_up_check()
{
var i = 98; //start from the top and work down
while(i != 0)
{
if(plyr_exp >= exp_per_lvl[i])
{
lvl_up_check = i;
break;
}
i -= 1;
wait(1);
}

if(plyr_lvl < lvl_up_check)
{
plyr_lvl = lvl_up_check;

i = 0;
while(i != 15)
{
status[i] += sqrt(plyr_lvl * 5);
i += 1;
wait(1);
}
}
}



Any suggestions would be great and I hope you find it useful. I'll answer any questions of course because I may not have clarified it enough. And I'll post more scripts If I find ones are left out that are needed.

Thankyou to Ale_Jrb and lswalby for their help with the script.

Last edited by Nikorasu; 08/27/05 00:32.