clone index question

You must understand the Game Editor concepts, before post here.

clone index question

Postby savvy » Sat Apr 16, 2011 12:55 pm

ok, so im trying to make it so that the view moves to a specific actor depending on its clone index. (short level transfer thing)
i have this so far, according to GE documentation...
Code: Select all
int i = level; //level is the level variable
Actor*getclone(char*levelindicator);
x=levelindicator[i].x;

im trying different things... if i get it right ill post so here, and show what i put.

please help

savvy
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 490
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 43 Give a positive score

Re: clone index question

Postby DarkParadox » Sat Apr 16, 2011 5:15 pm

Well, as it's my habit, I always use cloneID [by Feral] when working with clones (put in global code, save it):
Code: Select all
char buffer[50];
char * cloneID(const char *cname, short unsigned int cindex)
{
    sprintf(buffer, "%s.%d", cname, cindex);
    return buffer;
}


And use this code:
Code: Select all
// We don't need "i" anymore, just use level directly
x=getclone(cloneID("levelindicator", level))->x;
// See here, get clone lets us get a variable from a clone, and cloneID sets the name for us.
// The "->" is required instead of a "." when using getclone, and the X is retrieved.


Hope this helps, (^↽^)
◄Lurker Coder►
I'm in the chat over at game-editor.net often, why don't you come on by?
◄Black Hole of Codes (GUI API & More)►
◄GE's keywords and operators and how to use them►
Please excuse stupidity in my older posts, I was an internet newbie!
User avatar
DarkParadox
 
Posts: 445
Joined: Mon Jan 08, 2007 11:32 pm
Location: USA, Florida.
Score: 83 Give a positive score

Re: clone index question

Postby savvy » Sun Apr 17, 2011 1:24 pm

thanks a bunch dark ;) 1up for you
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 490
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 43 Give a positive score

Re: clone index question

Postby lcl » Sun Apr 17, 2011 10:33 pm

Btw dark, here's more easy to use function for checking clones by index.
Code: Select all
char ACTOR[50];

Actor * getClone2(char NAME[50], int NUM)
{
    sprintf(ACTOR, "%s.%i", NAME, NUM);
    return getclone(ACTOR);
}


Example:
Code: Select all
getClone2("myActor", 5)->x = 10;


I don't remember who made this one originally, but I use it. :)
ERROR: -Couldn't find "world-dominating bunny"-

SABRE - 3D raycasting engine for GE!
LCL Games LCL Games on Facebook
User avatar
lcl
 
Posts: 1776
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 192 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 0 guests

cron