Make A Game Like Pokemon in Unity | #25 - Move Priorities & Bug Fixes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Really great series.

👍︎︎ 2 👤︎︎ u/ProudBlackMatt 📅︎︎ Oct 04 2020 🗫︎ replies

another lovely installation

👍︎︎ 2 👤︎︎ u/skellytongs 📅︎︎ Oct 04 2020 🗫︎ replies

This is part 25 of my Pokemon Game tutorial series in unity. In this video, we'll implement priority moves. So a move like Quick Attack should be performed first even if the other pokemon has higher speed. We'll also prevent the pokemon from performing moves that doesn't have any PP remaining.

If you're new to this series, this a series where we'll create a Turn-Based RPG like Pokemon in unity using Design Patterns and Good Game Development Practices. I'd love hear what you think about it :)

Here is the entire playlist.

👍︎︎ 1 👤︎︎ u/GameDevExperiments 📅︎︎ Oct 04 2020 🗫︎ replies
Captions
hey everyone welcome to part 25 of my pokemon game series in unity so in this video we'll implement more priorities so if i use a move like quick attack then i should get the first turn even if the enemy has higher speed so we'll try to implement that and also we'll fix some of the issues that we currently have in the battle system special thanks to all my patreons for making the series possible by becoming a patreon you can support me in the making of the series and get some cool rewards like access to the complete project files of the series so let's start the video okay so right now to check which pokemon goes first we are only checking the speed of the pokemon right so let's also add more priorities so inside my move base class i'll create a variable called priority and let me also create a property for it so now in our battle system to check which pokemon goes first first we need to check the priority and if the more priority is same then we'll check the speed of the pokemon right so initially i'll set player goes first to true and let me actually store the more priorities in a variable so that it's easy to check okay and let me also store the enemy move priority all right so initially i'll set player goes first true and then if the enemy move priority is greater than the player more priority then i'll set player goes first to false alright so by default it's true and if the priority of the enemy move is greater than that of the player move then we'll set player goes to false and enemy will get the first move and otherwise if both the priorities are equal then we should use the speed of the pokemon to determine who goes first right so let me just copy this line and paste it here okay so basically first we'll check the more priority and only if the move priorities are same then we'll check the speed of the pokemon right so let's go to unity and try testing this so most of the moves have a priority of zero and there are only few moves that have a positive or negative priorities so let's try creating a move like quick attack so i'll actually just duplicate a move like tackle and rename it to click attack okay so everything else is the same but the only difference is for quick attack the priority is actually one right so let me assign this to some pokemon so i'll assign it to pidgey okay and in my player party i'll make pidgey the first pokemon just to make it easy to test and let's say its level is eight all right so now for the enemy pokemon let's choose some pokemon that has higher speed than pg right so pg speed is 56 and let's choose a pokemon like butterfree whole speed is 70. so let me just make part of t the enemy pokemon and i'll set the level to eight which is same as that of pidgey alright so let's test this so let me start a battle okay so since butterfree has higher speed if i use a normal mode like tackle then butterfree will get the first move right but if i use a move like quick attack i'll get the first move because even though butterfree has more speed quick attack has more priority right so let's try using quick attack so yeah you can see that we got the first move and if i use a move like tackle then butterfree should get the first more right so more priorities are working just like you wanted okay so next let's fix some of the bugs that we currently have so inside our pokemon class to calculate the max hp currently i'm using the base b right so let's change that to base dot max hp okay so this was something i recently found so next let's fix another issue so right now we'll be able to perform a move even if the pp of the move is zero it's actually just that so let me just change the ppe of tackle to something small like one and the fat is the game all right so you can see tackles pp's one all right so now first time i should be able to perform the ball so now it's bp 0 and i should not be able to perform the move right but if i select tackle you can see that i'll still be able to perform the move so that's an issue that we need to fix so inside our handle move selection when i select move by pressing z i should only run all this code if the pp of the move is greater than zero right so first i'll get a reference to the move and then if mu dot pp is equal to zero then i'll just return and we won't execute any of these right so we also need to show some kind of feedback to the user indicating that our pp is zero so what i'll do is inside the update move selection function while setting the pp text i'll also set the color of the text to red if the bp is 0 so i'll say if mo dot pp equal to 0 then i'll set the color of the pp text to red and otherwise i'll just set the color to black right so that should be enough so let's actually test this right now tackle has one pp so it's color is actually black so let me use it once all right so now you can see that tackle has 0bp and its color has changed too right and if i try to press z then i won't be able to perform tackle right but if i choose another attack i should be able to perform that so one more thing that we can do is we can actually prevent the enemy from performing a move that doesn't have bp so inside my pokemon script in the get random move function first i'll get a list of moves that actually has some bp so for that i can say moves dot pair okay i'll have to you import link in order to use there and for the condition i'll say pp greater than zero all right so i'll convert this into a list so this variable will contain the list of moves as book 1 that actually has some ppe so now instead of selecting a random move for the most list i'll select the random move from this list so let me replace moves with moves with zp all right so that's it and now the enemy won't be able to perform moves that doesn't have vp so one thing to note here is that if the enemy doesn't have any move with pp then this list will be empty and we'll get another difference error so always make sure that the enemy has at least one move with a lot of pp to make sure this doesn't happen you can go ahead and test this out to see if this work so i'll stop the video here if you think this video is helpful please leave a like on the video and subscribe to my channel that'll really help me a lot so i'll see you in the next video
Info
Channel: Game Dev Experiments
Views: 3,298
Rating: undefined out of 5
Keywords: make a game like pokemon in unity, how to make a game like pokemon in unity, make pokemon in unity, make pokemon game in unity, how to make pokemon game in unity, make a pokemon game in unity, unity pokemon game tutorial, unity turn based battle system, turn based battle system in unity
Id: Pi5knsC_H78
Channel Id: undefined
Length: 9min 56sec (596 seconds)
Published: Sat Oct 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.