Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
We've got quite a chunk of work done on the visual presentation of our game
But before we continue with that work because we still have a lot to do
What's the add some more content in what I'm thinking we can do is add
Couple of up
For our existing abilities
And what I want to do is I want to do a damage
So I want to
Add maybe like a
Certain percent damage increase for the acts as well as the sword
Now we're going to end up with a tricky situation because
We
Could
Or the player weather
Might not have the axe ability
So we can't just blindly select
The axe upgrade
For the player right so we can handle all of that in this lesson and let's get started so
The first thing you want to do is go to our
Resources in an upgrades
An
We're going to just a duplicate one of these so let's say
Duplicate the sort of
And let's call it sorted underscore
Subtitled by online-courses.club We compress knowledge for you!
Damage
What duplicate that
Garden double click the sword down
Change the ID it's very important that you change the ID
Two sword
Damage
And then the max quantity let's just said that to 0 which means that we can have an unlimited number of
Is upgrades
Animal World change this name to sword damage
Analisi increases sword
Damage
Bye
Let's do 15% that sounds good to me
Alright and then let's Create one for the acts as well so I'm just going to duplicate this or damaged by right-clicking duplicate
You can also press ctrl d to duplicate cell
Control
And then I'm going to call this x underscore damage
Duplicate
Double click into your extension and replace all of the references to sword
Axe damage
Ask damage and again will keep the maxquant the
And let's change this one
To slightly lower because the axe
Can damage multiple enemies at a time
So we're gonna turn this down
Tenpin
Ok let's open up the script for upgrade Manager by clicking into
And we have our upgrade pool up here
Which is going to be a little bit problem at
And why is it going to be problematic because again
If we randomly choose
What's the
Damage upgrade
We may not have the axe yet and it doesn't
Make sense
So what I'm going to do is I'm good
To actually
Use that waited a table that We Created a couple of lessons ago and we're use that for upgrade pool
Instead
Let's get rid of this upgrades
Analyst create under our current upgrade let's create a upgrade
War
Variable a new one
And it's going to be over
Where did table and then we'll send it to Waiting table that
New Lakeside
Ok so now we've got
A table instead of
Our array that we export
And we need to preload all of our upgrade
So I'm going to go and create a new line
I'm just going to say ok let's call it
Ask
Upgrade is he good to
Reload and I'm just going to
Preload basically all of the upgrades that we
Solve our x upgrade is equal to
Ask damage is equal to preload
And then you can just start riding act damage and that will be
Pre-loaded again make sure you're loading it from the upgrade directory don't want to accidentally load something that's not
An upgrade resource
Save our sword
Is he good to preload
And then you can
Type sort underscore rate and select the one that is in the resources
And then very sore
Damage
Is he good
Preload
RAS
Or we can
Type sword Den
To get
The autocomplete search
Ok so what items do we want to add
Sauna ready-made
I'm gonna above this connect
Lying here
I'm going to say
Upgrade pool
IPad Air
And we're going to put in
The
Ask
And I'm going to before we go any further
I'm going to change the naming of this a little bit so
Instead of axe upgrade which I wrote up here and act damaging sword Greatsword damage
I'm going to change all these to have a prefix of upgrades underscores I'm going to get rid of this underscore upgrade in the
Online nine hair
Then I'm going to select
At the beginning of the acts with my cursor
I'm going to hold up
So hold the alt key down and then click at the beginning of each
Variable
And I will create a multiline cursor
And with that everything that we type
Is going to be
Duplicated across all those lines and so I'm just going to
Right upgrade underscore
Prefix all of those like that
Just for consistency
Ok so with that out of the way
Let's add an item
What's a upgrade axe
And then we'll say
10
I want to see the weight of 10 Furbies
Channel is due upgrade Poole
Now if you wanted to be sophisticated
You could add another method in our wedding table
Set alarms you to add a whole array of items with the same
But we're not going to go that far
So I'm going to do upgrade
Sword red
10 and then upgrade pool
Start
Upgrade sword
Damage
10
For adding all the upgrades to upgrade but except for the accent
And you'll see wireless
Ok
So in a reply upgrade matter what needs to happen well
Let's think about this so when do you want the player to be able to choose the axis
Image as an up
Well only after we've actually received the accessibility
So in our apply upgrade
We can actually modify our upgrade pool at run
While the game is running
To update it with new ID
And so we can write that code in the apply upgrade but I'm actually going to create a new function
I'm going to say
Funk
Update
Upgrade
And then it were going to say
Let's let's Create another argument or a premier account chosen upgrade
And will
Ability upgrades as a type of there
And then we'll
Start writing at this method so
What do you want to do we want to say yes
Chosen upgrade
Dart ID
Is equal to
And what is your ACS ID
Are exid is simply just ask so I can do ask
And even better instead of writing a string in here I already have a reference
To my upgrade
Here right
So I can say if chosen upgrade that ID is equal to upgrade
Ask
I D
Then that means
The axe has been charged
Right
And technically what I can do is I can even just do this and see if these resources
Are equal to
Each other
So you can use any phone that you were
I like to use ID
Because
There could be situations where
You may be
Duplicating a resource which breaks the reference right so if I did this
If my chosen upgrade
Ability upgrades is equal to upgrade AXA dupla
This will always return farts why because duplicate create a new rap
And when you compare to Reece
Together by equality
Are your checking if the reference is there
Sorry I like to do this because there is a risk that somewhere in your code you might duplicate a resource for some purpose
And then when you try to do this equality it will break
Because
It's
Technically the same ref
So that's why I like to have a secondary
Sort of ID
Because I want to be sure
That
These are the same type of resource
So that's just my personal preference
You can also if you wanted to
Use this property resource pack
And resource path
If we click into it
Is the path
To The Resource on the disk
So you can actually just compare the pair
To see if it's the same file anyway
That's enough on all those recorded just use the ID because we're already using an ID elsewhere
So if our children upgrade is it go to the upgrade x
Then what we can do as we could say upgrade cool
Add item
And we're going to add
The
Item which is upgrade
Damage
And we're going to add 10
No I'm just going to make all these weight equal but feel free to change these weights according to how you want a balance the game
Remember a great away
It means that it will be more like
Baby chosen
Ok and then we have this function now which weekend extend when we have other
That are being shown
Ok so we still need to call this though so before we call the Amit in our apply upgrade
Let's do update
Upgrade pool
Animal pass in h
Upgrade
There's still a bunch wrong with this code because we went from
Standard array with a upgrade pool to a weighted table
So you recall a couple of lessons ago we were doing some things
With the Opera port we were filtering it and all that good stuff
So that we didn't choose the same
Upgrade
And we're going to have to do the same with our waiting take
And this actually shouldn't be
Tudor
Instead of this filter upgrade
We're not going to do any of that so let's get rid of this filtered upgrades line
Subtitled by online-courses.club We compress knowledge for you!
No we don't get a bunch of errors from removing that line but that's fine for now
So chosen opera
We're going to instead of doing filter upgrades here so let's comment out this line because it
A little bit annoying so go ahead control k on these two lines to come in
And then our chosen upgrade were going to say
Upgrade
Poole
Dart
Ok and then we're going to pay
So we actually don't need this filter down here anymore
Because we're going to do something similar
In our
Upgrade
Table
Or awaiting table leather sole
Click ctrl click on this pic item right here
To go into the waiter table
And let
Allow ourselves to pass in in array
Of items to
So what I'm going to do is I'm going to say excluded
Is it going to be of type array
And we can't type this because
Weed
Have types in this
In this classroom
And we're going to set this by default equal to empty array
So
You can actually assign default values for parameters by putting an equals
And whatever value you want
As part of the perimeter so this means that if we don't pass in and excluded
It's by default go
Empty
Alright it's all gonna have to do a little bit of manipulate
I'm here in order for this
The Rachel
So we want to do
Excluded
Dad size
Greater than zero
Let's write a past right here for now
So sense of what we're going to do is working to recalculate the weights
And we're going to reassign the items arrive
So let's create a new variable a call
Adjusted items
Is equal to
An empty array and we can also type this the same as the items
So let's type it as an array
Ok and we can just assign this to start
2
Just like so
And then we're going to say via adjusted weight
Is equal to weight
Some
Let's be consistent with just weights
So now with grab a separate reference to those
Excluded size is greater than 0
And what we're going to do
Is we're going to say
Adjusted
Is equal to empty array
So I'm going to rear sign
I'm going to say 4
In
Are we going to say
If I do
And then a key of item in qu
In
Exclude
Then what we want to do is we want to
Otherwise what we're going to do
Is ringing to say adjusted items
Dr pen
Adam
And then adjusted weights
Was equals
Adam and then in quotes
Wait
Ok and then we need to make sure that under this adjusted items line
Me to say
Justin Waite
Sum is equal to
Right so what is this
So we're iterating over each item in our internal items a race of this one up here that store
So it raining all over there
We're getting the adjective
The guitar variants that stored at the key item
And chatting if that item is nearly excluded and this is basically a shorthand way of saying
Iterate over the exclude array
To check if this item is inside
We are
And now I continually
Is it different than bread
Break will stop the execution of
The four
Overall
Continue
Will
Stop the execution of this specific
So continue essentially means OK Google next item in the
If the item is not in our exploration what we're doing is work adding that to the adjusted out
So this is our new right and then we are also adding the new weights
To that adjusted weights
And soul
In our chosen week now and in this blackout here we need to change what numbers are being
So this week some here
Needs to be adjusted weights on
And then for item in this has to be adjusted
This is basically going to have this is not gonna change if I exclude eraser
Because we're signing the adjusted items to the reference
Of this I am the real
And there were also a signing the adjusted weight some to the
Toroid
So and then we're just essentially recalculating it if the excluding Ray
Present
A word about this is that this is not the most
Performance code is going to be perfectly fine for our use cases
But
For example you have
Let's save 500 upgrades
And you pass in
And excluded ray of 200
You are going to
Perhaps see some mothers what issues because
You'll be iterating over this loop 500 times
But then you'll be iterating over this
200
So you're doing a loop of 200
Within a loop of 500 and you can see that can stack up pretty well now
That's a very specific Circumstance and we're not going to be
You can probably safely do a couple hundred
Upgrades and as long as you're excluded
Doesn't grow any larger than life
We are 4 or maybe even 10
It should be fine so
The point is this is the quickest and easiest way
To get this algorithm
To pick items to work
And it will work with relatively small
Erase
But just be aware
That
This can present performance problems
If you're arrays are pretty
But I think we'll be ok
With what we've got here
Answer now what we can do as we can go back to her upgrade manager
And we got these chosen upgrade
We can just feed that back into
Upgrades for pick item right so we can say chosen
Upgrades
So keeping track your children upgrades and then were feeding a back into pick item as our excluder resource
Don't pick any upgrades I have already been
And then we can get rid of this
Silted up
Here
And we
Just need to fix this check here so
Let's just make this cheque effectively the same as what we have so we don't have a filter upgrade anymore so why is this
This is essentially here
We is there are no options
To pick any
Right
And how can we check that well it's very simple we can just take the upgrade pool
Items
Because that's are a right here right
Upgrade product items that size is equal to 0
But our chosen upgrades
Start
Size
Right so central what was saying is if the exclude array
Is equal in size
2
The overall items around the upgrade pool
Then what that means is that
They are all of the items in the pool are going to be excluded and it's going to be a pool of 0
Write the table is going to contain 0 valid
This is effectively the same chat
There
So let's just do a quick check to make sure that are upgrades are still working fine
Alright so we've got sore damage and sort quick
I can pick up the sword quickness
Ok so when I chose the axe I got a crash and that's because we're still
Treating the upgrade as if it was
A
An array but it's actually still waiting
So I'm going to start again
They should be fairly easy to deal with basically what we're saying is
Once the
Quantities equal to the mass quantity we want to remove the item from the upgrade pool
So what I'm going to do is I'm going to go back to my weight in table
And I'm going to create a function called remove item
Underscore item
And we are going to pass in the light
To do as we're going to say
Items for items array
Is it good to
Items.for
In a passing the filter funk
And
Were going to say
Funk
Colin
Item and then the key
I know this
Confuse
But so the ski right here
Is equal to
Let's let's rename this parameter item to remove
Just so it's more clear
So we're going to remove item item to remove
We're going to set the items array equal to a filter version of the items array
Where
The item
Is not equal to
The item
And we need to
Return this
Return the object that exist at the key item within the current item that were looking at
And and
It's not equal to the item to
CL saying give us all of the
Items in the items array that are not equal to the item to array
And we need to recalculate your weight some so
Let's say wait so many people 20 and then we'll write a quick
For loop for item in
We're going to say wait some
Equals item
Wait
Some
Or sorry this is just wait here
So I am and then the key
Wait because that's what an addiction
Remove the item for the list or rather the proper way of saying this is
Get all of the items
In the items array that are not equal to the item to remove
And then set the weights under 0 iterate over all of those new filter items
Adding up the weights into the weights
So now when we go
Back 2 hour
Upgrade manager
You can see that now instead of doing the filter here in our upgrade pool
So in the supply upgrade method
We were filtering it instead we can do upgrades Poole
Remove item
And we're going to remove the item that is this up
Ok and so that should probably remove the axe from our pool
Let's go to our basic anime scene
Let's turn up the volume drop to one sort of I'll drop presenter 21
So that we can test it proper
Came in and pick the axe
No errors this time and I shouldn't be able to pick the axe
In the future
Ok all looks good
There's one more thing to do in that is to make the damage work
So let's open up our sword ability controller
And will open up Dad's
And you can see that are on ability opera
Added this is where we want to listen for upgrades and we're going to get
All upgrades sent here now we have this built with the assumption that the sword rate is the only one
Can happen
What I can
Affective disorder
Are we actually have a new one sword down
And so
What we can do is before I go any further I'm going to rename this to base damage
Just like so
And then I'm going to say
Create a new variable via additional
Damage
Percent
What's that one and why resetting at 1 because when we multiplied base damage by additional day
Percent
That will return 5
And then we can just increment this number to increase the Malta
So
Back down to the bottom of the strip we need to replace this with base underscore damage so sore instance
Hitbox component that damage
Is it going to be snowing which time
The additional damage percent
CC Alex
And then our own ability upgrade added functions
I'm going to remove this return
And then I'm going to indent all three of these lines underneath
Ok and I'm going to change this
Check
This operator to IKEA
So if I break ideas equal disorder
Do all of these things
Then we can do an Elsa
So
An Elsa fingered all is done with l
Glif
And this is basically saying
Only moved to this black
If this block fails so if this evaluation is false
Then move on to this evaluate
So I can say hello
Upgrade
Is equal to
Sword underscore damage
Which is what our ID is right here
And then what do you want to do in here
Additional
Damage percent plus equals
And what do we say
Lights 15%
So weird
Plus .1
Ok
So that is our sword damage increase let's do the same change for
Ask
And I'm going to
Cheat a little bit I'm going to copy this
Honour building upgrade Adams function right here
And
I think I should be fine so I'm going to open up these sort of sorry the accessibility controllers
We need to go ahead and paste
So disorder building upgrades added
Graco back to my sword ability controller script copy this game event line from the ready method
Just because I'm lazy and I
And Pace that in the ready method
The axis
You controller
We can get rid of the second a lift black hair
And we can
Basically get rid of its now I'm in a ride pass on here cos I'm realising
We implemented the Sword of odour control damage slightly wrong
Instead of just simply adding
10%
In the Army building upgrade
We want to read
The credit upgrade quant
Right so we want to say
Additional damage percent
Is equal to
1
Plus
And then let's remove the point 15
In parentheses
Credit upgrades sword underscore damage
Quantity and then multiply that by .15
And the reason why we want to use this instead of doing a straight edition
We were doing
Is because you can imagine a situation
We change the quantity
More than one
Right so we say oh and 2 instead of 1
Well this would be incorrect then if it was only a
15% of 30
So we're going to read the current up
And then make sure to change this key to sword Dam
Write this needs to be the same
I just need to be reference in this order
Alnwick
X
Point
So now let's go back to the accessibility
And we have
Damn
So let's change this pop grade ideal line 2 x underscore damage
And we can do the same thing so we'll see
Up online 50-in a change that variable
The base damage
Never going to create another variable
Additional data
Equals 1
Ok then would change the line 26 down here on timer timeout
Damn
X
Additional
Damage percent
Ok
And then
In here we're going to say
Instead of writing pass will do additional
Damage percent is equal to 1 plus
In parentheses
Current upgrade
Kid with
Ask undiscord damage
And then
Quant
And I multiply this by I believe it was 10% right
Search open up her act
Yeah
Set someone x
Ok
Let's see if he's upgrade work
And the beautiful thing about this is we have floating number
And so we should be able to see
Does flooring number
Affecting the day
Wireless did axe damage in we should see a number greater than 10
There we go
Now if I select a sword damage what you'll notice is that
We're going to start seeing decimal
And we don't necessarily want
That
To be shown at least not to that degree
So we need a form
That text when responding the
Next dimension
And this will be the final thing that we need to do for this lesson
I'm going to go and open up the herb box component
Which is responsible for formatting the string
And we need to format this properly according to
Actual value of the number and sort is it a little bit tricky and
There are formatting string documents that I'm going to look
For this lesson
So you can take a look at the mess and Resources
To read the documentation about string formatting
But basically the way that we can format decimal places is we can do that so I'm going to say
Bar
Former
Underscore string
Is equal to in quotes
Percent
0
1
Ok so this may be a little bit confusing
But essentially what is the saying is
Add no padding so just make the string as long as it used to
And format to 1 decimal
That's what the saying is
Fminside at 6
In the way that we use this is we can do
Instead of doing the string or remove that
Will do
Format underscore string
NN percent
Hitbox component bad day
So now we run that what's going to happen if you're going to start seeing
.0
So it's one decimal place but we don't want that to happen
Or
We only want that to happen if there's actually a decimal number
Like 5.8 like that showing up right there
So the way that we're going to do this is this is why
We store
Format string in a bit
So
In her basket
Script let's write an if statement if round
And then we're going to take that hit box component that damage
Is that number round
Is equal to
Beatbox component that damage
Then we're going to say our format string
Is equal to
We're going to make it the same string except we are going to
2
0
So what actually saying is
If the rounded
Value of the number is equal to the number of cells that must mean that it's a whole integer
Right
And so we're just going to set the format string 0.0 and what this essentially does to is this tells us to round
Number
Well
0 decimal places that's what rounding
By the way was one decimal place it rounds to that
What is right
So
That's basically it's a real sign in the format string to have 0 decimal places
And now
When you
The game
It will only show the decimals
Phone numbers that actually have decimal digit
That was a long left
Got a lot done
Our wedding table is now much more powerful than it was and we have plenty of room to add even more can't
I will say that if you don't like the look of the decimals
You can just set your format string to this is 0.0
Value
If you just want a round all the numbers and you don't care about being act
So another option is you can be fab all of the damage numbers and
The health of all the entity
To the point where
You don't need to be super specific
Encourage you to play with any of the numbers play with the drop raids that helps the damage
Those are super important to match me
Make it feel how you want to feel bad
This is how you can format string
To display
Properly
Alright and
We've got
Two new upgrades done
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.