Vice City Multiplayer

VC:MP 0.4 (Beta) => Script Discussion => Topic started by: Flockshot on September 29, 2014, 06:35:56 pm

Title: using custom object as bullet
Post by: Flockshot on September 29, 2014, 06:35:56 pm
I have an idea to use a custom object as a bullet but there is a problem.

I can make that object and also move it.But the problem is that how do I figure out in which direction to move.
For Example: I used it but i am pointing it a little away from straight but the object goes straight and missing the player.

Can anyone give any idea so that i can move object to where the player points.
I know its possible.
Title: Re: using custom object as bullet
Post by: heekz.shadow on September 29, 2014, 08:06:19 pm
If you are good with math, it's extremely easy.

You can also search this forum and the unofficial one, it's been answered plenty of times.
Title: Re: using custom object as bullet
Post by: Flockshot on September 30, 2014, 04:08:04 am
I am good at math but dont know the equation to be used for it.


and i dont seem to find any on the forum.
Title: Re: using custom object as bullet
Post by: Flockshot on October 02, 2014, 12:46:14 pm
Anyone
Title: Re: using custom object as bullet
Post by: thijn on October 02, 2014, 12:56:32 pm
Code: [Select]
// [Ka]Juppi's func from http://forum.liberty-unleashed.co.uk/index.php/topic,398.0.html
function GetForwardPoint( pos, angle ) // you must pass an angle in degrees
{
local rad = angle * PI / 180; // we convert to radians
                local x = pos.x, y = pos.y;
local x2 = x + 1.0 * cos(rad) - 25.0 * sin(rad); // we calculate
local y2 = y + 1.0 * sin(rad) + 25.0 * cos(rad);
                return Vector( x2, y2, pos.z ); // return a vector
}

Object.MoveTo( GetForwardPoint( player.Pos, player.Angle ) )

Not tested, but it should give you an idea.
Title: Re: using custom object as bullet
Post by: Flockshot on October 02, 2014, 04:07:29 pm
Code: [Select]
// [Ka]Juppi's func from http://forum.liberty-unleashed.co.uk/index.php/topic,398.0.html
function GetForwardPoint( pos, angle ) // you must pass an angle in degrees
{
local rad = angle * PI / 180; // we convert to radians
                local x = pos.x, y = pos.y;
local x2 = x + 1.0 * cos(rad) - 25.0 * sin(rad); // we calculate
local y2 = y + 1.0 * sin(rad) + 25.0 * cos(rad);
                return Vector( x2, y2, pos.z ); // return a vector
}

Object.MoveTo( GetForwardPoint( player.Pos, player.Angle ) )

Not tested, but it should give you an idea.

That just move the object in only 1 place no matter what the angle is.
About u saying that it can give me idea i cant understand it.

I dont know about PI,cos,sin i am just in class 8 and it haven't been taught to us.
Title: Re: using custom object as bullet
Post by: thijn on October 02, 2014, 08:04:32 pm
Then it's probably a good idea to find something else to do.
Title: Re: using custom object as bullet
Post by: Flockshot on October 03, 2014, 05:14:08 am
If i remember correctly there was a ramp function in your,stormues test server that make a ramp in front of player
Is it possible to give me that.
Title: Re: using custom object as bullet
Post by: thijn on October 03, 2014, 05:58:22 pm
That's the code I posted.
Title: Re: using custom object as bullet
Post by: Flockshot on October 03, 2014, 06:06:42 pm
That's the code I posted.
Then that code should work.