Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. [ZM] BO3's Three hit system and increased health for when the player(s) obtain Juggernog for BO2 Zombies

[ZM] BO3's Three hit system and increased health for when the player(s) obtain Juggernog for BO2 Zombies

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
3 Posts 2 Posters 41 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Coronavirus-19undefined Offline
    Coronavirus-19undefined Offline
    Coronavirus-19
    wrote last edited by Coronavirus-19
    #1

    To add this script first copy n' paste this code into Notepad++ then save it as a ".txt" after edit the change ".txt" to ".gsc" -- if you don't know how to do that open up a random folder look for "View" at the top and click it. A drop down menu should appear and you'll see "Show" at the bottom, click it and you'll see "File name extension" and should be able to change ".txt" to ".gsc"

    --You can name the file whatever you want, just make sure it ends with ".gsc"

    After the File name extension change add the ".gsc" to the Plutonium folders by:
    Win + R and Run "%localappdata%" then search for "Plutonium" and go the folders as shown: Local/Plutonium/storage/t6/scripts/zm

    #include common_scripts\utility;
    #include maps\mp\_utility;
    
    init()
    {
        level thread onPlayerConnect();
    }
    
    onPlayerConnect()
    {
        for (;;)
        {
            level waittill("connected", player);
            player thread onPlayerSpawned();
        }
    }
    
    onPlayerSpawned()
    {
        self endon("disconnect");
        level endon("game_ended");
    
        for (;;)
        {
            self waittill("spawned_player");
    
            // Initialize state
            self.jugActive = false;
    
            // Apply base health immediately on spawn
            self.maxhealth = 150;
            self.health = self.maxhealth;
            self IPrintLnBold("Base Health set to 150HP");
    
            // Start two threads:
            // 1) continuously watch for hasPerk changes (jug acquired/lost)
            // 2) reapply appropriate health immediately on revive (fixes game resetting to 100)
            self thread monitorPerkChanges();
            self thread handleRevives();
        }
    }
    
    monitorPerkChanges()
    {
        self endon("disconnect");
        level endon("game_ended");
    
        // Polling loop - keeps the perk state correct even across edge cases
        for (;;)
        {
            wait 0.5;
    
            // Correct function to detect Juggernog perk
            hasJugNow = (self hasPerk("specialty_armorvest"));
    
            // If perk state changed, update health accordingly
            if (!isDefined(self.jugActive) || hasJugNow != self.jugActive)
            {
                self.jugActive = hasJugNow;
    
                if (self.jugActive)
                {
                    // Player has Jug -> set to 300
                    self.maxhealth = 300;
                    self.health = self.maxhealth;
                    self IPrintLnBold("Juggernog acquired! Health set to 300HP");
                }
                else
                {
                    // Player doesn't have Jug -> ensure base 150
                    self.maxhealth = 150;
                    self.health = self.maxhealth;
                    self IPrintLnBold("Juggernog lost or not owned. Health set to 150HP");
                }
            }
        }
    }
    
    handleRevives()
    {
        self endon("disconnect");
        level endon("game_ended");
    
        for (;;)
        {
            // This waits until the player is revived.
            // When revive happens, the game's internal logic can reset health to 100,
            // so we immediately reapply our desired maxhealth based on current jugActive.
            self waittill("player_revived");
    
            // After revive, reapply correct health state
            if (isDefined(self.jugActive) && self.jugActive)
            {
                // If jugActive is true (player still has perk after revive), we follow your requirement:
                // you requested that getting down after having jug should revert to 150 until jug is reobtained.
                // So we will revert to 150 on revive even if they had jug before going down.
                //
                // If you instead want revive to keep Jug's 300 when they still own Jug after revive,
                // change the following block to set 300 instead of 150.
                self.maxhealth = 150;
                self.health = self.maxhealth;
                self IPrintLnBold("Revived — health set to 150HP (must re-obtain Jug to get 300HP)");
            }
            else
            {
                // No Jug — ensure base 150
                self.maxhealth = 150;
                self.health = self.maxhealth;
                self IPrintLnBold("Revived — health remains 150HP");
            }
    
            // Note: monitorPerkChanges() will immediately detect if the player re-buys Jug after revive
            // and will set the health to 300 when that happens.
        }
    }
    
    
    1 Reply Last reply
    0
    • Knitbyundefined Offline
      Knitbyundefined Offline
      Knitby
      wrote last edited by
      #2

      Coronavirus-19 The game crashes whenever i get knocked down, i modified the script to change the base health and the jug health values, what can cause the crash?

      Coronavirus-19undefined 1 Reply Last reply
      0
      • Knitbyundefined Knitby

        Coronavirus-19 The game crashes whenever i get knocked down, i modified the script to change the base health and the jug health values, what can cause the crash?

        Coronavirus-19undefined Offline
        Coronavirus-19undefined Offline
        Coronavirus-19
        wrote last edited by
        #3

        Knitby I'm still using it currently and have had no issues. Are you sure you copied it correctly? If it's still giving issues I'll upload a mediafire download!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Donate