View Single Post
Author Message
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 01-01-2023 , 07:13   [L4D & L4D2] Scope Level Adjust v2.4 [12-April-2023]
Reply With Quote #1

about
  • using forward key and back key to adjust scope level or config yourself
  • can loop level between min and max
  • can hold key to adjust or adjust if not holding key
  • option to allow which non-scopable weapon using scope, with zoom animation
  • tested on l4d1 and l4d2
  • experimental: use mouse wheels to adjust scope level without binding keys


ConVar

PHP Code:

// max fov zoom level, greater mean see nearer
// higher than 90 will cause 'ultra wide angle' and view can throuth the wall
scope_level_max "89"

// min fov zoom level, less mean see farer, dont suggest less than 1
scope_level_min "1"

// zoom animating step, 5=linear fov but weird animating
// -20=calc to linear scope level by 20%
scope_level_step "-33"

// key to decrease level 16=Back(s), 0=disabled
scope_level_dec "16"

// key to increase level 8=Forward(w) 0=disabled 32=Use(e)
scope_level_inc "8"

// hold key to adjust level, negative is reverse logic
// 131072=most hold shift -131072=if not hold shift key
// see more key on /include/entity_prop_stocks.inc
scope_level_hold "0"

// when zoom level reached bound value, reset level to cause loop
scope_level_loop "0"

// key to cancel zoom level 2048=shove 8192=reload 1=attack 2=jump
scope_level_cancel "10242"

// does enable fake scope on all non-scopable weapon 0=disabled 40=enabled with 40 initial fov
scope_level_fake "40"

// weapon list of fake scope feature, separate by comma, no spaces
scope_level_fake_list "weapon_rifle,weapon_rifle_m60,weapon_rifle_ak47,weapon_smg,weapon_smg_silenced,weapon_smg_mp5"

// add extra zoom sound when open zoom, to fix vanilla game only play on cancel zoom
scope_level_sound "1"

// announce types 0=dont announce 1=center 2=chat 4=hint. add numbers together you want
scope_level_announce "2"

// expermental feature, speculate mouse wheels to adjust scope level,
// prevent weapon switch, 1=enabled if speculation failed increase level
// 2=same as 1 but decrease 0=disabled
scope_level_wheels "1" 
changelog
  • v1.0 just releases; 1-January-2023
  • v1.1 new features and fix:
    - new ConVar *_hold to control which key hold to adjust scope level or vice versa,
    - new ConVar *_inc, *_dec to specify which key to adjust, defaults is forward and back,
    - new ConVar *_loop to allow loop zoom level when reached bound level, usually combined use when set *_inc only or *_dec only,
    - fix sg552 wrong scope level,
    - to cancel zoom dont have to tap zoom key twice anymore; 7-January-2023
  • v2.0 new features and fixes:
    - add ConVar *_cancel to fix scope level wont cancel when reload/shove/jump, this option can use for support '[L4D & L4D2] Unscope Sniper On Shoot' if add 1=attack,
    - new ConVar *_fake to allow non-scopable weapon using scope with animation,
    - new ConVar *_fake_list to control which weapon allow access *_fake feature,
    - new ConVar *_sound to add extra zoom sound when open scope, to fix vanilla game only play on cancel zoom; 13-January-2023
  • v2.1 new feature and fix:
    - support scope adjust hint on pickup available weapon and translation,
    - new ConVar *_announce to control pickup hint text position,
    - optimize fake scope logic to fix sometime work unexpected,
    - version tested on l4d1 and l4d2; 21-January-2023
  • v2.1.1 fixes:
    - fix fake scope features not cancel properly by player being attacked,
    - fix *_cancel not included game default behavior keys cause issue; 21-January-2023
  • v2.2 new features:
    - new experimental feature use mouse wheels to adjust level, but these speculation
    - new ConVar *_wheels to enabled mouse wheels features, 1=increase when failed speculation, 2=decrease,
    - fix pick hint message sometime not happen; 22-January-2023
  • v2.3 new feature:
    - add negative value range for *_step, if set -20 will calc FOV as linear scope level automatically by 20%; 27-January-2023
  • v2.3.1 for fake scope feature: cancel scope when auto-reload or be hurt, to make close to vanilla sniper behavior; 8-February-2023
  • v2.4 new command sm_zoomout to allow user run key binding script (see thread) to using modern game feature: hold to open scope and release to cancel the scope on available weapons; 12-April-2023

.cfg scripts make scoping like modern game
PHP Code:
// right click: hold to zoom, wheel key is 'mouse3'
bind mouse2 "+zooms";
alias +zooms "+zoom";
alias -zooms "-zoom;sm_zoomout";
// v key: shove, not requirement
bind v +attack2
todo
  • i try make non-scopable weapons view model appear on screen if these can be


Installation
  • put l4d_scope_level.smx on /plugins/
  • put l4d_scope_level.phrases.txt on /translations/
Attached Files
File Type: sp Get Plugin or Get Source (l4d_scope_level.sp - 397 views - 17.9 KB)
File Type: txt l4d_scope_level.phrases.txt (780 Bytes, 459 views)
__________________

Last edited by NoroHime; 04-13-2023 at 06:30.
NoroHime is offline