hi, me again with another question about structs.
In my attempt to create a fully customisabel turret script, i got this (for me) strange behaviour;
var testarray[2] = {1,39};
typedef struct
{
[...]
var harpoint_counter; // Max number of weapons for the turret
var* vertex_numbers[0]; // Array for the vertex of the model
[...]
} TURRET;
TURRET* Test;
init_structs_startup()
{
Test = sys_malloc(sizeof(TURRET));
Test.hardpoint_counter = 2;
Test.vertex_numbers = testarray;
[...]
}
But "Test.vertex_numbers[0/1] becomes 0,2 and 0,0039 instead of 1 and 39.
Later i would use the information this way
[...]
var i=0;
for(i=0;i<Test.hardpoint_counter;i++)
{
my.skill[4+i] = Test.vertex_numbers[i];
}
and use vec_for_vertex and ent_create to attach the guns.
But currently they are not placed at the right position, because of the wrong numbers above. Maybe i'm still to stupid for this kind of programming and the code above cant work at all.
I hope someone can help me to fix this problem or tell me to stop cause i follow a dead end. Tank you in advance.
regards