Ok so i'm having trouble with structs, it seems that they can only be used to statically create 3d objects, as there is no way of referencing them afterwards... heres my lates nemesis:
=================================================================
typedef struct
{
var lifetime;
ENTITY* model;
} box;
function i_am_fly()
{
my.lifetime -= 1;
if (my.lifetime < 1)
{
ent_remove(my_box.model);
}
}
function new_box()
{
box my_box;
my_box.model = ent_create("cube_small.x",vector(0,0,0),NULL);
my_box.function = i_am_fly();
/* some 3d object set up stuff */
my_box.lifetime = 100;
c_setminmax(my_box.model);
wait(1);
/* some object physics set up stuff */
num_box=num_box+1;
}
}
wait(1);
}
===============================================================
There is very little information on using structs in the manual really, theres no examples of getting data from them and no information on how to remove a struct entry altogether.
However i saw that *effects* use something called "my.function* to make stuff happen to their particles after creation and assumed this works for structs also. I'm also assuming that the assigned function is run once per struct entry per frame?
However the code above doesn't work as lite-c tells me the line "my.lifetime -= 1;" is giving the error: ".lifetime is not a member of ENTITY".
Which is wrong as i defined it in the struct defenition!!!!
Last edited by CdeathJD; 09/11/08 14:30.