A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Help With RPG elements

  1. #1
    Blind Metal™ Solomon Cloud's Avatar
    Join Date
    Aug 2001
    Location
    In A Rusty 1969 Ford Galaxie
    Posts
    147

    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.
    Lucy, is an artist. Lucy paints pictures of Barbara Streisand.

    http://www.blindmetal.com

  2. #2
    smile for the camera! jesserules's Avatar
    Join Date
    Dec 2004
    Location
    a dark place where people have trouble in flash
    Posts
    720
    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!

  3. #3
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    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

  4. #4
    Blind Metal™ Solomon Cloud's Avatar
    Join Date
    Aug 2001
    Location
    In A Rusty 1969 Ford Galaxie
    Posts
    147

    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?
    Lucy, is an artist. Lucy paints pictures of Barbara Streisand.

    http://www.blindmetal.com

  5. #5
    Noob in disguise blakfeld's Avatar
    Join Date
    Jun 2002
    Posts
    258
    something to the extent of...

    code:

    if(hp<maxHp) {
    hp = maxHp;
    }

    Your a toaster and thats all youll ever be!

  6. #6
    MindGem Graphics Inc. JediMind's Avatar
    Join Date
    Nov 2001
    Location
    Stockholm/Sweden
    Posts
    407
    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.

  7. #7
    Blind Metal™ Solomon Cloud's Avatar
    Join Date
    Aug 2001
    Location
    In A Rusty 1969 Ford Galaxie
    Posts
    147
    thanks, jedimind and blakfeld. now its working quite nicely.
    Lucy, is an artist. Lucy paints pictures of Barbara Streisand.

    http://www.blindmetal.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center