Display text expression for displaying random dmg
Hey guys, hoping someone can help me with this because my brain is all mathed out right now.
Essentially I want to have a text displayed showing the actual random dmg done every time an actor ( in this case we'll call it enemy1) takes a random amount of dmg from another actor (missle1).
So what I have is a game attribute (real) for enemy HP which is set to 10. Then a rule in the the missile that says when overlaps or collides with enemy1 change attribute enemy.hp to enemy.hp-random(1,4). What expression can i use to get this to display the random amount of dmg done as a text every time it hits. The closest I got was creating another hp actor called max and then setting the value to 10 then doing (enemy.hp.max-enemy.hp) which will then count the dmg up, but not display the unique random dmg every hit without adding to the previous.
Anyway hope this makes sense and someone knows a solution.
Essentially I want to have a text displayed showing the actual random dmg done every time an actor ( in this case we'll call it enemy1) takes a random amount of dmg from another actor (missle1).
So what I have is a game attribute (real) for enemy HP which is set to 10. Then a rule in the the missile that says when overlaps or collides with enemy1 change attribute enemy.hp to enemy.hp-random(1,4). What expression can i use to get this to display the random amount of dmg done as a text every time it hits. The closest I got was creating another hp actor called max and then setting the value to 10 then doing (enemy.hp.max-enemy.hp) which will then count the dmg up, but not display the unique random dmg every hit without adding to the previous.
Anyway hope this makes sense and someone knows a solution.
Comments
attribute enemy.hp = tmp
display text tmp
If this was actual code, you'd want to do one calculation and store it rather than do it several times, same applies here.
What I need it to do is subtract from the attribute hp each time ( hp-random(1,4)) but show only the value of the random number being subtracted every time in the display text (text=random number that was subtracted from hp) this way it can still take a set amount of dmg before it dies, and you know how much dmg is being done each time the random hits..
attribute tmp = random(1,4)
attribute enemy.hp = attribute enemy.hp - tmp
display text tmp