Speed: Turn Order and Escapes

Any information you would like to share or ask in regards to the hacking of Legend of Legaia
User avatar
meth962
Level 23
Posts: 266
Joined: Tue Apr 03, 2012 8:37 am
Location: USA
Contact:

Re: Speed: Turn Order and Escapes

Post by meth962 » Tue Jul 15, 2014 8:34 am

Nightshade wrote:That, or I just read what you said literally three posts above.
Well, bad example to bring it up, but you've done it many times before from different threads. So I thought, you have a good memory, take notes, or are looking up past threads haha.
まさかつあがつ

User avatar
K73SK
Level 89
Posts: 3953
Joined: Tue Feb 01, 2011 7:00 am
Location: USA
Contact:

Re: Speed: Turn Order and Escapes

Post by K73SK » Tue Jul 15, 2014 8:42 pm

Nightshade wrote:That, or I just read what you said literally three posts above.
I had read that too but didn't take it as a conclusion considering I was there was some code in there that said "if enemy count < x, duplicate" or something like that.
GoldenPower89 wrote: I'm a little worried he's gonna start making multiplying enemies now...

Sasquach used Divide!
Brilliant idea!!! I didn't even think about that!!!
Donate to legendoflegaia.net if you are one who wants to keep it alive! http://www.legendoflegaia.net/donate.html

User avatar
Nightshade
Level 60
Posts: 1797
Joined: Tue Jul 26, 2011 9:07 pm
Location: the the the the

Re: Speed: Turn Order and Escapes

Post by Nightshade » Tue Jul 15, 2014 11:10 pm

Darn you, G-Pow! My unending rage upon you! And K73SK too!
Do not question yourself with the why or the how. I simply am, and that is all you need to know.

GoldenPower89
Level 57
Posts: 1638
Joined: Mon Sep 09, 2013 3:12 am
Location: Indiana

Re: Speed: Turn Order and Escapes

Post by GoldenPower89 » Wed Jul 16, 2014 1:30 am

Hey, at least we'll get more EXP. Anyway, we're getting a bit off topic here.

Meth, did you try out Chicken Safe? I actually forgot that item existed until it was mentioned earlier in the thread.
Image

User avatar
meth962
Level 23
Posts: 266
Joined: Tue Apr 03, 2012 8:37 am
Location: USA
Contact:

Re: Speed: Turn Order and Escapes

Post by meth962 » Tue Jul 22, 2014 10:24 am

I have not tried it yet. I'm sure it just changes their AI since they don't actually need to compare speed to run away.
まさかつあがつ

User avatar
Nightshade
Level 60
Posts: 1797
Joined: Tue Jul 26, 2011 9:07 pm
Location: the the the the

Re: Speed: Turn Order and Escapes

Post by Nightshade » Wed Dec 24, 2014 12:18 am

I thought I would ask a couple of questions about this for speedrunning purposes:

1) Do dead party members also contribute toward the party's escape "value", if you will?

2) How does the game determine how many enemies, if any, get to attack before the party can (attempt to) escape?
Do not question yourself with the why or the how. I simply am, and that is all you need to know.

User avatar
meth962
Level 23
Posts: 266
Joined: Tue Apr 03, 2012 8:37 am
Location: USA
Contact:

Re: Speed: Turn Order and Escapes

Post by meth962 » Wed Dec 24, 2014 9:21 am

Nightshade wrote:I thought I would ask a couple of questions about this for speedrunning purposes:

1) Do dead party members also contribute toward the party's escape "value", if you will?
From my notes, I only wrote that dead enemies still contribute to the escape value so I'm not 100% sure if the same is for the party. I'd have to check.
Nightshade wrote:2) How does the game determine how many enemies, if any, get to attack before the party can (attempt to) escape?
Hrm, I thought the standard speed/turn order rules apply. If one of your characters gets a turn, then the escape is triggered. I'd also have to check on that.
まさかつあがつ

User avatar
Nightshade
Level 60
Posts: 1797
Joined: Tue Jul 26, 2011 9:07 pm
Location: the the the the

Re: Speed: Turn Order and Escapes

Post by Nightshade » Mon Jun 01, 2015 11:07 pm

I was wondering if you could post the full complicated formula the game uses to roll for escape success rate; it would be a boon if I knew exactly what it did so I can tweak the speedrun route to account in such a way to maximize escape probability.
Do not question yourself with the why or the how. I simply am, and that is all you need to know.

User avatar
meth962
Level 23
Posts: 266
Joined: Tue Apr 03, 2012 8:37 am
Location: USA
Contact:

Re: Speed: Turn Order and Escapes

Post by meth962 » Wed Jun 03, 2015 1:59 pm

The quick explanation from the guide:
"- Escaping -
The game keeps track of how many times you escape, so be aware! Your escape
chance is a comparison of the sum of your party's speed, and the sum of the
enemies' speed. The health of your party and enemies affect the chances too:

1. Damaged players/enemies add more value to the speed roll. The more hurt you
are, the better your chances.
2. Full life players/enemies only add their speed stat.
3. Dead enemies actually contribute to the chances (and a lot since their hp
is at 0). This means its harder to run away from enemies if there are 1 or
2 dead.
4. The Chicken Heart accessory adds 50% to your runaway odds and Chicken King
guarantees an escape unless a boss or event battle."

And formula below:

Code: Select all

// Sum up party's speed values, adding more if injured
(speed += speed*2)/2 + (max-hp * 16)

if char_flag 0x100000 set 1 to r16 // 50% boost, this is chickenguard
if char flag 0x800000 set 1 to r17
    if map_flag is not 0 add 2 to r17 // 100%, if not a boss. This is chickenking

// enemies
(max-hp) * 32 + speed

r18 = party
r19 = enemies

r18 += rng%r18 // add rng
r19 += rng%r19 // add rng

if r16 != 0 add r18/2 to r18 // This is the 50% boost flagged from earlier (chickenguard)

if flag_enemy == 0 // This is a boss flag or 'no escape' flag
  if r17 != 0 set r18 = r19 // Game sets these equal so that the following condition always fails

if r18 < r19 // then escape!
I shortened up the first line and summarized it because the steps to do that are like 15 lines long. Also all hardcoded multiplying was just bit-shifting so I normalized it to make it easier to read for those not familiar with bit-shift operations :)
まさかつあがつ

Post Reply