Author Topic: Need Help Making a Mod for All Maps (Changes Zombie Health)  (Read 586 times)

0 Members and 1 Guest are viewing this topic.

Offline Invader115

  • - Original Poster (OP) -
  • Fresh Corpse
  • Posts: 4
  • Country: us
  • Respect: 0
    • View Profile
   Hey everyone,

   To start with, I'm someone with only minimal experience programming who's trying to make a mod for BO3. That alone is probably the biggest problem I'm having, but despite that I'm going to post what I'm trying to do and how I think I could be helped.



   What I'm trying to do is to make a mod (not a map but a mod that affects all maps) which would do the following:

   -Cap zombie health at round 10
   -Tie zombie speed to round number or double round number (may not make it into final version)
   -Increase the number of zombies to balance it out



   I found some values in _zm.gsc that I changed but that didn't work (crashed); later I read that you can't edit _zm.gsc right now so that'll be the problem there. To try to get around that I started editing zombie_utility.gsc (since as far as I can tell the values I was changing in _zm.gsc were just being sent there) and I thought that would work but the result is that nothing changes in-game.

   Just to verify that my mod was loading properly I followed a guide I found regarding changing the price of perks and I successfully adapted the guide to make Quick Revive cost less on every map. Running to the Quick Revive machine and verifying that the price is changed is how I make sure the mod is loaded in properly. So far every time I've loaded into a zombie level with my mod enabled, this has worked.

   What hasn't worked is actually making the zombies' health change. To test I've just been setting the zombies' starting health to 9999 for testing and the change never takes place (they still die after about a clip from a 1911).

   Here's what my change looks like in the code (note that the rest of zombie_utility.gsc is still in the file unedited):

Code: [Select]
function ai_calculate_health( round_number )
{

level.zombie_health = 9999;
for ( i=2; i <= round_number; i++ )
{
// After round 10, get exponentially harder
if ( i >= 10 )
{
old_health = level.zombie_health;
level.zombie_health += Int( level.zombie_health * level.zombie_vars["zombie_health_increase_multiplier"] );

if ( level.zombie_health < old_health )
{
// we must have overflowed the signed integer space, just use the last good health, it'll give some headroom to the capped value to account for extra damage applications
level.zombie_health = old_health;
return;
}
}
else
{
level.zombie_health = Int( level.zombie_health + level.zombie_vars["zombie_health_increase"] );
}
}
}

And here's what the original code looks like (the value of "zombie_health_start" is determined in _zm.gsc, or at least that's my understanding).

Code: [Select]
function ai_calculate_health( round_number )
{
level.zombie_health = level.zombie_vars["zombie_health_start"];
for ( i=2; i <= round_number; i++ )
{
// After round 10, get exponentially harder
if ( i >= 10 )
{
old_health = level.zombie_health;
level.zombie_health += Int( level.zombie_health * level.zombie_vars["zombie_health_increase_multiplier"] );

if ( level.zombie_health < old_health )
{
// we must have overflowed the signed integer space, just use the last good health, it'll give some headroom to the capped value to account for extra damage applications
level.zombie_health = old_health;
return;
}
}
else
{
level.zombie_health = Int( level.zombie_health + level.zombie_vars["zombie_health_increase"] );
}
}
}


   I suspect that if the problem isn't something I'm completely oblivious to, it's probably that the values in _zm.gsc are being loaded in before my edited zombie_utility.gsc gets loaded in. I'm not sure what to do about that, if that's the problem.

   I've seen mods on the Steam Workshop that change zombie health at different rounds so I believe this can be done. What I'm not sure of is how to do this myself (since all of those mods do other stuff that I don't like).

   Just for good measure, here's what my zm_mod.zone file looks like.

Code: [Select]
>mode,zm
>type,common

#include "zm_mod.class"

scriptparsetree,scripts\zm\_zm_perk_quick_revive.gsc
//scriptparsetree,scripts\zm\_zm.gsc
scriptparsetree,scripts\zm\zombie_utility.gsc

///////////////////////////////////////////////////////////////////////////////////////////////////////////
rawfile,dummy.cfg
///////////////////////////////////////////////////////////////////////////////////////////////////////////

Offline buttkicker845

  • Mr. Elemental
  • Posts: 242
  • Country: us
  • Respect: 81
    • View Profile

Re: Need Help Making a Mod for All Maps (Changes Zombie Health)

« Reply #1 on: July 16, 2017, 06:15:57 pm »
You're setting the health value just fine but you never stopped the original code from running so it just sets the health value to what ever is the calculated value for the current round. to keep this from happening you need to either comment out the original code or delete it all together.

PS: in case you don't know how to make a comment you make one by placing // in front of a line of text
Code: [Select]
//this is a comment and means that all text will be ignored by the compiler and doesn't get read as code. 
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."

Offline Invader115

  • - Original Poster (OP) -
  • Fresh Corpse
  • Posts: 4
  • Country: us
  • Respect: 0
    • View Profile

Re: Need Help Making a Mod for All Maps (Changes Zombie Health)

« Reply #2 on: July 16, 2017, 08:32:10 pm »
Thanks for your reply but I'm confused as to what code I'm supposed to comment out or delete.

Here's what I have in zombie_utility.gsc now:

Code: [Select]
function ai_calculate_health()
{
level.zombie_health = 9999;
}

I felt like that should have made a change but the zombies still start at their normal health.

Also, the original, unedited code included in the OP was just for reference, it wasn't in my edited file (in case I made it seem like it was).

Offline Invader115

  • - Original Poster (OP) -
  • Fresh Corpse
  • Posts: 4
  • Country: us
  • Respect: 0
    • View Profile

Re: Need Help Making a Mod for All Maps (Changes Zombie Health)

« Reply #3 on: July 16, 2017, 09:34:01 pm »
Hey, I figured it out! The problem was with my zm_mod.zone file and my file structure within the mod. Compare the new, working .zone file to the old one in the OP:

Code: [Select]
>mode,zm
>type,common

#include "zm_mod.class"

scriptparsetree,scripts\zm\_zm_perk_quick_revive.gsc
scriptparsetree,scripts\shared\ai\zombie_utility.gsc

///////////////////////////////////////////////////////////////////////////////////////////////////////////
rawfile,dummy.cfg
///////////////////////////////////////////////////////////////////////////////////////////////////////////

Now on to making the actual mod...

Offline Invader115

  • - Original Poster (OP) -
  • Fresh Corpse
  • Posts: 4
  • Country: us
  • Respect: 0
    • View Profile

Re: Need Help Making a Mod for All Maps (Changes Zombie Health)

« Reply #4 on: July 16, 2017, 09:35:09 pm »
Oh, and I did not use the code included in the my second post. I used the code I posted to the OP.