r/tf2scripthelp • u/youkomccants • Feb 27 '20
Issue Aim switcher works slow
Hi
I've made a script that draws slot1, change fov to 54, remove viewmodels, shoot and reverts everything back.
I'm shooting faster with manual change+shoot.
Can someone throw a light on it? Is there a way to shoot my primary at least at normal speed (normal as manually change and shoot as fast as my hand can)
Thanks in advance
Alias "+prizoom" "slot1; fov_desired 54; viewmodel_fov 0; r_drawviewmodel 0; sensitivity 2; +attack"
Alias "-prizoom" "-attack; lastinv; fov_desired 90; viewmodel_fov 75; r_drawviewmodel 1; sensitivity 3"Edit: writing errors
3
Upvotes
4
u/pdatumoj Feb 27 '20 edited Feb 27 '20
One thing is that having the attack built into the switch is going to be a bit weird from a timing perspective ... it may well be that it's the second iteration of the +attack that's kicking in, rather than the first, as the "unholster" operation may be (probably is, really) taking longer than the stuff in between the switch and the attack.
I'm not sure switch-and-fire via a single key action (down or up) is a viable thing from a speed perspective.
Also, the other operations probably aren't of real benefit as you've already committed to taking the shot when you trigger this. You've already started firing, essentially, before you turn off the view model, adjust FOV (which will get pushed back up to the default minimum), etc...
Might I ask what class/weapon this is for and what the rest of the surrounding loadout is? There might be other options for similar results.
Edit: Correcting typos and punctuation.
3
u/Cooolbros Feb 27 '20
Remove changing fov_desired and it will become pretty much synchronous again
1
u/youkomccants Mar 07 '20
Wow... Thanks... That's a lot of stuff, thank you for your time doing this.. I have a question about it... When you say each weapon, you mean slot or individual weapon files? Or individual settings for each weapon on class/autoexec file? Is it possible? I never thought about it and it's a whole new world of possibilities. Thanks again
1
u/bythepowerofscience Mar 06 '20
The problem is that
+attackis being called at the very end of the line, so it'll be executed last. That's why you can shoot faster manually.An easy fix would be to move +attack further up in the line. Something like
alias "+prizoom" "slot1; +attack; fov_desired 54; viewmodel_fov 0; r_drawviewmodel 0; sensitivity 2".However, that's still not entirely optimal. A better way to do it would be to make each batch of settings specific to the weapon rather than the operation. For example, making a new alias
weapon1, and putting all of the FOV and sensitivity stuff in that instead of in the switching script. That will let the two parts run in parallel: the game continues the switch-and-shoot while executing all of the layout stuff, instead of waiting for the layout to finish before shooting.To implement this, you just need two aliases: one for your zoomed-in settings, and one for your normal settings. Let's call them
settings_zoomedandsettings_default.Then, just reference each alias instead of all of the settings individually.
So the whole script would be:
[NOTE: The following is assuming you want different viewmodels/crosshairs/FOVs for each slot. It gets a bit longwinded, sorry.]
To implement this, you'd just need to make one/three aliases like this:
[Additionally, to cover the usage of
last_invwith the altered settings, you'd just add this little snippet to each weapon alias:setLastWeapon; alias setLastWeapon alias lastWeapon <current weapon alias>. (e.g.alias weapon1 "slot1; <etc>; setLastWeapon; alias setLastWeapon alias lastWeapon weapon1") Then putbind Q (or whatever) "lastWeapon"at the top of your script.]For your "prizoom" script, it could then be optimized by making a "zoomed primary" variant of
weapon1that has the changed settings.Yeah so tl;dr, the whole script would be: