local buttonslast local function lastPlayerPress(player) end local enemiesDestroyed = 0 local originalAbility local isplayerinnightsmode local mapdefaultsong local player = consoleplayer local darkform = { usable = false, on = false } local darkformmusic = false local cangosuper = false local lastcharacter = "" local adrenalinecheat = false freeslot( "SKINCOLOR_SUPERDARK" ) skincolors[SKINCOLOR_SUPERDARK] = { name = "Super Dark", ramp = {31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31}, invcolor = SKINCOLOR_WHITE, invshade = 9, chatcolor = V_BLUEMAP, accessible = false } addHook("MapLoad", function() mapdefaultsong = mapmusname isplayerinnightsmode = G_IsSpecialStage(map) end) addHook("PlayerSpawn", function(player) player.jumpfactor = skins[player.realmo.skin].jumpfactor -- reset powers if player.fakenormalspeed player.fakenormalspeed = restorefakenormalspeed else player.normalspeed = skins[player.realmo.skin].normalspeed end player.acceleration = skins[player.realmo.skin].acceleration player.charflags = skins[player.realmo.skin].flags if lastcharacter == player.realmo.skin and cangosuper == true player.charflags = $|SF_SUPER end player.adrenaline = 0 --reset adrenaline once player spawns in buttonslast = player.cmd.buttons --reset button presses --originalAbility = skins[player.realmo.skin].ability --makes sure ability is stored player.enemiesDestroyed = enemiesDestroyed player.superdark = false --reset darkform variables player.darkform = { usable = false, on = false } darkformmusic = false end) -- if isplayerinnightsmode == false addHook("PostThinkFrame", function() function lastPlayerPress(player) if player.mo.valid == true or player.valid == true buttonslast = player.cmd.buttons end end return buttonslast end) addHook("PlayerThink", function(player) if not player.adrenaline ----set player variables player.adrenaline = 0 else return end end) hud.add(function(v, player) --draw the hud if emeralds & EMERALD3 if player.adrenaline < 100 v.drawString( 200, 10, "N.CHAOS EN. " + player.adrenaline + "%", V_YELLOWMAP) elseif player.adrenaline >= 100 local timer = leveltime%2 --flash timer if timer == 1 v.drawString( 200, 10, "N.CHAOS EN. " + player.adrenaline + "%", V_INVERTMAP) else v.drawString( 200, 10, "N.CHAOS EN. " + player.adrenaline + "%", V_GRAYMAP) end end end end, "game") addHook("PlayerThink", function(player) --limits adrenaline value if player.adrenaline > 100 player.adrenaline = 100 elseif player.adrenaline < 0 player.adrenaline = 0 end return player.adrenaline end) COM_AddCommand("InfiniteEnergy", function(player) if not (player and player.valid) CONS_Printf(player, "\x85"+"No player has been detected, aborting.") return end if adrenalinecheat == false adrenalinecheat = true CONS_Printf(player, "\x85"+"Infinite Chaos Energy cheat has been turned on.") else adrenalinecheat = false CONS_Printf(player, "\x85"+"Infinite Chaos Energy cheat has been turned off.") end end, COM_ADMIN) COM_AddCommand("SetChaosEnergy", function(player, num) --adds a command to modify adrenaline if not (player and player.valid) print("Must be in-game to use this command.") return end if not tonumber(num) print("Only use numbers for this command.") else if num == nil print("Insert a value into the command.") else player.adrenaline = tonumber(num) if (player.adrenaline > 100) print("You can't set Adrenaline to more than 100%!") player.adrenaline = 100 return player.adrenaline elseif (player.adrenaline < 0) print("You can't use negative values for Adrenaline!") player.adrenaline = 0 return player.adrenaline else return player.adrenaline end end end -- end end, COM_ADMIN) -------- addHook("PlayerThink", function(player) if not (player.realmo and player.realmo.valid) --confirm player is valid return end if not player.darkform --set player variables player.darkform = darkform end --if player.cmd.buttons & BT_CUSTOM1 --use custom1 to check current var. state --local musicname = S_MusicName(player) --print("Music is "+musicname) --end end ) addHook("ShouldDamage", function(target, inflictor, source) --add adrenaline if player hits enemy if source != nil and source.player and target != nil and not (source.player.darkform.on == true) and ((target.flags & MF_ENEMY) or (target.flags & MF_BOSS) or (target.player)) source.player.adrenaline = source.player.adrenaline + 5 return source.player.adrenaline elseif source != nil and source.player and (source.player.darkform.on == true) and target != nil and ((target.flags & MF_ENEMY) or (target.flags & MF_BOSS) or (target.player)) source.player.adrenaline = source.player.adrenaline + 4 return source.player.adrenaline else return end return true end ) addHook("MobjDamage", function(target, inflictor, source) --dark forms can't be stunned if target.player and target.player.darkform.on == true target.player.powers[pw_flashing] = 2*TICRATE S_StartSound(target.player.mo, sfx_s1c6) if target.player.rings > 10 target.player.rings = target.player.rings/2 elseif target.player.rings <= 10 target.player.rings = 0 end if target.player.rings == 0 target.player.adrenaline = target.player.adrenaline - 10 end elseif target.player and target.player.darkform.on == false target.player.adrenaline = target.player.adrenaline - 10 return false else return end return true end ) addHook("PlayerThink", function(player) if emeralds & EMERALD3 if player.adrenaline >= 30 and not All7Emeralds(emeralds) --only triggers when adrenaline is 30 or more but doesn't have all emeralds and player.darkform.on == false if player.charflags & SF_SUPER player.darkform.usable = true if player.powers[pw_super] == 0 if player.powers[pw_flashing] == 0 if player.cmd.buttons & BT_TOSSFLAG --activated by tossflag player.charflags = $&~SF_SUPER player.darkform.on = true cangosuper = true lastcharacter = player.realmo.skin P_DoJump(player) P_BlackOw(player) if player.fakenormalspeed player.fakenormalspeed = FixedMul($, 3*FRACUNIT/2) else player.normalspeed = FixedMul($, 3*FRACUNIT/2) end player.acceleration = $ * 2 player.darkform.usable = false S_ChangeMusic("VSBRAK",true,player,mflags,24000) darkformmusic = true end end end else return end elseif player.adrenaline >= 30 and player.adrenaline < 100 and All7Emeralds --only triggers when adrenaline is 30 or more but less than 100 when they have all emeralds and player.darkform.on == false if player.charflags & SF_SUPER player.darkform.usable = true if player.powers[pw_super] == 0 if player.powers[pw_flashing] == 0 if player.cmd.buttons & BT_TOSSFLAG --activated by tossflag player.charflags = $&~SF_SUPER player.darkform.on = true cangosuper = true lastcharacter = player.realmo.skin P_DoJump(player) P_BlackOw(player) if player.fakenormalspeed player.fakenormalspeed = FixedMul($, 3*FRACUNIT/2) else player.normalspeed = FixedMul($, 3*FRACUNIT/2) end player.acceleration = $ * 2 player.darkform.usable = false S_ChangeMusic("VSBRAK",true,player,mflags,24000) darkformmusic = true end end end else return end elseif player.adrenaline == 100 and All7Emeralds(emeralds) --trigger if adrenaline is 100 and player.darkform.on == false if player.charflags & SF_SUPER player.darkform.usable = true if player.powers[pw_super] == 0 if player.powers[pw_flashing] == 0 if player.cmd.buttons & BT_TOSSFLAG --activated by tossflag player.charflags = $&~SF_SUPER player.darkform.on = true cangosuper = true lastcharacter = player.realmo.skin P_DoJump(player) P_BlackOw(player) player.superdark = true player.darkform.usable = false if player.fakenormalspeed player.fakenormalspeed = FixedMul($, 5*FRACUNIT/2) else player.normalspeed = FixedMul($, 5*FRACUNIT/2) end player.acceleration = $ * 2 S_ChangeMusic("VSBRAK",true,player,mflags,24000) darkformmusic = true end end end else return end end end end ) addHook("TouchSpecial", function(special, toucher) --dark forms can't collect rings if (toucher.player or toucher.player.bot) and toucher.player.darkform.on toucher.player.rings = toucher.player.rings else return end return true end, MT_RING) addHook("PlayerThink", function(player) if adrenalinecheat == true player.adrenaline = $ + 2 end end ) addHook("PlayerThink", function(player) if player.darkform.on == true and player.adrenaline > 0 --if darkform is on and you have more than 0 adrenaline, you'll be transformed --set powers --if not player.powers[pw_sneakers] --player.powers[pw_sneakers] = 65535 --end if not (player.charflags & SF_CANBUSTWALLS) player.charflags = $|SF_CANBUSTWALLS end if skins[player.realmo.skin].prefcolor == (SKINCOLOR_BLACK) --if player prefcolor is black, go for red instead player.realmo.color = (SKINCOLOR_RUBY) elseif skins[player.realmo.skin].name == "metalsonic" --metal gets special treatment if not (leveltime%(TICRATE)) --flash between colors player.realmo.color = (SKINCOLOR_KETCHUP) else player.realmo.color = (SKINCOLOR_SUNSET) end elseif skins[player.realmo.skin].prefcolor == (SKINCOLOR_RED) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_RUBY)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_SALMON)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_FLAME)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_KETCHUP))--ditto player.realmo.color = (SKINCOLOR_CRIMSON) elseif (skins[player.realmo.skin].prefcolor == (SKINCOLOR_PINK)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_ROSY)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_BUBBLEGUM)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_MAGENTA)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_PLUM)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_RASPBERRY)) player.realmo.color = (SKINCOLOR_VIOLET) elseif player.superdark == true and ((skins[player.realmo.skin].prefcolor == (SKINCOLOR_BLUE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_BLUEBELL)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_AZURE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_WAVE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CYAN)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CERULEAN)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_ICY)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_SAPPHIRE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CORNFLOWER)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_COBALT)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_VAPOR)) or (player.mo.skin:match("sonic"))) player.realmo.color = (SKINCOLOR_SUPERDARK) elseif (skins[player.realmo.skin].prefcolor == (SKINCOLOR_BLUE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_BLUEBELL)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_AZURE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_WAVE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CYAN)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CERULEAN)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_ICY)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_SAPPHIRE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CORNFLOWER)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_COBALT)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_VAPOR)) player.realmo.color = (SKINCOLOR_DUSK) elseif (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_YOGURT)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_BROWN)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_SUNSET)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_PEACHY)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_QUAIL)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_COPPER)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_ORANGE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_RUST)) player.realmo.color = (SKINCOLOR_BRONZE) elseif player.superdark == true player.realmo.color = (SKINCOLOR_BLACK) else player.realmo.color = (SKINCOLOR_JET) end player.jumpfactor = skins[player.realmo.skin].jumpfactor*2 --player.thrustfactor = skins[player.realmo.skin].thrustfactor+2 P_SpawnGhostMobj(player.mo) if player.superdark == false and not (leveltime%(TICRATE)) then player.adrenaline = player.adrenaline-1 elseif player.superdark == true and not (leveltime%(TICRATE/2)) then player.adrenaline = player.adrenaline-1 end --local timer = leveltime%2 -- aura timer --if timer == 1 local aura = P_SpawnMobjFromMobj(player.realmo, P_RandomRange(-18, 18) * FRACUNIT, P_RandomRange(-18, 18) * FRACUNIT, P_RandomRange(0, 32) * FRACUNIT, MT_FLAMEPARTICLE) if (skins[player.realmo.skin].prefcolor == (SKINCOLOR_BLACK)) aura.color = (SKINCOLOR_RUBY) elseif skins[player.realmo.skin].name == "metalsonic" aura.color = (SKINCOLOR_YELLOW) elseif skins[player.realmo.skin].prefcolor == (SKINCOLOR_RED) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_RUBY)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_SALMON)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_FLAME)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_KETCHUP))--ditto aura.color = (SKINCOLOR_NEON) elseif (skins[player.realmo.skin].prefcolor == (SKINCOLOR_PINK)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_ROSY)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_BUBBLEGUM)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_MAGENTA)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_PLUM)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_RASPBERRY)) aura.color = (SKINCOLOR_NEON) elseif player.superdark == true and ((skins[player.realmo.skin].prefcolor == (SKINCOLOR_BLUE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_BLUEBELL)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_AZURE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_WAVE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CYAN)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CERULEAN)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_ICY)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_SAPPHIRE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CORNFLOWER)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_COBALT)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_VAPOR))) aura.color = (SKINCOLOR_BLUE) elseif (skins[player.realmo.skin].prefcolor == (SKINCOLOR_BLUE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_BLUEBELL)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_AZURE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_WAVE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CYAN)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CERULEAN)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_ICY)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_SAPPHIRE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_CORNFLOWER)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_COBALT)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_VAPOR) or (player.mo.skin:match("sonic"))) aura.color = (SKINCOLOR_DUSK) elseif (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_YOGURT)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_BROWN)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_SUNSET)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_PEACHY)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_QUAIL)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_COPPER)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_ORANGE)) or (skins[player.realmo.skin].prefcolor ==(SKINCOLOR_RUST)) aura.color = (SKINCOLOR_PLUM) else aura.color = (SKINCOLOR_DUSK) end aura.colorized = true --end if player.superdark == true player.realmo.eflags = $|MFE_FORCESUPER --force super sprites player.realmo.colorized = true if not player.powers[pw_invulnerability] player.powers[pw_invulnerability] = 65535 end return else return end return elseif player.darkform.on == true and player.adrenaline == 0 --otherwise, you'll detransform --power loss darkformmusic = false if not (skins[player.realmo.skin].flags & SF_CANBUSTWALLS) player.charflags = $&~SF_CANBUSTWALLS end if cangosuper == true player.charflags = $|SF_SUPER end if player.powers[pw_sneakers] == 65535 player.powers[pw_sneakers] = 0 end P_RestoreMusic(player) player.realmo.color = skins[player.realmo.skin].prefcolor player.jumpfactor = skins[player.realmo.skin].jumpfactor if player.fakenormalspeed player.fakenormalspeed = restorefakenormalspeed else player.normalspeed = skins[player.realmo.skin].normalspeed end player.acceleration = skins[player.realmo.skin].acceleration --player.thrustfactor = skins[player.realmo.skin].thrustfactor player.darkform.on = false if player.superdark == true player.powers[pw_invulnerability] = 0 player.realmo.colorized = false player.realmo.eflags = $&~MFE_FORCESUPER else return end player.superdark = false return end end ) addHook("PlayerThink", function(player, mobj, target) --Dark Homing Attack if player.darkform.on == true and player.adrenaline > 0 if player.enemiesDestroyed < 3 player.target = P_LookForEnemies(player, true, true) if (player.cmd.buttons & BT_ATTACK) if not (player.pflags & PF_ATTACKDOWN) if player.target S_StartSound(player.mo, sfx_rail2) player.pflags = $|PF_ATTACKDOWN else return end else return end if player.target player.mo.state = S_PLAY_ROLL player.pflags = $|PF_SPINNING player.charability = (CA_HOMINGTHOK) player.actionspd = 120*FRACUNIT P_HomingAttack(player.mo, player.target) player.pflags = $&~MF2_JUSTATTACKED end player.actionspd = skins[player.realmo.skin].actionspd player.charability = skins[player.realmo.skin].ability return true else return end else return end else return end end ) -- addHook("PlayerThink", function(player) --passive adrenaline drain -- if player.darkform.on == false and player.adrenaline > 0 -- if not (leveltime%(TICRATE*2)) then -- player.adrenaline = player.adrenaline-1 -- end -- end -- end) addHook("ShouldDamage", function(target, inflictor, source) --add number of enemies player destroyed with homing thok if source != nil and source.player if(source.player.cmd.buttons & BT_ATTACK) and (source.player.darkform.on == true) and (target.flags & MF_ENEMY) source.player.enemiesDestroyed = source.player.enemiesDestroyed + 1 return source.player.enemiesDestroyed else return end else return end return true end ) addHook("PlayerThink", function(player) --if player destroyed more than three enemies, reset number after 1 and a half second if player.enemiesDestroyed > 0 if not (leveltime%(TICRATE+(TICRATE/2))) then player.enemiesDestroyed = 0 else return end return player.enemiesDestroyed else return end end ) local muspos addHook("MusicChange", -- change music on transformed function(oldname, newname) if consoleplayer and consoleplayer.darkform if darkformmusic == true if newname == mapmusname return "VSBRAK", mflags, looping, 24000 end end end end ) addHook("PlayerSpawn", function(player) -- restore music on respawn if mapdefaultsong and darkformmusic == false P_RestoreMusic(player) end end)