#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Need help with equation of enemy hit

Posts: 159Member

Hello,

how can I make it possible to display the hit I make on an enemy?
I want it to be shown everytime I hit the enemy so it spawns above like "-10" .. "-12" etc etc.

Whats the equation?

check picture for setup at the moment.
I tried health - player damage but that only show the health that is left.

regards

• London, UK.Posts: 12,822Member

When hit change X to random (A,B)

Display X

Change self.health to self.health-X

• Posts: 159Member

@Socks said:
When hit change X to random (A,B)

Display X

Change self.health to self.health-X

I tried that but issue is that instead of showing every hit I do it sum up on X.

So for the first hit which should be between 2-12 its lets say -10 on display. Next hit is lets say 9 it show -19.. then next -25 etc etc until its equal to the health of enemy in negative state.

What I need is that it show the hit in negative state every hit.
I cannot figure it out :&

• London, UK.Posts: 12,822Member
edited January 2016

@KIIVIIN said:
I tried that but issue is that instead of showing every hit I do it sum up on X.

You've probably made a mistake in the way your rules are set up - the example I gave you will work, it will display only the last chosen random value.

Can you upload a screenshot of the rules you have used.

• Posts: 159Member

@Socks said:

@KIIVIIN said:
I tried that but issue is that instead of showing every hit I do it sum up on X.

You've probably made a mistake in the way your rules are set up - the example I gave you will work, it will display only the last chosen random value.

Can you upload a screenshot of the rules you have used.

I think I made it to work! I just added : "-"..
to the display text so its like its negative numbers.

• London, UK.Posts: 12,822Member
edited January 2016

@KIIVIIN said:

Your code is different to my suggestion, that's why it doesn't work !

My version says:

When hit change X to random (A,B)

When hit change X to X-random (A,B)

• Posts: 159Member

@Socks said:

@KIIVIIN said:

Your code is different to my suggestion, that's why it doesn't work !

My version says:

When hit change X to random (A,B)