Multi-Gaming Community
It is currently 17 Jun 2025, 23:14

All times are UTC+02:00




Post new topic  Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Loadout switching script
PostPosted: 03 Jul 2008, 15:54 
Offline
The Necromancer (4970)
There one thing that you still don't know about me - I'm a HL scripting expert (for all it's worth ;-) so I thought I'll copy&paste a script I posted on the Steam forums recently. It might be useful for some of you.

"Back in the day I used to play around with HL scripts A LOT - mostly for myself and my friends. My config was so huge that it obviously caused a z_malloc overflow and I had to split it into smaller files which were loaded consecutively. Basically there were none of the commonly sought after "cheat scripts" like anti-recoil etc. but advanced customization settings like a script that fast-switched only the three basic weapons (without grenades) on the mousewheel when fastswitch hadn't been implemented for it yet etc.

I digress.

I heard that many people like to switch their Medic, Pyro and now Heavy, I presume, loadouts without having to go through the annoying mouse-click menus. This is achieved by using the "equip" command and some simple binds but from what I gathered none of the scripts were "elegant enough" for me - the most advanced thing they were doing was a simple button cycle algorithm.

You may already notice that my motto is: "If it's worth doing then it's worth overdoing" (I wrote a batch script once that had around 1000 lines of code to basically rename one file back and forth with an interactive user interface etc. ;-)

Hence I came up with more POWERFUL versions of the quick loadout switching script for the Medic, the Pyro and the Heavy (figuring out the weapon codes was easy since Valve seems to follow a certain numbering scheme and it was only a matter of trying out some combinations =).

What the scripts do is quite simple: they allow you to cycle through your normal and unlockable weapons with three keys (of course you have to stand in a spawn area and have unlocked the given weapon - this isn't any kind of cheat script) and display pretty console messages in the upper left corner while doing so. You can define your default loadout and even check it with a fourth key which, again, displays some pretty messages.

The scripts are commented; specifically for YOU guys, I could do without all this stuff if I were to use it only by myself; so changing your loadout and the keys (mine are F1, F2, F3 and F4) should be quite easy.

Redundant after the last update: There's one minor issue with the Backburner: if you select the weapon without going through the menu your maximum health will increase to 225 points BUT you'll still have the default 175 hitpoints so you'll be needing a trip to the nearest locker (which should be close by since you're in the spawn area anyway) or some other form of healing.

Without further ado, here are the scripts. Paste them into your Steam -> steamapps -> account@someserver.com -> team fortress 2 -> tf -> cfg -> pyro.cfg, medic.cfg and heavyweapons.cfg files respectively.
Code:
// Pyro
// -------------------------------IGNORE-THIS-;-)---------------------------------------------------

// Message setup

alias	"d1"		"developer 1; contimes 3; con_notifytime 3"
alias	"d4"		"developer 1; contimes 6; con_notifytime 5"
alias	"d0"		"wait 1000; contimes 0; con_notifytime 0; developer 0"

alias	"m_backburner"	"echo Equipped a Backburner"
alias 	"m_flamethrower""echo Equipped a Flamethrower"
alias	"m_flaregun"	"echo Equipped a Flare Gun"
alias	"m_shotgun"	"echo Equipped a Shotgun"
alias	"m_axtinguisher""echo Equipped an Axtinguisher"
alias	"m_fireaxe"	"echo Equipped a Fire Axe"

// Equipment aliases with cycle stubs

alias	"backburner"	"equip 7 0 5; alias message1 m_backburner; alias prim 1norm"
alias 	"flamethrower"	"equip 7 0 0; alias message1 m_flamethrower; alias prim 1custom"
alias	"flaregun"	"equip 7 1 4; alias message2 m_flaregun; alias sec 2norm"
alias	"shotgun"	"equip 7 1 0; alias message2 m_shotgun; alias sec 2custom"
alias	"axtinguisher"	"equip 7 2 6; alias message3 m_axtinguisher; alias tert 3norm"
alias	"fireaxe"	"equip 7 2 0; alias message3 m_fireaxe; alias tert 3custom"

// Aliases for the binds

alias 	"1custom"	"backburner; d1; message1; d0"
alias	"1norm"		"flamethrower; d1; message1; d0"

alias 	"2custom"	"flaregun; d1; message2; d0"
alias	"2norm"		"shotgun; d1; message2; d0"

alias 	"3custom"	"axtinguisher; d1; message3; d0"
alias	"3norm"		"fireaxe; d1; message3; d0"

// Loadout echo

alias	"my_loadout"	"d4; echo My current loadout:; message1; message2; message3; d0"

// -------------------------------YOUR-STUFF-GOES-HERE---------------------------------------------------

// Default setup

backburner
shotgun
axtinguisher

// Binds (prim = primary weapon, sec = secondary, tert = tertiary weapon, my_loadout = echo of current loadout)

bind	"F1"		"prim"
bind	"F2"		"sec"
bind	"F3"		"tert"
bind	"F4"		"my_loadout"
Code:
// Medic
// -------------------------------IGNORE-THIS-;-)---------------------------------------------------

// Message setup

alias	"d1"		"developer 1; contimes 3; con_notifytime 3"
alias	"d4"		"developer 1; contimes 6; con_notifytime 5"
alias	"d0"		"wait 1000; contimes 0; con_notifytime 0; developer 0"

alias	"m_blutsauger"	"echo Equipped a Blutsauger"
alias 	"m_syringe"	"echo Equipped a Syringe Gun"
alias	"m_kritzkrieg"	"echo Equipped a Kritzkrieg"
alias	"m_medigun"	"echo Equipped a Medigun"
alias	"m_ubersaw"	"echo Equipped an Ubersaw"
alias	"m_bonesaw"	"echo Equipped a Bonesaw"

// Equipment aliases with cycle stubs

alias	"blutsauger"	"equip 5 0 1; alias message1 m_blutsauger; alias prim 1norm"
alias 	"syringe_gun"	"equip 5 0 0; alias message1 m_syringe; alias prim 1custom"
alias	"kritzkrieg"	"equip 5 1 2; alias message2 m_kritzkrieg; alias sec 2norm"
alias	"medigun"	"equip 5 1 0; alias message2 m_medigun; alias sec 2custom"
alias	"ubersaw"	"equip 5 2 3; alias message3 m_ubersaw; alias tert 3norm"
alias	"bonesaw"	"equip 5 2 0; alias message3 m_bonesaw; alias tert 3custom"

// Aliases for the binds

alias 	"1custom"	"blutsauger; d1; message1; d0"
alias	"1norm"		"syringe_gun; d1; message1; d0"

alias 	"2custom"	"kritzkrieg; d1; message2; d0"
alias	"2norm"		"medigun; d1; message2; d0"

alias 	"3custom"	"ubersaw; d1; message3; d0"
alias	"3norm"		"bonesaw; d1; message3; d0"


// Loadout echo

alias	"my_loadout"	"d4; echo My current loadout:; message1; message2; message3; d0"

// -------------------------------YOUR-STUFF-GOES-HERE---------------------------------------------------

// Default setup

blutsauger
medigun
ubersaw

// Binds (prim = primary weapon, sec = secondary, tert = tertiary weapon, my_loadout = echo of current loadout)

bind	"F1"		"prim"
bind	"F2"		"sec"
bind	"F3"		"tert"
bind	"F4"		"my_loadout"
Code:
// Heavy
// -------------------------------IGNORE-THIS-;-)---------------------------------------------------

// Message setup

alias	"d1"		"developer 1; contimes 3; con_notifytime 3"
alias	"d4"		"developer 1; contimes 6; con_notifytime 5"
alias	"d0"		"wait 1000; contimes 0; con_notifytime 0; developer 0"

alias	"m_natasha"		"echo Equipped Natasha"
alias "m_sasha" 		"echo Equipped Sasha"
alias	"m_sandvich"	"echo Equipped a Sandvich"
alias	"m_shotgun"		"echo Equipped a Shotgun"
alias	"m_kgb" 			"echo Equipped K.G.B."
alias	"m_fists"			"echo Equipped Fists"

// Equipment aliases with cycle stubs

alias	"natasha"				"equip 6 0 8; alias message1 m_natasha; alias prim 1norm"
alias "sasha"					"equip 6 0 0; alias message1 m_sasha; alias prim 1custom"
alias	"sandvich"			"equip 6 1 7; alias message2 m_sandvich; alias sec 2norm"
alias	"shotgun"				"equip 6 1 0; alias message2 m_shotgun; alias sec 2custom"
alias	"kgb"						"equip 6 2 9; alias message3 m_kgb; alias tert 3norm"
alias	"fists"					"equip 6 2 0; alias message3 m_fists; alias tert 3custom"

// Aliases for the binds

alias 	"1custom"	"natasha; d1; message1; d0"
alias		"1norm"		"sasha; d1; message1; d0"

alias 	"2custom"	"sandvich; d1; message2; d0"
alias		"2norm"		"shotgun; d1; message2; d0"

alias 	"3custom"	"kgb; d1; message3; d0"
alias		"3norm"		"fists; d1; message3; d0"

// Loadout echo

alias	"my_loadout"	"d4; echo My current loadout:; message1; message2; message3; d0"

// -------------------------------YOUR-STUFF-GOES-HERE---------------------------------------------------

// Default setup

sasha
sandvich
kgb

// Binds (prim = primary weapon, sec = secondary, tert = tertiary weapon, my_loadout = echo of current loadout)

bind	"F1"		"prim"
bind	"F2"		"sec"
bind	"F3"		"tert"
bind	"F4"		"my_loadout"
Several notes
  • I noticed that the scripts are ESPECIALLY useful on the Special Attack servers with their melee-only sudden death. I couldn't be bothered to mention that but I've been reaping the benefits of this knowledge for quite some time: using my scripts to define default loadouts through "equip" commands DOESN'T change the equipment you have chosen on the loadout screen. How is that useful? You can actually choose the Fireaxe and Bonesaw in the loadout screen since they are far more useful in Sudden Death and e.g. the Axtinguisher and Ubersaw as defaults in my script (the sudden death plugin doesn't execute class scripts - I realized that when I wasn't able to switch my weapon with F3 =)... Tadaa!
  • The info messages displayed in the upper left corner aren't handled in a very elegant way and that's because Valve changed the behavior of the "developer 0" command... Basically if you start switching all the weapons around the messages will be disappearing very quickly when all the "wait" commands initiated before catch up... Back in the day it was possible to simply use "developer 0" and all the text that had been displayed before wouldn't disappear... :-(
  • If you prefer "whole loadout switching" (I for my part use all kinds of different combos so I don't want to waste keyboard space) then you just need the part where I aliased all the weapon equipment commands and make some really easy binds like:

    bind "anykey" "backburner; shotgun; fireaxe"
    bind "anotherkey" "flamethrower; flaregun; axtinguisher" etc.
Any suggestions are welcome. I am able (but not necessarily willing) to write ANY script that's possible in Valve's very, very simple console scripting language but I'll most likely ignore any requests concerning new scripts if I wouldn't use them myself (currently I'm using none except for the one above) unless they're challenging and fun to code or designed to do some crazy stuff. :-D"

_________________
War does not determine who is right - only who is left. - Bertrand Russell


Last edited by Lim-Dul on 21 Aug 2008, 16:52, edited 8 times in total.

Top
   
PostPosted: 03 Jul 2008, 17:26 
Offline
Has no REAL life! (1831)
User avatar
My sourcemod scipts pwn your console scripts anyday! :ba:


Thx for sharing. :18


Top
   
PostPosted: 03 Jul 2008, 20:56 
Offline
The Necromancer (4970)
Ha - you want to compare internet pens0rs? :-P

Back in CS days I was the co-developer of a fork of the WarCraft 3 plugin for AmxModX. We had a central DB for storing people's XP etc. (kinda like SpA points? :-D) from several servers - all over a secure socket connection (this part was coded by kenterfie of HLSW fame). Over 10.000 lines of code for the AMXX plugin alone - I still have the sources. :-P

_________________
War does not determine who is right - only who is left. - Bertrand Russell


Top
   
PostPosted: 03 Jul 2008, 21:47 
Offline
Community slut (13474)
User avatar
[SpA]Lim-Dul wrote:
Ha - you want to compare internet pens0rs? :-P

Back in CS days I was the co-developer of a fork of the WarCraft 3 plugin for AmxModX. We had a central DB for storing people's XP etc. (kinda like SpA points? :-D) from several servers - all over a secure socket connection (this part was coded by kenterfie of HLSW fame). Over 10.000 lines of code for the AMXX plugin alone - I still have the sources. :-P

Huh? Which fork was this ?


Top
   
PostPosted: 03 Jul 2008, 21:56 
Offline
The Necromancer (4970)
We called it WC3.net. =)

The official site used to be under this address...

_________________
War does not determine who is right - only who is left. - Bertrand Russell


Top
   
PostPosted: 03 Jul 2008, 22:08 
Offline
Community slut (13474)
User avatar
Which of the versions you were active in? wc3, wc3tf, uwc3?


Top
   
PostPosted: 03 Jul 2008, 22:56 
Offline
The Necromancer (4970)
You mean like, playing or coding? Playing - mainly WC3 and WC3:TFT. As to coding - only our plugin which was based partially on WC3:TFT.

_________________
War does not determine who is right - only who is left. - Bertrand Russell


Top
   
PostPosted: 04 Jul 2008, 19:59 
Offline
Has no REAL life! (1309)
User avatar
Chanks for the code :mrgreen:

_________________
02:47 <@NabNab> saifon: you so sexy ;)
02:47 <+saifon> D:


Top
   
PostPosted: 30 Jul 2008, 20:34 
Offline
Pretty useless (82)
User avatar
Thanks for the scrips, gonna use 'em ;D

_________________
Image
I reject your reality, and substitute my own. - Adam Savage


Top
   
PostPosted: 30 Jul 2008, 21:01 
Offline
The Necromancer (4970)
Thanks for the thanks. ^^

I updated the description of the scripts with a note about how to use them specifically on the SpA servers.

_________________
War does not determine who is right - only who is left. - Bertrand Russell


Top
   
PostPosted: 14 Aug 2008, 11:56 
Offline
Has no REAL life! (4896)
Unfortunately this thread melted my brain so I won't be able to use your script....

....Or live anymore.


Top
   
PostPosted: 14 Aug 2008, 12:19 
Offline
The Necromancer (4970)
He, he - just copy&paste the scripts. :-D

I will be updating the scripts after the Heavy pack, of course.

_________________
War does not determine who is right - only who is left. - Bertrand Russell


Top
   
PostPosted: 14 Aug 2008, 12:59 
Offline
Likes to type... (255)
User avatar
Woot! I'm glad you bumped this, McMoist, or I would've missed it. This is supremely useful! I usually skip changing just because it's so tedious. Awesome work, Lim.


Top
   
PostPosted: 21 Aug 2008, 16:55 
Offline
The Necromancer (4970)
I updated the post with the Heavy equipment script. In fact I posted it earlier on the Steampowered forums but SpA was down for a while and I forgot to post it here as well. ;-)

I updated ALL the scripts to make them slightly easier to use. You don't need to change any aliases for the cycle script to work properly since I moved the aliasing commands directly to the equip aliases (I wonder why I haven't thought about it before)...

Anyways - update all your scripts! I think I will links to the files in future instead of posting the scripts because the thread gets overloaded by the first post. =)
The reason I did it like that in the first place was because some of you might have custom stuff in the config files and I didn't want to overwrite them. ^^

_________________
War does not determine who is right - only who is left. - Bertrand Russell


Top
   
PostPosted: 21 Aug 2008, 17:49 
Offline
Has no REAL life! (4162)
User avatar
Nice... I'll give it a try, too. :)

_________________
SaintK: I'm completely lost :mrgreen:


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 15 posts ] 

All times are UTC+02:00


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited