Well, I went through your code and tried to fix a few things. I think I got it to work in the end. The major problem, as far as I know, was that every time you went through LoadCharacter (void), resetx (void), createObject (void), or checkItem (void), you redeclare an object of the class makeObject under a currently used name. You already created an object of the class makeObject called obj after you defined the class.
I am still a beginner to C++, and I'm not sure if this is right, but it almost seems like every time you make an object called obj, it overwrites the old one. Another change I made, because I don't know the difference between "extern class" and "class", and because my compiler got errors with "extern class" that I didn't know how to fix, I switched it to a class.
However, I never got the same problem that you had. For me, obj.objects[1], either returned a 0 or a 1. Anyway, I'll post the revised snippets here. See if they work for you.
Your object.h
class makeObject
{
public:
int objects[4], useables[3], x, z;
void createObject (CHAR* filename, int useable, int character);
void gravall (void);
void resetx (void);
} obj;
Your object.cpp
void makeObject::resetx(void){
x = 1;
z = 0;
z = z - 1;
}
void makeObject::createObject( CHAR* filename, int useable, int character){
if (character == 1){
dbLoadObject (filename, 1);
obj.objects[1]=1;
}else{
x = x + 1;
dbLoadObject (filename, x);
obj.objects[x]=x;
}
if (useable == 1){
z = z + 1;
obj.useables[z]= x;
}
}
void makeObject::gravall( void){
for (int i = 1; objects[i] != '\0'; i++){
float fHeight = dbGetTerrainGroundHeight ( 6, dbObjectPositionX (i ), dbObjectPositionZ (i ) );
dbPositionObject (i, dbObjectPositionX (i ), fHeight, dbObjectPositionZ (i ) );
}
}
Your load.cpp
void LoadCharacter ( void )
{
obj.resetx();
obj.createObject ("colonel-x.x", 0, 1);
}
Your use.cpp
void checkItem (void){
float playerid =obj.objects[1];
dbPrint(playerid);
}
Please try these and let me know what happens. I'll try to get back to this and see what happened for you. If you need anymore help, let me know and I'll try to help. Remember though, I'm a beginner still to C++!
By the way, I noticed that you use objects[1] but not objects[0]. In C++, arrays begin at 0, just in case you didn't know.
I hope this helps!