Befor I jump into the deep waters of collision

Posted By: sadsack

Befor I jump into the deep waters of collision - 09/01/08 21:01

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:
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
Posted By: Vyse220

Re: Befor I jump into the deep waters of collision - 09/01/08 21:43

I can take you my code.
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:
Code:
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
Posted By: MrGuest

Re: Befor I jump into the deep waters of collision - 09/01/08 21:50

Code:
my.pan = ship1.pan;
make sure they have the right/same directions in med

you can also use
Code:
vec_set(my.pan, ship1.pan);
to set the pan, tilt and roll
Posted By: sadsack

Re: Befor I jump into the deep waters of collision - 09/01/08 21:53

Thank you both for your time and help.
renny
Posted By: sadsack

Re: Befor I jump into the deep waters of collision - 09/01/08 22:28

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:
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
Posted By: sadsack

Re: Befor I jump into the deep waters of collision - 09/01/08 22:40

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
Posted By: MrGuest

Re: Befor I jump into the deep waters of collision - 09/02/08 00:34

ahhh yeah, me will be NULL, unless you'd of either

a) put in inside its action (which i'd hoped you'd do),
Code:
action missile(){
vec_set(my.pan, ship.pan);

or
b)
Code:
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
Posted By: Anonymous

Re: Befor I jump into the deep waters of collision - 09/02/08 05:27


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.


© 2023 lite-C Forums