UGX-Mods

Call of Duty 5: World at War => Tutorial Desk => Scripting => Topic started by: gympie6 on August 01, 2021, 03:23:53 pm

Title: Zombie Boss: Banzai Zombie (Level: Easy)
Post by: gympie6 on August 01, 2021, 03:23:53 pm
(https://steamuserimages-a.akamaihd.net/ugc/1706286890255479558/93D9DFD25F5DC727A59068533E51427203DBBDF1/?imw=5000&imh=5000&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false)

I made this mini boss a few years back for my big map called: Snowblind
It works fine but they are maybe too focused on their targets even if they are in laststand.
If you are able to fix this issue be my guest and post it here.
I re-checked and fixed some old issues so maybe it's already solved but who knows?

________________________________________________

1. copy the following files from raw/maps folder to your mod:
(If you already have those files you don't need to copy them)

________________________________________________

2. In your mod make a new script file (MODNAME/maps) and paste the following code in there:
Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

#using_animtree( "generic_human" );
spawn_banzaizombie()
{    
    self.gib_override = false;
    self.gibbed = true;
   
    self setModel("char_ger_ansel_body");
   
    self.hatmodel = "char_ger_wermachtwet_helm1";
    self Attach( self.hatmodel );

    // Wait until the zombie entered the player area
    while(1)
    {
        if (!self.ignoreall)
        {
            self thread banzai_zombie();
            break;
        }
        wait 0.5;
    }
}

banzai_zombie()
{
    self endon( "death" );

    // Settings
    self.moveplaybackrate = 0.80; // Play banzai animation at 80%
    self.banzai_minimum_damage = 65; // Melee minimum damage with bayonet
    self.banzai_maximum_damage = 75; // Melee maximum damage with bayonet
    self.banzai_range = 70; // Melee range with bayonet
    self.banzai_hit_range = 30; // Melee hit range with bayonet
    // Settings
   
    self.pathEnemyFightDist = 0.0000001; // To Disable hand melee attacks.
    self.banzai_stop_stabbing = false;
    self thread banzai_zombie_stop_stabbing();
    self thread banzai_zombie_draw_weapon();
   
    self.zombie_move_speed = "sprint";
    banzaiRandom = randomFloat(100);
    if (banzaiRandom <= 25) self.run_combatanim = %ai_bonzai_sprint_a;
    else if (banzaiRandom > 25 && banzaiRandom <= 50) self.run_combatanim = %ai_bonzai_sprint_b;
    else if (banzaiRandom > 50 && banzaiRandom <= 75) self.run_combatanim = %ai_bonzai_sprint_c;
    else self.run_combatanim = %ai_bonzai_sprint_d;
   
    players = get_players();
   
    while( 1 )
    {
        if (isdefined(self.favoriteenemy))
        {
            target = self.favoriteenemy;
            if (self.banzai_stop_stabbing)
            {
                return;
            }
           
            if (target.is_zombie || target maps\_laststand::player_is_in_laststand() || target.sessionstate == "spectator" || !isalive(target))
            {
                continue;
            }
           
            if (distance( target.origin, self.origin ) <= self.banzai_range && target.origin != self.origin)
            {        
                self thread banzai_zombie_attack(target, target.origin);
                self waittill( "attack_done" );
            }
        }
        wait .05;
    }
}

banzai_zombie_attack(player, player_pos)
{
    angles = VectorToAngles( player_pos - self.origin );
    self OrientMode( "face angle", angles );
    self animscripted("melee_zombies", self.origin, self.angles, %ai_bayonet_stab_melee);        
   
    while ( 1 )
    {
        self waittill( "melee_zombies", note );
        if ( note == "fire" )
        {
            if( isalive(player) )
            {
                if (distance( player.origin, self.origin ) < self.banzai_range)
                {
                    radiusdamage(player_pos, 45, self.banzai_maximum_damage, self.banzai_minimum_damage, self, "MOD_MELEE");
                   
                    //Give the player the feeling he got stabbed
                    radiusdamage(player_pos, 45, 0, 0, player, "MOD_MELEE");
                    wait .2;
                    self stopAnimScripted();
                    break;
                }
            }
        }
        if ( note == "end" )
            break;        
    }
    self notify( "attack_done" );
}

banzai_zombie_stop_stabbing()
{
    self endon( "death" );

    level waittill( "end_game" );
   
    self.banzai_stop_stabbing = true;
}

banzai_zombie_draw_weapon()
{
    self endon( "death" );
   
    wait 3; // Otherwise you see spooky things
    self.primaryweapon = "kar98k_bayonet";
    self animscripts\shared::placeWeaponOn( self.primaryweapon, "right" );
}
(You can for example copy the _zombiemode.gsc file, clear that file and paste this in)
________________________________________________
3. openup _zombiemode and look for:
Code Snippet
Plaintext
precache_models()
{
    precachemodel( "char_ger_honorgd_zomb_behead" );
    precachemodel( "char_ger_zombieeye" );
    PrecacheModel( "tag_origin" );
}
change it to this:
Code Snippet
Plaintext
precache_models()
{
    precachemodel( "char_ger_honorgd_zomb_behead" );
    precachemodel( "char_ger_zombieeye" );
    PrecacheModel( "tag_origin" );
   
    precachemodel( "char_ger_ansel_body" );
    precachemodel( "char_ger_wermachtwet_helm1" );
}
________________________________________________
4. openup _zombiemode_spawner and look for:
Code Snippet
Plaintext
self notify( "zombie_init_done" );
change it to this:
Code Snippet
Plaintext
self notify( "zombie_init_done" );

if (self.animname != "quad_zombie" && self.animname != "boss_zombie" && self.animname != "zombie_dog")
{
    spawn_round = 6; // the starting round the banzai zombie will spawn
    spawn_percentage = 10; // the spawn percentage the banzai zombie will spawn

    if (level.round_number >= spawn_round && randomInt(100) <= spawn_percentage)
    {
        self thread maps\YOURSCRIPT::spawn_banzaizombie();
    }
}
________________________________________________
5. openup dlc3_code and look for:
Code Snippet
Plaintext
include_weapon
along the others add this:
Code Snippet
Plaintext
include_weapon( "kar98k_bayonet", false );
________________________________________________
6. Add this to your modbuilder:
Code Snippet
Plaintext
// Banzai Zombie
xmodel,char_ger_ansel_body
xmodel,char_ger_wermachtwet_helm1
xanim,ai_bonzai_sprint_a
xanim,ai_bonzai_sprint_b
xanim,ai_bonzai_sprint_c
xanim,ai_bonzai_sprint_d
xanim,ai_bayonet_stab_melee
weapon,sp/kar98k_bayonet
// Banzai Zombie
________________________________________________
7. Build mod and you're done! Have fun! :)
Title: Re: Zombie Boss: Banzai Zombie (Level: Easy)
Post by: ghetto_wizzz on April 29, 2022, 01:01:53 pm
hey, im having a little issue where these guys appear headless lol. other zombies appear too look normal thankfully.
not gonna lie I kinda like the look of them when they have no head, looks rather spooky :o
but say there was a fix lol, it's also worth mentioning i'm also using your electricity zombies, & flame zombies as well! your work is phenomenal so i thought why not have more to cred you for. thanks hope to hear back! :)
Title: Re: Zombie Boss: Banzai Zombie (Level: Easy)
Post by: gympie6 on April 29, 2022, 04:57:05 pm
 
hey, im having a little issue where these guys appear headless lol. other zombies appear too look normal thankfully.
not gonna lie I kinda like the look of them when they have no head, looks rather spooky :o
but say there was a fix lol, it's also worth mentioning i'm also using your electricity zombies, & flame zombies as well! your work is phenomenal so i thought why not have more to cred you for. thanks hope to hear back! :)
 
