Player dmg add or minus in health of Enemy

Hi… can some1 help me?

can i make it with logic bricks or do i need 2 make a Script?

now i have:
My Player have a Intiger called dmg… and send message 2 the Enemy if t enemy recive the message,
will activate prop, ( Enemy HP -1)

i would like 2:
example
if my Player’s dmg is 1, enemy recives dmg from Player -1
if my Player’s dmg is 5, enemy recives dmg from Player -5
so he minus the amount of the Player damage),
cos if the Player Level up the dmg get biger also… or do i need 2 settup the enemy get dmg, also every Level?

is there a script or a Setup 4 the logic bricks, ( tutorial or existing file)?

PS: it’s my final Problem this time it stop my Work :frowning:

i Keep on searching and start now Scripting
can somebody tell me if m on the right way with my first script, or help me to correct or make it better

import bpy.data()
Player = bpy.data.objects[“Player”]
PP = Player.game_property()
dmg1 = pp[“dmg p”] # Player main damage
dmg2 = pp[“AP”] # Player additional damage
dmgsend = (dmg1 + dmg2)

from bge import logic as l
c = l.getCurrentController()
o = c.owner # owner = Enemy
s = l.getCurrentScene()

key1 = c.sensors[“key1”] # just to try, it will b collision with spell’s
kill = c.actuators[“kill”] # like (Fireball…etc)
if key1.positive:
o[‘hp e’] -= dmgsend

c.activate[‘kill’]
if o[‘hp e’] <= 0

Don’t use bpy. Use the game object as a dictionary for property access

Sent from my Nexus 5 using Tapatalk

instead of this:

import bpy.data()
Player = bpy.data.objects[“Player”]
PP = Player.game_property()

use:

import bge
player = bge.logic.getCurrentScene().objects[“Player”]
PP = player#player is a KX_GameObject and KX_GameObject behaves like a dictionary

That’s because when the game engine start the bpy.data stuff (some of it) is transformed into game specific format and made available via the bge library. What the game uses from then on is the bge version. If you use the bpy data you may access features not available in the game engine or get values that do not reflect in game changes.

thank u
i will try in a script

i just try my second script after this and i think it moves Forward

i will post if it look better, ist a System with ep and Level up.

Thank 4 the Answers

Do it with logic bricks. I used a clever assortment of logic bricks and animation keyframes to make a perfect healthbar as two physical objects, a colored bar and a plane that grows longer every time you take damage, and when it is sized fully to 1 (frame 1000) it kills you, restarts the scene. Try it you can do it with logic bricks, it just takes some thought