Half-Life 2

Half-Life 2

Script MultiLoader
 This topic has been pinned, so it's probably important
How to Create a Script for MultiLoader
If you don't want to check the VPK, here's how it works.

skill_manifest.cfg execs script_loader.cfg, which in turn executes 300 scripts inside of the subfolder "custom_scripts". Each script is just the number, without any prefixes or suffixes.

So if I wanted to create a script to occupy slot 151, within the cfg folder I would create a script inside the subfolder "custom_scripts" named "151.cfg".
Last edited by Vitamin Celsius; 18 Nov, 2024 @ 4:02pm
< >
Showing 1-2 of 2 comments
Qwazzy 19 Nov, 2024 @ 11:34am 
"What if I just want a few personal tweaks without uploading it to the workshop?"
As it turns out, you can totally do this!
The only requirement is that you're subscribed to this Script MultiLoader and have it as priority one in your addons, like you already would do for others' scripts. The multiloader will find your script if you place it in the right area, and won't differentiate between a script that's loaded from workshop or just sitting on your hard drive.

You just have to remember not to use a slot that's being used by another script addon you are subscribed to, or one will override the other.

How To
Go to the following folder:
steamapps\common\Half-Life 2\hl2_complete\cfg\
"Why hl2_complete instead of hl2?" Because as far as I can tell, this folder is for loading content that should apply to all game/episodes. Evidence of this is how in this cfg folder there's a text file detailing which addons you have subscribed by ID and whether or not they're enabled. So, if my theory holds true, any cfg files here can be executed no matter which game or episode you're playing.

Anyway. Once here, make a new folder called "custom_scripts" and enter it.

Then, make your script file. Pick a number that isn't being used by any other script addon you're subscribed to. There's currently 1000 to choose from, so any 3-digit number would likely do the trick. Make sure the file extension is CFG, not TXT. Don't worry, Notepad can still open a CFG file.

Finally, put your script info inside. If you don't know what to put in it right now and just want to see if you're doing this right, here's my test script:
ent_fire !player addoutput "max_health 987" ent_fire !player sethealth 987

Once your script is created and saved, open HL2. Double check that Script MultiLoader is enabled and at the top of the priority. Then open any map you want.

If everything was done right, your config should execute. If you used my code as a test, your health should read "987".

-----------

Cheers! Hope this helps someone. I'm sure there's at least a couple people out there like me who want to make code snippets that execute with any map but skip the need to make a separate workshop addon for it.
I don't recommend using numbers lower than 750. There's a buffer problem where they seem to be prevented from executing. Encountered some awful bugs until I moved the numbers up.
< >
Showing 1-2 of 2 comments
Per page: 1530 50