SA-MP Forums Archive
some advanced maths conversion.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: some advanced maths conversion.. (/showthread.php?tid=252437)



some advanced maths conversion.. - Donya - 01.05.2011

pawn Код:
if(a <= 5.0 || a >= 355.0) x += 0.645;
                    else if(a <= 10.0) x += 0.645 + (floatsin(-a, degrees) / 0.62);
                    else if(a <= 20.0) x += 0.645 + (floatsin(-a, degrees) / 0.68);
                    else if(a <= 30.0) x += 0.645 + (floatsin(-a, degrees) / 0.69);
                    else if(a <= 40.0) x += 0.645 + (floatsin(-a, degrees) / 0.65);
                    else if(a <= 44.0) x += 0.645 + (floatsin(-a, degrees) / 0.62);
                    else if(a <= 48.0) x += 0.645 + (floatsin(-a, degrees) / 0.60);
                    else if(a <= 50.0) x += 0.645 + (floatsin(-a, degrees) / 0.58);
                    else if(a <= 60.0) x += 0.645 + (floatsin(-a, degrees) / 0.63), y -= 0.3;
what i am trying to accomplish
im trying to get at each angle, it will create a pickup at the minigun (at the bullet holders or w/e, in this picture it shows at angle 40.0 is working right, but after 70 i cant seem to get it to work, isn't there some kind of way to do it in a few lines with floatsin or something?

x offset at 0.0 - 0.645
y offset at 0.0 - 1.42
z offset at - -0.30 + 0.07

Picture:



Re: some advanced maths conversion.. - Backwardsman97 - 01.05.2011

So you're trying to create something at the minigun?


Re: some advanced maths conversion.. - Donya - 01.05.2011

yes, at all zangles which the vehicle is facing, im trying to create like a bullet, dont worry about where it moves or what ever, i just need it at the minigun, where the health pickup is at


Re: some advanced maths conversion.. - SchurmanCQC - 01.05.2011

Offtopic: Pretty advanced shit there. >.>


Re: some advanced maths conversion.. - Donya - 01.05.2011

oh and
pawn Код:
w/e * (floatsin(-a, degrees)
does not work. i've tested it in almost all ways

and Backwardsman97, this is actually based off of your 0.3c vehicle missiles


Re: some advanced maths conversion.. - Backwardsman97 - 01.05.2011

Well you can't get the position in front of the actual object because it's coordinates don't update when it's attached like that. What I did was I got the position to the left or right of the vehicle, created the missile, then got the position in front of the missile. Here's the section of code that deals with it.

pawn Код:
GetVehiclePos(id,x,y,z);
GetVehicleZAngle(id,a);

a += 270;
z += VehicleOffsetZ[id];

x += (VehicleOffsetX[id] * floatsin(-a, degrees));
y += (VehicleOffsetX[id] * floatcos(-a, degrees));

VehicleBomb[id][0] = CreateObject(3790,x,y,z,0,0,a,300.0);
VehicleSmok[id][0] = CreateObject(18731,x,y,z-1.3,0,0,0,300.0);

a += 90;

x += (30 * floatsin(-a, degrees));
y += (30 * floatcos(-a, degrees));

MoveObject(VehicleBomb[id][0],x,y,z,MISSILE_SPEED);
MoveObject(VehicleSmok[id][0],x,y,z-1.3,MISSILE_SPEED);

SetTimerEx("VM_Explode",MISSILE_DETONATE_TIME,0,"dd",id,0);
You can toy with the offsets and what not. I have to go now but if you still have problems with it, you can PM me.


Re: some advanced maths conversion.. - Donya - 01.05.2011

yes, i saw that thats something like what im trying to do, but instead of you getting the right or left position of the vehicle, i am doing the same, but getting the right corner window shield end of a bullet / or of the minigun attached to the bullet


Re: some advanced maths conversion.. - Donya - 01.05.2011

no, that wont work.. tried it


Re: some advanced maths conversion.. - Donya - 02.05.2011

bump


Re: some advanced maths conversion.. - Donya - 09.05.2011

bump