Zet0rz / nzombies

A GM13 Nazi Zombies style (WIP) gamemode
GNU General Public License v3.0
71 stars 77 forks source link

GobbleGum #454

Open jaxjaxk opened 7 years ago

jaxjaxk commented 7 years ago

if anyone is interested in making the GobbleGum machine model i can do the remainder. all i need is the machine and it will be perfect.

so say something if you are interested in making the model for the machine because i suck at that stuff.

OctothorpeObelus commented 7 years ago

I am proficient at 3DS Max, so I could create a the model, but my 3DS Max is currently looking in invalid paths for 3 paths I am unable to set manually. Do you have any particular design in mind I can reference?

jaxjaxk commented 7 years ago

@OctothorpeObelus best i got is http://callofduty.wikia.com/wiki/GobbleGum

OctothorpeObelus commented 7 years ago

As of now I am gonna experiment with running 3DS Max from and External HDD to solve these issue. Will get started once this happens :)

DjNathann commented 7 years ago

Can't wait to spawn a death machine and camp in a corner. lol.

jaxjaxk commented 7 years ago

just as a heads up so far i have all of these working --Arms Grace --Coagulant --In Plain Sight --Impatient --Sword Flay --Anywhere But Here! --Now You See Me --Alchemical Antithesis --Aftertaste --Burned Out --Dead of Nuclear Winter --I'm Feeling Lucky --Immolation Liquidation --Licensed Contractor --Phoenix Up --Pop Shocks --Unquenchable --Who's Keeping Score? --Fatal Contraption --Unbearable --Board Games --Idle Eyes --Board to Death --Cache Back --Kill Joy --On The House --Wall Power --Fear in Headlights --Temporal Gift --Crate Power --Soda Fountain --Killing Time --Perkaholic --Secret Shopper --Shopping Free --Near Death Experience --Profit Sharing --Round Robbin' --Self Medication --Power Vacuum --Reign Drops

while a good portion of these can work without having to alter files (you know, hooks are great) some stuff just flat out requires it. as you can guess once we have the model i can start altering gamefiles as quite a lot of files change. so i will wait until the machine is ready so that i do not end up updating an old version of NZ and i can use the newest version on gethub for the pull request. ( that and all my personal alterations are mixed in so i need a fresh copy anyways)

DjNathann commented 7 years ago

Cool.

Zet0rz commented 7 years ago

If I get around to make Gobblegums, which I might now that I have the models and animations, it will be through a hook system rather than altering a bunch of files to check only the relevant gobblegums. It will basically change the entire gamemode to call hooks and use return values to change the outcome. Gobblegums will then just hook.Add that player. It will also be likely that it won't be default BO3 Gobblegums, but instead many custom variations on them, possibly even some completely original ones. Most importantly though, it will allow addons to add more Gobblegum types. Also probably use png icons rather than BO3 model skins (such as silk icons), which allows easier adding of new Gobblegums (not having to port a model, just draw a .png icon and pick the relevant gobblegum color).

I'm saying this because when you say "pull request", there is a high chance I won't accept it and instead make my own version if yours doesn't follow the same modular vision I have for this entire gamemode.

OctothorpeObelus commented 7 years ago

@Zet0rz you have the GobbleGum model? Should I still work on my model or are you going to use that one?

conbubz commented 7 years ago

if you make these, will it be the same as wunderfizz allowing you to choose which ones you use?

Zet0rz commented 7 years ago

@Zet0rz you have the GobbleGum model? Should I still work on my model or are you going to use that one?

I don't have it directly, but I have BO3 as well as a program to extract it. Working on Zombie models atm.

if you make these, will it be the same as wunderfizz allowing you to choose which ones you use?

That's actually a good idea. I was originally thinking of making it like BO3 though, where you have a personal inventory that you can build up with some gamble/spinner, and where it is saved locally in a .txt file (which means you could easily modify how many of what gobblegum you have. The alternative was to save it on the server, but I didn't really like how you'd lose it from playing solo/local multiplayer. The third alternative was to let any player have all gums, but where the rarer ones are rare from the machine itself, not from the gamble to get it in your inventory.

If I go with the third alternative, I could probably make it like the Wunderfizz. But I imagine I'd go for the first solution,

