////////////////////////////////////////////////// //Thanks to Joat for this handy little function.// ////////////////////////////////////////////////// local function isPress(player,bf) if player.cmd.buttons & bf and not (player.oldButtons & bf) then return true end return false end //This is my own modification of said function, made to track movement instead. local function isMove(player) if player.cmd.forwardmove > 25 and player.oldForwardMove <= 25 then return 1 end if player.cmd.forwardmove < -25 and player.oldForwardMove >= -25 then return 2 end return 0 end //HEY GUESS WHAT I NEVER ADDED ON THE FIRST PASS THATS RIGHT A WAY TO TRACK LEFT AND RIGHT MOVEMENT //THROUGH THE MENUS local function horizMove(player) if player.cmd.sidemove > 25 and player.oldSideMove <= 25 then return 1 end if player.cmd.sidemove < -25 and player.oldSideMove >= -25 then return 2 end return 0 end /////////////////////////////////////////////////////////// // Taken from Dialouge.wad, couldn't be bothered to deal // // with this stuff myself, and i'd already been looking // // at that to begin with // /////////////////////////////////////////////////////////// //Thanks, StackOverflow! http://stackoverflow.com/questions/5249629/modifying-a-character-in-a-string-in-lua local function replace_char(pos, str, r) return str:sub(1, pos-1) .. r .. str:sub(pos+1) end local function wrap(v,s,w,widthType) s = string.gsub(s,"-","- ") //This (and the reverse done later) is done to properly handle wrapping around dashes. //Relevent character positions. local lastNewline = 0 local lastSpace = string.find(s," ") if lastSpace == nil then return s end //If there are no spaces in the string, return the string. local currentSpace = string.find(s," ",lastSpace+1) local reachedEnd = false //If this is set to true, return the string at the end of the iteration. if widthType == nil then widthType = "normal" end //If widthType is undefined, presume normal. while true do //Not actually an infinite loop, since it contains a return statement. if currentSpace == nil then //If no new space was found, set the effective new space to just past the string length and set the function to return at the end of this iteration. currentSpace = string.len(s)+1 reachedEnd = true end //This makes sure that manually-added newline characters do not confuse the algorithm. while string.find(string.sub(s,lastNewline+1,currentSpace),"\n") != nil do if v.stringWidth(string.gsub(string.sub(s,lastNewline+1,lastNewline+string.find(string.sub(s,lastNewline+1,currentSpace),"\n")),"- ","-"),0,widthType) > w then //The gsub prevents dashes from skewing the results. If the text from the last newline character exceeds the width allowed... s = replace_char(lastSpace, s, "\n") end lastNewline = lastNewline + string.find(string.sub(s,lastNewline+1,currentSpace),"\n") end if v.stringWidth(string.gsub(string.sub(s,lastNewline+1,currentSpace-1),"- ","-"),0,widthType) > w then //The gsub prevents dashes from skewing the results. If the text from the last newline character exceeds the width allowed... s = replace_char(lastSpace, s, "\n") lastNewline = lastSpace end //Get a new currentSpace and set lastSpace to old currentSpace value. lastSpace = currentSpace currentSpace = string.find(s," ",lastSpace+1) if reachedEnd == true then s = string.gsub(s,"- ","-") return s end end end local function upgradeStats(player) for o=0, 2 player.shopincstat = 0 if o == 0 player.shopbaseline = skins[player.mo.skin].normalspeed / 10000 end if o == 1 player.shopbaseline = skins[player.mo.skin].jumpfactor / 10000 end if o == 2 player.shopbaseline = skins[player.mo.skin].acceleration end for i=0, player.charlevelcurrent[o] if i != 0 if i <= 10 player.shopincstat = $1 + player.shopbaseline * player.statinccalc[o][0] elseif i < 20 player.shopincstat = $1 + player.shopbaseline * player.statinccalc[o][1] elseif i == 20 player.shopincstat = $1 + player.shopbaseline * player.statinccalc[o][2] end end end if o == 0 player.normalspeed = skins[player.mo.skin].normalspeed + player.shopincstat end if o == 1 player.jumpfactor = skins[player.mo.skin].jumpfactor + player.shopincstat end if o == 2 player.acceleration = skins[player.mo.skin].acceleration + (player.shopincstat / 10000) end end end ///////// // END // ///////// local function checkEmeralds() local gems gems = 0 if (emeralds & EMERALD1) gems = $1 + 1 end if (emeralds & EMERALD2) gems = $1 + 1 end if (emeralds & EMERALD3) gems = $1 + 1 end if (emeralds & EMERALD4) gems = $1 + 1 end if (emeralds & EMERALD5) gems = $1 + 1 end if (emeralds & EMERALD6) gems = $1 + 1 end if (emeralds & EMERALD7) gems = $1 + 1 end return gems end local function checkPlayers() local outcome outcome = 0 for check in players.iterate if outcome == 0 if check.valid outcome = 100 end else if check.valid outcome = $1 + 25 end end end return outcome end local cv_shopback = CV_RegisterVar({"ShopBack", "On", CV_NETVAR, CV_OnOff}) COM_AddCommand("giverings", function(player, player2, ringstogive) if player2 == nil or ringstogive == nil CONS_Printf(player, "giverings: Gives the named played the specified ammount of rings" ) return end for playertorecieve in players.iterate if playertorecieve.name == player2 and playertorecieve.valid if player.bank >= tonumber(ringstogive) player.bank = $1 - tonumber(ringstogive) playertorecieve.bank = $1 + tonumber(ringstogive) CONS_Printf(player, "Rings successfully sent.") CONS_Printf(playertorecieve, player.name + " gave you " + tonumber(ringstogive) + " Rings!") return else CONS_Printf(player, "You can't give more rings than you have!") return end end end CONS_Printf(player, player2 + " does not exsist!") end) COM_AddCommand("shophelp", function(player, withwhat) if withwhat == nil CONS_Printf(player, "shophelp : Gives helpful advice about one of the below topics!\n\nControls: Tells you the controls!\nUpgrading: All you need to know about the Upgrade Screen!\nCommands: Info on the various other commands that you can use.") end if withwhat == "controls" CONS_Printf(player, "Toss Flag: Opens the shop menu!\nForward/Back: Move through the selections\nStrafe Left/Right or Turn Left/Right: Move through the various Upgrade Tabs\nJump: Make a selection/purchase\nSpin:Return to the previous menu") elseif withwhat == "upgrading" CONS_Printf(player, "The Upgrade screen has 3 tabs.\nThe first is Characters, where you pick which character's upgrades you wish to view.\nThe second is Upgrade, where you may purchase levels of your selected character's Upgrade. All Upgrades take affect no matter which character you're playing as.\nThe third is Skills, where you purchase special abilities that only take affect for the specified character!") elseif withwhat == "commands" CONS_Printf(player, "shopback: Turns on and off the blue background to the shop. allows you to see the world around you more clearly, at the expense of looking less nice.\n\ngiverings: Allows you to gift some of your banked Rings to another player. There isnt any real benefit to doing this, but if you have more Rings than you know what to do with, it would certainly be nice to share them!") end end) addHook("MobjDamage", function(mobj, source, attacker, notused) if mobj.valid and not (mobj.player.powers[pw_super]) mobj.player.gothit = 1 mobj.player.combirings = (mobj.player.health - 1) if mobj.skin == "knuckles" and mobj.player.skills[2][2] == 2 and mobj.health > 1 mobj.health = 2 mobj.player.health = 2 end end end, MT_PLAYER) //Super Special Mega Thanks to Lach and Monster Iestyn for assisting with Combi-Ring code addHook("MobjThinker", function(mobj) if mobj.flinging == nil mobj.flinging = 0 end if mobj.target != nil and mobj.target.valid and mobj.target.player if mobj.target.skin == "knuckles" if mobj.target.player.skills[2][2] == 2 mobj.scale = FRACUNIT * 2 if mobj.flinging == 0 mobj.momx = $1 * 2 mobj.momy = $1 * 2 mobj.momz = $1 * 2 mobj.flinging = 1 end mobj.ringvalue = mobj.target.player.combirings end end end end, MT_FLINGRING) addHook("TouchSpecial", function(mobj,toucher) if mobj.ringvalue != nil and P_CanPickupItem(toucher.player) toucher.health = $1 + mobj.ringvalue - 1 toucher.player.health = $1 + mobj.ringvalue - 1 end end, MT_FLINGRING) // For some reason this doesn't work so whatever ill just use the one above --addHook("MobjDeath", function(mobj, toucher, notused) -- if toucher.valid and toucher.player -- if mobj.ringvalue != nil -- toucher.health = $1 + mobj.ringvalue - 1 -- toucher.player.health = $1 + mobj.ringvalue - 1 -- end -- end --end, MT_FLINGRING) addHook("MobjDeath", function(mobj, inflictor, notused) if (mobj.flags & MF_ENEMY) if inflictor != nil and inflictor.valid if inflictor.player if inflictor.skin == "knuckles" and inflictor.player.skills[2][0] == 2 inflictor.player.bank = $1 + 2 return false end end end end if mobj.type == MT_SUPERRINGBOX if inflictor != nil and inflictor.valid if inflictor.player if inflictor.skin == "knuckles" and inflictor.player.skills[2][1] == 2 inflictor.player.health = $1 + 10 inflictor.health = $1 + 10 return false end end end end end) addHook("ThinkFrame", do for player in players.iterate if true --not (player.pflags & PF_NIGHTSMODE) if player.shopinit == nil // Begin Initiation! --CONS_Printf(player, "Welcome! Use the shophelp command for instructions!\3") player.shopdebug = 0 player.gothit = 0 player.ringsbanked = 0 player.bank = 0 player.shopinit = 1 player.shopmenuopen = 0 player.shopmenuscreen = 1 player.shopselect = 0 player.maxselect = 1 player.screenscroll = 0 player.maxscreenscroll = 0 player.displayshieldwarning = 0 player.usedbpohcability = 0 player.bpohchorizselect = 0 player.bpohccharselect = 0 player.bpohclevelselect = 0 player.bankinc = 0 player.bankmult = 1 player.shopincstat = 0 player.emeraldsneeded = 0 player.emeraldtext = "" player.charlevelmax = {} player.charlevelcurrent = {} for i = 0, 100 do player.charlevelmax[i] = 0 player.charlevelcurrent[i] = 0 end player.bpohcskillshave = 0 player.bpohcskillsapplied = 0 player.bpohccost = 0 player.upgradebasecost = {} player.upgradebasecost[0] = 10 player.upgradebasecost[1] = 25 player.upgradebasecost[2] = 5 // For stat Upgrades player.statinccalc = {} // character, statinc for i=0,2 do player.statinccalc[i] = {} -- create a new row end //Sonic player.statinccalc[0][0] = 750 player.statinccalc[0][1] = 416 player.statinccalc[0][2] = 3756 //Tails player.statinccalc[1][0] = 500 player.statinccalc[1][1] = 277 player.statinccalc[1][2] = 2507 //Knuckles player.statinccalc[2][0] = 750 player.statinccalc[2][1] = 416 player.statinccalc[2][2] = 3756 player.skills = {} // character, skill number for i=0,2 player.skills[i] = {} for o=0,2 player.skills[i][o] = 0 end end player.skillcost = {} // character, skill number for i=0,2 player.skillcost[i] = {} end //Sonic player.skillcost[0][0] = 100 player.skillcost[0][1] = 200 player.skillcost[0][2] = 1200 //Tails player.skillcost[1][0] = 400 player.skillcost[1][1] = 200 player.skillcost[1][2] = 800 //Knuckles player.skillcost[2][0] = 50 player.skillcost[2][1] = 150 player.skillcost[2][2] = 500 //player.skills[0][2] = 2 //player.skills[2][2] = 2 player.startingshield = SH_NONE player.jumpupgradelevel = 0 player.shopstoredstats = {} for i=1,4 player.shopstoredstats[i] = 0 end player.shopitemlist = {} player.shopitemlist[1] = "Super Ring (15)" player.shopitemlist[2] = "Basic Shield (15)" player.shopitemlist[3] = "Force Shield (30)" player.shopitemlist[4] = "Attraction Shield (20)" player.shopitemlist[5] = "Elemental Shield (30)" player.shopitemlist[6] = "Whirlwind Shield (25)" player.shopitemlist[7] = "Armageddon Shield (40)" player.shopitemlist[8] = "Speed Shoes (30)" player.shopitemlist[9] = "Invincibility (50)" player.deathcharge = 0 end //////////////////////////////////////////////// // For skill abilities (and some other stuff) // //////////////////////////////////////////////// if player.mo.health == 0 player.gothit = 1 end if player.shopdebug == 1 for i=0,2 player.skills[0][i] = 2 player.skills[1][i] = 2 player.skills[2][i] = 2 end if isPress(player,BT_CUSTOM1) player.shopmenuopen = 1 end end if player.mo.skin == "sonic" if player.skills[0][0] == 2 and player.gothit == 0 player.bankmult = 2 elseif player.skills[0][0] != 2 or player.mo.skin != "sonic" player.bankmult = 1 end if player.skills[0][2] == 2 if (player.pflags & PF_THOKKED) and player.usedbpohcability == 0 and (not player.powers[pw_invulnerability]) player.powers[pw_invulnerability] = TICRATE / 2 player.usedbpohcability = 1 end if P_IsObjectOnGround(player.mo) player.usedbpohcability = 0 end end end if player.mo.skin == "tails" if player.skills[1][0] == 2 if player.mo.shieldinit == nil player.powers[pw_shield] = SH_PITY P_SpawnShieldOrb(player) player.mo.shieldinit = 1 end end if player.skills[1][1] == 2 if (player.cmd.buttons & BT_ATTACK) and player.usedbpohcability == 0 and player.health > 1 player.deathcharge = $1 + 1 player.usedbpohcability = 5 player.health = $1 - 1 player.mo.health = $1 - 1 S_StopSound(player.mo) S_StartSound(player.mo,238,p) elseif (not (player.cmd.buttons & BT_ATTACK)) and player.deathcharge > 0 P_NukeEnemies(player.mo, player.mo, (player.deathcharge*300)*FRACUNIT) S_StopSound(player.mo) S_StartSound(player.mo,242,p) player.deathcharge = 0 end if player.usedbpohcability > 0 player.usedbpohcability = $1 - 1 end end if player.skills[1][2] == 2 if (player.pflags & PF_THOKKED) and player.powers[pw_tailsfly] == 0 and isPress(player,BT_USE) and player.health > 20 player.mo.health = $1 - 20 player.health = $1 - 20 player.mo.state = S_PLAY_ABL1 player.powers[pw_tailsfly] = 280 end end end ///////////////////////////////////////////////////////////// // For handling of things outside, but related to the shop // ///////////////////////////////////////////////////////////// if player.exiting != 0 // Makin' Bank. and player.ringsbanked == 0 // for sonic's speed bonus upgrade if player.mo.skin == "sonic" and player.skills[0][1] == 2 and (mapheaderinfo[gamemap].BonusType != Boss and mapheaderinfo[gamemap].BonusType != None) if player.realtime / TICRATE <= 45 player.mo.health = $1 + 1000 elseif player.realtime / TICRATE <= 60 player.mo.health = $1 + 800 elseif player.realtime / TICRATE <= 80 player.mo.health = $1 + 600 elseif player.realtime / TICRATE <= 100 player.mo.health = $1 + 400 elseif player.realtime / TICRATE <= 120 player.mo.health = $1 + 200 elseif player.realtime / TICRATE <= 140 player.mo.health = $1 + 100 elseif player.realtime / TICRATE <= 160 player.mo.health = $1 + 90 elseif player.realtime / TICRATE <= 180 player.mo.health = $1 + 80 elseif player.realtime / TICRATE <= 200 player.mo.health = $1 + 70 elseif player.realtime / TICRATE <= 220 player.mo.health = $1 + 60 elseif player.realtime / TICRATE <= 240 player.mo.health = $1 + 50 elseif player.realtime / TICRATE <= 260 player.mo.health = $1 + 40 elseif player.realtime / TICRATE <= 280 player.mo.health = $1 + 30 elseif player.realtime / TICRATE <= 300 player.mo.health = $1 + 20 elseif player.realtime / TICRATE <= 320 player.mo.health = $1 + 10 elseif player.realtime / TICRATE <= 340 player.mo.health = $1 + 5 end end player.bankinc = player.mo.health - 1 // Adding precision... player.bankinc = $1 * 100 // So that we can make an increase that's precice to the hundredth! player.bankinc = $1 * checkPlayers() // But we need to return the number to normal afterwards. (the extra 2 zeroes come from the checkPlayers function) player.bankinc = $1 / 10000 player.bank = $1 + (player.bankinc * player.bankmult) player.bankmult = 1 player.ringsbanked = 1 player.gothit = 0 elseif player.exiting == 0 player.ringsbanked = 0 end if isPress(player,BT_TOSSFLAG) and player.shopmenuopen == 0 // Let's open the menu! player.shopmenuopen = 1 elseif (isPress(player,BT_TOSSFLAG) and player.shopmenuopen == 1) // Restoring your stats for you, after closing it. player.shopmenuopen = 0 player.normalspeed = player.shopstoredstats[1] player.jumpfactor = player.shopstoredstats[2] player.charability = player.shopstoredstats[3] player.charability2 = player.shopstoredstats[4] player.pflags = $1 & ~PF_FORCESTRAFE end if (player.pflags & PF_NIGHTSMODE) // You probably shouldn't be able to use it in NiGHTS mode player.shopmenuopen = 0 player.normalspeed = player.shopstoredstats[1] player.jumpfactor = player.shopstoredstats[2] player.charability = player.shopstoredstats[3] player.charability2 = player.shopstoredstats[4] player.pflags = $1 & ~PF_FORCESTRAFE end upgradeStats(player) ////////////////////////////// // The shop menu babyyyyyyy // ////////////////////////////// for i=0,0 if player.shopmenuopen == 1 player.normalspeed = 0 // Heeey thanks to Joat for this implimentation. player.jumpfactor = 0 player.charability = 0 player.charability2 = 0 player.pflags = $1|PF_FORCESTRAFE if player.shopmenuscreen != 3 // The BPoHC screen needs it's own controls if isMove(player) == 1 and player.shopselect > 0 // Change Selection! player.shopselect = $1 - 1 S_StartSound(player.mo,142,p) elseif isMove(player) == 2 and player.shopselect < player.maxselect player.shopselect = $1 + 1 S_StartSound(player.mo,142,p) end end if player.shopmenuscreen == 1 // For the opening shop screen. player.maxselect = 2 if isPress(player,BT_JUMP) and player.shopselect == 0 player.shopmenuscreen = 2 break 1 end if isPress(player,BT_JUMP) and player.shopselect == 1 player.shopmenuscreen = 3 player.shopselect = 0 break 1 end if isPress(player,BT_JUMP) and player.shopselect == 2 player.shopmenuscreen = 4 break 1 end end if player.shopmenuscreen == 2 // The items screen, where you... Buy items! player.maxselect = 8 player.maxscreenscroll = 9 if player.shopselect > 5 player.screenscroll = 6 else player.screenscroll = 0 end //////////////////////////////////////// // Here's the code for the selections // // you can make on the items screen. // //////////////////////////////////////// if isPress(player,BT_JUMP) and player.shopselect == 0 and player.bank >= 15 P_GivePlayerRings(player, 10) player.bank = $1 - 15 //player.shopmenuopen = 0 S_StartSound(player.mo,138,p) end if isPress(player,BT_JUMP) and player.shopselect == 1 and player.bank >= 15 player.powers[pw_shield] = SH_PITY P_SpawnShieldOrb(player) player.bank = $1 - 15 //player.shopmenuopen = 0 S_StartSound(player.mo,138,p) end if isPress(player,BT_JUMP) and player.shopselect == 2 and player.bank >= 30 player.powers[pw_shield] = SH_FORCE|1 P_SpawnShieldOrb(player) player.bank = $1 - 30 S_StartSound(player.mo,138,p) end if isPress(player,BT_JUMP) and player.shopselect == 3 and player.bank >= 20 player.powers[pw_shield] = SH_ATTRACT P_SpawnShieldOrb(player) player.bank = $1 - 20 S_StartSound(player.mo,138,p) end if isPress(player,BT_JUMP) and player.shopselect == 4 and player.bank >= 30 player.powers[pw_shield] = SH_ELEMENTAL P_SpawnShieldOrb(player) player.bank = $1 - 30 S_StartSound(player.mo,138,p) end if isPress(player,BT_JUMP) and player.shopselect == 5 and player.bank >= 25 player.powers[pw_shield] = SH_JUMP P_SpawnShieldOrb(player) player.bank = $1 - 25 S_StartSound(player.mo,138,p) end if isPress(player,BT_JUMP) and player.shopselect == 6 and player.bank >= 40 player.powers[pw_shield] = SH_BOMB P_SpawnShieldOrb(player) player.bank = $1 - 40 S_StartSound(player.mo,138,p) end if isPress(player,BT_JUMP) and player.shopselect == 7 and player.bank >= 30 player.powers[pw_sneakers] = 20*TICRATE player.bank = $1 - 30 S_ChangeMusic("SHOES",true,player) S_StartSound(player.mo,138,p) end if isPress(player,BT_JUMP) and player.shopselect == 8 and player.bank >= 50 player.powers[pw_invulnerability] = 20*TICRATE player.bank = $1 - 50 S_ChangeMusic("INVINC",true,player) S_StartSound(player.mo,138,p) end // Items screen selections end. if isPress(player,BT_USE) player.shopmenuscreen = 1 player.shopselect = 0 end end //////////////////////////// // THIS WAS A BIG MISTAKE // //////////////////////////// if player.shopmenuscreen == 3 // Upgrade Screen, post present world overhaul player.maxselect = 1 player.shopincstat = 0 if player.shopselect == 0 player.emeraldsneeded = 1 elseif player.shopselect == 1 player.emeraldsneeded = 3 elseif player.shopselect == 2 player.emeraldsneeded = 6 end if player.emeraldsneeded == 1 player.emeraldtext = "Chaos Emerald" else player.emeraldtext = "Chaos Emeralds" end for i=0, player.bpohclevelselect if i != 0 if i <= 10 player.shopincstat = $1 + player.statinccalc[player.bpohccharselect][0] elseif i < 20 player.shopincstat = $1 + player.statinccalc[player.bpohccharselect][1] elseif i == 20 player.shopincstat = $1 + player.statinccalc[player.bpohccharselect][2] end end end if player.bpohchorizselect == 0 // Code for characters box if isMove(player) == 1 // Change Selection! if player.bpohccharselect > 0 and player.bpohccharselect > 0 player.bpohccharselect = $1 - 1 player.bpohclevelselect = player.charlevelcurrent[player.bpohccharselect] S_StartSound(player.mo,142,p) end elseif isMove(player) == 2 if player.bpohccharselect < 2 and player.bpohccharselect < 2 player.bpohccharselect = $1 + 1 player.bpohclevelselect = player.charlevelcurrent[player.bpohccharselect] S_StartSound(player.mo,142,p) end end if horizMove(player) == 1 player.bpohchorizselect = 1 player.oldSideMove = 26 end end if player.bpohchorizselect == 1 // Code for Upgrade box if isMove(player) == 1 and player.bpohclevelselect > 0 player.bpohclevelselect = $1 - 1 S_StartSound(player.mo,142,p) elseif isMove(player) == 2 and player.bpohclevelselect < 20 player.bpohclevelselect = $1 + 1 S_StartSound(player.mo,142,p) end player.bpohccost = 0 for i=player.charlevelmax[player.bpohccharselect], player.bpohclevelselect if i < player.bpohclevelselect if i <= 10 player.bpohccost = $1 + (player.upgradebasecost[player.bpohccharselect] * (i + 1)) elseif i < 20 player.bpohccost = $1 + (player.upgradebasecost[player.bpohccharselect] * 10) + (((player.upgradebasecost[player.bpohccharselect] * 10) / 100) * ((i + 1) - 10)) end end end if isPress(player, BT_JUMP) if player.bpohclevelselect > player.charlevelmax[player.bpohccharselect] and player.bank >= player.bpohccost player.bank = $1 - player.bpohccost player.charlevelmax[player.bpohccharselect] = player.bpohclevelselect player.charlevelcurrent[player.bpohccharselect] = player.bpohclevelselect S_StartSound(player.mo,138,p) elseif player.bpohclevelselect <= player.charlevelmax[player.bpohccharselect] player.charlevelcurrent[player.bpohccharselect] = player.bpohclevelselect end end if horizMove(player) == 1 player.bpohchorizselect = 2 elseif horizMove(player) == 2 player.bpohchorizselect = 0 end end if player.bpohchorizselect == 2 // Code for Skills box if isMove(player) == 1 and player.shopselect > 0 player.shopselect = $1 - 1 S_StartSound(player.mo,142,p) elseif isMove(player) == 2 and player.shopselect < 2 player.shopselect = $1 + 1 S_StartSound(player.mo,142,p) end if checkEmeralds() >= player.emeraldsneeded if isPress(player,BT_JUMP) and player.skills[player.bpohccharselect][player.shopselect] == 0 and player.bank > player.skillcost[player.bpohccharselect][player.shopselect] player.bank = $1 - player.skillcost[player.bpohccharselect][player.shopselect] player.skills[player.bpohccharselect][player.shopselect] = 2 S_StartSound(player.mo,138,p) elseif isPress(player,BT_JUMP) and player.skills[player.bpohccharselect][player.shopselect] == 1 player.skills[player.bpohccharselect][player.shopselect] = 2 elseif isPress(player,BT_JUMP) and player.skills[player.bpohccharselect][player.shopselect] == 2 player.skills[player.bpohccharselect][player.shopselect] = 1 end end if horizMove(player) == 2 player.bpohchorizselect = 1 end end if isPress(player,BT_USE) player.shopmenuscreen = 1 player.shopselect = 0 end end ///////////////////////////////////////////////////// // Well, there's not much need for control here... // ///////////////////////////////////////////////////// if player.shopmenuscreen == 4 player.maxselect = 0 if isPress(player,BT_USE) player.shopmenuscreen = 1 player.shopselect = 0 end end ////////////////////////////////////////////////////////////////// // I litterally don't think this was used in any version whoops // ////////////////////////////////////////////////////////////////// if player.displayshieldwarning == 1 and isPress(player,BT_JUMP) player.displayshieldwarning = 2 player.shopmenuscreen = 4 end end end /////////////////////////////////////////////////////////////////////////////////////////// // Are these even relevant now that upgrades re-define your stats upon closing the shop? // /////////////////////////////////////////////////////////////////////////////////////////// if player.normalspeed != 0 player.shopstoredstats[1] = player.normalspeed end if player.jumpfactor != 0 player.shopstoredstats[2] = player.jumpfactor end if player.charability != 0 player.shopstoredstats[3] = player.charability end if player.charability2 != 0 player.shopstoredstats[4] = player.charability2 end player.oldButtons = player.cmd.buttons //Keep the oldbuttons variable up to date. player.oldForwardMove = player.cmd.forwardmove //Keep oldForwardMove up to date. player.oldSideMove = player.cmd.sidemove //FINALLY WE MAY MOVE HORIZONTALLY (on one screen) end end end) local function debughud(v, player, cam) v.drawNum(200, 10, player.powers[pw_tailsfly]) v.drawNum(200, 20, player.deathcharge) end local function drawhud(v, player, cam) local p_ringbox = v.cachePatch("SRBXB0") local p_pitysh = v.cachePatch("GRTVB0") local p_forcsh = v.cachePatch("BLTVB0") local p_attrsh = v.cachePatch("YLTVB0") local p_elemsh = v.cachePatch("ELTVB0") local p_whirsh = v.cachePatch("WHTVB0") local p_armash = v.cachePatch("BKTVB0") local p_shoes = v.cachePatch("SHTVB0") local p_invin = v.cachePatch("PINVB0") //v.drawString(300, 35, "It occurs offsite too, right?", V_SMALLSCALEPATCH) v.drawString(230,180, "Bank:") v.drawNum(300, 180, player.bank) if player.shopmenuopen == 1 if cv_shopback.value == 1 v.drawFill(10, 10, 300, 160, 240) end if player.shopmenuscreen == 1 v.drawString(30, 35, "Items") v.drawString(30, 55, "Upgrades") v.drawString(30, 75, "Credits") v.drawString(80, 160, "Use the 'shophelp' command for more info!", 0, "small") v.drawString(20, (35 + player.shopselect * 20), ">") elseif player.shopmenuscreen == 2 // 6 options can fit at once for i=1,6 if player.maxscreenscroll >= player.screenscroll + i v.drawString(45, 15 + (20 * i), player.shopitemlist[player.screenscroll + i]) if player.screenscroll + i == 1 v.draw(70, 45 + (40 * i), p_ringbox, V_SMALLSCALEPATCH) elseif player.screenscroll + i == 2 v.draw(70, 45 + (40 * i), p_pitysh, V_SMALLSCALEPATCH) elseif player.screenscroll + i == 3 v.draw(70, 45 + (40 * i), p_forcsh, V_SMALLSCALEPATCH) elseif player.screenscroll + i == 4 v.draw(70, 45 + (40 * i), p_attrsh, V_SMALLSCALEPATCH) elseif player.screenscroll + i == 5 v.draw(70, 45 + (40 * i), p_elemsh, V_SMALLSCALEPATCH) elseif player.screenscroll + i == 6 v.draw(70, 45 + (40 * i), p_whirsh, V_SMALLSCALEPATCH) elseif player.screenscroll + i == 7 v.draw(70, 45 + (40 * i), p_armash, V_SMALLSCALEPATCH) elseif player.screenscroll + i == 8 v.draw(70, 45 + (40 * i), p_shoes, V_SMALLSCALEPATCH) elseif player.screenscroll + i == 9 v.draw(70, 45 + (40 * i), p_invin, V_SMALLSCALEPATCH) end end end v.drawString(20, 35 + ((player.shopselect - player.screenscroll) * 20), ">") if player.screenscroll + 6 < player.maxscreenscroll v.drawString(140, 155, "More...") end if player.screenscroll != 0 v.drawString(140, 15, "More...") end elseif player.shopmenuscreen == 3 //BPoHC Upgrade Screen //////////////////////////////////////// // Something something upgrade screen // //////////////////////////////////////// v.drawFill(15, 125, 290, 40, 140) //Description box if player.bpohchorizselect == 2 v.drawFill(218, 13, 89, 109, 114) else v.drawFill(218, 13, 89, 109, 31)// Skills box outline end v.drawFill(220, 15, 85, 105, 13) // Skills box if player.bpohchorizselect == 1 v.drawFill(118, 13, 84, 109, 114) else v.drawFill(118, 13, 84, 109, 31) // Upgrade box outline end v.drawFill(120, 15, 80, 105, 14) // Upgrade box if player.bpohchorizselect == 0 v.drawFill(13, 13, 89, 109, 114) else v.drawFill(13, 13, 89, 109, 31) // Characters box outline end v.drawFill(15, 15, 85, 105, 15) // Characters box //v.drawString(20, 20, "Sonic") v.drawString(75, 35, "Characters", V_YELLOWMAP|V_SMALLSCALEPATCH) v.drawString(35, 50, " Sonic", V_SMALLSCALEPATCH) v.drawString(35, 65, " Tails", V_SMALLSCALEPATCH) v.drawString(35, 80, " Knuckles", V_SMALLSCALEPATCH) v.drawString(35, 50 + (15 * (player.bpohccharselect)), ">", V_SMALLSCALEPATCH) /////////////////////////////// // Code for the Upgrades box // /////////////////////////////// v.drawString(158, 18, "Upgrade", V_YELLOWMAP, "small") v.drawString(158, 25, "Level", 0, "small") v.drawString(144, 30, "(Current/Max)", 0, "small") v.drawPaddedNum(325, 75, player.charlevelcurrent[player.bpohccharselect], 2, V_SMALLSCALEPATCH) v.drawString(164, 36, "/") v.drawPaddedNum(365, 75, player.charlevelmax[player.bpohccharselect], 2, V_SMALLSCALEPATCH) v.drawString(150, 80, "Increase", 0, "small") v.drawPaddedNum(360, 180, player.shopincstat % 100, 2, V_SMALLSCALEPATCH) v.drawNum(340, 180, player.shopincstat / 100, V_SMALLSCALEPATCH) //v.drawPaddedNum(360, 180, player.shopincstat, 5, V_SMALLSCALEPATCH) v.drawString(170, 92, ".", 0, "small") v.drawString(183, 91, "%", 0, "small") v.drawString(160, 58, "Cost", 0, "small") v.drawPaddedNum(350, 135, player.bpohccost, 4, V_SMALLSCALEPATCH) for i=0, 9 if i > (player.charlevelmax[player.bpohccharselect] - 1) //Drawing the box borders, when they're above the upgrade level... v.drawFill(130, 16 + (i * 6), 10, 1, 31) v.drawFill(130, 16 + (i * 6), 1, 3, 31) v.drawFill(140, 16 + (i * 6), 1, 4, 31) v.drawFill(130, 19 + (i * 6), 10, 1, 31) else // and below it. v.drawFill(130, 16 + (i * 6), 10, 1, 128) v.drawFill(130, 16 + (i * 6), 1, 3, 128) v.drawFill(140, 16 + (i * 6), 1, 4, 128) v.drawFill(130, 19 + (i * 6), 10, 1, 128) end if i < (player.bpohclevelselect) and i < (player.charlevelmax[player.bpohccharselect]) //Drawing the box innards, when they've already been purchased... v.drawFill(131, 17 + (i * 6), 9, 2, 0) elseif i < (player.bpohclevelselect)//... and when they haven't. v.drawFill(131, 17 + (i * 6), 9, 2, 104) end end //Drawing the outline for the 11-20 box. v.drawFill(130, 77, 10, 1, 31) v.drawFill(130, 77, 1, 41, 31) v.drawFill(140, 77, 1, 41, 31) v.drawFill(130, 118, 11, 1, 31) //Drawing the 11-20 box innards for i=0, 9 if i < (player.bpohclevelselect - 10) and i < (player.charlevelmax[player.bpohccharselect] - 10) v.drawFill(131, 78 + (4 * i), 9, 4, 0) elseif i < (player.bpohclevelselect - 10) v.drawFill(131, 78 + (4 * i), 9, 4, 104) end end //Drawing the variable length max upgrade level box if (player.charlevelmax[player.bpohccharselect] - 10) > 0 v.drawFill(130, 77, 10, 1, 128) v.drawFill(130, 77, 1, ((player.charlevelmax[player.bpohccharselect] - 10) * 4) + 1, 128) v.drawFill(140, 77, 1, ((player.charlevelmax[player.bpohccharselect] - 10) * 4) + 1, 128) v.drawFill(130, 77 + ((player.charlevelmax[player.bpohccharselect] - 10) * 4) + 1, 11, 1, 128) end //v.drawString(20, 130 ,wrap(v,"",575),0,"small") this is the template if player.bpohchorizselect < 2 if player.bpohccharselect == 0 v.drawString(20, 130 ,wrap(v,"Sonic's Upgrade -- Blue Shift: Increases one's Top Speed. Remember, you can always set the upgrade to a lower level if you find the speed too much!",580),0,"small") elseif player.bpohccharselect == 1 v.drawString(20, 130 ,wrap(v,"Tails' Upgrade -- Tailwind: Increases one's Jump Height. You'll be soaring through the air pretty soon! Do be careful, though, as you'll find it harder to make tiny hops!",575),0,"small") elseif player.bpohccharselect == 2 v.drawString(20, 130 ,wrap(v,"Knuckles' Upgrade -- Rocket Accel: Increases one's acceleration. It might become difficult to handle, especially if your Top Speed is above average...",580),0,"small") end end ///////////////////////////// // Code for the Skills box // ///////////////////////////// // Label v.drawString(250, 18, "Skills", V_YELLOWMAP, "small") //Skill 1 text if player.skills[player.bpohccharselect][0] == 0 v.drawString(225, 25, " Skill 1", 0, "small") elseif player.skills[player.bpohccharselect][0] == 1 v.drawString(225, 25, " Skill 1", V_REDMAP, "small") elseif player.skills[player.bpohccharselect][0] == 2 v.drawString(225, 25, " Skill 1 (Active)", V_REDMAP, "small") end //Skill 2 text if player.skills[player.bpohccharselect][1] == 0 v.drawString(225, 33, " Skill 2", 0, "small") elseif player.skills[player.bpohccharselect][1] == 1 v.drawString(225, 33, " Skill 2", V_REDMAP, "small") elseif player.skills[player.bpohccharselect][1] == 2 v.drawString(225, 33, " Skill 2 (Active)", V_REDMAP, "small") end //Skill 3 text if player.skills[player.bpohccharselect][2] == 0 v.drawString(225, 41, " Skill 3", 0, "small") elseif player.skills[player.bpohccharselect][2] == 1 v.drawString(225, 41, " Skill 3", V_REDMAP, "small") elseif player.skills[player.bpohccharselect][2] == 2 v.drawString(225, 41, " Skill 3 (Active)", V_REDMAP, "small") end v.drawString(235, 60, "Cost", 0, "small") v.drawNum(500, 140, player.skillcost[player.bpohccharselect][player.shopselect], V_SMALLSCALEPATCH) //v.drawString(225, 33, " Skill 2", 0, "small") //v.drawString(225, 41, " Skill 3", 0, "small") if player.bpohchorizselect == 2 if checkEmeralds() < player.emeraldsneeded v.drawString(20, 130 ,wrap(v,"Sorry, but you need " + player.emeraldsneeded + " " + player.emeraldtext + " to unlock this Skill!",575),0,"small") elseif player.bpohccharselect == 0 if player.shopselect == 0 v.drawString(20, 130 ,wrap(v,"Sonic Skill -- Perfect Run: If you're able to get through a stage without getting hit, you'll bank twice the rings at the end!",575),0,"small") elseif player.shopselect == 1 v.drawString(20, 130 ,wrap(v,"Sonic Skill -- Speed Bonus: Adds a certain ammount of rings to your Bank, depending on how quick you finish the level. This bonus is also multiplied by the Perfect Run upgrade, so be sure not to get hit, either. Surely, the fastest thing alive won't have any trouble making money like this... Right?",575),0,"small") elseif player.shopselect == 2 v.drawString(20, 130 ,wrap(v,"Sonic Skill -- Barrier Thok: Gives you a split-second of invincibility at the start of a thok. It's somewhat similar to a certain other jump ability, though it won't extend your attack range. It's difficult to really use effectively, but could bring great power if mastered. ...Well, maybe.",575),0,"small") end elseif player.bpohccharselect == 1 if player.shopselect == 0 v.drawString(20, 130 ,wrap(v,"Tails Skill -- Shielded Start: Gives you a free pity shield at the start of every stage, and when you respawn. It's simple, but effective.",575),0,"small") elseif player.shopselect == 1 v.drawString(20, 130 ,wrap(v,"Tails Skill -- Ring Blast: By holding down Ring Toss, you can spend rings to charge up an Armageddon Blast, destroying all enemies in the area. The size of the blast depends on how much you charge it up for.",575),0,"small") elseif player.shopselect == 2 v.drawString(20, 130 ,wrap(v,"Tails Skill -- Second Wind: By pressing Spin after tiring out during flight, you can continue flying, at the cost of 20 rings! Now you really can fly high!",575),0,"small") end elseif player.bpohccharselect == 2 if player.shopselect == 0 v.drawString(20, 130 ,wrap(v,"Knuckles Skill -- Badnik Bounty: Adds 1 Ring to your Bank for each destroyed Badnik. It might add up eventually.",575),0,"small") elseif player.shopselect == 1 v.drawString(20, 130 ,wrap(v,"Knuckles Skill -- Treasure Hunter: Doubles the value of Super Ring monitors. There's really no going wrong with this one.",575),0,"small") elseif player.shopselect == 2 v.drawString(20, 130 ,wrap(v,"Knuckles Skill -- Combi Ring: When you get hit, all your lost rings will be combined into one big ring, that has the value of all the rings you lost. You'll basically never lose rings again.",575),0,"small") end end end v.drawString(225, 25 + (8 * player.shopselect), ">", 0, "small") //v.drawString(20, (35 + player.shopselect * 20), ">") elseif player.shopmenuscreen == 4 v.drawString(130, 15, "Scripter", V_YELLOWMAP) v.drawString(110, 25, "LunarDestroyer") v.drawString(115, 45, "Special Thanks", V_YELLOWMAP) v.drawString(20, 55, "Joat, for making Dialouge.lua, various parts of which are used here.", 0, "small") v.drawString(20, 65, "Monster Iestyn and Lach for assistance on the Combi Ring ability", 0, "small") v.drawString(90, 85, "MEGA SPECIAL THANKS", V_REDMAP) v.drawString(100, 95, "Trick Nostalgie's", V_GRAYMAP) v.drawString(15, 115, "Len'en ~ Brilliant Pagoda or Haze Castle") v.drawString(20, 135, "For being the basis for the Upgrade \nscreen and it's mechanics.") //v.drawString(20, (35 + player.shopselect * 20), ">") elseif player.displayshieldwarning == 1 v.drawString(50, 75, "Warning! Once you pick a shield, \n that's the shield you've got!") v.drawString(50, 135, "Press Jump to continue.") //v.drawString(50, 95, "Press Spin to go back and reconsider, press Jump to go ahead!") end else v.drawString(220, 160, "(Toss Flag)") end end hud.add(drawhud) //hud.add(debughud)