rawset(_G, "hq_awards" , CV_RegisterVar({ name = "hq_awards", defaultvalue = "Off", flags = CV_NETVAR, PossibleValue = CV_OnOff })) local function hqa_awardinit(p) if p and p.valid and not p.hqawinit p.hqawar = 0 p.hqaboom = 0 p.hqawall = 0 p.hqabig = 0 p.hqastar = 0 p.hqawinit = true //print("Award variables set.") end end local function HQA_ItemPlay(p, inf, source) if not (hq_awards) return end if not (HOSTMOD and CV_FindVar("hm_intermission")) return end if not (source and source.player) then return end if not (p.mo and p.mo.valid) then return end local s = source.player if inf and inf.valid if (s == p) s.hqawar = $ + 0 else s.hqawar = $ + 1 end if ((inf.type == MT_SSMINE) or (inf.type == MT_SSMINE_SHIELD) or (inf.type == MT_MINEEXPLOSION) or (inf.type == MT_SPBEXPLOSION) or (inf.type == MT_SPBEXPLOSION and inf.extravalue1)) if (s == p) s.hqaboom = $ + 0 else s.hqaboom = $ + 1 end end if s.kartstuff[k_invincibilitytimer] s.hqastar = $ + 1 end end end addHook("PlayerSpin", HQA_ItemPlay) addHook("PlayerExplode", HQA_ItemPlay) addHook("PlayerSquish", function(p, inflictor, source) if not (hq_awards) return end if not (HOSTMOD and CV_FindVar("hm_intermission")) return end if not (source and source.player) then return end if not (p.mo and p.mo.valid) then return end local s = source.player if (s == p) s = nil else s.hqabig = $+1 end end) local function K_Wallflower(p) if not p.mo or not p.mo.valid return end local mo = p.mo if mo.eflags & MFE_JUSTBOUNCEDWALL p.hqawall = $ + 1 end end addHook("MapLoad", function() if not (hq_awards) return end if not (HOSTMOD and CV_FindVar("hm_intermission")) return end for p in players.iterate if p and p.valid p.hqawinit = false hqa_awardinit(p) end end end) addHook("ThinkFrame", function() if not (hq_awards) return end if not (HOSTMOD and CV_FindVar("hm_intermission")) return end for p in players.iterate if not p.hqawinit hqa_awardinit(p) end K_Wallflower(p) end if hm_intermissioncalc() then local demohits = {} local squishers = {} local starpower = {} local wallflowers = {} local warmongers = {} for p in players.iterate if p and p.valid if p.hqaboom ~= nil then table.insert(demohits, p) end if p.hqabig ~= nil then table.insert(squishers, p) end if p.hqastar ~= nil then table.insert(starpower, p) end if p.hqawall ~= nil then table.insert(wallflowers, p) end if p.hqawar ~= nil then table.insert(warmongers, p) end end end table.sort(demohits, function(a, b) return a.hqaboom > b.hqaboom end) table.sort(squishers, function(a, b) return a.hqabig > b.hqabig end) table.sort(starpower, function(a, b) return a.hqastar > b.hqastar end) table.sort(wallflowers, function(a, b) return a.hqawall > b.hqawall end) table.sort(warmongers, function(a, b) return a.hqawar> b.hqawar end) if demohits[1].hqaboom >= 5 HM_AddAward("\133DEMOLITIONS EXPERT","Scored \133"..demohits[1].hqaboom.."\128 hits with explosives.\128",demohits[1],15*demohits[1].hqaboom) end if squishers[1].hqabig >= 5 local randtitle = "HUGE QUEST" if leveltime%2 then randtitle = "WELCOME TO IHOP" else randtitle = "WELCOME TO DENNY'S" end HM_AddAward("\132"..randtitle,"Flattened \132"..squishers[1].hqabig.."\128 players. What a rampage!",squishers[1],15*squishers[1].hqabig) end if starpower[1].hqastar >= 5 local randtitle = "SUPERSTAR" if leveltime%2 then randtitle = "SUPERSTAR" else randtitle = "I'M FUCKIN' INVINCIBLE" end HM_AddAward("\130"..randtitle,"Rammed \130"..starpower[1].hqastar.."\128 players while invincible.",starpower[1],15*starpower[1].hqastar) end if wallflowers[1].hqawall >= 50 HM_AddAward("\139GBJ", "Bumped into walls \139"..wallflowers[1].hqawall.."\128 times. Heads up: The respawn command exists.",wallflowers[1],6*wallflowers[1].hqawall) elseif wallflowers[1].hqawall >= 15 HM_AddAward("\139JESUS TAKE THE WHEEL", "Bumped into walls \139"..wallflowers[1].hqawall.."\128 times. Don't text and drive.",wallflowers[1],6*wallflowers[1].hqawall) end if warmongers[1].hqawar >= 20 HM_AddAward("\133WARMONGER","Scored \133"..warmongers[1].hqawar.."\128 hits overall with items.",warmongers[1],5*warmongers[1].hqawar) end end end)