Results 1 to 4 of 4
  1. #1

    Default Can't get a Kactor to spawn via script

    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:

    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 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'.

    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?
    Last edited by NickCaligo42; 04-03-2012 at 11:25 PM.

  2. #2
    Skaarj
    Join Date
    Oct 2011
    Location
    Soviet Russia
    Posts
    11

    Default

    maybe KActorSpawnable ?
    ARE WE THE GODS

  3. #3

    Default

    ... Yep. That did it. That did it perfectly.

    Man. I am a tool. Thank you, my friend, that was most helpful.

  4. #4
    MSgt. Shooter Person
    Join Date
    May 2012
    Posts
    139

    Default

    Bump for being awesome and posting exactly what code I need to get started with physics fun stuff.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.