Half-Life 2

Half-Life 2

Resident Evil 2 - Source
 此主題已被置頂,因此它可能很重要
Qwazzy  [開發人員] 2024 年 11 月 16 日 下午 9:48
Headcrabless zombies - a janky method
Someone asked about making all the zombies headcrabless, to better fit the RE2 theme.

Researching this, I found that there really isn't a simple way of going about this. Most of the advice is editing the SDK itself for those making a sourcemod. Little explained how to do anything of the sort in vanilla Half Life 2.

I was able to sort-of do this using nothing but the console, but it's a pretty janky solution.

I can't guarantee this won't cause issues, especially if you can't run the game at a smooth framerate, as it involves a timer firing a couple times a second.

Use at your own risk.

How To

  1. Open steamapps/common/half-life 2/hl2/cfg

  2. Create a new cfg file here, name it whatever. For example, "headcrabless.cfg". If you need to, make a blank txt file and change the extension to cfg. It will still open in Notepad.

  3. In the file, paste the following code:

    ent_create logic_timer refiretime 0.5 startdisabled 0 ontimer"npc_zombie*,SetBodygroup,0" ontimer"npc_headcrab*,Kill" ontimer"npc_fastzombie*,SetBodygroup,0"

  4. Save the file.

  5. Open HL2 and go into a game. If you play RE2:S, you'll spawn next to quite a few zombies, making for a perfect test.

  6. Open the console (the game should pause) and type in "exec NAME" where NAME is the name of your cfg file, without the extension. (For my example, I'd type "exec headcrabless")

  7. Close the console, resume the game, and observe your handiwork. If you did it right, the zombies around you should change to be headcrabless.

  8. The entity only lasts for that map, so when you transition to a new map, you'll need to execute the cfg file again.

How it works

It creates an invisible logic_timer entity. If you do any mapping then you probably already know the logic entities and what they do, but if you don't, fret not. It isn't terribly important for an end user. Suffice to say, this one is set to fire every half second. If it makes your game lag, you can try making it fire every second, every 2 seconds, whatever. Of course, the longer the refire, the more a headcrab can exist before being thanos-snapped.

Anyway. Every time the timer fires, it sets any npc_zombie or npc_fastzombie to have its bodygroup changed to hide the headcrab. Then it looks for any npc_headcrab (which should include fast headcrabs, but also maybe poison headcrabs which might not be intended, but oh well...) and delete it in an instant. So if you kill a zombie and it spawns a headcrab, it will vanish before it can do anything to you.

But yeah, again, this is VERY jank and if it causes problems, well, you were warned. :health:

Edit:
Edited out the script bit about turning cheats on and off because, apparently, you don't need cheats on to create entities. Neat!
I'm too used to multiplayer games like No More Room In Hell or Left 4 Dead 2 where doing such things would be locked behind cheats for obvious reasons. Didn't occur to me that in this singleplayer game they wouldn't have bothered.
最後修改者:Qwazzy; 2024 年 11 月 19 日 下午 12:25
< >
目前顯示第 1-7 則留言,共 7
寻光 2024 年 11 月 16 日 下午 10:22 
HHH
Blood_Wraith 2024 年 11 月 18 日 上午 8:09 
Certainly more elegant than just setting all the zombies' bodygroups to 0 in every map, in Hammer (like I used to do), and have a headcrab pop out of nowhere upon zombie death *anyway* (and exist for more than a split second, anyway....)

More importantly, you don't need to modify the game's code itself to have true(ish) headcrabless zombies, like I had to for the actual mod.

There might be the side effect of performance impact though. If there is, it's probably because the game's checking the ENTIRE MAP for the generic named npc(s) (every half second), then removing it. You think the game would just have all entity types in a map flagged on a list, so it could check for it much more efficiently, instead of having to scan the entire map.

I'm kind of surprised Valve never gave us the option for actual headcrabless zombies in the first place. I mean, come on, a zombie mod is usually the first type of mod that is created for most FPS games.
最後修改者:Blood_Wraith; 2024 年 11 月 18 日 上午 8:25
Qwazzy  [開發人員] 2024 年 11 月 18 日 上午 8:45 
I was honestly surprised that it wasn't an option to begin with. You'd think it would be an option or a spawnflag in Hammer, since most NPC entities have an overwhelming amount of options to begin with.

I originally used this repeating-timer method for another game called No More Room In Hell, specifically for playing custom maps singleplayer. Many map makers loved to spam the runner-type zombies for the sake of difficulty (or trolling, if we're being honest here) and handling them was incredibly frustrating solo. So I learned how to spawn a timer that would routinely kill those runners as soon as they spawn, or - when a future update added the option - turn them into shamblers instead.

I've never had the timer method of either game cause any lag, but it's certainly true that it can, especially with weaker or older computers.
Aetho 2024 年 11 月 22 日 上午 3:28 
What would I use for the extension? It says it's not present
Qwazzy  [開發人員] 2024 年 11 月 22 日 上午 11:17 
Use the extension ".cfg". You can still open them in Notepad (you might have to tell Windows to do this, but it will work) and edit them like normal text files.

If you don't see extensions:
Open File Explorer.
Click the View tab in File Explorer.
Click the box next to File name extensions to see file extensions.
Fluffy The Umbreon 2024 年 11 月 22 日 下午 1:25 
This may be a late response but, thanks for somewhat solving my crabless zombie question.
Qwazzy  [開發人員] 2024 年 11 月 23 日 上午 8:46 
Another possible method of headcrabless zombies. I haven't used it myself, but it seems solid. Main downside is that it will likely overwrite the settings RE2S uses for melee damage, gun damage, etc, so the maps' balance will be altered. Just something to keep in mind.

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3370688889
< >
目前顯示第 1-7 則留言,共 7
每頁顯示: 1530 50