Page 1 of 1

Killing Actors

PostPosted: Sun Oct 22, 2006 6:05 am
by Parrot
I've got this code that I'd thought would delete all the clones of an actor that still exist:

Code: Select all
    int i;
    for(i=0; i<5; i++)
    {
        if(getclone("green.i"))
        {
            DestroyActor("green.i");
        }
    }


There are at most 5, some may have already been destroyed. This is supposed to go through each, see if it exists, and if it does destroy it.

It's not working properly though. Am I using getclone improperly?

I think I may also be concatenating improperly, it's hard to find information on this in the help files.

PostPosted: Sun Oct 22, 2006 1:22 pm
by makslane

PostPosted: Mon Oct 23, 2006 12:33 am
by Parrot
Thanks Mak, I'll use that. But I think that's not the only problem. I suspect it's a problem with concatenation, could you give me the proper syntax to concatenate a number to the end of a string? I tried this code:

Code: Select all
    int i;
    for(i=0; i<5; i++)
    {
         DestroyActor("green.i");
    }


and it only destroyed one of the "green" actors.

PostPosted: Mon Oct 23, 2006 12:41 am
by makslane
To destroy all green actors, just use:

Code: Select all
DestroyActor("green");


Don't need any loops.

PostPosted: Mon Oct 23, 2006 12:55 am
by Parrot
makslane wrote:To destroy all green actors, just use:

Code: Select all
DestroyActor("green");


Don't need any loops.


What I would like to do is destroy them one at a time with a small pause between.

PostPosted: Mon Oct 23, 2006 2:45 am
by DilloDude
Probably the simplest way is to store them in an array, and loop through the array and destroy them.