Final Fantasy Wiki
Advertisement
Gilgamesh-ffv-ios-portrait
Gilgamesh: Enough expository banter!
This talk page is used for discussing improvements to the page "FFIX AI". It is not the place for general discussion or sharing stories about the topic of this article.

Fixing the display

Hello everyone and thank you for the module, JBed.
I see three problems that could be fixed though:

(1) The whole code is put inside a < p>...

tag except for the first and last lines, for some reason. It creates an extra space after the first line and before the last line.

(2) There is no line break when there is no colon (used for indentation). In particular, the global and general variable declarations are packed on one line.

(3) The wrapping doesn't look very good due to the indentation. When a line is too long, it goes back to the extreme left of the caption. In my opinion (but that is more a personal taste actually: I'm not sure if there is a way to satisfy all tastes), the wrapping should be indented like the line. I have tried to remove the < br> tags and put lines inside the tag < div style="padding-left: (#coloncount*10)px;">... but I failed miserably. It would also make copy/paste of the code less practical so I don't know... Maybe a solution would be to disable wrapping and add an horizontal scrolling?

Anyway, as it is, the code looks very good already. The new font is a bit smaller and makes the 3rd problem less important. You can see the 3 problems in the page of Amdusias for example.Tirlititi (talk)

Thanks a bunch! Tirlititi (talk)

About RandomAttack

I have tried to understand a bit of the way the attacks are randomly picked with the most common process, which is replaced in all the scripts here by "RandomAttack". So here is how it works in details:

Initialisation: When the attacklist is initialised (usually in the "_Init" function but also in the "_Loop" function sometimes), a shuffled list is generated. It's a list of numbers [ 0, 1, ..., number of attacks - 1 ] that is shuffled using the Fisher–Yates algorithm. I'll call that list "shuffledlist".

Picking Attack: The first element of shuffledlist is picked as the attack index that will be picked assuming that the attack is valid (ie. the enemy has enough MP and a valid target is available). This first element is then re-inserted to a random position of shuffledlist (more frequently toward its end). If that (previously) first element is valid, then it's returned as the "selectedattack". Else, shuffledlist gets cycled: the first element is checked for being the attack index and moved to the back of the list, and this is done at most "number of attacks" times. More precisely, this whole step is:

"MoveListElement(a, b)" must be understood as removing the element "a" of the list and inserting it back at position "b" (such that list[a] becomes list[b] and all the elements between the indexes [a,b] are shifted to the left).

Thus, assuming that all the attacks are valid, the chance of using the same attack index twice in a row is given by . There are more chances if the attack is duplicated in the attacklist of course (in some rare instances, like in Earth Guardian's AI, the same attack is duplicated and the target conditions are not the same for the duplicate).Tirlititi (talk) 17:56, February 18, 2020 (UTC)

Advertisement