Problems with Pawn (Destroying and Ragdoll)


I am currently stuck with this one:
If a pawn get’s killed he should get removed by our game mode when some time passed (round end).

The current code:

   for (TActorIterator<AGameCharacter> ActorItr(GetWorld()); ActorItr; ++ActorItr)
    		AGameCharacter* CurrentDeadBody = *ActorItr;
    		if (!CurrentDeadBody->GetController())
    			UE_LOG(LogTemp, Warning, TEXT("I am dead: %s"), *CurrentDeadBody->GetName()); // gets called and prints the right name
    			GetWorld()->DestroyActor(CurrentDeadBody); // does not work
    			CurrentDeadBody->killme(); // Neither this  (just this->Destroy(); on the pawn)

The game is a multiplayer game, but since it gets called from the game mode this should not be a problem, right?

When this->destroy() is called right after DetachFromControllerPendingDestroy(); within the pawn after taking damage it works.
I am also unable to go into ragdoll mode. (I almost copied the entire code from the first person example shooter game (AShooterCharacter::OnDeath()))

The game is at 4.13.2

I have absolutely no clue right now… :confused:

Ragdolling characters can actually be a bit difficult to set up in Multiplayer, since you want the pawn to ‘tear off’ and stop replicating movement etc too most likely.

Check out ShooterGame, it has code that does exactly this :slight_smile:

I already checked that one.
Seems that I have to destroy the pawn on the server AND on the client …
I think I am ending up just copying a lot of the ShooterGame’s Character class (but why not ^^)

I am still unable the remove all the dead corpses (first post)

Can’t destroy them?
“CurrentDeadBody->Destroy();” should work.

As for ragdolling, the default method is to ‘tear off’ the characters and then enable physics on the character mesh.
When an actor is torn off, it is destroyed on the server, but remains on any clients it existed on previously - hence, torn off.

If you do not need dead bodies to be synchronized, this method is the better way of doing things, since it reduces the load on the server.
This method requires removing the bodies via a message on the game state instead of game mode.

If you do need them synchronised, well, as TheJamsh mentioned, that is more difficult, though not impossible.

I got some of the code from the shootergame and the ragdoll works now.
But Destroying does only work if I call a NetMuslticast method (this->Destroy():wink: on the pawn.
Also one of the models seems to “vibrate” while being in ragdoll (only this, a different one works).

I have a bigger, strange problem now:

Dropbox - File Deleted <- log

I have absolutely no clue why.
The editor crashes while compiling, but after restarting it seems that everything is compiled correctly.
Also AttachToProcess with VS does not work.

Any suggestions?

// edit:

Seems to work after doing this in a completely different file (last changed more than 3 months ago):

bool UTODemoList::Initialize()
	//ReplayStreamer = FNetworkReplayStreaming::Get().GetFactory().CreateReplayStreamer();

    //EnumerateStreamsVersion.Changelist = 0;
    //EnumerateStreamsVersion.NetworkVersion = 0;


    return true;