 Hello and welcome to the third part of this series. If you want to check the previous ones There are some links in the description. This time we're gonna be making some updates to the auto clickers We're gonna make the price a dynamic value and we're gonna be also Duplicating this element several times. So we have different tiers of auto clickers and stuff like that I'm going to move all the gold relevant to this element to itself instead of having it on the main one As we had it before. So let's go ahead and create a script Which is gonna be auto clickers that vs just the default that we have here is okay and Now let's go and open main visual script, which is the one that we had before and here we have the own auto clicker pressed so This one Let's sum out a little bit Let's select everything Control C. Oh, oh, no Okay, we cannot copy this Function, but the rest once we can copy. That's something. Yeah Since this is the function definition It seems like we're gonna copy, but the rest of them we can so let's go ahead and copy and now on the auto clicker Let's select the function that we had here on this button Here instead of press I'm gonna disconnect it And I'm gonna connect it again To this node instead of the main one that way whenever we Press the button instead of going to the main script. It will go to the auto clicker Script if you notice a difference with previous videos in the new version of Godot They updated how this dialogue looks and I think it's much clearer. There's nothing new about it But I think it's more simplified. So it's just better to understand You can see here in blue is the node that has the signal and then you select the node You want to have the method created this method on bottom pressed. We want to have it on auto clickers Now that we have it connected and we had everything copied we can Control V which will paste it and And We have everything now We can connect the function with the condition and everything and this should be the same as it was before On the main script, let's go ahead and remove the on auto clicker press Which was the signal that we are not using anymore from before so we don't get confused and Now we have the main one the bottom press which is the make something button and Here we have the on button press which is This button inside the auto clickers a little bit confusing, but yeah, let's go ahead save it and try it out Let's see if we have any issues with our program Okay, it's disabled Okay now Okay The gets and the sets they don't seem to be working as Intended why is that since these valuables were defined on the main script? You see here. We have these variables We need to have the auto clickers get the reference from the Main node instead of the auto clickers now and This is starting to get confusing really really quick That's why I think the best way to work with visual scripting is When you have a very simple task to achieve whenever you start making things complicated Code will always be a better way of doing that. So how can we get the variables from the other node? Well, remember we had exported those so we can try and drop so if we click here on the main node and Here on the inspector we will get the count here and we can try and drop and This is the set count on that node And we can replace it with this one and if you try and drop pressing the control You get the getter so we can get the Count here Okay, let's replace the values here so a is gonna be this and Also, we want to have it here. We can remove this node We are now getting the correct one The auto clicker value Now the set we can set it here Here instead of having it there we have it and we replace this one We can remove this one. Okay Now the auto clicker If you remember This was also here on the variables which was Handling all the how many auto clickers you had We're gonna have to move this one onto the new code here. We can create the amount variable Which will mean how many of these? Auto clicker we have enabled So instead of counting in all the auto clickers from the main one, we're gonna be adding the Amount from here now that we have the variable here. We can replace it Like so instead of getting the auto clicker. We're getting this one the amount and instead of setting with control set the amount and We set the value here and This should be working Okay, we had replaced it all those values. Let's go ahead now and do the weird parking fix. Okay. Now it's zero and We have this on press but we also want to have the timer affect The auto clicker node instead of the main node since we're gonna have many different auto clicker nodes We want to keep track of each auto clicker and its speed so We save we go back to here and on timer timeout This is another function that we have created for the main one from as node like this We're going to do basically the same. Let's go to the timer node Let's disconnect the signal and connect it again But to the auto clicker node Now let's copy all the code except the function declaration here on timer timeout, which was the signal used before and to the new one So we have all these variables. We already know from before and we have to replace them Let's select the main the count We can have it here Prepare the nodes first and they get by pressing control Okay, can remove this one and Let's replace this one like this and the values are gonna be this one Now auto clicker. It was a variable. We are not using anymore. We're using this one. So We get the amount sorry here and This should be happening now all the time and we can go to the main one and remove the timeout So goodbye timeout Let's check if we had something here on As well. Yes, they disabled. We also need to handle this like If it's bigger than 10 like the count It's actually this part. We need to handle it as well on the auto clickers So it was in the process function. Let's go to the auto clickers and Create the process function Sorry instead of creating one you can click here on the drawer and find the process Here process Now they have the process function Let's copy this part Okay, we copy. Let's go to the auto clickers We paste it Okay Now we connect these two nodes again The count we need to get it from the main one We select the node and from here we Press control and drop it. We get the correct node. Okay So we're gonna replace these two as well because I wanted to reference self instead of this node specifically So let's go ahead and select the auto clickers button and They disable here one which was false and again Disabled It's going to be true and we connected here Okay, I think we have everything now. Sorry if this part was confusing But yeah, this is also the life of somebody that is using visual scripting Let's try it out. Let's see if it works. Let's get to 10 and buy one. Okay But does not leave no What is happening here is that on the set text We have to update the reference on where this text is So Let's select the label node and Move the text as well again. This happens because when you're selecting a node God is Generating the path to that node relative to where the node that you're calling it from is What does this mean? It means that if you're on main It's going to search for auto clickers and after you search for auto clickers is gonna go to the label But if you're calling the same node from auto clickers It's gonna look for another child Which is called auto clickers which it doesn't exist and that invisible thing is gonna call for a label Which it doesn't exist either That's why you have to update the references if you are moving code from one visual scripting to another one and The paths are not the same So let's go ahead and replace this value Okay Let's rerun it again click hard and Click it. Okay. We have one auto clicker, which is updating one value by a second and Yeah It seems to be working now. Let's update it. We have to know It's getting two by the second three now by the second. Okay. Everything seems to be working as we had it before So that's it for all the changes we have to do and now we can start to Separate this officially from the main scene Okay, let's save this auto clickers as Save branch as a scene this will create a new scene with only that content. Let's call it auto clicker scene that's gonna be the name of it and As you can see here, I cannot see the children anymore and there's like a movie clip like link Which if you click it, it will open this auto clicker in a separate scene Now that this is alone together alone in the world without any context whatsoever Let's reset the position from the wrecked Which is the distance from the start of the scene if you can see here is 30 pixels and 92 Why so if you press here and the reset is gonna go to the corner that way whenever you create at the node This scene into another place. You're done. You're not going to have that Offset Okay, let's save the scene and it's gonna be move it move heroes also all this will be of course Fixed is instead of just drag and dropping like I'm doing right now You are actually using container nodes, but we're not gonna be using them right now Okay, now that we have the auto clicker as a separate scene. I can duplicate it Okay, duplicate it and I have another one and I had another one and yeah as many as you want That way when you play the game You can have a lot of auto clickers and this is starting to look more similar to what a clicker game is, right? like you have different options With different prices, and yeah, you can start buying all of them And I don't have to really like have to reference the new ones a lot or anything like that Because there are all clones of this one So as long as we continue upgrading this New scene all of this will update as well The first thing I want to do is to add the price as a variable instead of just a number so let's go ahead and Open the script and create a new variable here. Let's close the output Let's create a new variable which is gonna be the price Let's edit it's gonna be an integer We do the fix. Okay, so this is going to be the price of these Auto clicker. Let's set it to five. So it's a different value and we can check it And now every time we have here the 10, which is what we were checking before We have to add updated to this value to five. So let's get it We're getting the price And we'll place it here. So now this is going to be five We do the same here or Remember we can drag and drop the value to this one as well think this would be easier if the lines were Not crossing that much, but okay, the position is clear like We don't need anything fancy here. Okay. I don't have any 10 here. Nope. This is okay This part is ready. This was the unbutton press function. Let's go to the timer timeout We don't see anything here with any 10. Let's go to the process here We have a 10 which is like checking if we can buy or not and Let's try it here Okay so Now that we have the price We also will need to update the label here. We have the label here as a 10 on the button Looks kind of ugly. Let's remove it from there and Let's create a new label which is going to be called price and This label will be price equal five Okay, some custom color Fund color is gonna be like, I don't know green. Yeah, okay. This is the price now Let's update now this Value like I hard coded the price here by typing it, but we want to set it dynamically. So on the auto clicker Let's go to the functions and here on the process function. Let's update the label. So We get the label price we drag and drop the text and Now here we have like the string value. We want to get the price like what is the price value in this case five and If you remember here we do something similar Which is getting it and transforming it to a string so Let's go back and We transform this one to a string string Where is it string? Int here Okay, so now we're gonna have it as text and We also need To add the string value which we're gonna create a new variable for Which is gonna be price string Let's edit the number string value price equals and a space Okay so if we get the value and We add math add we get the price equals and The five and we set it to the The same text Okay If we want to continue the process process gonna come to the condition The condition is gonna be checking if it's true or false for the disable and then it's gonna continue with the done So we want to do this after we check that so we continue the program and Now we are setting all the time the label depending on that value Why is this important because if we want to modify now The price for each of the auto clickers We want to update that all the time and we know that the price on every clicker game is only going to go up so The last thing we have to do now is on the price variable edit and export it Okay So remember when we sport a variable We can see it from the inspector as a script variable here. We have it price five okay Let's try it out like this. Let's see if it's working or if I missed something. Okay now it only should cost five and Okay, I it seems like I forgot something. I think it's checking for the 10 in some other place when I click on the button. Let's see Let's see how much set the amount Here a minus B What am I getting? The price This is tricky why is it not happening? Oh Oh Here we have a 10 Why do we have it here? Get the count set disabled? Think we should remove this part, right? This is happening on the other one. So we don't really need it Okay, this wasn't mine. Okay button press. Okay, this should be fine auto clickers Let's see. We're getting the count We're getting the price Where is the conditional here is the conditional Interesting, let's see if we go to 10 if it's still happening. Yeah, I can buy if it costs 10 What was that? Okay, it seems like that other part was confusing Then the main script was Confusing the the other button. Okay, we have it working now like we wanted So what can we do with all these confusing stuff? I hope you're following this If not, I'm gonna be answering all your questions on the comments So they are coming and I'll do my best to help you with any questions you might have But yeah, now that we have all this set up We can set the price for each of them from the inspector here and since Now we know that it's going to be updating we can set the first one to five the second one to ten Third one to I don't know 15 This one is gonna be 20 and this one is gonna be 100 Okay Let's try it out and we see different prices for all the auto clickers Let's see if we only have five only this one is available if we have ten this one is starting to be available 15 20 and I'm not gonna click 100 times right now But let's do it auto clickers to base which is by stuff Start buying stuff Okay Yeah Okay. Yeah. Yeah, let's get it. Let's get it Okay, as you can see here now that we have 100 it's available and You might already be able to Think on what we can do next which is another principle of clicker games how much The auto clicker is going to be augmenting this value right now. All of them are only adding one and That every time that we buy one upgrade the price is gonna go up Those values we're gonna set them on here as a script bearable so we can continue to edit them from the inspector like this ones and Once we have all that we might already have a fully fledged clicker game ready for us to now select a theme and Start adding some graphics and things like that if you want to get the code for this tutorial I'm gonna be leaving it for my Patreons if you want to help me continue with this series Please consider being a patreon because if thanks to my patreons that I'm able to do these videos And if not, I'm gonna be releasing the code when I finish the series anyways, so Just remember to subscribe to know when that happens. Thank you very much everyone See you next time on the part 4 of the visual scripting and clicker game tutorials Bye