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
One problem that we still have that you may have noticed as that you can pick the accessibility multiple times now
If you are building a game you may decide that is fine that you want to play to be able to stack abilities but for
Purpose of this course we don't want that
To happen
And so we're going to prevent that from happening
And what we're going to do essentially
Filter out
Upgrades that exist inside the upgrade pool
In the upgrade
So let's go ahead and click into the Opera managers script writer
And
What we need to do is essentially modify the upgrade pool to pick up
Archie
What we're gonna need to do as we're gonna need to specify a Mac
Quantity for
Turn up
So let's before we do anything
I'm here go to our resources directory and then to
Let's double click on ability upgrades
Dodgy
Add LEDs
Do a Max quantity above
The name
So we're going to do at Expo
Bar
Max underscore
Subtitled by online-courses.club We compress knowledge for you!
Quantity
And that's going to be of time
And we will set
2
Willie Venezia
And what I mean is that there's an you can have an indefinite number of these up
Ok so we have an X quantum you probably know this double click on her x
And the max quantity is not
Showing up and I have a feeling that this might be a good deal issue
So what we're going to do is before we do anything
Let's click this to a button right here
This
One that says managed object properties when you have over it
Go ahead and just
Harvey Proctor
Ok and then let's remove the Script by clicking this
Button at the bottom this reset but
That's going to get rid of all the properties
What's drag the ability dodgy back on to it
And now we have matched
That's probably a good elbow
But no worries we can go back to the store button here
Pace properties
And everything should be more
Restore
And now we've got the max quantity
This may not be a problem in the version of Google for that you're using
I'm on release candidate to so it may still be a remaining bug
In any case
Where is the fix for if you end up with a problem
And we're going to set our Max
Be here to 14 the
Which is basically saying we can only have one accessibility at a time
And the sword rate is also problematic because if we let it go indefinite
Then it could have a greater than 100% reduction
In it's cool down time
Which doesn't make any
So we're going to limit these sword great let's say we can limited to
What's the safe
Sorry to say you can do up to 50%
Sore
Tagra
So we've got there quantity defined in both are
Axe and sword resource
Let's go ahead and open up the upgrade manager script
And now we need to filter out the up
Import and this is luckily going to be
Pretty
So here we have the supply upgrade
Function and this is where we going to be doing our pool
So
We have our upgrade
And what would I do is really say a new plot
And we'll say if
Max quantity is greater than 0
Then we want to do so
Filtering
So let's grab the current quantity
By doing vodka
Quantity
Is equal to
I just copy this line on
22
Credit upgrades upgrade.ie
Going to say that
So that's going to give us the current quarter the after
Stop lying
And then what will say is what I say
Current
Equal to
So if current quantity is equal to
Upgrade dart Max quality so this is the point at which
We are going to want
Remove this upgrade as an option from the
Upgrade pool
So the weather
Do that is we will filter it just like we filtered
Down here in our pick upgrades funk
So we can do basically the same thing so I'm going to say upgrade
Equal
Upgrade
War dart
Filter
Supply and inline function again
Funk
Let's say
Google underscore upgrade
As the argument is coming
Inline function
So that's our one of our pool upgrades again
The filter function
Works by applying the inner function for every single lol
In the array
And if there's a function Returns true then
Never Returns false
Women's heels
And so
We're going to be calling after
Funk poor upgrade
And what week
Return true
If the ID is not
The current
Right so I'm going to say return
Upgrade
I D
Is not equal to
The upgrades coming into the supply upgrade function
Ok that updates our upgrade pool cause again the filter function Returns a new array Swift
Override the upgrade
And I believe that should be it so let's go ahead and
Play a game
And what we're going to do is we're going to see if we can
Take the ass
So I do the first up
Ok I'm going to pick the
And then
Going to level up one more time
Where's my new accessibility
And see
So I ended up with a problem
And the problem is that
We're gonna crash and the reason is so
So think about
The crash little bit a good actress
So
Sing For A Moment to yourself
Why do you think work experience in a car
What's review the code
So what is the code DO
Well we're filtering out some upgrades right but then we're also running pic
Upgrades
So think about yourself a little
Here's Leanne
Pick upgrades
Always
ASDA cheese
2
Because we've hardcore
To hear
The problem is once we filtered out the axe in since we only have 2 upgrades total
13th zodiac
There's only one upgrade left to choose from
Now that would be fine x x
Remember where filtering the upgrades as we pick them in the pick-up grades and May
And so we're actually ending up with an empty array after it picks the first sort of
Why
Because it's picking a random element from the filter upgrade
Adding that as an option
2 hour
You ice cream by adding it to this
And then is re-assigning the still upgrade by removing
That option
From
The
And sold by the time we hit the second iteration
This pic random is returning now
Because there are no Ella
Unfortunately the fix for this is going to be rather simple
We just simply have to check
Chosen upgrade
Is equal to null
We're going to
Warwick
And so what brake does is it ends the function or the for loop execution so this could be
10000
Chooses on Noel option on iteration 2
It won't not do the rest of the 9th I
And choose an upgrade
I will only be now if they started up
Here's my
So if they're
At least one element it will never be no
But
It can be
So that should be the fix
Let's Run the game again in make sure that
Is working
As we want
Ok I'm going to pick my ass
And then
So now that I've levelled up again
You can see the
My only option is to increase the sword
Now
There is a problem here
And we will probably address it later
If you
Keep playing a game until
Required
Sword upgrades
Then what will happen
Is
The game of soft lock because there will be no options presented
To the UI element that is pausing the sky
We will address that later
But for now we've got a couple of errors being printed in a console
And
These errors are telling us that we can't
Values from an empty array
So if we double click on this error in the console
You're take us to the upgrade manager
It looks like we just need one more
Check
Or I guess we should probably change this checks
This chat technically works but
It's printing errors to the console which means it doesn't like the way they do
So instead of doing that what we're going to do instead as we're going to
Write a different estate
If filter upgrades
Dart
Size is
Equal to 0 then we're going
And we can remove
Directions stop printing
Clothes airer
Ok thanks I just got my second
Upgrade here in a minute longer seeing any errors
Next to the console
And that should be good now one final thing that I want to do
Before ending this lesson is the axis or little bit too frequent so I'm going to control shift
I'm going to open up my accessibility controller
Right here
And I'm going to click
Timer
I'm just going to up the wait time for something
Next 3.5 which I think is a little bit
Reason
And then I'm going to go ahead and run it
And let's see
How that feels one side
That feels a little bit less soapy to me
Engine has plenty of room
To improve the access efficacy
With upgrades
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.