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
Indonesian
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
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
Let's look now at the cover system.
This is the system that checks the available cover positions for the current year agent and if it returns
a good one.
The cover system is made out of two parts.
The cover system script, which is found in every instance, and the building script which is found
in every building instance, starting with the cover handler.
The main functionality here is get retreat point.
It can also receive a parameter of a cover that we want to exclude from our search.
Firstly, we need to go through the list of buildings.
To do this, we actually need to get the buildings and they're nicely placed in a good group called
Buildings.
And of course, we do require a target because if you don't have a target, then we don't have a relative
position that we can check to get the cover from next.
We need to set up our strategy.
And there are two strategies.
The first one is get the closest available cover and the second one is get the furthest in case of the
tactical.
Thank you, which needs to take a lot of space between it and the player.
And based on this, the cover distance is either nine and nine or zero, and this will be used to compare
it with the first pick to make sure that the first pick always gets used.
Next, we need to iterate through every single building and then we query that building to get the best
cover.
And of course we need to provide the players position to get the cover from the player and we also compute
the distance from the current enemy to that position because based on that distance, we will adjust
our strategy.
If no cover was found or the cover was excluded, then we will skip it.
If the cover was already used, we will skip it as well because we don't want to use the same cover
multiple times in a sequence.
Next, we actually get the cover based on the strategy and if it's the closest, then this means that
the distance between the enemy and the cover needs to be smaller than the font cover distance.
And from the step above, we actually set this to a high number, so we make sure that the first position
is always received.
And then we set up the font cover and we update the cover distance with this the same thing, but in
reverse, help us to the furthest with one specification that we also need to make sure that the distance
is smaller than the detection range because otherwise we will enter the search target state instead
of actually shooting the player.
After all of this passing of the buildings and covers, if we have found a cover then we need to initialize
less detected cover with it.
We also added to a list of used covers.
This will prevent using the cover multiple times in a sequence.
Then.
Then we complete opposition from the cover position.
We offset it a little on the x and z axis just to give it a more dynamic engagement.
Instead of the eye going to the same place twice for the same cover, the add cover to last used function
basically adds this cover to a list of used covers and based on the max number of used covers, we will
remove the first one.
So we will keep cycling in and out all our covers and your cover.
So in this way we make sure that we can use older covers but not newer ones.
And this list is actually specified here.
So this is the list of just covers and we can specify the number of maximum used covers to seven.
So we need to use seven covers before we can use the first one.
Of course, you can change this value to make it as you like.
Let's now look at the building and see how an actual cover is chosen.
So going inside the building and checking its 3D shape, we find out we have this cover element that
contains four covers because I just picked the four sides of the building.
So we have cover one, two, three and four, and those are rigid bodies because we need to check the
collisions against them and they have a collision shape, which is a box shape.
We also have the cover and this we will actually get moved to the player's position and it will be adjusted
so that it will go through one or a different cover to make sure that it's visible or not from the player's
point of view.
Let's look now at the code.
First we get the list of all the cover points.
So basically get the note cover and get all the children.
We also need to disable the collision shape of this and we will only enable it once we are checking
that particular cover position.
If it's good or not, the main functionality here is get the best cover.
So first we will use this variable font cover and we will set that to now this should be filled with
either a good cover or will continue with no.
Next, the covering needs to change position and it will be changed to the player's current position.
Next, we iterate through every single cover.
Then we of course need to enable the condition shape.
It's kind of redundant because it's disabled false.
So basically it's enabled.
Then we make the cover a look at the new cover position and also we force a request update to make sure
that discovery works properly.
What this does is basically checks if there is colliding and if it is colliding the cover, then this
means that the cover is bad.
But if it's not colliding to cover like in this.
That it's probably colliding an obstacle like, let's say, a building.
So this means that the cover is valid.
And once we find the valid cover, we initialize the found cover of it and we break the execution of
this for loop.
Lastly, we return the font cover so that it can be used by the cover system in the enemy.
Basically, this is how the cover system works.
Of course it will be used by the retreat functionality and by the attack functionality in the case of
the defensive tank.
Let me know what you think about this system in the comments down below.
Assuming the next one.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.