1.8.0.3 Temporary vehicle upgrade

Inkko

Valued Member!
I'm working on a script that allows players to temporarily upgrade certain vehicles. Temporary meaning after a restart the upgrade is wiped. After the upgrade is applied it sets a public variable on the vehicle. Any player who is in the drivers seat of that vehicle after it has been "upgraded" gets a scroll option to turn on the upgrade. The upgrade is a speed boost script, its something I used way back when Blue Phoenix was around with his tools. I've modified the speed boost to get disabled upon getting out of vehicles and fixed a couple bugs with it ect.

I'm just a little confused at understanding the speed boost script itself. It seems very iffy. I pretty much just want it so once enabled it increases the top speed of the vehicle by X%. It seems to be all over the place, sometimes it'll increase the top speed about right and other times it will increase the speed way too much. I'm not on the correct computer right now so I only have the template speed boost script, but I'll post that see if anyone can help me to understand how to limit it better/understand it better. I get the basic understanding of it, it just looks like it has an infinite possibility on speed to me. Like a policecar can normally top out at 109 ish maybe and with the speed boost sometimes its 130 and sometimes its 180... 130 is perfectly fine but going 180 is too much.

Code:
hint "Speed upgrade loaded!";
waituntil {!isnull (finddisplay 46)};

Car_speed_upgrade = (findDisplay 46) displayAddEventHandler ["KeyDown","_this select 1 call CAR_UPGRADE_ENABLED;false;"];

CAR_UPGRADE_ENABLED= {

_vcl = vehicle player;

if(_vcl == player)exitwith{hint "Speed upgrade disabled!";
(findDisplay 46) displayAddEventHandler Car_speed_upgrade;};

_nos = _vcl getvariable "nitro";
_supgrade = _vcl getvariable "supgrade";

if(isEngineOn _vcl) then
{
        switch (_this) do {
                case 17: {
                        if(isEngineOn _vcl and !isnil "_supgrade") then
                        {
                                _vcl SetVelocity [(velocity _vcl select 0) * 1.009, (velocity _vcl select 1) *1.009, (velocity _vcl select 2) * 0.99];
                        } else {
                                _vcl setvariable ["supgrade", 1, true];
                        };
                };
                case 42: {
                        if(isEngineOn _vcl and !isnil "_nos") then
                        {
                                _vcl setVelocity [(velocity _vcl select 0) * 1.015, (velocity _vcl select 1) * 1.015, (velocity _vcl select 2) * 0.99];
                        } else {
                                _vcl setvariable ["nitro", 1, true];
                        };
                };
        };
};
};
 
Back
Top