Author Topic: Vehicle Speed Script  (Read 1169 times)

0 Members and 1 Guest are viewing this topic.

Laxbrousa

  • Intentional Cheater
  • **
  • Posts: 40
  • Lax For Life
    • View Profile
Vehicle Speed Script
« on: June 26, 2012, 11:41:57 pm »
How do I change a vehicles max speed in game with Medics MrMedicv1.0_p2 I'm hoping there is a way to change the vehicles max speed while I'm in it thanks and please help










Also please give some examples that would work Thanks Again!

Fishgun123

  • Online Villain
  • ***
  • Posts: 223
    • View Profile
Re: Vehicle Speed Script
« Reply #1 on: June 26, 2012, 11:47:41 pm »
That would be pretty cool if you could, but I dont know.

Laxbrousa

  • Intentional Cheater
  • **
  • Posts: 40
  • Lax For Life
    • View Profile
Re: Vehicle Speed Script
« Reply #2 on: June 27, 2012, 12:15:13 am »
Umm this must be possible because Zargabad Life has a speed upgrade and a nitrous upgrade witch makes any car that the person uses the upgrade on move faster

Fishgun123

  • Online Villain
  • ***
  • Posts: 223
    • View Profile
Re: Vehicle Speed Script
« Reply #3 on: June 27, 2012, 12:19:07 am »
Yes I was thinking myself it is. I think its serverside.. Well i know its serverside that the speed limit of vehicles are.. justl ike any server the car has a speedlimit not just life servers so yh. sorry bro but im not certain.. might be :3?.

XJ

  • Online Villain
  • ***
  • Posts: 246
  • Find what you love and let it kill you.
    • View Profile
Re: Vehicle Speed Script
« Reply #4 on: June 27, 2012, 12:45:09 am »
For info check onKeypress.sqf from any mission that offers speed/nitro upgrades.

s0beit

  • Relentless Teamkiller
  • **
  • Posts: 94
    • View Profile
Re: Vehicle Speed Script
« Reply #5 on: June 27, 2012, 01:18:56 am »
Umm this must be possible because Zargabad Life has a speed upgrade and a nitrous upgrade witch makes any car that the person uses the upgrade on move faster

It's not a matter of changing a vehicle's "max speed", what you would want to do is make your own key event and add to your velocity.

As XJ said,
Code: [Select]
//Left Shift key
case 42:

{

_vcl = vehicle player;

if(_vcl == player)exitwith{};

_nos = _vcl getvariable "nitro";

if(isEngineOn _vcl and !isnil "_nos") then

{

_vel  = velocity _vcl;
_spd  = speed _vcl;
_fuel = fuel _vcl;
_vcl setVelocity [(_vel select 0) * 1.01, (_vel select 1) * 1.01, (_vel select 2) * 0.99];
_vcl setfuel (_fuel - 0.0003);

};

};


That's the code they use, it's not hard to figure out how to increase it and make your own nos.

MrMedic

  • MasstKer
  • ********
  • Posts: 8900
  • programmer/dev/software engineer
    • View Profile
Re: Vehicle Speed Script
« Reply #6 on: June 27, 2012, 02:13:04 am »
either use velocity *
or calculate your pos and dir and add a vector forward to it + length.

( there is a working example in the mod pack i released on here a few month ago )
« Last Edit: June 27, 2012, 02:19:28 am by MrMedic »
EnCoded Message: i3iy9yl8kr2xf3g2Txs3pr6ye3ya7jg5ty2z

https://www.youtube.com/watch?v=62_7-AYfdkQ
you need a paypal account for the private versions.

Website:
http://bit.ly/medic101

Teamspeak 3: 85.236.101.5:10157

Laxbrousa

  • Intentional Cheater
  • **
  • Posts: 40
  • Lax For Life
    • View Profile
Re: Vehicle Speed Script
« Reply #7 on: June 27, 2012, 04:01:55 am »
either use velocity *
or calculate your pos and dir and add a vector forward to it + length.

( there is a working example in the mod pack i released on here a few month ago )


Can you give me the link

JonMS

  • Intentional Cheater
  • **
  • Posts: 40
    • View Profile
Re: Vehicle Speed Script
« Reply #8 on: June 27, 2012, 07:56:43 am »
either use velocity *
or calculate your pos and dir and add a vector forward to it + length.

( there is a working example in the mod pack i released on here a few month ago )


Can you give me the link

Can you spoon feed me too Medic?

daleeb

  • Intentional Cheater
  • **
  • Posts: 45
    • View Profile
Re: Vehicle Speed Script
« Reply #9 on: June 27, 2012, 08:26:28 am »
Binding this to W key would work.
Code: [Select]
_dir = getdir vehicle player;
_pos = getPos vehicle player;
_pos = [(_pos select 0)+2*sin(_dir),(_pos select 1)+2*cos(_dir)];
vehicle player setpos _pos;

MrMedic

  • MasstKer
  • ********
  • Posts: 8900
  • programmer/dev/software engineer
    • View Profile
Re: Vehicle Speed Script
« Reply #10 on: June 27, 2012, 01:07:30 pm »
Binding this to W key would work.
Code: [Select]
_dir = getdir vehicle player;
_pos = getPos vehicle player;
_pos = [(_pos select 0)+2*sin(_dir),(_pos select 1)+2*cos(_dir)];
vehicle player setpos _pos;

there you go.
EnCoded Message: i3iy9yl8kr2xf3g2Txs3pr6ye3ya7jg5ty2z

https://www.youtube.com/watch?v=62_7-AYfdkQ
you need a paypal account for the private versions.

Website:
http://bit.ly/medic101

Teamspeak 3: 85.236.101.5:10157

Laxbrousa

  • Intentional Cheater
  • **
  • Posts: 40
  • Lax For Life
    • View Profile
Re: Vehicle Speed Script
« Reply #11 on: June 29, 2012, 07:07:59 am »
Binding this to W key would work.
Code: [Select]
_dir = getdir vehicle player;
_pos = getPos vehicle player;
_pos = [(_pos select 0)+2*sin(_dir),(_pos select 1)+2*cos(_dir)];
vehicle player setpos _pos;

there you go.


So like //W key:
{
_dir = getdir vehicle player;
_pos = getPos vehicle player;
_pos = [(_pos select 0)+2*sin(_dir),(_pos select 1)+2*cos(_dir)];
vehicle player setpos _pos;

daleeb

  • Intentional Cheater
  • **
  • Posts: 45
    • View Profile
Re: Vehicle Speed Script
« Reply #12 on: June 29, 2012, 02:15:27 pm »
Have a look at the bottom of this page
http://community.bistudio.com/wiki/User_Interface_Event_Handlers


Code: [Select]
//Remove the EventHandlers...
(findDisplay 46) displayRemoveAllEventHandlers "KeyDown";
(findDisplay 12) displayRemoveAllEventHandlers "KeyDown";


keydown_function =
{
    switch (_this) do
{
//Key press W
        case 17:
{
            nul = [] execVM "scripts\speedhax.sqf";
        };

    };
}; 


//Add an EventHandler to the main display...
waituntil {!isnull (finddisplay 46)};
(findDisplay 46) displayAddEventHandler ["KeyDown","_this select 1 call keydown_function;false;"]; 
//Add an EventHandler to the map...
waituntil {!isnull (finddisplay 12)};
(findDisplay 12) displayAddEventHandler ["KeyDown","_this select 1 call keydown_function;false;"];