Przemek_kondor 13 Posted January 2, 2009 Hi, I try to create speedhack script: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _factor = 5; _LOOP_DELAY = 0.05; _dir = 0; while { true } do { if( player_moves_forward )then { _dir = direction player; player setVelocity [(sin _dir)*_factor, (cos _dir)*_factor, 0]; }; sleep _LOOP_DELAY; }; or <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _factor = 5; _LOOP_DELAY = 0.05; _pos = [0,0,0]; _new_pos = [0,0,0]; _dir = 0; _offset_factor = 0.2;//meters while { true } do { if( player_moves_forward )then { _dir = direction player; _pos = getPos player; _new_pos = [(_pos select 0) + _offset_factor*(sin _dir), (_pos select 1) + _offset_factor*(cos _dir), _pos select 2]; player setPos _new_pos; }; sleep _LOOP_DELAY; }; (where player_moves_forward is some global variable which enebles speed-hack) but there some problem occurs: when player is running (using speedhack) he can't rotate (change his direction) after 1,2 seconds. Is there any solution to fix this? Share this post Link to post Share on other sites
[frl]myke 14 Posted January 3, 2009 I'm sorry but i doubt you will get any answers on this question since it looks pretty much like you're trying to create a cheat. Maybe explaining what you want to do and why, where you want use it might bring some light. Until then, no offence, but no answer from my side so far. Share this post Link to post Share on other sites
Przemek_kondor 13 Posted January 3, 2009 I create arcade mission a'la quake with rockets , teleports, jumping etc: http://img528.imageshack.us/img528....mg] but standard moving is too slow for this type of mission Share this post Link to post Share on other sites
celery 8 Posted January 4, 2009 No turning is caused by having your guy above the ground. Have you tried this: player setVelocity [(velocity player select 0)*_factor, (velocity player select 1)*_factor, (velocity player select 2)]; Share this post Link to post Share on other sites
Przemek_kondor 13 Posted January 4, 2009 No turning is caused by having your guy above the ground.Have you tried this: player setVelocity [(velocity player select 0)*_factor, (velocity player select 1)*_factor, (velocity player select 2)]; Above code would be produce (infinite because of loop) increment of speed (acceleration), so I normalized velocity vector and muliplied by factor before setVelocity command: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ... while { true } do { if( player_moves_forward )then { _vel = velocity player; _length = sqrt ((_vel select 0)*(_vel select 0) + (_vel select 1)*(_vel select 1) + (_vel select 2)*(_vel select 2)); if( _length < 0.001 )then { _length = 1.0; }; //dividing by _length will normalize velocity _factor2 = _factor/_length; player setVelocity [(_vel select 0)*_factor2, (_vel select 1)*_factor2, _vel select 2]; };//if sleep _LOOP_DELAY; };//while but problem still occurs btw: if problem is caused by being above the ground then code: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> //in loop: _new_pos = [(_pos select 0) + _offset_factor*(sin _dir), (_pos select 1) + _offset_factor*(cos _dir), 0]; player setPos _new_pos; should work propertly(, but it doesn't). Or I am wrong? Share this post Link to post Share on other sites
celery 8 Posted January 4, 2009 Looks like that ArmA is basically built so that if someone moves faster than they should on their own, they just start sliding and lose control. Not much to do about that except if you come up with a creative scripting solution. Share this post Link to post Share on other sites
Przemek_kondor 13 Posted January 5, 2009 Looks like that ArmA is basically built so that if someone moves faster than they should on their own, they just start sliding and lose control. Problem is caused by something else, because when I set _factor to low value nothing is changes in this point. And on the begining everything is ok (during 1,2sec). But thanx for interesting Share this post Link to post Share on other sites
Hellop 0 Posted January 8, 2009 Here, play with my nitro script from my mission, CSI-Saharani. Â It is for vehicles, but you might be able to get some ideas for people. Â You might not be able to use it on people, though, because if you bump the ground going too fast the arma engine will damage you based on your velocity... and so you might die. Here ya go: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> /*cliS_actionNitro.sqf By: Hellop 2008 Copyright: Released to the Public Domain. Â It would be cool if you gave me credit in your mission if you use it. Purpose: Simulate Nitrous Oxide speed-boost for vehicles. Â Sets global variable on client computer, cli_nitroLock so that the nitro can't be engaged more than once at at time. Pre: 1. Global var: cli_nitroLock = true; 2. Player's vehicle has an action menu item enabled that runs this script. e.g. in the initline of a car/tank: this addEventHandler ["getin", { if ((_this select 1) == "driver") then { actionIDNitro = _this select 0 addAction ["Nitro", "client\action\cliS_actionNitro.sqf"]; Â }; }]; this addEventHandler ["getout", {_this select 0 removeAction actionIDNitro;}]; Post: cli_nitroLock is set to true; Testing: 5 min. reverse doesn't work. Â Would be nice if it worked dynamically from vehicle weight/maxspeed. Air Vehicles not tested. */ private ["_obj", "_vel", "_tmrInterval", "_dir", "_maxSpeed"]; _actionID = _this select 2; _obj = vehicle player; //Tanks and stuff get less nitro. _tmrInterval = .1; _maxSpeed = 120; _speedMultiplier = .4; //2 is good for cars, too much for tanks _nitroDuration = 5; if ((typeOf _obj) isKindOf "Car") Â then { _tmrInterval = .02; _maxSpeed = 180; _speedMultiplier = 1.5; }; if ((typeOf _obj) isKindOf "Air") then { _tmrInterval = .02; _maxSpeed = 500; Â //What is best val here? _speedMultiplier = .3; }; if ((typeOf _obj) isKindOf "Motorcycle") then { _tmrInterval = .02; _maxSpeed = 140; Â //What is best val here? _speedMultiplier = .2; }; //Initialize vars; _vel = 0; _velX = 0; _velY = 0; _velZ =0; _dir = 0; _sinDir = 0; _cosDir = 0; _previousVel = velocity _obj; _previousSpeed = speed _obj; _curSpeed = 0; if ((speed _obj) <= 3) then { player sideChat format ["You must be moving to activate Nitro."]; } else { Â Â if (cli_nitroLock) then { cli_nitroLock = false; player sideChat format ["Nitro Engaged."]; //player globalchat format["Time: %1, Vehicle Type: %2, MaxSpeed: %3", time, typeOf _obj, _maxSpeed]; _startTime = time; _tmpSpeedMultiplier = _speedMultiplier; while {(time - _startTime) < _nitroDuration} do { sleep _tmrInterval; _vel = velocity _obj; _curSpeed = (speed _obj); if (((abs _curSpeed) - (abs _previousSpeed)) > 30) then {_vel = _previousVel}; Â //To prevent getting thrown far in collisions _velX = _vel select 0; _velY = _vel select 1; _velZ = _vel select 2; _dir = getdir _obj; //player globalChat format ["Speed: %1", speed _obj]; if ((speed _obj) > _maxSpeed) then {_tmpSpeedMultiplier = 0} else {_tmpSpeedMultiplier = _speedMultiplier}; _sinDir = _tmpSpeedMultiplier*(sin _dir); _cosDir = _tmpSpeedMultiplier*(cos _dir); _obj setvelocity [_velX + _sinDir, _velY + _cosDir, _velZ -.1]; //Keep Z vector moving with gravity _previousSpeed = _curSpeed; _previousVel = _vel; }; cli_nitroLock = true; player sideChat format ["Nitro test Done! Ending Vel: %1. Dir: %2, Speed: %3", velocity _obj, direction _obj, speed _obj]; }; }; Well, I dunno why it doesn't autotab. Â I posted a formatted version on armaholic.com. Â You could go there and search for "nitro" if you want. Share this post Link to post Share on other sites
Caboose12388 10 Posted November 17, 2009 Here, play with my nitro script from my mission, CSI-Saharani. ***It is for vehicles, but you might be able to get some ideas for people. ***You might not be able to use it on people, though, because if you bump the ground going too fast the arma engine will damage you based on your velocity... and so you might die.Here ya go: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> /*cliS_actionNitro.sqf By: Hellop 2008 Copyright: Released to the Public Domain. ***It would be cool if you gave me credit in your mission if you use it. Purpose: Simulate Nitrous Oxide speed-boost for vehicles. ***Sets global variable on client computer, cli_nitroLock so that the nitro can't be engaged more than once at at time. Pre: 1. Global var: cli_nitroLock = true; 2. Player's vehicle has an action menu item enabled that runs this script. e.g. in the initline of a car/tank: this addEventHandler ["getin", { if ((_this select 1) == "driver") then { actionIDNitro = _this select 0 addAction ["Nitro", "client\action\cliS_actionNitro.sqf"]; *** }; }]; this addEventHandler ["getout", {_this select 0 removeAction actionIDNitro;}]; Post: cli_nitroLock is set to true; Testing: 5 min. reverse doesn't work. ***Would be nice if it worked dynamically from vehicle weight/maxspeed. Air Vehicles not tested. */ private ["_obj", "_vel", "_tmrInterval", "_dir", "_maxSpeed"]; _actionID = _this select 2; _obj = vehicle player; //Tanks and stuff get less nitro. _tmrInterval = .1; _maxSpeed = 120; _speedMultiplier = .4; //2 is good for cars, too much for tanks _nitroDuration = 5; if ((typeOf _obj) isKindOf "Car") ***then { _tmrInterval = .02; _maxSpeed = 180; _speedMultiplier = 1.5; }; if ((typeOf _obj) isKindOf "Air") then { _tmrInterval = .02; _maxSpeed = 500; ***//What is best val here? _speedMultiplier = .3; }; if ((typeOf _obj) isKindOf "Motorcycle") then { _tmrInterval = .02; _maxSpeed = 140; ***//What is best val here? _speedMultiplier = .2; }; //Initialize vars; _vel = 0; _velX = 0; _velY = 0; _velZ =0; _dir = 0; _sinDir = 0; _cosDir = 0; _previousVel = velocity _obj; _previousSpeed = speed _obj; _curSpeed = 0; if ((speed _obj) <= 3) then { player sideChat format ["You must be moving to activate Nitro."]; } else { *** *** if (cli_nitroLock) then { cli_nitroLock = false; player sideChat format ["Nitro Engaged."]; //player globalchat format["Time: %1, Vehicle Type: %2, MaxSpeed: %3", time, typeOf _obj, _maxSpeed]; _startTime = time; _tmpSpeedMultiplier = _speedMultiplier; while {(time - _startTime) < _nitroDuration} do { sleep _tmrInterval; _vel = velocity _obj; _curSpeed = (speed _obj); if (((abs _curSpeed) - (abs _previousSpeed)) > 30) then {_vel = _previousVel}; ***//To prevent getting thrown far in collisions _velX = _vel select 0; _velY = _vel select 1; _velZ = _vel select 2; _dir = getdir _obj; //player globalChat format ["Speed: %1", speed _obj]; if ((speed _obj) > _maxSpeed) then {_tmpSpeedMultiplier = 0} else {_tmpSpeedMultiplier = _speedMultiplier}; _sinDir = _tmpSpeedMultiplier*(sin _dir); _cosDir = _tmpSpeedMultiplier*(cos _dir); _obj setvelocity [_velX + _sinDir, _velY + _cosDir, _velZ -.1]; //Keep Z vector moving with gravity _previousSpeed = _curSpeed; _previousVel = _vel; }; cli_nitroLock = true; player sideChat format ["Nitro test Done! Ending Vel: %1. Dir: %2, Speed: %3", velocity _obj, direction _obj, speed _obj]; }; }; Well, I dunno why it doesn't autotab. ***I posted a formatted version on armaholic.com. ***You could go there and search for "nitro" if you want. plz help i am very new to scripting how do i use this Share this post Link to post Share on other sites