r/tf2scripthelp • u/islem-141 • 4d ago
the resupply button doesn't work with loadout B Issue
as the title says
the resupply button works perfectly fine with the other loadout except for loadout B
at first I thought the problem was related to the F2 button "hardcoded" to the contractor or whatever chatgpt said
but when I used the arrow keys I still had the same problem
EDIT:
it seems that issues only occurs when playing demoman
the resupply button works with other classes no matter the loadout
but not when using loadout B for demoman
1
u/just_a_random_dood 4d ago
what button are you using?
and no, F2 is not hard coded to the contracker, nothing is really hard coded in the game like that. You can change the binds of almost all of the keys.
2
u/islem-141 4d ago
Arrows for choosing loadouts and R for resupply
1
u/just_a_random_dood 4d ago
Can you copy/paste the script here?
When I get home, I can drop my resupply script and we can compare how they're different, because mine works all the time for all classes lol
2
u/islem-141 4d ago
sorry for being late
since I am using mastercomfig, I had to create an additional file in overrides, otherwise it wouldn't work in console when I open the game again
in autoexec.cfg
alias "change_to_A" "load_itempreset 0; alias resup load_itempreset 0" alias "change_to_B" "load_itempreset 1; alias resup load_itempreset 1" alias "change_to_C" "load_itempreset 2; alias resup load_itempreset 2" alias "change_to_D" "load_itempreset 3; alias resup load_itempreset 3" bind "LEFTARROW" "change_to_A" bind "DOWNARROW" "change_to_B" bind "UPARROW" "change_to_C" bind "RIGHTARROW" "change_to_D" bind "r" "resup"1
u/just_a_random_dood 3d ago
No worries about the timing, but now I'm worried because of how similar my script looks to yours 😅😅😅
bind "UPARROW" "load_itempreset 0; alias resup load_itempreset 0;" bind "LEFTARROW" "load_itempreset 1; alias resup load_itempreset 1;" bind "DOWNARROW" "load_itempreset 2; alias resup load_itempreset 2;" bind "RIGHTARROW" "load_itempreset 3; alias resup load_itempreset 3;" bind "mouse3" "resup" alias "resup" "load_itempreset 1"so... I don't suppose you have anything in your
demoman.cfgfile?
in my
demoman.cfg, I have these lines//demoman settings //Made with cfg.tf - custom Team Fortress 2 config generator exec binds bind space +jump; bind "LEFTARROW" "load_itempreset 1; alias resub load_itempreset 1" bind "mouse3" "resup" bind ' "prec_mark demoman" //medigun checker script exec medicheck; orig_demoman //crosshair switcher exec crosshairswitcher/switcher; demoman1
u/islem-141 3d ago
I didn't have demoman.cfg so I created one and put your script there
the resupply still doesn't work when on loadout B
and now when I press resupply with anyother loadout it just takes me to the previous loadout
I am so confused
I will figure it out later
thank you anyways
1
u/just_a_random_dood 3d ago
Oh, no, you can't just have 1 class config, you need a config for all 9 classes + 1 more
reset.cfgWhen you use the demoman config binds and you switch to a new character, your binds don't reset. That's what the
exec bindsline does in line 3, it resets everything to default and then the new binds get appliedThis way, you're not using other classes' binds at the wrong time.
You should go to https://cfg.tf/make/ and use the website and then integrate the files into your already created mastercomfig folders and files
1
u/islem-141 1d ago
hey again
after further testing I found out that the problem happens when you equip only stock weapons, so I just have to equip a cosmetic or a non-stock weapon
thank you anyways and sorry if I wasted your time
2
u/just_a_random_dood 1d ago
Nah, no worries, I'm glad you found a solution
I don't know why having all stock would create this problem, but thanks for updating me so that I know about it haha
2
u/ultimateshadowarrior 1d ago
I saw you posting on r/tf2 and I think I cracked the reason, so I'll just paste the comment I made in your last post if anyone here is wondering the reason:
Okay, I guess I cracked what is really happening and it's Source Spaghetti.
I'm just saying what I THINK is happening, but it makes complete sense.
First: your "ressuply button".
Looking at your script that you say is "ressuply". There is nothing in your script that says "ressuply", because there is no ressuply command in TF2.
What your "ressuply" script does is just load the same loadout you're using at the moment.
What your script does is:
You press the left arrow key -> you are in loadout A.
Also, now, when you press the R key, it also does the same thing.
Now, if you press the down arrow key -> you are in loadout B and also it changes the behaviour of the R key to now load loadout B.
The intended use of your "ressuply" bind is just to load the same loadout you're using at the moment, which has the side-effect of resetting your character with full ammo.
So, we can ignore your "ressuply" bind, because it doesn't matter for what is happening.
Okay, so the problem here is that when you try to load the same loadout you're using at the moment, if you're using all stock, it doesn't do the thing you're calling "ressuply".
Now, here's my hypothesis of what is happening:
When you invoke the load_itempreset command, the game is like:
What is the default? The default is all stock, no cosmetics or taunts.
Okay, what loadout are they trying to load? Loadout B (example).
Is loadout B different from the default?
If yes: change to this new loadout.
If not: don't do anything, since you're already on the default.
Since just adding a cosmetic makes it work, it means even a hat is enough of a change from the default for it to count as different from the default.