3 registered members (NewbieZorro, TipmyPip, 1 invisible),
19,045
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
attachen won't work
#213082
06/25/08 19:09
06/25/08 19:09
|
Joined: Feb 2007
Posts: 53
n00bie
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2007
Posts: 53
|
me again. First some script:
ENTITY* boosterpaal;
ENTITY* temp_b;
ENTITY* gondel_1;
action rotate_boosterarm()
{
boosterpaal = me;
set(my,PASSABLE);
vec_for_vertex(&temp,my,2691);
...
)
action rotate_gondel1()
{
gondel_1 = me;
set(my,PASSABLE);
vec_for_vertex(&temp_b,boosterpaal,1);
my.x = temp_b.x;
my.y = temp_b.y;
my.z = temp_b.z;
}
The problem is that the engine shuts down with an error. Why? In C-script it worked.
|
|
|
Re: attachen won't work
[Re: Helghast]
#213087
06/25/08 19:27
06/25/08 19:27
|
Joined: Feb 2007
Posts: 53
n00bie
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2007
Posts: 53
|
action no longer is a supported parameter, replace it with void, that should work. also, temp is no longer available, you have to define that yourself first.
regards, The engine starts now, but the model is'nt visible that should be attached to "boosterpaal". The code:
VECTOR* temp_b;
ENTITY* boosterpaal;
ENTITY* gondel_1;
void rotate_boosterarm()
{
boosterpaal = me;
set(my,PASSABLE);
vec_for_vertex(&temp_b,my,2691);
...
}
void rotate_gondel1()
{
gondel_1 = me;
set(my,PASSABLE);
vec_for_vertex(&temp_b,boosterpaal,1);
my.x = &temp_b.x;
my.y = &temp_b.y;
my.z = &temp_b.z;
}
|
|
|
Re: attachen won't work
[Re: Helghast]
#213095
06/25/08 20:48
06/25/08 20:48
|
Joined: Feb 2007
Posts: 53
n00bie
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2007
Posts: 53
|
you dont need to write &temp_b, temp_b.x will do as well. besides that, looks fine to me.
regards, When I do that, the engine shuts down with a read error.
|
|
|
Re: attachen won't work
[Re: n00bie]
#213100
06/25/08 21:11
06/25/08 21:11
|
Joined: Oct 2004
Posts: 4,134 Netherlands
Joozey
Expert
|
Expert
Joined: Oct 2004
Posts: 4,134
Netherlands
|
action is still supported, as well as function. They are just definitions of void. But it can't hurt to replace them, I'd recommend it as well  . Since you use a vector pointer instead of a vector, you need to write temp_b->x, temp_b->y etc. The app crashes because boosterpaal is probably not assigned to rotate_boosterarm yet. You need to let the function wait for the entity to be assigned by writing: while(!boosterpaal){wait(1);} above in the function.
Click and join the 3dgs irc community! Room: #3dgs
|
|
|
Re: attachen won't work
[Re: Joozey]
#213103
06/25/08 21:19
06/25/08 21:19
|
Joined: Feb 2007
Posts: 53
n00bie
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2007
Posts: 53
|
action is still supported, as well as function. They are just definitions of void. But it can't hurt to replace them, I'd recommend it as well  . Since you use a vector pointer instead of a vector, you need to write temp_b->x, temp_b->y etc. The app crashes because boosterpaal is probably not assigned to rotate_boosterarm yet. You need to let the function wait for the entity to be assigned by writing: while(!boosterpaal){wait(1);} above in the function. void rotate_boosterarm() { boosterpaal = me; so it is assigned? And how do you mean with "temp_b->x, temp_b->y"?
|
|
|
Re: attachen won't work
[Re: n00bie]
#213105
06/25/08 21:36
06/25/08 21:36
|
Joined: Oct 2004
Posts: 4,134 Netherlands
Joozey
Expert
|
Expert
Joined: Oct 2004
Posts: 4,134
Netherlands
|
It is assigned, but perhaps the function rotate_gondel1() is loaded before rotate_boosterarm, thus boosterpaal is still an empty pointer. That's why you need to wait. -> is used when you ask an object's attribute through a pointer.
VECTOR vec = nullvector;
VECTOR* vec_pointer;
...
vec_pointer = vec; //give vector reference to the pointer
vec.x = 5; //vector.x is 5
vec_pointer->x = 6; //and now it is 6
Click and join the 3dgs irc community! Room: #3dgs
|
|
|
|