Contagion
TheHyena 25 Nov, 2021 @ 1:40pm
Trying to mod zombie health
I can see that there is a command for Zombie health and damage factor but i can't get these to work.

Im trying to make a small mod for me and my friends that make the zombies die easier but just have more of them on the map, im trying to make it take 1-2 body shots. Any help?
< >
Showing 1-2 of 2 comments
Reborn 25 Nov, 2021 @ 4:51pm 
So, here is a simple script that forces any spawned zombie to set their health to 65 HP:
const int iZHealth = 65; void OnPluginInit() { // Plugin Data PluginData::SetVersion( "1.0" ); PluginData::SetAuthor( "Chicken Computers Co." ); PluginData::SetName( "LowHealthZombo" ); Schedule::Task( 0.1f, "RunRegisters" ); } void ThePresident_OnRoundStart() { Schedule::Task( 0.1f, "RunRegisters" ); } void RunRegisters() { Events::Entities::OnEntityCreation.Hook( @OnZombieCreation ); } HookReturnCode OnZombieCreation(const string &in strClassname, CBaseEntity@ pEntity) { if ( pEntity is null) { return HOOK_HANDLED; } if (Utils.StrEql("zombie", strClassname)) { Log.PrintToServerConsole(LOGTYPE_INFO, "{lime}Spawned Zombie with {gold}" + iZHealth + " HP"); //Debug message pEntity.SetMaxHealth(iZHealth); pEntity.SetHealth(iZHealth); return HOOK_HANDLED; } return HOOK_CONTINUE; }

Save the code in ".as" file and put it in your "../Contagion/contagion/data/scripts/plugins/" folder.

Then run as_loadplugin yourfilenamegoeshere.as in console to load it;
either as a lobby host (or in solo) using your ingame console
or using the server console if running a dedicated server (or using rcon if you prefer that).

UPD: Added one line that was missing.
Last edited by Reborn; 27 Nov, 2021 @ 1:34am
TheHyena 25 Nov, 2021 @ 11:00pm 
thank you :steamthumbsup:
< >
Showing 1-2 of 2 comments
Per page: 1530 50