Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- v1, v2 or v3 | Only use one, uncomment/comment related lines in this file & in _main.lua
- -- v1 | Timer under crosshair
- -- v2 | Timer bottom of the screen
- -- v3 | Timer right side of the screen
- local RldTime = 0 -- Reload duration in sec (tested @ 15ms)
- local RldEndTime = 0
- local CclTime = 0 -- Percentage of the reload animation before it can be cancelled (tested @ 15ms)
- local MarkerPos = 0 -- Cancel marker position based on CclTime
- --local TestRldStart = 0 -- Reload time testing | Time at the start of the reload
- --local TestRldTime = 0 -- Reload time testing | Reload duration (s)
- --local TestPrinted = true -- Reload time testing | Last reload duration printed to console
- function RldSetTimer()
- -- TestRldStart = os.clock() -- Reload time testing | Time at the start of the reload
- if string.match(currentWeapon.name(), "Rifle") or currentWeapon.name() == "NJ4 SMG" or currentWeapon.name() == "Nova Blaster" or currentWeapon.name() == "NJ5-B SMG" or currentWeapon.name() == "Falcon" or currentWeapon.name() == "X1 LMG" then
- if currentWeapon.ammo() > 0 then
- RldTime = 1.74
- CclTime = 59
- else
- RldTime = 1.78
- CclTime = 59
- end
- elseif string.match(currentWeapon.name(), "Spinfusor") or currentWeapon.name() == "Twinfusor" then
- RldTime = 1.21
- CclTime = 40
- elseif string.match(currentWeapon.name(), "Bolt") or currentWeapon.name() == "Thumper" or currentWeapon.name() == "Shocklance" then
- RldTime = 1.43
- CclTime = 60
- elseif currentWeapon.name() == "Honorfusor" then
- RldTime = 1.37
- CclTime = 40
- elseif currentWeapon.name() == "Fusion Mortar" or currentWeapon.name() == "MIRV Launcher" then
- RldTime = 2.65
- CclTime = 58
- elseif currentWeapon.name() == "Saber Launcher" then
- RldTime = 2.65
- CclTime = 63
- elseif currentWeapon.name() == "Nova Colt" or currentWeapon.name() == "Sparrow" or currentWeapon.name() == "Eagle Pistol" then
- RldTime = 1.74
- CclTime = 58
- elseif currentWeapon.name() == "Sawed-Off Shotgun" then
- RldTime = 1.43
- CclTime = 62
- elseif currentWeapon.name() == "Gladiator" then
- elseif currentWeapon.name() == "Arx Buster" or currentWeapon.name() == "Plasma Gun" or currentWeapon.name() == "Sawed-Off Shotgun" or currentWeapon.name() == "Grenade Launcher" or currentWeapon.name() == "Plasma Cannon" or currentWeapon.name() == "Light Grenade Launcher" or currentWeapon.name() == "Jackal" then
- RldTime = 1.71
- CclTime = 59
- else
- RldTime = 0
- end
- MarkerPos = (CclTime/100)*201 -- v1
- -- MarkerPos = (CclTime/100)*292 -- v2 / v3
- RldEndTime = os.clock() + RldTime
- end
- function reloadTimer(x, y)
- local ammo_rt = currentWeapon.ammo() / currentWeapon.ammoMax()
- local ammo_adj = ammo_rt * 1.7
- local ammo_pct = ammo_rt * 100
- local ammo_color = lerpColor(ammo_color_low, ammo_color_full, ammo_adj)
- local reload_pct
- local RldTimerOn = false
- drawUTText(weapon.ammoTotal(7), rgba(210, 210, 210, 200), x + 440, y + 487, 2, 2, 2) -- v1
- -- drawUTText(weapon.ammoTotal(7), rgba(255, 255, 255, 160), x + 24, y - 25, 2, 2, 2) -- v2
- -- drawUTText(weapon.ammoTotal(7), rgba(255, 255, 255, 160), x - 300, y + 400, 2, 2, 2) -- v3
- -- drawRect(x - 4, y - 4, x + 296, y + 21, bg_color2) -- v2
- -- drawBox(x - 4, y - 4, x + 296, y + 21, rgba(255, 255, 255, 120)) -- v2
- -- drawRect(x - 4, y - 293, x + 21, y + 7, bg_color2) -- v3
- -- drawBox(x - 4, y - 293, x + 21, y + 7, rgba(255, 255, 255, 120)) -- v3
- if not currentWeapon.isReloading() then
- -- TestRldTime = os.clock() - TestRldStart -- Reload time testing
- -- if TestPrinted == false then -- Reload time testing
- -- console(currentWeapon.name() .. " " .. TestRldTime) -- Reload time testing
- -- TestPrinted = true -- Reload time testing
- -- end -- Reload time testing
- -- drawProgressBar(x, y, x + 2.92, y + 17, ammo_color, 1, ammo_pct) -- v2
- -- drawProgressBar(x, y, x + 17, y + 2.92, ammo_color, 0, ammo_pct) -- v3
- RldTimerOn = false
- RldSetTimer()
- else
- -- TestPrinted = false -- Reload time testing
- RldTimerOn = true
- end
- if RldTime ~= 0 then -- Don't show the cancel timer if weapon was not tested
- if RldTimerOn == true then
- reload_pct = 100 - (((RldEndTime - os.clock())/RldTime)*100)
- if reload_pct > 100 then
- RldTimerOn = false
- else
- if reload_pct >= CclTime then
- BarColor = rgba(180, 255, 150, 255) -- v1
- -- BarColor = rgba(195, 248, 212, 255) -- v2
- else
- BarColor = rgba(255, 255, 255, 120) -- v1
- -- BarColor = rgba(255, 255, 255, 114) -- v2
- end
- drawProgressBar(x, y, x + 2.01, y + 4, BarColor, 1, reload_pct) -- v1
- drawRect(x - 1, y - 1, x + 202, y + 5, rgba(0, 0, 0, 40)) -- v1
- drawRect(x+MarkerPos, y, x + MarkerPos + 2, y + 4, rgba(255, 0, 0, 255)) -- v1
- -- drawProgressBar(x, y, x + 2.92, y + 17, BarColor, 1, reload_pct) -- v2
- -- drawRect(x + MarkerPos, y - 1, x + MarkerPos + 2, y + 18, rgba(255, 0, 0, 255)) -- v2
- -- drawProgressBar(x, y, x + 17, y + 2.92, BarColor, 0, reload_pct) -- v3
- -- drawRect(x , y - MarkerPos - 1, x + 18, y - MarkerPos, rgba(255, 0, 0, 255)) -- v3
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement