All language subtitles for 40. Using a Weighted Table for Enemy Spawning

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Now that we have another Enemy we need to make this enemy able to spawn as the game

Progressive

Now this is going to be a little bit advanced were going to

Create a loot table

Which

Is 9

Going to be used for loot essentially what working a create is a weighted random

Table

And we're going to be able to do is

Control how likely it is

That's something we'll be picked a randomly from a list

And the reason we're going to do that is because let's say that we go our enemy managers

Let's say that we simply export in a rave pack scenes

And said

Just pick a random scene from this array and use that as the enemy

The problem is that if we get two adding three or four or five enemies

To the game

They're all going to have an equal chance

Of being Pig

And that

May not be in the best interests of the balance of the game

Subtitled by online-courses.club We compress knowledge for you!

You may want to spawn

Less of the weakest anime as the game goes on in Moor of the stronger one

Right so we can control that by creating a weighted table or a loot table

And again not necessarily used for Luke just you

The tube

Values and have more control over

The random

So we're going to create a script that is going to represent our awaited table and then we're going to

Use that

For our enemy man

So let's go ahead and create a new folder under the rest

Route here in the filesystem

How to create a new folder Liscard scripts

And under scripts let's create a new script

And let's call this script

Waiting

Underscore

Table

GD

Create a let's go ahead and double click waiting table that gd200

We don't need to extend anything so let's get rid of this line and replace it with

Class underscore name

Waiting

Table

Impact

It's just like that

Ok we're going to need a variable which is going to represent our internal array

And so we're gonna save our items and this is going to be a ray

Of time

An array of objects

Piers Morgan

Let's create a function

Call

Add underscore

Ok

Then we're going to take the first argument is our item in the second argument is going to be our way

Which is an integer

And how this is going to work as we're going to

Take that items array

We're going to

A pen

A new dictionary item

And we're going to call this idea

I don't like snow

And wait

Wait

Like cell

Summer adding in object a dictionary

With the key item

That represents our item in this can be any type that we were

Sonar case where can I use it for Pat Simms

This is just going to be a connect

And then wait is going to be an integer always now before I go any further this items could potentially been also

Just going to initialise items

Up here

To be an MP

Alright son now is create a function called pick underscore

Adam

This is where the bulk of our logic about picking items is going to go

The way it works is you iterate over every element in the array

You keep track of the sum of the weights as you iterate

And then you'll see if a random integer that you pick

Is less than or equal to the sum

Memes that you should pick that up

So I'm going to go over that again as write this

That's the basic idea so you essentially keep a running total of all the way

Calculate

Until

You meet

Or exceed

The weight that is randomly chosen at the beginning

Solicitor

Bar

Chosen

Underscore wait

Is equal to

We want to do randai Range which generate a random integer between a given range

And this is

Inclusive

So what that means is that

Wearing a supply one as the first one

Anna last weight is going to be our wait some

So wait

Underscore some

And this is inclusive of this is 100

Then

It will pick anywhere between 1 and 1

Which includes one

No we don't have the sweets

White because we need to keep track of that so I could top underneath items array

Let's create a white sun

And initialised to zero

And then whenever we call ad

Let's incremental weights

So wait

Some

Plus equals

The way

That were passing in

So now we calculate your weight some this will stay in sync with the with all the weight

We've added

For each

So again

Each item has an individual with

But we're keeping track

The Torah wait because that's what we're going to

To pick

The random Range store picking between 1 and 1

Now we need to keep track of a

Iteration

Some

So let's create a variable interaction some and initialised that 20

And then we're going to do for work

For item

In item

So this is going to iterate over this array

Pulling out each one of these dictionary objects in Division

And what we're going to do is work going to increment our generation some

Buy items that way

Just like so

And then

What we're going to do is we're going to check

Chosen

Is less than or equal to

That iterations

The NED memes that we've

Landed on the item that we should return

In this case

I'm going to return

Item

Dot I know that's a little bit confusing

This item right here represents this dictionary object

And then this item represents that

Now I believe

This is actually incorrect so this is the way that you would reference

Properties within an object

But this is not the same type of undertakers addiction

So we actually need to

Used to reference the keys with

Brackets like so

And then

In quote wait

So this is how

We should reference that dictionary

So now we've got our pick item so again

Or basically just choosing a weight that is between 1 and wait some inclusive

Keeping track of the current iteration some by adding each individual wait as we iterate over

Adam

But if I chosen wait that we chose

Here is Leicester equal to our Generation song

Just going to stop and return that

So you can imagine

What should we have one either

Which is

Has a weight of 10

If we choose let's a five

Azhar chosen

Then

This is going to return true and return at item

If we choose 11 then there's I am knocking

Play we had a second item in addition to

Weight of 10

The had a weight of a hundred

So our total weight is 110

And if we shows 11 in that scenario then we would choose the item

Dad has the way

How to make

Should make more sense as we

Continue

So that are away today table

Now how do I use

What's open a bar enemy manager script from the main here

And we have our basic enemies

Here

What I'm going to do is I am going to

Create another export variable

Cold wizard anime scene

And it's going to be uptight packs

No I'm going to click into the enemy manager scene with this button here

To go to the scene

Where I can drag over the wizard anime scene

Here so I'm going to search for my file system

4 wizard

Scene

And I'm just going to go ahead and drag

Ok so going back to the enemy manager

We have these to see

Now what do we want to Akon

We want

To start spawning after some

Time

So using our loot table how can we do

Or are waiting tables

So what I'm going to do is I'm going to create a new weighted table

Bye

Create a new variable I'm going so far

Waiting

Table

Actually let's call it enemy table

Is equal to

Where did table.new

So this is how you create a new instance

That class that we define

In our waiting tables

And in the ready method what we're going to do

Is we're going to say enemy table

Add item

And we're going to pass in our basic anime seen as the item with a weight of 10

Ok perfect

So let's go down to on timer timeout

And in here instead of referencing a basic anime scene

Directly

Let's do

Another variable above the end

Enemy underscore scene

Is equal to

Wait

Table or song

Anime table

Pick

And this is going to return

One of the Pack seems that we configured in our table

And in this case it's just going to be the rat and

So here make sure to replace this basic enemy scene

Are you on timer time out to

Anime sing instead

And that should be good

So if we did everything correctly the rat

Should still be

Spawning

And actually

This basic anime scene here in my manager

Is still set to Wizard

So let's go ahead and search for the basic enemy here

And drag it over

Into the first light here

So now we've got basic enemy

And The Wizard

Subtitled by online-courses.club We compress knowledge for you!

So let's Run the game and make sure that work

So everything's the working which means that are way

Table is working

Now how do we make the wizard store

Spawning later in the game

So we've got this on Arena difficulty increased

So very simply

What we can do in this

Signal handler

Is we can say something like

Yes

Arena

Underscore difficulty

Is equal to 6

So that's 30 seconds into the game

What we're going to do is we're going to say

Anime table

And we are going to say the item is H

Wizard

Anime scene

And we're going to give it away

Top 20

So you see how this is working we're doing this wizard my seen a wait that's greater than the rat

To make it appear more calm

And so since the total weight by the time we add the wizard is going

30

There's actually going to be a 33.3

Percent chance of the rat spot

And a 66.6% chance

Of the wizards

And then we can

Weekend extended this further with other any type so we could say

LS

Arena

Difficulty

Is equal to

12 which would be 1-minute

Then we can add another Enemy

Right

But we're not going to do that

And so we can change this number later bye

Basically what I should see is by the time 30 seconds rolls around

Wizards should start spawning in addition to

Surat

And here comes some wizards

And I've got wizards coming out me

That should be the majority of the things that are pink

Now the majority of the enemies

Yes I look at all these wizards coming in now

There are still here at mixed in but it will mostly be wizards now

And now we've got multiple enemy time

Work

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.