Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Can someone help me make this speedomater display more accurately?
Can someone help me make this speedomater display more accurately?
2001-06-17, 1:59 PM #1
This speedometer displays player's speed in km/h and mph correctly only if the player is travelling along the x-axis, y-axis or z-axis. The display goes way off when player travels diagonally on the map. Can someone help me make the display more accurately when player isn't travelling along the axes?

Code:
pulse:
testspeedo = GetThingVel(player);
vecx = VectorX(testspeedo);
vecy = VectorY(testspeedo);
vecz = VectorZ(testspeedo);
if (vecx < 0) vecx = vecx - (vecx * 2);
if (vecy < 0) vecy = vecy - (vecy * 2);
if (vecz < 0) vecy = vecz - (vecz * 2);
resul = (vecx + vecy + vecz) * 36;

//resul = vectornorm(testspeed0);
resul2 = resul * 0.62137;
print("");
print("");
print("");

printvector(testspeedo);

jkstringconcatint(resul);
jkstringconcatasciistring(" km/h              ");
jkstringconcatint(resul2);
jkstringconcatasciistring(" mph              ");
jkstringoutput();
jkstringclear();
return;


------------------
"...and may the Force be with you."
-Luke Skywalker

Dark Luke, known for dressed like Vader (But no helmets and computer stuffs on), ignites his green lightsaber, ready to fight against evil and defend the light side.

Zone name: WD_Deedlit
Jedi vs. Sith - Dark Luke's Jedi Knight web site: Informations, addons, etc.
(Draws his undead great sword out, and with a variety of magical spells, gets ready to fight.

Music composer (presented as Undead Knight and maker of JK SP projects - download soundtrack of Dark Emperor 2 here!

Jedi vs. Sith - Dark Luke's Jedi Knight web site: Informations, addons, etc.
2001-06-17, 10:30 PM #2
I suggest you rewrite your cog to implement

Code:
VectorLen(GetThingVel(player)) 


Just like that , don't bother about the y, x, z vectors. Better just test it out first, I haven't tested it my self yet.
2001-06-18, 2:45 AM #3
Thanks a lot - you name will placed to the "special thanks" section of the credits section of this JK SP episode

And with the now-accurate speedometer, I have clocked the following speeds:
Normal Running: 47 km/h 29 mph
Force speed max: 107 km/h 67 mph
Flying, no force speed: 143 km/h 89 mph
Flying, max force speed: 323 km/h 201 mph

New code:
Code:
pulse:
testspeedo = GetThingVel(player);
//vecx = VectorX(testspeedo);
//vecy = VectorY(testspeedo);
//vecz = VectorZ(testspeedo);
//if (vecx < 0) vecx = vecx - (vecx * 2);
//if (vecy < 0) vecy = vecy - (vecy * 2);
//if (vecz < 0) vecy = vecz - (vecz * 2);
//resul = (vecx + vecy + vecz) * 36;

resul = vectorlen(testspeedo) * 36;
resul2 = resul * 0.62137;
print("");
print("");
print("");

printflex(vectorlen(testspeedo));

jkstringconcatint(resul);
jkstringconcatasciistring(" km/h              ");
jkstringconcatint(resul2);
jkstringconcatasciistring(" mph              ");
jkstringoutput();
jkstringclear();
return;


------------------
"...and may the Force be with you."
-Luke Skywalker

Dark Luke, known for dressed like Vader (But no helmets and computer stuffs on), ignites his green lightsaber, ready to fight against evil and defend the light side.

Zone name: WD_Deedlit
Jedi vs. Sith - Dark Luke's Jedi Knight web site: Informations, addons, etc.

[This message has been edited by Darth Maul (edited June 18, 2001).]
(Draws his undead great sword out, and with a variety of magical spells, gets ready to fight.

Music composer (presented as Undead Knight and maker of JK SP projects - download soundtrack of Dark Emperor 2 here!

Jedi vs. Sith - Dark Luke's Jedi Knight web site: Informations, addons, etc.

↑ Up to the top!