Hey folks. The effect I'm trying to achieve is that of a board that breaks into several pieces when destroyed by spawning different, fractured pieces in its place. For some reason, though, I can't get the Spawn() function to work. I must be doing something incredibly stupid with it, because I've been scrounging the web all night and nobody else seems to have trouble with this. Here's my code:
I have verified that it will continue to perform its function after the "destroy()" command has been given with a few broadcast messages, and I have also verified that the fragment actors do, in fact, work properly. I've also tried placing the Spawn() functions elsewhere prior to destruction and changing the location. I've tried swapping out the class of the actor being spawned, and I've tried changing the extension of this class to Interpactor. I've tried using broadcast messages and an actor variable to determine the name of what's being spawned, and the only thing the broadcast spits at me is 'none'.Code:class RevealKA_Board extends KActor placeable; var() int Health; event TakeDamage(int Damage, Controller EventInstigator, Vector HitLocation, Vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser){ super.TakeDamage(Damage,EventInstigator,HitLocation,Momentum,DamageType,HitInfo,DamageCauser); Health=Health-Damage; if (Health<=0) { Destroy(); Spawn(class'Reveal_Fragment_1_2'); Spawn(class'Reveal_Fragment_1_1'); //For frame of reference, these are simply KActors that have had a mesh component pre-selected in script and are pre-set to awake on start. } } DefaultProperties { begin object name=StaticMeshComponent0 StaticMesh=StaticMesh'BoardSample.Meshes.BoardSample' end object Components.Add(StaticMeshComponent0) Health = 25 bDamageAppliesImpulse=false bNoDelete = false }
I have to guess that I'm being really, incredibly dense about something and should fork over my programming badge, because this seems like a very basic thing that I shouldn't be screwing up like this. It's really embarrassing, but can anyone point out where I've gone wrong with this?



Reply With Quote


Bookmarks