Can you maybe post a screenshot of what you mean?
I know that the flame guys are headless.
Tbh, I am not sure if all the zombie types can be combined but it's not impossible to fix the issues.
Title: Re: Zombie Boss: Banzai Zombie (Level: Easy)
Post by: ghetto_wizzz on April 30, 2022, 06:38:30 am
EDIT: I actually figured out the problem!! I can still send a screen shot if need be, not sure if there is a simple fix too this but this also might help others include a couple of these mini bosses at once.
I realized (shouldn't have taken me this long) But the reason they're headless is because of the fire zombies! I just got hit in game while trying to take a screenie, and I was lit on fire and electrocuted at the same time.. haha so that solves that! But now my question would be, is it possible to call all of these bosses separately? Im assuming this is happening when we call for one of the 3 bosses in "zombiemode_spawner" around where we determine what round and % of chance that they spawn at.
I might be a little off, but it would make total sense to what you last responded with! Thanks :)
Code Snippet
Plaintext
    self notify( "zombie_init_done" );

if (self.animname != "quad_zombie" && self.animname != "boss_zombie" && self.animname != "zombie_dog")
{
    spawn_round = 1; // the starting round the banzai zombie will spawn
    spawn_percentage = 25; // the spawn percentage the banzai zombie will spawn

    if (level.round_number >= spawn_round && randomInt(100) <= spawn_percentage)
    {
        self thread maps\banzaizombie::spawn_banzaizombie();
        self thread maps\electriczombie::spawn_electricityzombie();
        self thread maps\firezombie::spawn_burnzombie();
    }
}
}

