|
I'm stumped, my variables dont work lol
#228191
09/18/08 06:08
09/18/08 06:08
|
Joined: Nov 2005
Posts: 66 Spokane, WA, USA
Vonman
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2005
Posts: 66
Spokane, WA, USA
|
I'm trying to TILE some dirt models to make a ground, instead of doing it with WED, I wanted to make a script that automaticaly generates the tile (for however long or big).
We all know that if you create two or more entities with the same pointer, and you change the xyz cords of the pointer (like thing.x += 10), then everything with the pointer (even if more than one entity) will all move.
This being taken into consideration, I made a global variable called 'placement[3],0,0,0'.
In the ent_create(-----) function, one of the parimeters is the initial position.
ent_create("gndtile.mdl",PLACMENT,NULL);
In the function that I used in order to MODIFY the xyz cords of PLACEMENT[3], which is an outside function, I tryed to modify my variable so that the NEXT generated tile would pop up 855 quants further down the .X cords. My modification looked like this.
placement.x += 855;)
When I tryed to run that, I got an error messege saying, " 'X' is not a member of 'function' ".
What i'm trying to figure out is WHY I cannot modify placement.x (or .y or .z) from within a function OTHER than the function that created the entity.
It worked before with C-Script, won't work with LC. placement[3] is a global variable, so it's not like i'm tring to use a local variable that exists within another function in the script.
Last edited by Vonman; 09/18/08 06:12.
|
|
|
Re: I'm stumped, my variables dont work lol
[Re: Vonman]
#228206
09/18/08 07:50
09/18/08 07:50
|
Joined: Oct 2007
Posts: 5,211 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
|
use VECTOR* placement; instead of placement[3]
ps. if you create entities on same pointer, the pointer will point only the las one you created.
VECTOR* placement = vector(0,0,0); int tile_count = 0; while(tile_count>100){ ent_create("tile.mdl",placement,NULL); placement.x+=855; tile_count++; if(tile_count%10 == 0){//move to the next row at 10 tiles(a row will have 10 tile) placement.y += 855; } }
3333333333
|
|
|
Re: I'm stumped, my variables dont work lol
[Re: Quad]
#228222
09/18/08 09:27
09/18/08 09:27
|
Joined: Oct 2003
Posts: 702
zazang
User
|
User
Joined: Oct 2003
Posts: 702
|
remember that LC is case-sensitive so if u use an X instead of x then it will throw an error.
I like good 'views' because they have no 'strings' attached..
|
|
|
Re: I'm stumped, my variables dont work lol
[Re: zazang]
#228316
09/18/08 17:33
09/18/08 17:33
|
Joined: Nov 2005
Posts: 66 Spokane, WA, USA
Vonman
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2005
Posts: 66
Spokane, WA, USA
|
Thanks guys, I just figured it out last night, I just had to go from directly modifying the variable PLACEMENT.X to modifying it with a VEC_ADD instruction.
vec_add(placement,vector(855,0,0));
Now I just have to work around a few weird here-and-there puzzlers and I have just learned to do LC lol
|
|
|
|