MAxHealth

heya i need to know a small thing,

i have a rpg game with level and exp system but, i would like to add something extra,
like:

if u get lvl 2 u gain health and attackrate

 
if (_root.exp>100){
 level = 2;
 "Maxhealth = 200;"
stop();

^ <== thats what im trying nomal max healh = 150 and when u lvl up maxhealth gets 200
so if u use a potion or a healing field or spell u need maxhealth else u go over the health limit

can anyone make a maxhealth system for me?

im noob in that kind of stuff

thnx :smiley:

regards,
Ricer

well from what i see you don’t know syntax :stuck_out_tongue:


if (_root.exp>=100){
 level++;
 Maxhealth = 200
//if its a textbox MaxHealth.Text=200
//also you exp leveling script isn't good unless you reset the _root.exp variable back to o
stop();

i allready get that but i need a variable from maxhealth

the function of maxhealth must be to make the health stop at the value of maxhealth

if (health >= Maxhealth)
{
health = Maxhealth;
}

it doesnt work =(

it still goes higher that 150 on lvl 1 when i got maxhealth on 150

if(health > maxhealth){
health = maxhealth
}
if (_root.exp>100){
level = 2;
maxhealth = 200;
}
if(_root.exp<100){
level = 1;
maxhealth = 150;
}
if(_root.exp>300){
level = 3;
maxhealth = 250
}
//etc etc etc…

are u sure thats stops the health from healing?

like im lvl 1 and i stand on a healing place it cannot go further that 150
but @ lvl 2 not higher that 200 ?

should be so. Try it.

Sooo im so incredlibly bored so I just had to edit this and tell you, yes it works :slight_smile:

doesnt work for me =(

but thanks anyway for trying to help me

could be made smaller though but oh well,it gives you an idea,

as the base put in=
@first key frame:@

 
maxhp = 150;
hp = 150
exp = 0;
attackrate = 20;
lvl = 1;


@on 2nd keyframe:@
note!1:
the roots should be placed on frame 1,and where you actually play the game is: frame 2 (or another frame if you made an intro and/or start screen,where the battle begins)
note!3:
if it’s a game based on frames and not on mc’s,ALWAYS instead of going to frame 1, let it go back to frame 2(note!4 if you have frame 2(and maybe more)filled with an intro or startscreen or etc. don’t change a darn thing)


if(_root.exp>99){
if(_root.lvl==1){
_root.maxp=_root.maxhp+50;
_root.attackrate=_root.attackrate+5;
_root.exp=0;
_root.lvl=_root.lvl+1
}
}
// it can be changed to a smaller version,but let's keep it nice and big so it's easier to understand;-) 
 
if(_root.exp>149){
if(_root.lvl==2){
_root.maxp=_root.maxhp+50;
_root.attackrate=_root.attackrate+5;
_root.exp=0;
_root.lvl=_root.lvl +1;
}
}
 
if(_root.exp>199){
if(_root.lvl==3){
_root.maxp=_root.maxhp+50;
_root.attackrate=_root.attackrate+5;
_root.exp=0;
_root.lvl=_root.lvl +1;
}
}
stop()
//and on and and on.till your guy can reach the maxlvl you like him to :-)


be sure to read the notes! first before you just squat in the codes.
hope it was helpfull,if you don’t understand something of it ask me and i will make an in-depth explenation.
if it isn’t working or it has a bug tell me,
the problem will probably be the scripting of the heal spot.

you should probably make a formula for exp since its alot easier then writing if(exp >200){//blah blah } check my posts i remember posting one before it was a whole tile based thing i think