-
Blind Metal™
Help With RPG elements
Hi, I am here to ask a somehwhat simple question, I am currently developing a midsized RPG, it has turnbased battles controled by stamina.
But enough with that stuff, I have a question and that is with calling upon stats.
At the moment during battle damage is dealt in a very easy way, a set damage for each attack, yet since I am making this so the user can level up.
I was wondering if flash 5 can call upon a variable like a strength stat and subtract that from the enemies hp?
at the moment my damage is really scriptd and stuff and looks like this.
enhp = enhp-235
I want to know if its possible to take a variable and then use it to subtract the amount from the enemies hp. Also if its possible to multiply the variable to inflict critical hits etc.
Thanks in advance for any help and btw I use Flash 5.
-
smile for the camera!
you mean like this:
Code:
damage = random(300)+1
enemyhp = enemyhp-damage
in Flash4 and up, you can use -=, like this:
Code:
damage = random(300)+1
enemyhp -= damage
good luck on that RPG, its really hard to make those
My site
The Current Project is RoboRace.
Screens Public Beta Coming Soon!
-
DOT-INVADER
i have some vague souvenirs about flash 5 ( ), but maybe you are thinking about something like this?
code:
function damage(value){
enemyHP-=value
if(enemyHP<=0){
// tell the enemy to play its die animation
}
}
this is the function, now each time you want to call it, do it that way (the current example shows how to substract 23 HPs to the enemy):
code: damage(23)
good luck
-
Blind Metal™
thanks
hey its working really well now and I am close to having a new battle system up and running.
I have one tiny little question left though.
How can I cap values (like max level is 99, and make it so the player cant heal over his/her max hp).
Its kinda been boggling my mind lately but maybe you guy's can help?
-
Noob in disguise
something to the extent of...
code:
if(hp<maxHp) {
hp = maxHp;
}
Your a toaster and thats all youll ever be!
-
MindGem Graphics Inc.
Originally posted by blakfeld
something to the extent of...
code:
if(hp<maxHp) {
hp = maxHp;
}
What blakfeld ment to say was.
On the event of the levelup or restoration of health:
hp+=amount;
if(hp>maxHp) {
hp = maxHp;
}
As I understand it was that you can repair/restore your health but not more than to maxHp.
If you ment that when you levelup your health should fill up to max again, then blakfelds code will work. But since you ask to cap values this should not be the case.
-
Blind Metal™
thanks, jedimind and blakfeld. now its working quite nicely.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|