|
|
Re: what the hecks wrong here?
[Re: Fenriswolf]
#138306
06/28/07 11:07
06/28/07 11:07
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
if the ent_remove is commented out the torp gets stuck in me, if it`s not commented out it seems to be removed as sson as it`s created as i hear the torp_wav but see no torp. thanks again for your patience guys
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: what the hecks wrong here?
[Re: jigalypuff]
#138307
06/28/07 12:11
06/28/07 12:11
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
As Fenriswolf just said. The ent_remove has to be put after the closing bracket of the while loop. Code:
function move_torp1 { var bullet_speed; // this var will store the speed of the bullet var trace_coords; my.skill1 = 1; my.enable_entity = on; my.enable_block = on; my.enable_impact = on; my.visible = on; my.transparent = on; my.bright = on; my.passable = off; my.scale_x = 0.5;//scale it down to have it's size my.scale_y = my.scale_x;//same as scale x my.scale_z = my.scale_x;//same as scale x wait(1); c_updatehull(my,my.frame); wait(2); my.event = remove_torp1; // when it collides with something, its event function (remove_bullets) will run vec_set(my.pan, player.pan); vec_set(bullet_speed,nullvector); while (my.skill1) // this loop will run for as long as the bullet exists (it isn't "null") { bullet_speed.x = 40 * time_step; // move the bullet ignoring the passable entities and store the result in distance_covered c_move (my, bullet_speed, nullvector, ignore_passable); wait (1); }
wait(1); ent_remove(me); }
function remove_torp1() // this function runs when the bullet collides with something { my.skill1 = 0; }
edit: Added some stuff and correct some things, like the ; after the while(..)
Last edited by Xarthor; 06/28/07 12:14.
|
|
|
Re: what the hecks wrong here?
[Re: Xarthor]
#138308
06/28/07 12:18
06/28/07 12:18
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
ya thats what i did, however i never had that wait(1) before the ent_remove, the torp now appears for a second, does not move and then disapears. also if i have this ; in the while (my.skill1); i get error missing } but if it`s not there i get no errors, i`m damned if i can see were there is a bracket missing.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: what the hecks wrong here?
[Re: jigalypuff]
#138309
06/28/07 12:25
06/28/07 12:25
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
There is no bracket missing in the snippet I posted. And there should not be any semicolon after the while(my.skill1) at all. That will give you an error too, after you found that missing bracket. Update to the remove_torp1 function: Code:
function remove_torp1() { if(event_type == event_entity || event_type == event_impact) { my.skill1 = 0; } }
However that should not make any difference, as the event function is only triggered when an event happens.
|
|
|
Re: what the hecks wrong here?
[Re: Xarthor]
#138310
06/28/07 12:32
06/28/07 12:32
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
got rid of the semicolon, no errors now, however the torp still just flashs for a second and then vanishes again. it`s like the my.skill1 is somehow stoping the movement code.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: what the hecks wrong here?
[Re: jigalypuff]
#138311
06/28/07 12:42
06/28/07 12:42
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
Well from the snippet posted in here I cannot tell any more than: Weird  lol, well you should check all functions that deal with that torpedo if they influence the torpedo's skill1 in any way.
|
|
|
Re: what the hecks wrong here?
[Re: Xarthor]
#138312
06/28/07 12:54
06/28/07 12:54
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
ok mate, thanks for your help, i had better rewrite everthing i suppose instead of just adding bits in lol.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
|