Advice for Multiplayer Game

Hi all…
I have the same BP character controlled by 4 different people. So i m using a player controller and a BP. Now if the first player hits the second player, how i can set a variable only of the second player? All my BP variable are in the character, but maybe i m starting thinking that all that variable(life of the player etc) have to stay in the player controller. Or i have to create 4 different BP? One for player? For sure i can’t handle the variable in the character BP so what do you to advise? Create different BP or pass all the variable in the player controller?

Plase help, i would like to know. I have a multiplayer game and i have 4 people that use the same character BP. How i can do for to do that when 1 player hits the seconds, the second lost 30 hp? I mean the BP it’s the same, so i can’t cast to the player controll or the BP itself

Just because you’re using a blueprint to create several characters doesn’t mean that all characters should share variable data. Variable data should be inherited from the blueprint. It sounds like your understanding of using blueprints and variables needs broadening. I would advise going throuth the Twinstick Shooter tutorial. While it’s not multiplayer, it does handle player character, enemy characters (multiple enemy characters based off a single blueprint), damage recognition, and other variable usage. Reference to the knowledge in this tutorial should help put you on the right path.

Hey,

It seems to me you are attempting to make a multiplayer game here. First of all, you only need one class of player pawn (character) not one for each player. When your level begins, and 4 characters are spawned into the world, those 4 characters all have their own separate variables. Health with initialise to whatever you set it to, but it will only change for the specific player you are affecting.

If your player character does a line trace, and the line trace hits another player character, you can use the apply damage function built into Unreal to apply damage to the character.

However the fact that you are making a multiplayer game makes this a vastly more complicated problem. Every character exists on his local client, the server, and every other client connected to the server. You will need to look into replicating variables and events to have this be a smooth as an experience as possible.

I really recommend looking on google for tutorials to do specifically what you want, as there are plenty out there. I haven’t looked through this video specifically but it was the first result.

best of luck

Oh thanks a lot. I don t know it. Now I get it. Now I have only one problem left, but for that I opened already another thread.