I’m trying to diminish the character health based on the gun damage
I do the very same logic to set the Rate of Fire of the gun.
But for some weird reason. the same thing works for the Rate of Fire but doesn’t work for the damage, aparently the damage is always 0.0, even tough the default value is 0.2(20%)
For what do you using timeline? Fire loop when lmb is pressed? I found probably better setup on fire i put delay node (fire rate input) and then event run on owning client which calls fire again if “LMBkeyPressed?” is true (i control that variable with event input pressed/released)…
Well health/damage is pretty basic and i dont have idea where is mistake… that bp looks like u r shooting yourself
I can only recommend you using damage events… input damage - output health minus damage…
If problem still persist, post full screens and ill check it more into details.
this is a bullet BP, when the bullet hits the character it diminishes it’s health. Also, can you go in more detail about this damage event thing? i’m still learning those BP’s
Engine have nodes “event damage” and “apply damage”
In bullets you have to place event damage nodes. In bullets you probably storing damage variable so plug that variable into damage event damage. You have probably collision sphere which checks which actor it overlap. Plug “actor” reference from overlap event to damage event.
In all characters/items which you want damage, put “apply damage” node. It automatically “find target”…
Output of applydamage is damage. Subtract that damage from char hp. its all… if you dont figure out it let me know and ill post you my screens when ill be at home.
Ok, i tried but not so hard yet because i have a calculus exam tomorrow.
I tried with this setup right now :
the projectile blueprint applies the damage and (should) have the damage modified by the damage modifier of the weapon.
then, on mycharacterBP i get an event any damage and set the new health = health - damage;
This setup is waaaay better than the previous one, but still the damage modifier(was previously called damage when i created the post) is still ALWAYS considered 0, even though the default value is 2. i’m not multiplying the damageAmount by the damage modifier because it’s always 0 and i’ll **** up my projectile.
Long story short(read it with the southpark “longstory short guy” voice) everything is still the same
EDIT: the was damaged bool is to make the character play a hit animation
Your modifier cannot work, because you dont using it anywhere
You must multiply it [damage * modifier], you can do it before apply damage, or after event AnyDamage…
edit: now i see why you dont use multiply… but anyway it must work try to store damage modifier in your bullet BP, not in character->weapon. It looks like you storing your modifier in weapon, but maybe that BP where you set your “Wep pointer” is bad. Post that screen also if this won’t help
I don’t think it’s bad because i use the same variable(Wep Pointer) to check if a rifle , sniper , pistol or shotgun is equipped and if one of them is equipped and i try to equip a different type it’ll use the pointer to put the weapon in it’s respective inventory slot. It works perfectly. Also the wep pointer is set to have the same values the rifle , sniper etc etc has(damage, ammo etc…).
Not only using this pointer to this objective works but i also use the very same things to put an Ammo : x / X on a hud with the same logic. Works more than perfectly.
Not only all this but i also use the same wep pointer to see if i can shoot(have something equipped) and if i have ammo enough to shoot. It also works more than perfectly.
I can’t know why this is the only case this is not working.
Ok, i tried with this setup now and it works, but i have no idea why. I changed the bullet to affect AI aswell, changing the casting to pawn instead of my character. Then for no reason i mixed the previous setups with the new one and it magically worked.
doing this now:
PS: I was testing with other player characters
You must only try alternatives i had a lot of “bugs” in my game but i cleaned it everything because i tried really much setups and i found that correct ones…
Btw that BP does not make sense at all, it looks like: When pawn overlap sphere/box, he shoot himself with his weapon.
edit: i cant see that attachment
I have a shootBP that set a line trace, and if it’s aiming at a pawn it’ll spawn the myProjectile at the location. that’s why it works
Oh , and the shoot bp event is fired by the left mouse click on my character BP