Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,789 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A level plus experience and Stats Script for RPGs #53420
08/27/05 00:25
08/27/05 00:25
Joined: Jun 2005
Posts: 40
USA, WA, Seattle
Nikorasu Offline OP
Newbie
Nikorasu  Offline OP
Newbie

Joined: Jun 2005
Posts: 40
USA, WA, Seattle
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.
Re: A level plus experience and Stats Script for R [Re: Nikorasu] #53421
08/30/05 03:43
08/30/05 03:43
Joined: Jun 2005
Posts: 40
USA, WA, Seattle
Nikorasu Offline OP
Newbie
Nikorasu  Offline OP
Newbie

Joined: Jun 2005
Posts: 40
USA, WA, Seattle
Maybe I put this in the wrong spot.

Being a total Newbie I'm sure this script is not useful now. Perhaps in the c-script section where others can help me learn any mistakes or issues involved with this script.

The script worked for me but I have made all my scripts from scratch with a movement script from a tutorial that I had slightly adjusted. So it may not be at all a stand-alone script.

My game works like I want it to but it may have serious bad scripting in it and you all are too nice to tell me that.

Perhaps someone can move this post to a place for judgements and editing.


Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1