I worked through the Weapon code to see if I could find some inspiration on this problem, but nothing came along my way.
My goal is to offer the LD the possibility to spawn a KActor when the UltimateDestroyableEnvironment took enough damage. In order to do that, I created a custom subclass of the Karmathing (a KActor that replicates it's movement to the client, see here for code) that is bStatic = False and bNoDelete = False.
Then I want to spawn it in the TakeDamage()-function of the UDE (which is bNoDelete=True btw, so all mapper-defined variables should be known on the client), which I declared simulated:
Works all fine in offline play, but nothing is spawned online (and it doesn't feel like it's spawned on the server as well because I have no invisible collision anywhere). I imagine it pretty hard to spawn exactly the same object on server and client, but it needed to be done this way in order to keep the things synced, I guess.Code:simulated function TakeDamage( int NDamage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType) { […] // Spawn KActors for (j = 0; j < LevelOfDestruction[i].KarmaDeco.Length; j++) { if (LevelOfDestruction[i].KarmaDeco[j].KActorStaticMesh != None) { SpawnedKActor = Spawn(class'DynamicSpawnableKarmaThing', self,, Location + LevelOfDestruction[i].KarmaDeco[j].SpawnOffset, Rotation + LevelOfDestruction[i].KarmaDeco[j].RotationOffset); if (SpawnedKActor != None) { SpawnedKActor.LifeSpan = LevelOfDestruction[i].KarmaDeco[j].KActorLifeSpan; SpawnedKActor.SetStaticMesh(LevelOfDestruction[i].KarmaDeco[j].KActorStaticMesh); SpawnedKActor.MaxNetUpdateInterval = Max(LevelOfDestruction[i].KarmaDeco[j].KActorMaxNetUpdateInterval, 0.25); } } } } // ============================================================================ // GainedChild // // This is the only place where we can assign our custom KParam as KParam of // the spawned KActor before the Karma physics are initilizing. // ============================================================================ simulated function GainedChild(Actor Other) { if (DynamicSpawnableKarmaThing(Other) != None) { DynamicSpawnableKarmaThing(Other).KParams = LevelOfDestruction[i].KarmaDeco[j].KActorParameters; } }
Any ideas?
Ok, maybe I need to do something with PostNetReceive and some bools that get replicated in order to spawn it on the client, but that doesn't solve the sync problem, does it?




Reply With Quote



Bookmarks