0 registered members (),
1,459
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: c_move question
[Re: Torr]
#151680
09/02/07 15:44
09/02/07 15:44
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
hello
he is moving 1 qaunt a fram say you have 120 fps he is moving 120 qaunts * wait(-5);
c_move(me, temp, nullvector, GLIDE)*time_step;
ore
temp = (key_cuu - key_cud)*time;
"empty"
|
|
|
Re: c_move question
[Re: Torr]
#151681
09/02/07 17:13
09/02/07 17:13
|
Joined: Nov 2002
Posts: 792 Berne, Switzerland
elsewood
User
|
User
Joined: Nov 2002
Posts: 792
Berne, Switzerland
|
write it like that: Code:
wait(-5.0); temp = vector(1,0,0); c_move(me, temp, nullvector, GLIDE);
The problem with your code ist that temp will sure be used by other functions during the wait instruction... So better use a local variable for that!!
A bus station is where the bus stops. A train station is where the train stops. On my desk I have a workstation...
|
|
|
Re: c_move question
[Re: elsewood]
#151682
09/03/07 09:51
09/03/07 09:51
|
Joined: Aug 2007
Posts: 17
Torr
OP
Newbie
|
OP
Newbie
Joined: Aug 2007
Posts: 17
|
The code still doesn't work. You're right about temp being modified but I have no idea by what since I don't use it anywhere else. I added a watch(never thought of that before) on temp, set a breakpoint at temp = vector(1,0,0); and the x value goes from 0 to 264628.23 at that point. Is temp a predefined variable? I've tried changing it to another name and I get an Unknown Parameter error. Code:
// main game loop while(1) { if(gid01_level_state != gid01_level_loaded) { freeze_mode = 1; // pause the game while(gid01_level_state != gid01_level_loaded) { wait(1); } freeze_mode = 0; // resume the game } wait(1); UpdateBots(); } Function is defined in another wdl. Code:
function UpdateBots() { my = ptr_for_handle(list[0]); wait(-5.0); temp = vector(1,0,0); c_move(me, temp, nullvector, GLIDE); }
|
|
|
Re: c_move question
[Re: Torr]
#151684
09/03/07 11:05
09/03/07 11:05
|
Joined: Jul 2000
Posts: 8,973 Bay Area
Doug
Senior Expert
|
Senior Expert
Joined: Jul 2000
Posts: 8,973
Bay Area
|
Quote:
Is temp a predefined variable?
Yes.
Quote:
I've tried changing it to another name and I get an Unknown Parameter error.
In Lite-C (or C-Script) you need to define a parameter before using it. Parameters like "temp" and "my" are already defined, so you don't get an error.
See the user manual for more information (Lite-C->Syntax->Variables).
|
|
|
Re: c_move question
[Re: Felixsg]
#151686
09/03/07 13:38
09/03/07 13:38
|
Joined: Aug 2007
Posts: 17
Torr
OP
Newbie
|
OP
Newbie
Joined: Aug 2007
Posts: 17
|
Thanks for the replies, everyone. I'm really new to this so I appreciate all the help I'm getting Quote:
You like to teleport not to move?
No, I want to move, not teleport/translate.
Quote:
In Lite-C (or C-Script) you need to define a parameter before using it. Parameters like "temp" and "my" are already defined, so you don't get an error.
I've tried these(C-Script): Code:
var temp_vec; //entity* temp_vec; temp_vec = vector(1,0,0);
entity* temp_vec doesn't compile. I thought vector() returns a pointer? var works. Does temp_vec become an array in this case?
Quote:
ok...now you ignored the fact that you must use
* time_step / 16; ...you should use that, and just use a number, instead of refering to a variable to make sure it works. If it does, define a variable(inside the top of the action/function) to keep it local, if it is global, you will end up with bots that are adding to their speed or other weird things.
Do you mean flits's code? Code:
wait(-5);
c_move(me, temp, nullvector, GLIDE)*time_step;
ore
temp = (key_cuu - key_cud)*time;
I didn't understand why there's *time_step or the 2nd line so I tried elsewood's suggestions first. Can you explain further?
|
|
|
Re: c_move question
[Re: Torr]
#151687
09/03/07 14:54
09/03/07 14:54
|
Joined: Jul 2005
Posts: 1,002 Trier, Deutschland
Nowherebrain
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
|
it should be something like this....
c_move(me,(vector((10 * time_step / 8),0,0)),nullvector,glide); not all the brackets are necessary, but it's good practice to encapsulate or separate math operations.
there you would be moving forward(the actors "X")
a vec is using vector(x,y,z), you could add gravity by adjusting the "Z" paramater. alternately it could be used to define color... vector(red,green,blue), it really depends on the variable. I hope this makes sense and that it helps.
|
|
|
|