How to damage an player, enemy, monster.

Hello,
i want that my character is adding damage to other players/enemies/monsters. (Not blocks, walls and floors :D)

Basicly it needs to output a set damage (in variable) on any player, enemy and monster.
Same as all players, enemies and monsters need to receive that damage and substract it from the current HP.

Basicly i know how to killmyself but not how to kill enemies. Is it even possible to make one blueprint for all players, enemies and monster who take and deal damage? I don’t mean like creating in each Monster a blueprint with that “function” but actualy make it somehow “global” ?

I don’t know the node names off hand, But there is a node to apply damage to an actor; And a event that is called when damage is (to be) applied to an actor.
So you would have your weapon call apply damage to the target actor, And the actor would then receive the event and do some logic with that (like reducing health and then being deleted when health drops too low)

HTH

But how to select ALL players, ALL Enemies and ALL Monsters at once? So i don’t need to use vars like “Player1” “Player2” etc. Just simply use an overall “system/function” for this.

I would probably use the game instance (an actor would work too) to keep a list of players, enemies and mosters.
I would have a base class or component that will register with the “manager” on spawn via a function/event; That will add it to a list.
The list should also be cleared if when a map is loaded if done from the game instance.

Then a function/event can be used to do whatever to the list of items.
I would probably keep a different list for each type (players, monsters, enemies)

So, It would be a (global) list(array) for each type(player, enemy, monster) that you can interect with via functions/events as nescisary.

HTH

So i need to create a blueprint but what type of blueprint for these lists? Or should i do it in all Levels BP? So “On Spawn” it add the players name or value, ID or something? Is it possible to create a group?
I mean that all actors with a variable “Player” can take damage? And all the calculation will be done based on the players defense etc that will be in players blueprint.

get all actors of class can get all the actors of a type and add them to an array, then a for each loop and apply damage to all the actors in that array…

I would use the game instance, But you also need to go into the project settings and set the game instance class to that (IIRC the section is has “game mode” in the name)

You would use a BP node to get the game instance, Cast that to the type (that you created) and call a custom event in the game instance to add the actor to a array.

[QUOTE=DamianToczek;704943I mean that all actors with a variable “Player” can take damage? And all the calculation will be done based on the players defense etc that will be in players blueprint.[/QUOTE]

Yes, that should be in the players blueprint, There is a event with the name “damage” in it.
You can use that event to handle how the player takes damage.

HTH

So what, exactly, are you trying to achieve?

If you want to damage everything at once, use an Event Dispatcher. All viable targets subscribe to the dispatcher. When it is called by, say, your level blueprint, all subscribed target have the associated function activate.