 oh yeah yes beautiful flawless amazing oh okay let's give myself 80 and time matter hello guys crypto grounds here welcome back to the unity anti matter dimensions video this is episode six and today we're gonna be doing the by max okay so if you enjoyed this video make sure you smash that like button subscribe my channel if you're new turn on those notifications got notified for future live streams and videos my god this is itchy me comment all your feedback questions compliments all that good stuff below and let's get into it all right so I also wanted I might want to do key binds so we'll see I could probably do that different video but I want to get the by max done and out of the way okay so we're gonna be doing this in our dimensions script right here and this should be pretty easy I guess so let's check out let's start with that tick speed okay um do I even have the by until 10 working I don't I don't know okay I don't know why this is great out so I'm just gonna ignore that so let's say I want to I want to skip that where's our tick speed is that in game controller by tick speed right here okay so we need to make this into a by max now I don't want to make this into a while loop and this is pretty easy to make since our cost equation is very simple so we will make public void by actually you know what let's let's do it in here so we're gonna do by tick speed and we're gonna call this we're gonna have a different mode we're just gonna do this in a switch case in here so for our first one is going to be one or yeah sorry it's case one yeah like that okay and basically when we're buying one it's just like that okay break it and we can honestly just return this okay and we also need a max okay I hope you like my wig by the ways so obviously we could just make it this into a while loop that's the big no no we want we want to do math math will save our lives okay so we need some variables in here so I'm gonna start with a big double we need the base costs okay we need a big double let's see we need a cost molt which is pretty easy to do cost molt we need our currency which we honestly don't need we can just make a variable for this and get rid of it we need a current level so our current level tick speed level and I think there's one more that we need I think that might be it honestly okay so if you haven't checked out this by max math explained video I'd highly recommend you to take a look because it pretty much explained how all the equations we use are created and what all the variables mean also here it shows all of our variables we have our base costs or which is a starting cost or growth rates our current levels and number to buy also we have our currency which is C or the current cost okay so we'll be using these these equations here to to make this formula here now I obviously I can't I still can't remember these top my head I did a little bit back in but we're we'll try my best okay so let's make a cost here okay because what we do is the maximum we can buy is based off of N okay so the thing is that we have to find out and for the cost as well that might be a little tricky that which that's why we replace cost with currency which C okay so in this case so we need to find what N is first so I think I got I think I said we need to start with the cost but we need actually need to start with N which is the to buy and we can shorten these variable names in the future okay and we can make this a var and do all that good stuff so you see here that our equation here is log base R and inside of it is C times r-1 over b times r to the power of L and all that plus one and that's our equation okay so we'll go off of this here I will put this aside and I will start writing things down okay so first we have to do our big double log also if you don't I know I haven't I think I've said this in the past but if you don't have the big double yet and if you're doing this with me you'll there's a I have a breakfinity video with the download link there so now we don't do log 10 we want to do log because we have a certain base which is going to be R now R is our growth rate so we'll just put our cost molt here okay so now we want to multiply that the numerator which is our currency currency times the R minus one and remember R is the growth rate which is cost molt so we do currency times cost molt minus one okay so let's see we're getting some errors here I think it's because yeah these are not initialized so our base cost here is one is it 23 it's 1000 okay and our cost molt is and we can shorten this okay trust me we will and our cost molt is 10 and this will change when it comes to challenges so again there's a lot of complexity to this game so don't expect some changes in the future we our currency is data anti-matter our level is data dot tick speed levels and yeah we have all of our variables initialized also we can get rid of this big double okay so we are error free here we're gonna divide all of this by B times that's the base cost times R to the power of L so it's base cost times big double dot POW where since I have the static break the need up big double here all I need to type is POW okay and what we do here is R to the power of L so that's cost molt to the power of our level all right that is simple enough so now we have our developed equation here okay so now we need cost so we're gonna set cost equal to this other equation here which is B times R to the power of L times R minus or R to the power of N minus 1 all that divided by R minus 1 okay so and again I'm not gonna explain how these equations work because I did in this video so if you're curious on that make sure you please check out my video okay so we need to do base costs times times all by R to the power of L so that's base costs yeah base cost to the power of level and we're gonna multiply this by base cost to the power of N and subtract it by one and we can get rid of some of these oh wait to buy sorry okay I think get nope we don't have to get rid of anything here and we want to buy all of this by R minus 1 so we'll probably get rid of some of these parentheses here oh nope looks like we're fine let me make sure we're multiplying the right things yep we can get rid of that perfect so we have both of our equations here and we can keep these here var var and honestly we can I want to keep these here even though we can just replace base cost with 1000 the reason why is because certain challenges like like the tixby challenge things are gonna look different right all these costs are gonna change so we want to keep the variable so we keep ourselves organized and we can just replace some of the things with the var because it knows it's a big double so if you do var here I don't think that will work it's because it double why is it a double okay I'm just not gonna worry about that okay so we're not doing anything double related here okay so now with our costs we need to see if it's if antimatter is greater than the cost the buy max cost and if it is then we will subtract it by the cost and yep it's pretty self-explanatory subtract it from the cost and add levels by the very the level variable or actually know the to buy variable here okay so hopefully that all makes sense I know I kind of went through it really quickly but again I have a separate video for the math related explanations for that I wanted to get that out of the way now we'll be using the same system here for our dimensions so let's find that and I yeah so this is a little weird because I don't I'm not sure how I think antimatter mentions by max is pretty much based on like what you can buy from like here than this one for this one this one this one so on so it's gonna be a little weird it's not by max based on until 10 I believe I'm not positive should we check that out yeah I think we should it's safe to say so we know what we need to do because I'd rather do less work than we are supposed to oh steam work support I don't like it when they email me okay so looks like that doesn't work so it looks like it's only by by maxing the until 10 perfect that's what I want also I think this by max all does everything so we'll have to include the the tix be to that see 100 yes it looks like it's only buying that okay that makes sense so that's less work for us to do okay so we need to start with this by until 10 here let's paste that in here okay okay so we'll be using this in here by max also what we can do here actually now we won't have the switch case system here we'll just get rid of all this this string mode here okay so we have variables where's our costs oh right here dimension cost so yeah we have variables like the base cost the cost molds and stuff like that okay so I'm gonna move this here we can just start shifting stuff around so our base cost is going to be our base cost dimension base cost at index okay so we have to do this in a for loop so we're gonna we're gonna loop it from seven index seven which is this one right here to zero so we're gonna start from down up okay so we'll just start with seven here we'll replace it with a for loop later on and our cost multiple equal to dimension cost malt at index seven and our currency is the same our level however is so this is the weird thing is that it's buying 10 instead so it's what ours is gonna be based off is how many dim boost we have I think is what yeah dimension boost yep okay cool so our level is dimension boost at index seven okay and our bimax equation is pretty much the same thing well actually so the cost is weird because it's not remember it's not just one E8 it decreases as we buy one of these so it's a little weird but the buy until 10 is that so I feel like our cost is this minus or minus how many levels times 10 or something like or this how many by how many levels times 10 minus yeah I don't know it's really weird so okay so our currency our to buy I think we should calculate based on what our current level is okay so what I'm doing here also what I did here is that I added this right here so basically we add our dimension boost to our to buy and our levels we set that zero so now what I'm gonna do here is exactly what we did for our until 10 cost and since this is equation here and that's what our bimax is right now but we need to include the in case we have extra levels here so we do that by multiple by using this formula here which is our dimension cost times 10 and that is our to until 10 and we subtract that by how many levels we've already bought in okay so we can go to this cost here and we need to multiply this by 10 anyways so we'll do that and we'll subtract it by dimension cost like that I think that's what we do I'm not completely positive this is like a big gamble right here so we'll see if this works at all I'm so bad at parentheses so bad okay um that should be fine it's just the to buy that I'm really concerned about because I feel like that it's I don't know I just feel like it's not the right numbers I guess like I feel like this currency should be divided by 10 or something like that so I maybe I can just like I don't know I let's just test to see how this runs so dimension count oh yeah we need to add dimension count really irrelevant at this at this point but okay so we're adding the 10 times to buy so basically we're adding 10 every shift because or every dimension boost because that's just it's not only a dimension boost actually but this unlock thing I guess we need to do so we'll just say okay so we need to we need to add this as a for loop like really fast so because this is getting kind of annoying to look at so we need to start at seven okay and we're we're gonna make sure this is never less than zero and we're just gonna subtract by one every time we iterate and we replace all these sevens and IDs with I okay so replace that with I where else do I right here I think if I oh yeah these three and replace I hear on I think that's how they do it I don't know let's see we need to check if these even are unlocked so before we do all this useless math we need to check to see if it's unlocked anyways so if dimensions on the current dimension if it's unlocked then we can do this okay and we can make these variables since our base costs are big doubles invert this I guess okay so now if it's false then we're just gonna continue on with the for loop we don't do this so that's what the continue does okay it basically just continues on with the for loop it ignores all of this right here so it's like a return but it doesn't actually return the method it just doesn't continue here but it continues the for loop if that makes sense okay let's save it and this is a huge gamble I don't think this is gonna work but we have any errors no okay so where's our by max okay so we have our by max tick speed here so we're gonna call this dimensions oh this is not dimensions this is our main script here our no oh yeah scripts right here is that it yep game controller okay so I dragged in the scripts right here with which has our game controller and we're gonna add by tick speed and set it the string to max and now we want to do that the same thing for our other by tick speed and we want to set the string this parameter to one okay and this by max I guess it's below I don't I don't even know where my dimensions dimsack here it is that's a no weird spot and we're gonna set this by max to the by max method okay I'm gonna save this here and let's give it a shot I don't expect this to work at all but the tick speech be flawless okay where's our script here okay I'm gonna give ourselves eight antimatter and it should buy oh great it doesn't okay well that's a good not okay so it looks like both of our by maxes aren't working so that's that's neat oh that was really that okay that was confusing but I don't know it's not even buying like all of them this doesn't even look right like this cost does not okay I'm look I'm scared to look at my dimension boost because I know it's not a constant number yeah look at that what the hell okay well that's not good okay so let's first start with tick speed also we need to add our by tick speed in this method too so we just do game dots by tick speed and we add the max string as a parameter or to our argument and so why is it not working I feel like I need to round these so what I'm gonna do here is I'm gonna print to buy and our cost oh yeah we might stop we need to see if this is iterating at all so okay so it's negative it's going more negative oh that was not good so first start with negative one and cost is greater than zero okay so if cost is greater than zero to okay just so that doesn't happen but why was it negative one I don't know okay I got to take up this I was driving me nuts now I got hair all over me like okay I was I was having me insane okay so oh okay so let's double check our equations here oh I see we're missing a plus one okay so we're missing a plus one in our log here so we're gonna plus one right here because this should be zero and we also need to add a floor so we multiply all this yeah okay just add a plus one here and what we're gonna do is add a floor to this because we don't want to buy decimals or we're gonna do the same thing for above and this should reduce our this should get rid of our negative issue where is it yeah we're gonna set log to floor also we need to add that plus one to here too so I completely like forgot about that and we should be set I just realized I'm not using the latest version of unity so you click this is zero okay perfect if you say seven so the cost doesn't look quite right the buying is good though so that's nice but the cost is really weird actually no this is right yeah this is correct it just looks weird okay it's correct never mind obviously this could be shortened to just all zeros here and but I don't know cuz it's cuz these numbers like this thousand right here this upgrade right here that should be free it should be technically free because of how irrelevant it is but they don't need to do that so I think this is the right cost I'm yeah let's just say it is because we're buying four yeah that that's yeah so now it's not buying at all so is this okay I think the issue here is that this is still bigger than this right so if we make this two oh it's trying to round up to the next one so that's not good see we can afford it the four of them right now but now it's saying that we can afford five so I'm debating on if we should just subtract one I feel like that's bad practice but I don't know why this is incorrect I think we were forgetting a variable so let's see base cost the power LR to the power of N all that minus one and all this divided by that yep that's correct oh it's divided by base cost over one that's its growth rate okay so again if stuff doesn't work you always just got to check your work okay so that might be the issue why this is not working and it's I guess that made a pretty weird impact and not like a really oblivious one where we got a bunch of NaNs okay so now if we set this to four or four yeah it should okay so we can buy two this cost is very weird I don't know why it's like that because this is like two that's that's yeah this is not right either well if we put like 90 for example yeah that's not correct it should be 1A90 this N right here is correct it's our cost equation that's a little messed up here all right I'm gonna go take a look at this beer back okay so immediately I saw what was wrong so cost more right here I didn't even have to like cut this part because I immediately saw this the base cost is what I got mixed up okay so replace all the base cost with your cost malt sorry about that I got mixed up with my Rs and Bs okay now it should work just fine hopefully it's weird because like the other thing would have worked too but it it was kind of weird in a way so now if we put six cool so now it buys the right amount so if we put E99 it should buy oh that's not correct okay well okay what if we put something smaller like 50 so not saying we can buy 51 even though we can only buy like 44 yeah 44 yeah okay well that's not good we're forgetting some variables here take speed levels what is our tix be love yeah that's right never mind so if we keep buying these it keeps adding on to this that's weird you see that it's like adding on it's like okay so there's something wrong with our level here so our to buy is divided by base cost the power of our cost molds are is there any base costs in here yeah just that one and parentheses here parentheses here I feel like it's something to do with our oh I see here okay that little sneaky plus one here okay so I added parentheses around man I got confused my parentheses already one two one two okay so I added parentheses around this base cost times power right here so I guess that screwed things up so let's copy these two equations back into actually know just this one here back into our dimensions because that will mess things up to and replace all these base costs with our cost molds here okay so now let's save this and let's get another try here you know what give us another shot how about over like that yeah that's that's really cool okay let's give ourselves some anti-matter shall we yes okay so try a bigger number now awesome it works it buys the right amount so yeah it should look like 1.11 e66 yeah so if we do that yep perfect so now our by max is another concern so it looks like it's buying the rest but it's not it's I think it's this one right here so okay cool so it looks like our by max actually does pretty well first try I did not think it was gonna work but I guess we got lucky here so we need to iterate this to I is greater than or equal to zero okay we could set this to is greater than negative one but that just doesn't look right so I'm gonna do greater than or equal than zero okay let's give this another shot another go and this should be a lifesaver here and what's nice is that it only iterates to the one that's actually unlocked so if we do 77 it should but if we do by max here oh man that's not good it's still not okay so that's nice I guess but it's still yeah I think how does the by max even like does the by max like in lock that unlock to ah frick keep going to the wrong thing here okay so we'll still not iterating through this I don't know why cuz is on is this unlocked already zero yeah this should be true and it's ugly notation and it's in okay so does this unlock let's give us some antimatter I'm curious if it automatically buys all of them or if it like does what mine does right now so if we do this okay so it looks like it unlocks all of them too so you got to click it once okay well we need to do that too because yeah I don't think we're gonna want to click buy max a few times so in this case I guess what's best to do is to reverse this order we don't know I guess we can yeah because when we oh wait a minute yeah we forgot some other things too I think we forgot this unlock no we have it right here so let's start from zero and stop at eight so yeah let's do that instead and it should be able to buy the first one just fine hopefully if not then I'm gonna have to do some debugging okay I see your issue here so this it's a really dumb mistake but you see how it says I is greater than eight well we started zero so clearly I is never gonna be greater than eight so we need to make sure it's I is less than equal less than eight okay so that was a just the stupid mistake so I don't think we'll need to print any of that stuff and they should be the last of it we need to get some of that anti-matter nine oh yeah yes beautiful flawless amazing oh that's not good so it's so true zero break where does okay so I kind of thought of something so our cost molt never changes both the base costs can we adjust that I think we can now the reason why I'm saying this is because we subtracted the overall cost by how many are levels so it's kind of like subtracting the base cost from the cost molt right because we're not changing the cost molt it's still like if we buy a dimension boost and not change our levels the cost molt still gonna be the same right it's gonna be times 10 or whatever the cost molt is so what if we change the base costs based on what we have here so I'm actually gonna try this now I don't think we need a times 10 anything maybe I can get rid of this and see if this solves the issue if not I'm just gonna put a comment of bring back divided by 10 also that means we need to bring back or we need to get rid of that okay so that's just a note for me to take now we want to set this this base cost to whatever the cost is now I don't want to subtract this cost obviously so I think what I'm just gonna do is is multiply it by 10 subtract it by the its base cost again by the levels okay so I think that might actually work if this does finally and honestly I thought this was gonna be a really short video I really did I thought it was gonna be much easier than I thought okay let's give myself 80 and time matter yes we got to work by max hell yeah even more by max more by max I demand more by max 15 by max give me more by max well that doesn't number to grow rise and tomato rise get me some more give me some more and time matter look at that number rise beautiful absolutely beautiful magnificent okay so good thing that worked so this is our final changes here now we can honestly just get rid of some of these variables since we do use them actually no we use them in numerous times so it is to shorten them but stuff like currency that can go so we'll shorten this up while my thing is catching up and it looks like we use level 1 so we'll just trim that cool so in conclusion of this equation basically what it does is that it start it goes in a for loop obviously it checks if it's even unlocked starting from the first to the eighth obviously the first one is always unlocked so that doesn't matter for that it checks if we can even afford an until 10 okay and there in the by max goes off of until 10 because really these are the most pointless things after at this point it's useful for like six dimension obviously but it's useless pretty much after that so it checks for that it calculates the base cost which we do base cost times 10 minus dimension base cost times game.data dimension level so now we which is this right here so if you buy one right here you can see that this cost reduces right so we're basically just shifting the base cost essentially not the actual cost molt so which is why we do this and we create a variable with cost molt which is this right here and we create a variable just because we use it more than we use it three times three times or more is the kind of a rule of thumb if you want to you know reduce some things and it's a mouthful calculate amount of upgrades we can buy using this massive equation here works perfectly so now we check if it's less now if we can buy less than one then we're just going to skip it all together we subtract the intimator by the actual cost rather than gathering all the total cost because that's kind of redundant really doesn't matter because these numbers are so big after all dimension counts we which is dimension counts dimension counts what's that I tell you I just brain fart what's this dimension count I just had a massive brain fart I don't I forgot what dimension count was dimension levels I know what that is dimension levels is this and dimension count that's this I'm stupid okay and then dimension boost is that okay so we add our count to how many we actually buy so we multiply 10 by 2 by and we subtracted by how many levels we have so if we have five right now and we buy it until 10 it buys five okay so we add five to the count so that's what that is and we multiply or we add our dimension boost by how many like how many dimension boost we have or that we can buy which is this right here and we set levels to zero okay which is why we want to check to see if we can afford this so we don't just set our levels back to zero for no reason and we make sure to check if we can unlock it like usual and after that we buy it takes me okay looks like it's not going to catch up anytime soon so I'm just gonna end this video off with a thank you guys very much for tuning in I'm sorry this was a really long and kind of maybe boring video I guess because I was working on a simple by max equation that I shouldn't know how to do so if you did if you stayed if you if you stuck around to the end and if you enjoyed this video make sure you smash that like button subscribe to my channel if you're new and turn on those notifications if you want to get notified for future live streams and videos share this video with your community your friends anyone you would like I would really appreciate it and if you want to ask any questions if you have any feedback suggestions all that good stuff make sure to comment below I'll be sure to check them out anyways thank you guys for watching the video and have a good dad have a good dad have a good day peace