UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

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

broken avatar :(
Created 7 years ago
by Invader115
0 Members and 1 Guest are viewing this topic.
3,518 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 July 2017
Last active: 7 years ago
Posts
4
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
Invader115's Groups
Invader115's Contact & Social Links
   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 Snippet
Plaintext
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 Snippet
Plaintext
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 Snippet
Plaintext
>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
///////////////////////////////////////////////////////////////////////////////////////////////////////////
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 3 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Signature
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
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 Snippet
Plaintext
//this is a comment and means that all text will be ignored by the compiler and doesn't get read as code. 
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 July 2017
Last active: 7 years ago
Posts
4
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
Invader115's Groups
Invader115's Contact & Social Links
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 Snippet
Plaintext
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).
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 July 2017
Last active: 7 years ago
Posts
4
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
Invader115's Groups
Invader115's Contact & Social Links
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 Snippet
Plaintext
>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...
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 July 2017
Last active: 7 years ago
Posts
4
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
Invader115's Groups
Invader115's Contact & Social Links
Oh, and I did not use the code included in the my second post. I used the code I posted to the OP.

 
Loading ...