jaxjaxk commented 7 years ago

@Zet0rz right now i just use them as items you can use any time. as for using hooks, let's face it 50% can get away with just simple code or hooks, the other half require you to modify files. obviously something like "Shopping Free" can not be done with hooks as everything is free so.....

Zet0rz commented 7 years ago

Incorrect, any single effect can be done with hooks if we modify the gamemode code to call the hook and use its return value. As in our own custom hooks. Shopping Free is actually the easiest one, just hook into OnPlayerBuy or PlayerCanAfford or whatever I called it, and return 0 as the new price lol. You are correct though, half of them would be able to get away with a simple run-on-use function like some perks.

jaxjaxk commented 7 years ago

@Zet0rz you just admitted you would have to alter the game mode code...... last time i checked adding "hook.call" is considered modifying files.

although honestly i wish you could hook any function even ones you create. oh and using CPP instead of lua would be nice..... you know, because multithreading and better coding.

jaxjaxk commented 7 years ago

welp here is a quick preview of what i have code wise. this works well however the final will be modular and better.

this is the simple function that is run when they eat the gum ( note that some required files to modified so only half of these work without the modified files) `` GLOBALGUM = {}

GLOBALGUM.Board_to_Death = false GLOBALGUM.Temporal_Gift = false GLOBALGUM.Near_Death_Experience = 0 GLOBALGUM.Profit_Sharing = false GLOBALGUM.Power_Vacuum = 0 function NZEatFunction(ply,item) ply:PrintMessage(HUD_PRINTTALK, "you ate the gum "..item) if item == "Arms_Grace" then ply.HasArmsGrace = true elseif item == "Coagulant" then ply.HasCoagulant = true timer.Simple(1200, function() ply.HasCoagulant = false end) elseif item == "In_Plain_Sight" then ply:SetTargetPriority(TARGET_PRIORITY_NONE) timer.Simple(20, function() ply:SetTargetPriority(TARGET_PRIORITY_PLAYER)
end) elseif item == "Impatient" then if (ply:Alive() == false) or (ply:Team() == TEAM_WAITING) then if nzRound:GetNumber() == -2 then ply:PrintMessage(HUD_PRINTTALK, "you will respawn in 25 min") timer.Simple(1500,function() ply:SetReady( true ) ply:SetPlaying( true ) ply:SetTeam(TEAM_PLAYERS) ply:ReSpawn() end) else ply:PrintMessage(HUD_PRINTTALK, "you will respawn when 80% of all zombies are dead") timer.Create( "Impatient"..ply:SteamID() , 5, 0, function() if (nzRound:GetZombiesKilled()*100)/(nzRound:GetZombiesMax()) >=80 then ply:SetReady( true ) ply:SetPlaying( true ) ply:SetTeam(TEAM_PLAYERS) ply:ReSpawn() timer.Destroy( "Impatient"..ply:SteamID() ) end
end) end else ply:PrintMessage(HUD_PRINTTALK, "you must be dead to use this!") ply:AddItem("Impatient", 1) end
elseif item == "Sword_Flay" then ply.HasSwordFlay = true timer.Simple(150,function() ply.HasSwordFlay = false end) elseif item == "Anywhere_But_Here" then

    local available = ents.FindByClass("nz_spawn_zombie_special")
    local spawns = {}
    for k,v in pairs(available) do

        if v.link == nil or nzDoors:IsLinkOpened( v.link ) then
            if v:IsSuitable() then
                --local pos = spawns[math.random(#spawns)]:GetPos()
                table.insert(spawns, v)

            end
        end
    end
    local pos = spawns[math.random(#spawns)]:GetPos()
    ply:SetPos(pos)
    local aim = ply:GetAimVector( )
    local force  = aim*(3*750)+Vector(0,0,1000)
    for k,v in pairs (ents.FindInSphere( ply:GetPos(), 1000 ) ) do
        if nzConfig.ValidEnemies[v:GetClass()] then
            v:Kill()            
        end
    end
    local windshot = ents.Create("wind_shot")
    if !windshot:IsValid() then return false end
    windshot:SetAngles(Angle(0,0,0))
    windshot:SetPos(ply:GetPos())
    windshot:SetOwner(ply)
    windshot:Spawn()
    windshot:Activate()
    windshot:SetColor(Color(0,0,0,0))
    timer.Simple(1,function()
    windshot:Remove()
    end)

elseif item == "Now_You_See_Me" then
    timer.Create( "youseeme"..ply:SteamID() , 1, 10, function()
        for _, target in pairs(ents.GetAll()) do
            if nzConfig.ValidEnemies[target:GetClass()] and target.Distracted != ply then

                target:SetTarget(ply)
                target.Distracted = ply

            end         
        end

    end)
    timer.Simple(11,function()
            for _, target in pairs(ents.GetAll()) do
            if nzConfig.ValidEnemies[target:GetClass()] then
                --target:SetTarget(self)
                target.Distracted = false               
            end         
        end
    end)
elseif item == "Alchemical_Antithesis" then
    ply.AlchemicalAntithesis = true
    timer.Simple(120,function()
        ply.AlchemicalAntithesis = false
    end)
elseif item == "Newtonian_Negation" then
--[[    physenv.SetGravity(Vector(100000,0,-100000)) 
    hook.Add("EntityTakeDamage", "nzEnemies_OnEntityCreated_newtonian", function (enemy, attacker, dmginfo, hitgroup)

    end)
    timer.Simple(1500,function()
    hook.Remove("OnEnemyKilled", "nzEnemies_OnEntityCreated_newtonian") 
    end)]]

elseif item == "Aftertaste" then
    ply.aftertaste = 3
elseif item == "Burned_Out" then
    ply.BurnedOut = 5
elseif item == "Dead_of_Nuclear_Winter" then
local spawns = {}
    local available = ents.FindByClass("nz_spawn_zombie_special")
    for k,v in pairs(available) do

        if v.link == nil or nzDoors:IsLinkOpened( v.link ) then
            if v:IsSuitable() then
                table.insert(spawns, v)
            end
        end
    end
    local pos = spawns[math.random(#spawns)]:GetPos()
    nzPowerUps:SpawnPowerUp(pos, "nuke")
    --pos = spawns[math.random(#spawns)]:GetPos()
    --nzPowerUps:SpawnPowerUp(pos, "nuke")

elseif item == "Im_Feeling_Lucky" then
    local spawns = {}
    local available = ents.FindByClass("nz_spawn_zombie_special")
    for k,v in pairs(available) do

        if v.link == nil or nzDoors:IsLinkOpened( v.link ) then
            if v:IsSuitable() then
                table.insert(spawns, v)
            end
        end
    end
    local pos = spawns[math.random(#spawns)]:GetPos()
    nzPowerUps:SpawnPowerUp(pos)
    --pos = spawns[math.random(#spawns)]:GetPos()
    --nzPowerUps:SpawnPowerUp(pos)
elseif item == "Immolation_Liquidation" then    
    local spawns = {}
    local available = ents.FindByClass("nz_spawn_zombie_special")
    for k,v in pairs(available) do

        if v.link == nil or nzDoors:IsLinkOpened( v.link ) then
            if v:IsSuitable() then
                table.insert(spawns, v)
            end
        end
    end
    local pos = spawns[math.random(#spawns)]:GetPos()
    nzPowerUps:SpawnPowerUp(pos,"firesale")
    --pos = spawns[math.random(#spawns)]:GetPos()
    --nzPowerUps:SpawnPowerUp(pos,"firesale")

elseif item == "Licensed_Contractor" then   
    local spawns = {}
    local available = ents.FindByClass("nz_spawn_zombie_special")
    for k,v in pairs(available) do

        if v.link == nil or nzDoors:IsLinkOpened( v.link ) then
            if v:IsSuitable() then
                table.insert(spawns, v)
            end
        end
    end
    local pos = spawns[math.random(#spawns)]:GetPos()
    nzPowerUps:SpawnPowerUp(pos,"carpenter")
    --pos = spawns[math.random(#spawns)]:GetPos()
    --nzPowerUps:SpawnPowerUp(pos,"carpenter")
elseif item == "Phoenix_Up" then
    for k,v in pairs( player.GetAll() ) do
        if IsValid(v) and !v:GetNotDowned() then
            v:RevivePlayer()
        end
    end
elseif item == "Pop_Shocks" then
    ply.PopShocks = 5
elseif item == "Unquenchable" then
    ply.Unquenchable = true
elseif item == "Whos_Keeping_Score" then
    local spawns = {}
    local available = ents.FindByClass("nz_spawn_zombie_special")
    for k,v in pairs(available) do          
        if v.link == nil or nzDoors:IsLinkOpened( v.link ) then
            if v:IsSuitable() then
                table.insert(spawns, v)
            end
        end
    end
    local pos = spawns[math.random(#spawns)]:GetPos()
    nzPowerUps:SpawnPowerUp(pos,"dp")
    --pos = spawns[math.random(#spawns)]:GetPos()
    --nzPowerUps:SpawnPowerUp(pos,"dp")
elseif item == "Fatal_Contraption" then
    local spawns = {}
    local available = ents.FindByClass("nz_spawn_zombie_special")
    for k,v in pairs(available) do          
        if v.link == nil or nzDoors:IsLinkOpened( v.link ) then
            if v:IsSuitable() then
                table.insert(spawns, v)
            end
        end
    end
    local pos = spawns[math.random(#spawns)]:GetPos()
    nzPowerUps:SpawnPowerUp(pos,"deathmachine")
    --pos = spawns[math.random(#spawns)]:GetPos()
    --nzPowerUps:SpawnPowerUp(pos,"deathmachine")   
elseif item == "Unbearable" then
    ply.Unbearable = 2
elseif item == "Board_Games" then
    ply.Board_Games = 5
elseif item == "Idle_Eyes" then
    for _,v in ipairs(player.GetAll()) do
        v:SetTargetPriority(TARGET_PRIORITY_NONE)
        timer.Simple(60, function()
            v:SetTargetPriority(TARGET_PRIORITY_PLAYER) 
        end)
    end
elseif item == "Board_to_Death" then
    GLOBALGUM.Board_to_Death = true
    timer.Simple(300,function()
        GLOBALGUM.Board_to_Death = false
    end)
elseif item == "Cache_Back" then
    local spawns = {}
    local available = ents.FindByClass("nz_spawn_zombie_special")
    for k,v in pairs(available) do          
        if v.link == nil or nzDoors:IsLinkOpened( v.link ) then
            if v:IsSuitable() then
                table.insert(spawns, v)
            end
        end
    end
    local pos = spawns[math.random(#spawns)]:GetPos()
    nzPowerUps:SpawnPowerUp(pos,"maxammo")
    --pos = spawns[math.random(#spawns)]:GetPos()
    --nzPowerUps:SpawnPowerUp(pos,"maxammo")
elseif item == "Kill_Joy" then
    local spawns = {}
    local available = ents.FindByClass("nz_spawn_zombie_special")
    for k,v in pairs(available) do          
        if v.link == nil or nzDoors:IsLinkOpened( v.link ) then
            if v:IsSuitable() then
                table.insert(spawns, v)
            end
        end
    end
    local pos = spawns[math.random(#spawns)]:GetPos()
    nzPowerUps:SpawnPowerUp(pos,"insta")
    --pos = spawns[math.random(#spawns)]:GetPos()
    --nzPowerUps:SpawnPowerUp(pos,"insta")
elseif item == "On_The_House" then
    ply:GiveRandomPerk(false)
elseif item == "Wall_Power" then
    ply.Wall_Power = true
elseif item == "Fear_in_Headlights" then
    local plyfear = ply
    timer.Create( "headlights"..ply:SteamID(), .5, 240, function()

        if SERVER then
            for k,v in pairs( nzConfig.ValidEnemies ) do
                for k2, v2 in pairs( ents.FindByClass( k ) ) do
                    if v2:Visible( ply) then

                        v2.loco:SetDesiredSpeed(0)

                        if timer.Exists((v2:EntIndex() ).."headlights_gum") then
                            timer.Start((v2:EntIndex() ).."headlights_gum") 
                        else
                            timer.Create( (v2:EntIndex() ).."headlights_gum", 2, 1, function ()
                                if IsValid(v2) then
                                    v2.WebAura = nil
                                    local speeds = nzRound:GetZombieSpeeds()
                                    if speeds then
                                        v2.loco:SetDesiredSpeed( nzMisc.WeightedRandom(speeds) )
                                    else
                                    print("back to normal")
                                        v2.loco:SetDesiredSpeed( 100 )
                                    end
                                end
                            end)
                        end
                    end
                end
            end
        end     
    end)
elseif item == "Temporal_Gift" then
    GLOBALGUM.Temporal_Gift = true
elseif item == "Crate_Power" then
    ply.Crate_Power =true
elseif item == "Soda_Fountain" then
    ply.Soda_Fountain = 5
elseif item == "Killing_Time" then
    local Killing_Time_List = {}
        if SERVER then
            for k,v in pairs( nzConfig.ValidEnemies ) do
                for k2, v2 in pairs( ents.FindByClass( k ) ) do                 
                    v2.loco:SetDesiredSpeed(0)

                    Killing_Time_List[v2:EntIndex()] = false
                    timer.Create( (v2:EntIndex() ).."killing_time", 20, 1, function ()
                        if IsValid(v2) then
                            v2.WebAura = nil
                            local speeds = nzRound:GetZombieSpeeds()
                            if speeds then
                                v2.loco:SetDesiredSpeed( nzMisc.WeightedRandom(speeds) )
                            else
                                v2.loco:SetDesiredSpeed( 100 )
                            end
                            if Killing_Time_List[v2:EntIndex()] == true then
                                v2:Kill()
                            end
                        end
                    end)
                end
            end
        end
        hook.Add("EntityTakeDamage","gobblegum_damage_killingtime",function(ent,dmginfo)
            if ent:IsValidZombie() then
                Killing_Time_List[ent:EntIndex()] = true
            end
        end)

elseif item == "Perkaholic" then
    for _,v in pairs( ents.FindByClass( "perk_machine") ) do
        if v:GetPerkID() != "pap" then
            ply:GivePerk(v:GetPerkID(), v)
        end
    end
elseif item == "Secret_Shopper" then
ply.Secret_Shopper = true
timer.Simple(600,function()
    ply.Secret_Shopper = true
end)
elseif item == "Shopping_Free" then
    ply.Shopping_Free = true
    timer.Simple(60,function()
        ply.Shopping_Free = false
    end)
elseif item == "Near_Death_Experience" then
    GLOBALGUM.Near_Death_Experience = 3
    timer.Create( "near_death_gum", .5, 0, function()
        if !(GLOBALGUM.Near_Death_Experience > 0) then
            timer.Destroy("near_death_gum") 
        end
        for _,v in ipairs(player.GetAll()) do
            if v:Alive() and v:GetNotDowned() then
                for _,v in ipairs(ents.FindInSphere( v:GetPos(), 100)) do
                    if IsValid(v) and v:IsPlayer() and !v:GetNotDowned() then
                        v:RevivePlayer()
                    end
                end
            end
        end
    end)
elseif item == "Profit_Sharing" then
    GLOBALGUM.Profit_Sharing = true
    timer.Simple(600,function()
        GLOBALGUM.Profit_Sharing = false
    end)

elseif item == "Round_Robbin" then
    if nzRound:GetNumber() < 0 or !nzRound:GetState(ROUND_PROG) then
        ply:PrintMessage(HUD_PRINTTALK, "you can not use that now!")
        ply:AddItem("Round_Robbin", 1)
    else
        nzRound:SetNumber( nzRound:GetNumber() + 1)
        nzRound:SetState(ROUND_PROG)
        nzRound:Prepare()
        if SERVER then
            for k,v in pairs( nzConfig.ValidEnemies ) do
                for k2, v2 in pairs( ents.FindByClass( k ) ) do
                    v2:Kill()
                end
            end
        end
    end
    for _,v in ipairs(player.GetAll()) do
        v:GivePoints(1600)
    end
elseif item == "Self_Medication" then
    ply.Self_Medication = 3 
--add elseif here
elseif item == "Power_Vacuum" then
GLOBALGUM.Power_Vacuum = 4
elseif item == "Reign_Drops" then
NZEatFunction(ply,"Kill_Joy")
NZEatFunction(ply,"Cache_Back")
NZEatFunction(ply,"Fatal_Contraption")
NZEatFunction(ply,"Whos_Keeping_Score" )
NZEatFunction(ply,"Dead_of_Nuclear_Winter" )
NZEatFunction(ply,"Immolation_Liquidation " )
NZEatFunction(ply,"Licensed_Contractor " )
end 
end

``

and here is the hook file `` hook.Add("PlayerInitialSpawn", "gobblegum_initialspawn", function(ply) ply.HasArmsGrace = false ply.HasCoagulant = false ply.HasSwordFlay = false ply.AlchemicalAntithesis = false ply.aftertaste = 0 ply.BurnedOut = 0 ply.PopShocks = 0 ply.Unquenchable = false ply.Unbearable = 0 ply.Board_Games = 0 ply.Wall_Power = false ply.Crate_Power = false ply.Soda_Fountain = 0 ply:SetCanZoom(false) ply.Secret_Shopper = false ply.Shopping_Free = false ply.Self_Medication = 0 end)

GUMTypes = { "Arms_Grace", "Coagulant", "In_Plain_Sight", "Impatient", "Sword_Flay", "Anywhere_But_Here", "Now_You_See_Me", "Alchemical_Antithesis", "Aftertaste", "Burned_Out", "Dead_of_Nuclear_Winter", "Im_Feeling_Lucky", "Immolation_Liquidation", "Licensed_Contractor", "Phoenix_Up", "Pop_Shocks", "Unquenchable", "Whos_Keeping_Score", "Fatal_Contraption", "Unbearable", "Board_Games", "Idle_Eyes", "Board_to_Death", "Cache_Back", "Kill_Joy", "On_The_House", "Wall_Power", "Fear_in_Headlights", "Temporal_Gift", "Crate_Power", "Soda_Fountain", "Killing_Time", "Perkaholic", "Secret_Shopper", "Shopping_Free", "Near_Death_Experience", "Profit_Sharing", "Round_Robbin", "Self_Medication", "Power_Vacuum", "Reign_Drops"

} hook.Add("PlayerDeath", "gobblegum_death", function(ply,inf,attacker) --[[print("died") if ply.HasArmsGrace then print("had grace") ply.HasArmsGrace = ply:GetWeapons() end]]

end)

hook.Add("PlayerSpawn", "gobblegumrespawn", function(ply) timer.Simple(1,function() if ply.HasArmsGrace != false then ply:StripWeapons() local weplistthing = string.Explode( " ", ply.HasArmsGrace, false) for ,v in ipairs (weplistthing) do ply:Give(v) end ply.HasArmsGrace = false end end) end)

hook.Add("EntityTakeDamage","gobblegum_damage",function(ent,dmginfo) if ent:IsPlayer() and ent.BurnedOut > 0 then for k, v in pairs ( ents.FindInSphere( ent:GetPos(), 200 ) ) do if nzConfig.ValidEnemies[v:GetClass()] then local timetoig = math.Round(math.random( 1, 10 )) if !v:IsOnFire() then v:Ignite(timetoig) local dmginfo = DamageInfo() dmginfo:SetDamage( 250 ) dmginfo:SetDamageType( DMG_BURN ) dmginfo:SetAttacker( ent) dmginfo:SetInflictor( ent ) timer.Create( (v:EntIndex() ).."zombie_gum", 1, timetoig, function() if v:IsValid() then v:TakeDamageInfo( dmginfo ) end

                end)
            end
        end

    end
ent.BurnedOut = ent.BurnedOut - 1                   
elseif ent:IsValidZombie() then
    if dmginfo:GetAttacker().HasSwordFlay then
        if dmginfo:GetInflictor():GetClass() == "csgo_karambit_ultraviolet" or dmginfo:GetInflictor():GetClass() == "csgo_m9_ultraviolet" or dmginfo:GetInflictor():GetClass() == "leak" or dmginfo:GetInflictor():GetClass() == "leek" then
            dmginfo:ScaleDamage( 5 )
        end
    end
    if dmginfo:GetAttacker():IsPlayer() and dmginfo:GetAttacker().PopShocks > 0 then
        if dmginfo:GetInflictor():GetClass() == "csgo_karambit_ultraviolet" or dmginfo:GetInflictor():GetClass() == "csgo_m9_ultraviolet" or dmginfo:GetInflictor():GetClass() == "leak" or dmginfo:GetInflictor():GetClass() == "leek" then
            nzEffects:Tesla( {
            pos = dmginfo:GetAttacker():GetPos() + Vector(0,0,50),
            ent = dmginfo:GetAttacker(),
            turnOn = true,
            dieTime = 1,
            lifetimeMin = 0.05,
            lifetimeMax = 0.1,
            intervalMin = 0.01,
            intervalMax = 0.02,
            })
                    --print(pct)
            local zombies = ents.FindInSphere(dmginfo:GetAttacker():GetPos(), 250)
            local d = DamageInfo()
            d:SetDamage( 500 )
            d:SetDamageType( DMG_SHOCK )
            d:SetAttacker(dmginfo:GetAttacker())
            d:SetInflictor(dmginfo:GetAttacker())

            for k,v in pairs(zombies) do
                if nzConfig.ValidEnemies[v:GetClass()] then
                    v:TakeDamageInfo(d)
                end
            end
            dmginfo:GetAttacker().PopShocks = dmginfo:GetAttacker().PopShocks - 1
        end
    end
end

end) hook.Add( "OnRoundPreparation", "gum_roundstart", function() if SERVER then if GLOBALGUM.Near_Death_Experience >0 then GLOBALGUM.Near_Death_Experience = GLOBALGUM.Near_Death_Experience - 1 end if GLOBALGUM.Power_Vacuum > 0 then GLOBALGUM.Power_Vacuum = GLOBALGUM.Power_Vacuum - 1 end GLOBALGUM.Temporal_Gift = false

    for _,v in ipairs(player.GetAll()) do
        if v.aftertaste >0 then
            v.aftertaste = v.aftertaste - 1
        end
        if v.Board_Games >0 then
            v.Board_Games = v.Board_Games -1
        end
    end

end

end) ``

conbubz commented 7 years ago

Looks like fun

Zet0rz commented 7 years ago

Yeah there's no way I'd merge that. Sorry to say, but that is terrible code :/ (20+ elseif's, hooks globally added, players storing sometimes irrelevant information). That being said, the code above is fine as a proof-of-concept/sketch/basis for mechanics if that's what you were going for.

I'm thinking a more sophisticated system, kinda like the perks. Players only store information about currently active gobblegum, hooks are added dynamically and per-player. Functions are ran via table key lookup rather than elseif-stacking. Doing it in table form also allows customization that can be useful elsewhere. My idea would end up something like this:

local GUM = {
    name = "Perkaholic",
    desc = "All perks acquired!",
    icon = "path/to/perkaholic.png",
    rarity = GOBBLE_ULTRA,
    color = GOBBLE_INSTANT,
    func = function(ply)
        -- Give perks and stuff
    end,
}
nzGobble:Add("gum_perkaholic", GUM)

The gobblegum model would then read this data, using the activation type for color, using rarity for the pattern, and using icon for the icon. You can then easily set up any gobblegum including custom ones following this. Activation would be by key lookup so it would be done like gobblegums[gum.id].func(gum.owner) - no need for elseifs.

Edit: The table would probably have more things like a ProgressUpdate function so you can handle progress and local gum data, to keep it on HUD or keep track of remaining activations.

jaxjaxk commented 7 years ago

@Zet0rz well obviously you would not merge that. that is the very first working method. it was more of a proof of concept. i have nothing to gain from making it modular as i am the only one using it, however if we get the model i will change it into something modular that works like the perkcola machines. i just do not feel like wasting my time right now if we never even get the model.

globalcringe commented 7 years ago

My friend ported the GobbleGum model from BO3 if you want it. You'll need to make a QC for it and port it to the Source format, though... https://feen.us/210nxtow.rar

DjNathann commented 7 years ago

Is there gonna be a Dr. Monty's Factory and Liquid Divinium drops like black ops 3 or are they gonna be all free?

conbubz commented 7 years ago

Most likey free

conbubz commented 7 years ago

how is the gobblegum making going?

Punkinator7 commented 7 years ago

bump

minin43 commented 7 years ago

There is no need to bump these threads.