How can I make my character lose health when I they attack ?

I made 2 player each one has a own screen and i want them to lose health when I perform the the action sword slash (a vetical slash) and i want it only to work during the animation

and want to be able when the player is hit by the sword animation to do my get hit animation

preferly without using python

I think you need integer properties, each hit adds one, and when you get to x, the character dies, dissapears, explodes, whatever. It’s in some tutorial. Wait for someone more experienced than me to tell you…

Like me?

  1. Give the weapon a property of “weapon”.
  2. Logic bricks: when the character collides with property “weapon”, then it plays action “Hit” and -1 gets added to its property called “health”.
  3. When health=0, then play the defeation animation and such.
  4. If you want different weapons to do different damage, then give them properties of “damage1” or “damage3”. Then, upon each seperate collision, a different property actuator that controls health is triggered.

See, I was close. :smiley:

I´m sorry but I couldn´t make it to work :frowning:
so could you be more specific :expressionless:

I wanted to be able when I press E with player 1 (screenTop) to do the sword hit animation (this I know) and make player 2 (screenBottom) to lose health when the sword animation collides to the character by the sword and when it does I want to do the getHit animation to happen

and could you be more specific when it comes to property and kinda new with that
I knowest that there where five different properties timer,string and so on
I didn´t know which one to put to the weapon and health properties

I´m sorry if I´m a pain in the ass it´s just that I need to learn this things

For the weapon, it doesn’t matter what kind of property it is because it’s only used for collisions. The sword also has to be a seperate object from the character mesh, parented to the hand bone of the character.

For the health, use an Int property, because Ints are whole numbers (no decimal parts).

wow commenting on a two year old post well anyway i noticed other objects for some reason cannot add or take away from a certain object like a health bar property. i would make it so its near and when the other player presse z or sumthing

Hello evrybody, I tested the things above with the blender 2.48 version and it doesn’t work. (but that could by my fould to)

so this is wath I did:

I added a cube(person) and a sphere(weapon). I set somme settings to make the sphere move arround if you press somme keys.
ok: I selected my cube and I added a property. I called it health(is this good?) and I gave it a value of 5. So I added a sensor-contr-actu. (when: “sensor” property:healt value:0 -> object dissapears) ok. then I selected my sphere and I added a property too called weapon (int) value:0. I selected back my cube and I added a “sensor” collision prop=weapon, controller and, and an actuator: property: health value -1

and this doenst work. wath could be the problem or did I made a stupid mistake???
greets me

It sounds like it should work. Maybe a problem with your logic bricks?

I made it all again and now I know wath I did wrong. I had set my objects static but they had to be dynamic. and now it works. :smiley:

greets me