I have been using AGS to make my game for months now, and have been lurking in the forums reading everything I can about this wonderful program....But now I'm stuck and I need help :P I want to share a struct and no matter how hard I try, AGS won't have it. This is what I have:
*********in global script*********
struct type1
{
int level;
int exp;
int chakraname;
int power[5];
};
struct type2
{
int str;
int powername;
int on;
int type;
};
type1 chakra[7];
type2 powers[20];
....
export chakra;
export powers;
*****in script header******
I have tried either
import int chakra;
import int powers;
or
import int chakra[7];
import int powers[20];
and even
import type1 chakra[7]; >>>>AGS doesn't like that one
import type2 powers[20]; >>>>at all :P
*****In local script*********
int tempstr=powers[chakra[1].power[1]].str;
but when I compile, I get a message that says:
"str is not of type int"
now, I know why it's telling me that (powers and chakra are not imported as struct but as one-dimensional ints) but I don't know how to fix it. Can anybody help?
Try this:
// main global script file
type1 chakra[7];
type2 powers[20];
export chakra;
export powers;
// Main header script
struct type1
{
int level;
int exp;
int chakraname;
int power[5];
};
struct type2
{
int str;
int powername;
int on;
int type;
};
import type1 chakra[7];
import type2 powers[20];
thank you, that worked ;D ...That must have been the only thing I hadn't tried as well :P