1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Drag And Drop Display Health Damage

Discussion in 'Programming' started by Arata_x, Dec 10, 2018.

  1. Arata_x

    Arata_x Member

    Joined:
    Dec 10, 2018
    Posts:
    3
    I'm currently having issues with RNG and variables,

    Essentially in my RPG, I want to display the amount of damage done to the creature when attacked, but I have a generator choosing a number and then the number actually affecting the monster is rounded up or down.

    and the problem I have is that it continues to display the generator and not the amount the health is removed from.

    hoping someone can fix my issue as I can't seem to find a solution for random variables nevermind on DND.
     
  2. Rob

    Rob Member

    Joined:
    Jul 12, 2016
    Posts:
    713
    Could you show your code (for the generator and how you're displaying the number (the number you say is being displayed incorrectly)? The solution sounds simple but it's better to give the solution based on what you've already done.
     
  3. Arata_x

    Arata_x Member

    Joined:
    Dec 10, 2018
    Posts:
    3
    Capture.PNG Capture2.PNG Capture3.PNG Capture4.PNG
    The last one on the right is on a different object. seen by obj_code."whatever"

    Edit 1: OH ****, i might of figured it out.

    Edit 2: nvm, that posing more problems. the random generator needs to be effected and added upon from different stats and effects later on when i develop on it. using a random number generator poses a different challenge of adding onto it.
     
  4. TheSly

    TheSly Member

    Joined:
    Jan 16, 2017
    Posts:
    1,000
    A few things.
    • Some of the code in the shots is truncated. You need to drag the boxes bigger so we can see all the code.
    • By putting the assign playerdamage code block in the step event you are creating a new random number every step. You really only need to generate it when the attack happens.
    • Do you find it easier to store the health of the player and the monsters in it's own object, rather then in the object that it belongs to?
    For showing damage I create a show_damage object, and create a new instance of it every time damage is done, passing the damage variable to that object, and it then can display it for a second or so before destroying itself. If you try to do it in the one object the next damage value will keep overwriting the previous one, and you will only be able to display one at a time. Maybe try that.
     
  5. Arata_x

    Arata_x Member

    Joined:
    Dec 10, 2018
    Posts:
    3
    For now most of this is just a temp build to get used to the engine thats why its all in one object, this will later change if i plan on working on it further but your right actually, Second bullet point makes really good sense thanks.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice