Description:
This macro is written for a G700 mouse, but will work on any Logitech G key. Including keyboard, etc.
This macro is fine tuned for the AWS. Dont ask me to tune it for your gun. This macro is universal and will require adjustments for your setup and gun.
Assumptions:
You have a G13 keyboard and have created a macro named "spot" that presses and releases "Q". This Lua will call this macro to automatically spot enemy upon normal "WASD" movement. You can use the spot function that i added, but i like the use macros on this better, due to lack of added delay. Your choice.
You have "Lshift" bound to run, in game
You have unbound left mouse click as fire and have bound "U" to fire, in game.
You have unbound G10 and G9 from their regular DPI setting and will now use them as in-game height adjustment for recoil.
You have unbound G11 and will now use it to enable or disable the Macro, in game.
Configuration:
"modifier" is the starting default recoil adjustment when the macro is started. Adjust this to your gun defaults. Then fine tune in game if needed (switching scopes, etc.)
Fine tune the "recoil_coords" to you gun if they need more left/right adjustment.
In-game Configuration:
G10 is less recoil reduction
G9 is more recoil reduction
Code:
EnablePrimaryMouseButtonEvents(true);
local recoil_coords = {
{ x = 0, y = 1 }
}
local recoil_coords_0 = {
{ x = -1, y = 0 }
}
local recoil_coords_1 = {
{ x = -1, y = 1 }
}
local recoil_coords_2 = {
{ x = -2, y = 1 }
}
local recoil_coords_noclick = {
{ x = 0, y = 2 }
}
local recoil = not true;
local key = "U";
local key2 = "t";
local key3 = "q";
local state1 = not true;
local state2 = not true;
local modifier = 7;
function flashlight ()
if not IsMouseButtonPressed(3)and not state1 then
state1 = true;
PressKey(key2)
Sleep(40)
ReleaseKey(key2)
end
end
function flashlight_off ()
if state2 then
state1 = not true;
state2 = not true;
else
state1 = not true;
state2 = not true;
PressKey(key2)
Sleep(40)
ReleaseKey(key2)
end
end
function suppress (x,y,sleep)
if not sleep then sleep="22" end
PressKey(key)
Sleep(sleep)
MoveMouseRelative(x,y)
Sleep(sleep)
MoveMouseRelative(x,modifier)
ReleaseKey(key)
Sleep(38)
end
function spot ()
PressAndReleaseKey(key3)
end
function OnEvent(event, arg)
if (event == "MOUSE_BUTTON_PRESSED" and arg == 11) then
recoil = not recoil
OutputLogMessage("AWS - No-Recoil-Flashlight-spot, %s \n", tostring(recoil))
end
if recoil then
Sleep(1)
-- Section below assumes that you have a G13 or similar keyboard. Comment out if you do not have macro configurable keyboard "WASD" keys
if (event == "G_PRESSED" and arg == 4) then
PressKey("lshift")
end
if (event == "G_RELEASED" and arg == 4) then
ReleaseKey("lshift")
end
if (event == "G_PRESSED" and arg == 10) then
PlayMacro("spot")
end
if (event == "G_PRESSED" and arg == 11) then
PlayMacro("spot")
end
if (event == "G_PRESSED" and arg == 12) then
PlayMacro("spot")
end
-- Section above assumes that you have a G13 or similar keyboard. Comment out if you do not have macro configurable keyboard "WASD" keys
if (event == "MOUSE_BUTTON_PRESSED" and arg == 9) then
modifier = modifier +1;
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 10) then
modifier = modifier -1;
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) then
repeat
for i, v in ipairs(recoil_coords) do
if (IsMouseButtonPressed(3)) then
state1 = true;
state2 = true;
suppress(recoil_coords_0[i].x,recoil_coords_0[i].y+modifier)
suppress(recoil_coords_1[i].x,recoil_coords_1[i].y+modifier)
else
suppress(recoil_coords_noclick[i].x,recoil_coords_noclick[i].y)
-- flashlight() -- only enable if you have a flashlight equipped
end
end
until not IsMouseButtonPressed(1)
--flashlight_off() -- only enable if you have a flashlight equipped
end
else
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) then
PressKey(key)
end
if (event == "MOUSE_BUTTON_RELEASED" and arg == 1) then
ReleaseKey(key)
end
end
end
Thank you to the other contributers out there that helped me get started with this script. I used logic from a few of their scripts as a base to complete this one.
Enjoy!