TKC-Community

Hacking and Art => Armed Assault 3 => Armed Assault 2 => Topic started by: Laxbrousa on June 26, 2012, 11:41:57 pm

Title: Vehicle Speed Script
Post by: Laxbrousa 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!
Title: Re: Vehicle Speed Script
Post by: Fishgun123 on June 26, 2012, 11:47:41 pm
That would be pretty cool if you could, but I dont know.
Title: Re: Vehicle Speed Script
Post by: Laxbrousa 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
Title: Re: Vehicle Speed Script
Post by: Fishgun123 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?.
Title: Re: Vehicle Speed Script
Post by: XJ on June 27, 2012, 12:45:09 am
For info check onKeypress.sqf from any mission that offers speed/nitro upgrades.
Title: Re: Vehicle Speed Script
Post by: s0beit 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.
Title: Re: Vehicle Speed Script
Post by: MrMedic 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 )
Title: Re: Vehicle Speed Script
Post by: Laxbrousa 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
Title: Re: Vehicle Speed Script
Post by: JonMS 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?
Title: Re: Vehicle Speed Script
Post by: daleeb 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;
Title: Re: Vehicle Speed Script
Post by: MrMedic 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.
Title: Re: Vehicle Speed Script
Post by: Laxbrousa 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;
Title: Re: Vehicle Speed Script
Post by: daleeb 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;"];