PDA

View Full Version : [solved] Kismet Event Destroyed not called with custom KActorSpawnable



FTC
02-10-2012, 11:24 AM
Hi,

I created a custom KActorSpawnable and use an Actor Factory in Kismet to create them. I want a fixed maximum amount of them in the level and create new ones when others are destroyed, so I created this Kismet setup:
http://img803.imageshack.us/img803/5411/kismet.png

To keep track of the currently existing actors I use an objectlist. The problem is that the destroyed event is never called when the kactors destroy after their ticks.
My Actor code is this:


class Leukocyte extends KActorSpawnable
placeable;

var float LifeTime;

function Tick(float DeltaTime)
{
super.Tick(DeltaTime);

LifeTime+=DeltaTime;
if(LifeTime>15)
{
Destroy();
}
}

DefaultProperties
{
Begin Object Name=StaticMeshComponent0
LightEnvironment=MyLightEnvironment
StaticMesh=StaticMesh'leukocyte.Mesh.leukocyte'
CastShadow=false
BlockRigidBody=true
CollideActors=true
End Object

CollisionType=COLLIDE_BlockAll

Begin Object Class=ParticleSystemComponent Name=ParticleSystemComponent1
Template=ParticleSystem'leukocyte.Effects.leukocyt e_extends'
End Object
Components.Add(ParticleSystemComponent1)

bWakeOnLevelStart=true

LifeTime=0;
}


Is that a bug or am I missing something completly obvious?

Edit:
http://desmond.imageshack.us/Himg141/scaled.php?server=141&filename=errorjr.jpg&res=medium
Unchecking "Player Only" solved everything

greetings

lovindadonks
02-10-2012, 12:28 PM
I'm not 100% sure what you are trying to do, but every 15 ticks (pretty quickly) you are destroying these actors. If you can give me a more detailed description of what you are trying to do, I may can help you with a better solution. That being said, make your the bDeleteMe is set correctly and it should be able to destroy the object. I would also make logs in your Destroy() because it may never get destroyed in the first place. There are alternate ways to doing this as well, like having a named Remote Event called from script every time one of these should die. This way, you don't have to keep track of every single reference of these things, but rather, any one that enters the world and dies calls this same event and this event can handle the decrement variable and any other housekeeping you need.

FTC
02-10-2012, 12:59 PM
It is not 15 ticks, because DeltaTime is about 0.016 every tick so the actor lives for several seconds. I try to emulate something like a KActor particle system with a maximum count (2 in this example). When the Destroy() function is called the actor gets deleted (at least the visual part does, because it is gone from the scene). When I try to set bDeleteMe in the Tick() or other functions it tells me I cannot assign const variables and when I set it to true in the defaultproperties I cannot spawn the actor anymore. As for remote events, that would be an idea but I read several times that those are for kismet internal event handling and are not meant to be used with script.

greetings

UnrealEverything
02-10-2012, 01:07 PM
If I dont mix things up, KActors don't get destroyed, they get shutdown.
So you have to find a workaround.

FTC
02-11-2012, 02:50 AM
I changed the super class from KActorSpawnable to Actor to test if KActors prevented the Destroyed event but no change. However the Actors definitly get destroyed in both cases. I looked it up with the -wxwindows interface. Could it be that something changed in UDK? I remember a similar setup that I did a long while ago that worked... That is why I asked for something that I overlooked.

greetings

UnrealEverything
02-11-2012, 03:46 AM
You might want to check what the Destroy() call returns ("true if destroyed, false if indestructible"), also check if Destroy/Destroyed is called at all. Or if the log says anything.

FTC
02-11-2012, 05:12 AM
I did all those things and everything indicated the successful deletion, but still no event. So I went through all the kismet piece by piece and found a checkbox to be the problem:
http://desmond.imageshack.us/Himg141/scaled.php?server=141&filename=errorjr.jpg&res=medium
Unchecking "Player Only" solved _everything_ :mad:

Well so much for overlooking something :o
Thanks for your help