Page 1 of 1

Internal Value for Clones

PostPosted: Sun Aug 28, 2005 10:51 pm
by Conqueran
I know actors can have internal values but is it possible for every clone of an actor to have a separate internal value?

For instance I'd like to create a transport actor, however I want each transporter clone to bring the main character to a different place.

Anyway to do this besides making 20+ separate transporter actors.

Any help is appreciated :).

PostPosted: Sun Aug 28, 2005 11:29 pm
by Game A Gogo
I encounter that problem to.

PostPosted: Mon Aug 29, 2005 12:56 am
by jazz_e_bob
You could use something like this:

Code: Select all
// set transport exit points

getclone("transport.1")->exitX = 100;
getclone("transport.1")->exitY = 100;

getclone("transport.2")->exitX = 200;
getclone("transport.2")->exitY = 400;


It may be simpler to build 2 actors per transporter.

tranporterStart & transporterEnd

Then you could use

On Collision with tranporterStart:

Code: Select all
ship.x = getclone2("transporterEnd", collide.cloneindex)->x;
ship.y = getclone2("transporterEnd", collide.cloneindex)->y;


This method would make it much simpler to design and edit levels.

You can get a copy of getClone2 here:
http://www.game-editor.com/forum/viewtopic.php?t=711&highlight=getclone

PostPosted: Mon Aug 29, 2005 8:29 pm
by ondy1985
Yes, I would really appreciate 'Copy actor' function.

PostPosted: Tue Aug 30, 2005 7:56 pm
by Conqueran
Thanks JAzz E BOB, I finally figured out that getclone thing. Its really useful.

PostPosted: Tue Aug 30, 2005 8:41 pm
by BeyondtheTech
Yes, think of getclone as a long-winded way of getting to an actor's internal variable.

What's nice is the getclone2 implementation that was posted here on the forum. If you are accessing a bunch (read: loop) or a different clone every time, you can use the getclone2 to specify the actor and the cloneindex separately.

For instance, I have 5 ships present, all called "ship.0" through "ship.5". for (a=0;a<6;a++) getclone2("ship",a)->xvelocity=1; allows me to individually set the xvelocity without having 6 separate lines of code.