2 registered members (Ayumi, 1 invisible),
584
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
local vectors work, but skill vectors wont
#147652
08/13/07 03:58
08/13/07 03:58
|
Joined: Apr 2002
Posts: 1,246 ny
jumpman
OP
Serious User
|
OP
Serious User
Joined: Apr 2002
Posts: 1,246
ny
|
hello all.
Im trying to make George's perfect AI more modular for multiple entites. Im running into problems dealing with vectors that are created inside the entity action opposed to vectors defined in skills.
action blah { var current_node_vec3[3];
}
Above is an example of creating vectors inside the entity. This vector works fine with:
current_node_vec3.x = nodex[path2[my.local_i]]; current_node_vec3.y = nodey[path2[my.local_i]]; current_node_vec3.z = nodez[path2[my.local_i]];
The entity will look towards the correct position using vec_to_angle.
However when I try to use skills to define vectors:
var current_node_vec4,skill8; var current_node_vec4,skill9; var current_node_vec4,skill10;
the following dosent work:
current_node_vec4.x = nodex[path2[my.local_i]]; current_node_vec4.y = nodey[path2[my.local_i]]; current_node_vec4.z = nodez[path2[my.local_i]];
EVERY pathfinding entity will look towards one node, giving me the feeling that the current_node_vec4 vector is being seen as a global vector, even though it is defined as a skill.
When I revert back to the vector being created inside the entity action, the entities work fine, and look at their own personal nodes in their own paths.
There are no other skills that the entity is using that would take up the same skill numbers as the defined skills.
I'm 99% sure its not a pathfinding problem.
|
|
|
Re: local vectors work, but skill vectors wont
[Re: jumpman]
#147653
08/13/07 06:18
08/13/07 06:18
|
Joined: Sep 2002
Posts: 700 Orange County, CA
LogantheHogan
Developer
|
Developer
Joined: Sep 2002
Posts: 700
Orange County, CA
|
Hm, this line doesn't make sense to me: var current_node_vec4,skill8; Looks like you meant DEFINE instead? But if you change it to DEFINE it's going to give you a bunch of errors because you'd have to access it through MY.current_node_vec4 instead of current_node_vec4.x or whatever, and you can't use my.current_node_vec.x. What's the problem with defining the vector inside a function? I think it's a far superior way, and frankly I'm surprised you're not getting a bunch of compiler errors with the code you currently have. edit: sorry if that sounded at all rude. not intended whatsoever.
Last edited by LogantheHogan; 08/13/07 06:21.
|
|
|
Re: local vectors work, but skill vectors wont
[Re: jumpman]
#147655
08/13/07 09:50
08/13/07 09:50
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
Code:
define vector_x,skill20; define vector_y,skill21; define vector_z,skill22;
var test_vec[3] = 5,10,15;
action entity_act { vec_set(my.vector_x,test_vec); // ... my.vector_z += 30; }
All code above is example code and should run with no errors.
|
|
|
|