Title: Re: Zombie Boss: Banzai Zombie (Level: Easy)
Post by: gympie6 on April 30, 2022, 09:20:29 pm
EDIT: I actually figured out the problem!! I can still send a screen shot if need be, not sure if there is a simple fix too this but this also might help others include a couple of these mini bosses at once.
I realized (shouldn't have taken me this long) But the reason they're headless is because of the fire zombies! I just got hit in game while trying to take a screenie, and I was lit on fire and electrocuted at the same time.. haha so that solves that! But now my question would be, is it possible to call all of these bosses separately? Im assuming this is happening when we call for one of the 3 bosses in "zombiemode_spawner" around where we determine what round and % of chance that they spawn at.
I might be a little off, but it would make total sense to what you last responded with! Thanks :)
Code Snippet
Plaintext
self notify( "zombie_init_done" );

if (self.animname != "quad_zombie" && self.animname != "boss_zombie" && self.animname != "zombie_dog")
{
    spawn_round = 1; // the starting round the banzai zombie will spawn
    spawn_percentage = 25; // the spawn percentage the banzai zombie will spawn

    if (level.round_number >= spawn_round && randomInt(100) <= spawn_percentage)
    {
        self thread maps\banzaizombie::spawn_banzaizombie();
        self thread maps\electriczombie::spawn_electricityzombie();
        self thread maps\firezombie::spawn_burnzombie();
    }
}
}
I had a feeling this was happening. :)
Yes you can do it like this:
Code Snippet
Plaintext
if (self.animname != "quad_zombie" && self.animname != "boss_zombie" && self.animname != "zombie_dog")
{
    // Banzai zombie will start spawning since round 1 with 25% chance
    if (level.round_number >= 1 && randomInt(100) <= 25)
    {
        self thread maps\banzaizombie::spawn_banzaizombie();
    }
   
    // Electric zombie will start spawning since round 3 with 10% chance
    else if (level.round_number >= 3 && randomInt(100) <= 10)
    {
        self thread maps\electriczombie::spawn_electricityzombie();
    }
   
    // Fire zombie will start spawning since round 5 with 5% chance
    else if (level.round_number >= 5 && randomInt(100) <= 5)
    {
        self thread maps\firezombie::spawn_burnzombie();
    }
}
If you don't like the headless zombies openup: firezombie.gsc
and comment this part like this:
Code Snippet
Plaintext
// self detachAll();
// self.headModel = "char_ger_honorgd_zomb_behead";
// self attach(self.headModel);
Let me know if this is what you're looking for. :)
Title: Re: Zombie Boss: Banzai Zombie (Level: Easy)
Post by: ghetto_wizzz on May 01, 2022, 05:52:46 am
this fixed the headless glitch and made it super easy for me to adjust the round and % for each one! thank you so much for all your help gympie :) +1
Title: Re: Zombie Boss: Banzai Zombie (Level: Easy)
Post by: gympie6 on May 02, 2022, 04:11:00 pm
You're welcome!
I am looking forward to play your map with all these bosses in the future. :)