GML Visual Display Health Damage

A

Arata_x

Guest
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.
 

Rob

Member
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.
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.
 
A

Arata_x

Guest
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.
 

Slyddar

Member
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.
 
A

Arata_x

Guest
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.
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.
 
Top