Download

Possessing/Unpossessing a pawn

Hello, I’m trying to make a basic multiplayer FPS.

As a first thing I want the “death” of a pawn to be correlated with an unpossess state rather than destroying the character, and its respawn to be related with a possession and repositioning of the pawn.

So the logic is: if Health <= 0 then unpossess, delay-> set health 1, transform and possess.

I made this blueprint in FirstPersonCharacter blueprint:

007677ceba6703e2304f216271dfde66b0c5eb8b.png

So what it does:

-when F key is pressed the character loses .25 of his HP
-if Health gets below or equal to 0 the character is unpossessed
-After a delay of 5 seconds health is restored
-then after health is restored the compare float is again executed, this time health is > 0 so the player should control again the pawn, but it doesn’t work

Everything works till health restoration, I lose control of the character, but I don’t take it back.

Any help? :frowning:

I would like to help, but i can’t access the picture ):

note: MUST RUN ON SERVER

Oh, I’m very sorry:

networked chat
bullets spawning
UI update
and respawn

thx, I’ll take a look at it, but I’d rather learn on my own, which is not easy when following other’s work.

I’m having hard time learning UE4, I’m also taking a C++ course but I feel like the more I learn the more everything is a mystery :frowning:

since you are not an inventor, failure dosnt count
there are two ways to learn the engine: “on your own” and “find soneone else work and follow the steps”
i chose second one, because i personally, dont need 10000 ways not to make a lightbulb.

Yes, but that depends on the goal you have, I’m more focused now on understanding how things works.

I have fun learning this kind of stuff.

Everything works according to rules, without knowing rules, you cannot progress until you would discover them himself, which is spedning a time.
As i said, run on server would help, possess even have LIGHTNING on it.

On your Possess node, the InPawn value must be set to the Character you wish to possess, so in this case it would be Self.

No change :frowning:

Well that’s normal. You are using “GetController”. GetController takes the controller that possesses the pawn. Since you “UnPossess” it, the pawn has no controller.
Try using “GetPlayerController 0” instead of GetController for your Possess node!

Works like a Charm, thank you sir :slight_smile: