the c_move won't move my entity!!!

Posted By: ato

the c_move won't move my entity!!! - 05/27/07 15:53

hello! I'm working (for my excercises) on a spaceship shooter.
See below, the code relative to firing, please:

Code:

...
...
if(key_ctrl && firing==0) {
firing = 1;
ent_create("fuoco.mdl",vector(my.x,my.y+32,my.z),fuoco);
}
...
...




my is related to the spaceship. And see this following code:

Code:

var firing = 0;
var s_laser;

sound laser <laser1.wav>;

function event_fuoco() {
firing = 0;
ent_remove(my);
}

function f_fuoco() {
temp.x = 0;
temp.y = 12*time;
temp.z = 0;
c_move(e_fuoco, temp, nullvector, IGNORE_YOU); // THIS DON'T WORKS...
s_laser = snd_play(laser,30,0);
waitt(3); //
firing = 0;
}

action fuoco {
e_fuoco = my;
e_fuoco.enable_block = ON;
e_fuoco.event = event_fuoco;
e_fuoco.scale_x = 0.066;
e_fuoco.scale_y = 0.066;
e_fuoco.scale_z = 0.066;
f_fuoco();
}



I'll only see the fire identity appearing but don't move upward... Any idea?

Thank you!
Posted By: Pinkhead

Re: the c_move won't move my entity!!! - 05/27/07 16:02

Have the oringinal script that, too?
Code:
 
function f_fuoco() {
temp.x = 0;
temp.y = 12*time;
temp.z = 0;
c_move(e_fuoco, temp, nullvector, IGNORE_YOU); // THIS DON'T WORKS...
s_laser = snd_play(laser,30,0);
waitt(3); //
firing = 0;
}



When you run the game (or something other) a error message appears?
Sorry for my bad english,

Pinkhead
Posted By: ato

Re: the c_move won't move my entity!!! - 05/27/07 16:03

No errors appears during gameplay.
The WAITT(3); is used to make a delay of firing when you hold down the ctrl key....
Posted By: Pinkhead

Re: the c_move won't move my entity!!! - 05/27/07 16:13

Oh sorry, i don't know that waiTT(3); exist...
I'm not a expert.
Test it so: Maybe it works.

Code:

var firing = 0;
var s_laser;

sound laser <laser1.wav>;

function event_fuoco() {
firing = 0;
ent_remove(my);
}

action fuoco {
e_fuoco = my;
e_fuoco.enable_block = ON;
e_fuoco.event = event_fuoco;
e_fuoco.scale_x = 0.066;
e_fuoco.scale_y = 0.066;
e_fuoco.scale_z = 0.066;
f_fuoco();
}

function f_fuoco() {
temp.x = 0;
temp.y = 12*time;
temp.z = 0;
c_move(e_fuoco,temp,nullvector,IGNORE_YOU);
s_laser = snd_play(laser,30,0);
waitt(3); //
firing = 0;
}


Posted By: ato

Re: the c_move won't move my entity!!! - 05/27/07 17:49

the difference by wait() and waitt() is:

wait(n) - waits for n frames
waitt(n) - waits for n ticks


Posted By: Pinkhead

Re: the c_move won't move my entity!!! - 05/27/07 17:50

Ah ok,
Does my new code work right?
Posted By: Fenriswolf

Re: the c_move won't move my entity!!! - 05/27/07 19:00

Hi,

you need a while loop in your script.
Without a loop your c_move instruction is called only once.

Example:
Code:

function f_fuoco() {
s_laser = snd_play(laser,30,0);
while(my) { // repeat as long as this entity exists
temp.x = 0;
temp.y = 12*time;
temp.z = 0;
c_move(e_fuoco, temp, nullvector, IGNORE_YOU);
wait(1);
}
}


Posted By: ato

Re: the c_move won't move my entity!!! - 05/28/07 07:10

yes Fenriswolf! I've missed the loop... Doh! Now works! Pinkhead thanks!

Thank you very much guys!!! :)
Posted By: Pinkhead

Re: the c_move won't move my entity!!! - 05/28/07 07:52

Yeah the loop, i forgot it.
Good Luck by your work, ato!
Posted By: ato

Re: the c_move won't move my entity!!! - 05/28/07 09:44

Thank you! I'll post to you a screenshot in this day
Posted By: ato

Re: the c_move won't move my entity!!! - 05/29/07 17:13

Hello!
As promising to you, is there a screenshot of my project. You can see the firing replication and moving



Thank you again!
© 2024 lite-C Forums