PDA

View Full Version : Stat Point System For Simplle Rpg



koolkrasher
October 2nd, 2006, 04:09 AM
i am having a little problem setting up a stat system. when my players go to my character select screen and make their character i have 3 main stats they can increase using the points provided to them . what i want to do is disable the increase of their stats when the available status points reaches 0

i have 4 text fields
each controls a stat and stat pont contols the starting amount.
_root.strength = 0;
_root.int = 0;
_root.charm = 0;
_root.statpoint = 20;

each stat field has a button next to it that increase the stat field by 1 and decreases the total stat point by 1.

on (release) {
this._root.strength++;
_root.statpoint--;
}


Is there an if statement or a function that i can assign to the buttons to stop increasing the number when the amount in the stat point field reaches 0?

help much appreciated
kool

Nich
October 2nd, 2006, 08:23 AM
a simple if statement will do the trick.

Change:

on (release) {
this._root.strength++;
_root.statpoint--;
}

to

on (release) {
if(_root.statpoint > 0) // we will only change the strength if statpoint > 0
{
this._root.strength++;
_root.statpoint--;
}
}

koolkrasher
October 2nd, 2006, 12:04 PM
OMG! dude u rock! thanks alot!

sammi
October 5th, 2006, 03:55 AM
hey koolkrasher I really need help creating character select and was wondering if you could post a swf or a tutorials for an example. thanks a lot.