|
|
Befor I jump into the deep waters of collision
#224902
09/01/08 21:01
09/01/08 21:01
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
I need help with a syntex error. I tryed every way I could think to use this but I have not been able to make it work. I have a jet plane that as a missle. When you hit a key (let say) key a the missle is created and than move. Seeing that as I turn the plane in all kinds of dir. the missle does not know which dir.to go. I been trying to make point in the dir. of the jet when it is created. CODE:
function create_missile1(){
if(ship1){ //makes sure ship1 exists
ent_create("missile1.mdl", vector(ship1.x, ship1.y, ship1.z-50),act_missile1);
{my.pan == ship1;}
}
}
This is what I am using(with out any luck) to point the missle in the dir. of the jet plane. {my.pan == ship1;} I tryed every way I could think of to make it work. NEED SOME HELP Thank You Renny
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: Befor I jump into the deep waters of collision
[Re: sadsack]
#224913
09/01/08 21:43
09/01/08 21:43
|
Joined: Aug 2008
Posts: 49
Vyse220
Newbie
|
Newbie
Joined: Aug 2008
Posts: 49
|
I can take you my code. while ((key_space == on) || (mouse_left == on)) {wait (1);} // wait until the player releases the keys
vec_set (temp.x, my.x);
temp.x += 70; // the laser is generated in front of the ship
snd_play (fire2_wav, 40, 0);
ent_create (laser2_mdl, temp, move_bullet1);This is the code in the ship action, it create a laser in front of the player that recall a specifc function: function move_bullet1()
{
var bullet_speed;
my.passable = on;
my.skill40 = 99; // player's bullet id
my.enable_impact = on;
my.enable_entity = on;
my.event = destroy_bullet;
my.pan = you.pan;
bullet_speed.x = 50 * time;
bullet_speed.y = 0;
bullet_speed.z = 0;
my.ambient = 100;
my.bright = on;
my.light = on;
my.red = 50;
my.green = 255;
my.blue = 50;
while (my.x < 700) // the bullets can destroy only what is visible on the screen
{
if (you != null)
{
if(vec_dist (my.x, you.x) > 50)
{
my.passable = off;
}
}
move_mode = ignore_you + ignore_passable;
ent_move (bullet_speed, nullvector);
wait (1);
}
ent_remove (my);
}this function make the bullet move in a direction and with some speed, it become inpassable when his x is > than 50 cause it can collide with the player. This is similar to the code of planet survivor, read aum39 i think it can help you
|
|
|
Re: Befor I jump into the deep waters of collision
[Re: Vyse220]
#224916
09/01/08 21:50
09/01/08 21:50
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
make sure they have the right/same directions in med you can also use vec_set(my.pan, ship1.pan); to set the pan, tilt and roll
|
|
|
Re: Befor I jump into the deep waters of collision
[Re: MrGuest]
#224917
09/01/08 21:53
09/01/08 21:53
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
Thank you both for your time and help. renny
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: Befor I jump into the deep waters of collision
[Re: MrGuest]
#224923
09/01/08 22:28
09/01/08 22:28
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
hey MrGuest, MS does not like that code. Ha Ha Ha It is not doing something right. here the error. Here is where I put the code, it maybe in the wrong place. CODE:
function create_missile1(){
missile1 = my;
if(ship1){ //makes sure ship1 exists
ent_create("missile1.mdl", vector(ship1.x, ship1.y, ship1.z-50),act_missile1);
{vec_set(my.pan, ship1.pan);}
}
}
I been looking in the manual and it say just what your code is so I don't know what to think. renny
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: Befor I jump into the deep waters of collision
[Re: sadsack]
#224924
09/01/08 22:40
09/01/08 22:40
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
OP
Senior Member
|
OP
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
hi all, I got the pan code to work, I went back to the manual and reread it and had a brain strom. here the code.
{vec_set(my.pan, ship1.pan);} new code {vec_set(missle1.pan, ship1.pan);}
It works great thanks all of you ON TO THE COLLISION renny
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: Befor I jump into the deep waters of collision
[Re: sadsack]
#224929
09/02/08 00:34
09/02/08 00:34
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
ahhh yeah, me will be NULL, unless you'd of either a) put in inside its action (which i'd hoped you'd do), action missile(){
vec_set(my.pan, ship.pan); or b) me = ent_create(etc...
wait(1); //make sure the ents created
vec_set(my.pan, ship.pan); you should still check to see if the ship exists before trying to duplicate it's properties
|
|
|
Re: Befor I jump into the deep waters of collision
[Re: MrGuest]
#224945
09/02/08 05:27
09/02/08 05:27
|
cemetarycat
Unregistered
|
cemetarycat
Unregistered
|
LoL! I know what you mean, sadsack. I get a lot of compiler errors in the 3D Game Studio and Lite C. And this one strange error popped up when compiling. 
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|