Killing Actors

Non-platform specific questions.

Killing Actors

Postby Parrot » Sun Oct 22, 2006 6:05 am

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.
Parrot
 
Posts: 36
Joined: Sun Sep 25, 2005 9:04 pm
Score: 0 Give a positive score

Postby makslane » Sun Oct 22, 2006 1:22 pm

makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Parrot » Mon Oct 23, 2006 12:33 am

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.
Parrot
 
Posts: 36
Joined: Sun Sep 25, 2005 9:04 pm
Score: 0 Give a positive score

Postby makslane » Mon Oct 23, 2006 12:41 am

To destroy all green actors, just use:

Code: Select all
DestroyActor("green");


Don't need any loops.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Parrot » Mon Oct 23, 2006 12:55 am

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.
Parrot
 
Posts: 36
Joined: Sun Sep 25, 2005 9:04 pm
Score: 0 Give a positive score

Postby DilloDude » Mon Oct 23, 2006 2:45 am

Probably the simplest way is to store them in an array, and loop through the array and destroy them.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest