Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: DLPB_ on 2014-08-26 21:35:50

Title: What condition sets this dialogue?
Post by: DLPB_ on 2014-08-26 21:35:50
Original game text (junone7)

Scarlet
“Why are you still standing there!?
   Catch her and take her away!”

junone7 > sca > script13 > 11

This will be shown if [5][16] var is 6.

That variable is set to 6 in one place (undersea water pipe): spipe_2 > Bubble2 > s0 main > 20

What this has to do with the above interaction with Scarlet is beyond me.  Unless this var is set to 6 here for totally unrelated reasons?

Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-08-26 21:51:37
...That variable is set to 6 in one place (undersea water pipe): spipe_2 > Bubble2 > s0 main > 20

What this has to do with the above interaction with Scarlet is beyond me.  Unless this var is set to 6 here for totally unrelated reasons?

Doesn't matter where else this is set. Bank 5/6 is temporary and is reset each time the field changes. If [5][16] isn't set on that field then reading it will always return a 0.

That said, Scarlett's Script 11 starts with "Var[5][16] = Var[5][16] + 1 (8-bit)". So if that gets run 6 times then your text gets displayed. I would assume a certain condition during the slap-fest.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-08-26 22:03:16
I forgot about temp banks...

You're absolutely right.

I'm thinking the dialogue occurs if you do a perfect slap count... i.e, scarlet does not land a single shot against you.

But I've just tried my hardest and she always gets at least one against me.  I'll keep trying.

edit.  Seems all you do is hold circle... but even then she lands a shot.  I don't see any way of getting this dialogue to occur.  It may be a script error (either you were meant to be able to do a perfect game against her, or the dialogue was meant to be shown due to some other factor).
Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-08-26 22:05:40
What happens if you don't slap at all?
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-08-26 22:07:31
Same dialogue.  Although by doing that you've found an error in the retranslation project :P  So not a total loss.
Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-08-26 22:08:36
Same dialogue.  Although by doing that you've found an error in the retranslation project :P  So not a total loss.

Glad I could help  ;D
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-08-26 22:12:59
From what I can see, to beat her you need to slap her 5 times... that's where the var ends up as 5.  But that dialogue requires 6 slaps, which may be impossible due to a script oversight.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-08-26 22:16:47
OK you can do a perfect run against her.  By timing circle presses properly.  But even then 5 ends the bout with the same dialogue.  I don't think that var ever reaches 6...
Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-08-26 22:44:34
From what I can see, to beat her you need to slap her 5 times... that's where the var ends up as 5.  But that dialogue requires 6 slaps, which may be impossible due to a script oversight.

Kind of how the 1700 points on Tetra Master results in erroneous text. I guess that should be fixed.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-01 19:15:40
Condition 2.  World map.  Canon has just disappeared from Junon.  This dialogue is supposed to be shown when Cloud notices that the canon is no longer there.  However, I can't make this dialogue appear.  Similar dialogue always seems to appear in Junon itself when the party notice the canon is gone, and then a var is set which must be used to make the canon disappear from the world map model.

In any case, I cannot get it to appear.

Dialogue is originally:

{CLOUD}
“…I got the feeling
    I'm forgetting something…”

It may be that this dialogue ended up being unused, because they had the exposition happen on the field instead.
Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-09-01 23:10:31
Have you tried with both subs? IIRC, the "I think we're missing something" happens when you go to the underwater reactor. I know the "you failed the sub game" scenario is different, but the field thing happens earlier than that, doesn't it?

Are you sure it has anything to do with the cannon? Maybe he's talking about the key to the ancients or he left an area before he was supposed to do something...
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-02 00:15:25
Pretty sure it's the canon, but can't be sure.  You can't get to the sub without the canon disappearing first and field dialogue being displayed.

It wouldn't be the first time there was unused wm dialogue though...

Tifa has a dialogue for when the buggy breaks down, for example.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-02 15:32:05
To be honest, the world map idea makes far more sense.  That's how that dialogue should have been displayed.  In the revision they've made, you go into Junon seeing the canon still there, and then suddenly when you arrive at the area, it's gone.  It doesn't work well for continuity.

Somewhere along the line it looks to me like they vetoed the world map exposition in favour of the field.  And I think that was a bad idea.  Further to that, I remember the first time I saw the junon cannon exposition- I thought "What's missing... I don't get it".  If it had been on the world map, the missing canon would have stuck out like a sore thumb.

Unless the dialogue can still be seen somehow.  I dunno. Maybe one day we'll have a world map script editor?
Title: Re: What condition sets this dialogue?
Post by: Kaldarasha on 2014-09-02 15:56:36
Can't you set the variable to remove the canon on an earlier scene, I would say fship_3 is a good point after Cloud has joined the party again and tells the truth.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-02 16:02:53
The variable to remove the canon only removes the model from the world map.  It doesn't invoke any dialogue when you arrive outside junon.
Title: Re: What condition sets this dialogue?
Post by: Kaldarasha on 2014-09-02 16:31:43
Yeah, but it's still better as when it magically vanishes after you enter the Junon event.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-02 16:53:26
Yeah, but it's still better as when it magically vanishes after you enter the Junon event.

Yeah, that's an easy way to fix it so that the field dialogue actually feels right. It would be nice to see if we could restore the wm dialogue though :)
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-03 11:07:28
@nfitc1 me and sithlord had a discussion last night about the save banks, because bank 10 was not remembering the vars on entry/exit to a field.

According to the wiki, this makes sense. It looks like a lot more banks besides 5 and 6 are for temp vars only.  The wiki shows which are saved.   I think it is 1,2,3,4,7, 11,12,13, 14, 15.

Yup it is:

http://wiki.qhimm.com/view/FF7/Savemap

A bit bizarre that bank 7 does not follow on from 4 in memory.
Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-09-03 13:49:47
@nfitc1 me and sithlord had a discussion last night about the save banks, because bank 10 was not remembering the vars on entry/exit to a field.

Here's how I have it set in my list:

Code: [Select]
Handlers:
Bank_0_Const       0x60F88E
Bank_12            0x60F8B9
Bank_34            0x60F8F5
Bank_56            0x60F9F3
Bank_7F            0x60F9B5
Bank_BC            0x60F936
Bank_DE            0x60F977
Bank_89A_Null      0x60FA2B

There is no Bank 0. That's a "read byte at absolute memory address X" command. This is a dummied "return [byte_arg] command". Likely unused.
Five of these banks are saved to the savemap which excludes 5/6. 8/9/A actually have no handler. If they're used in the field scripts they will do nothing. Here's the handler for 8/9/A on the PC:

Code: [Select]
.text:0060FA2B ; ---------------------------------------------------------------------------
.text:0060FA2B
.text:0060FA2B Bank_89A_Null:                          ; CODE XREF: Read_Field_Mem_Byte+126j
.text:0060FA2B                                         ; Read_Field_Mem_Byte+137j
.text:0060FA2B                                         ; DATA XREF: ...
.text:0060FA2B                 xor     al, al          ; default
.text:0060FA2B                                         ; jumptable 0060F887 cases 8-10

Exciting, isn't it? :)

tl;dr: 0 is possibly unused, 5/6 are field-based temporary, 8/9/A are dummied.

EDIT:
Those are the "Read Byte Handlers", the "Read Word Handlers" aren't much different.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-03 15:37:23
1. So what you are saying is 8,9 and A are completely unused, and cannot be used at all by anything?

2. Can world map use temp 5/6 ?  It does seem to use bank 1 for a few things if I recall.

3. Also, I noticed battle temp vars are copied at the end of battle to main vars (like escapes, kills) and that it's hardcoded.

4. Can battle AI change addresses / bank vars? And does it?
Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-09-03 18:45:57
1. So what you are saying is 8,9 and A are completely unused, and cannot be used at all by anything?
Exactly

2. Can world map use temp 5/6 ?  It does seem to use bank 1 for a few things if I recall.
I'm still not sure. It looks like the only possibilities of reading ANY fieldvars are codes 30C, 325 and 326 though I'm not convinced any of them actually do. I think all wm scripts can do is read the game moment vars and their own memory bank.

3. Also, I noticed battle temp vars are copied at the end of battle to main vars (like escapes, kills) and that it's hardcoded.
Only certain ones are copied. Lots of it is discarded.

4. Can battle AI change addresses / bank vars? And does it?
AI can only affect Bank 1/2 and only one byte at a time through the 95 code.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-03 18:55:40
Thanks, last questions :)

1. excellent. Which parts of the original game utilize code 95?

2.  Where is world map's real memory address for its vars?

3. Do you happen to know where bank 5/6 reside in memory

 (I could find these easily but why bother if you know already)

Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-09-03 19:11:06
1. excellent. Which parts of the original game utilize code 95?
It's the AI Code 95. Several enemies use this for various reasons.

2.  Where is world map's real memory address for its vars?
I dunno. I still don't know what all the codes do. I could be looking over it.

3. Do you happen to know where bank 5/6 reside in memory
0xCC14D0.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-03 19:17:25
Which enemies use it?  I need to look at one that does so I can think about making Midgardsormr disappear for good once defeated.  I'll make it set a bit/byte to 1 and then that will be used as a flag to stop it respawning.
Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-09-03 19:22:03
Which enemies use it?  I need to look at one that does so I can think about making Midgardsormr disappear for good once defeated.  I'll make it set a bit/byte to 1 and then that will be used as a flag to stop it respawning.

Ultima Weapon is a good example.

Now that I think about it, I'm sure there's something the world map can read because the "emerald or Ruby is defeated" flags are in Mem block 1/2.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-03 19:25:43
So it's battle that's setting those flags, but wm that can read them ?
Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-09-03 19:40:46
So it's battle that's setting those flags, but wm that can read them ?

Like I said, I don't know if wm reads it or not.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-03 19:42:44
I'm guessing it does, since that's the only way it can know whether to display Ruby's graphic or not.

In any case, I see here in Proud Clod that 95 saves to a var with a value like 7B.  I take it this means byte 7B startng from Bank 1?
Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-09-03 19:56:14
I'm guessing it does, since that's the only way it can know whether to display Ruby's graphic or not.

In any case, I see here in Proud Clod that 95 saves to a var with a value like 7B.  I take it this means byte 7B startng from Bank 1?

Yup.
Title: Re: What condition sets this dialogue?
Post by: Aali on 2014-09-04 23:02:50
For the record, worldmap can read and write anything in the savemap beyond 0x0BA4. See http://wiki.qhimm.com/view/FF7/WorldMap_Module/Script/Opcodes/118 (http://wiki.qhimm.com/view/FF7/WorldMap_Module/Script/Opcodes/118)
Title: Re: What condition sets this dialogue?
Post by: nfitc1 on 2014-09-05 00:10:13
For the record, worldmap can read and write anything in the savemap beyond 0x0BA4. See http://wiki.qhimm.com/view/FF7/WorldMap_Module/Script/Opcodes/118 (http://wiki.qhimm.com/view/FF7/WorldMap_Module/Script/Opcodes/118)

And to declare my inadequacies, I glossed over the 1XX codes because I thought they were just math functions. I knew there had to be something wrong with my answer because it didn't make sense even to me.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-05 00:55:58
Also minigames set vars.  For example sub minigame sets a 1 for success and 0 for loss to var [14][94]

I assume snowboard minigame has to be setting your score / time etc.  And of course, G-bike has to be setting the score you have made.  All hardcoded in exe of no doubt.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-07 16:49:32
Is it just me, or did this issue exist in PSX as well?

At the start in Bombing Mission, if Jessie reaches the door before you after the stairs, she just runs through it.  The door opening is not triggered.

How to fix?  I've had a look at it and can't work out what the issue is.
Title: Re: What condition sets this dialogue?
Post by: Sega Chief on 2014-09-07 21:21:35
I had a look at that field but it was a bit odd. In the walkmesh viewer there's four green lines (denoting Location groups) but there's only three Location groups that are visible in the editor; the two for the ladder and one for the slide (that's unused but probably functioning). The one that handles the door seems to be missing, but functions in-game. Maybe it's because this area was done during the demo phases so there's bits and pieces the editor doesn't recognise? I scoured the other groups for script that handles the door but couldn't find anything.

What you should try first is maybe enabling the Jessie group's 'Contact' (it's set to disabled in her Init). But if that doesn't work, then best guess as to the actual issue is that the game is tracking Cloud's current triangle ID on the walkmesh and continually updating a variable with it. In the 'dir' group's Main script it tracks the Cloud group's Triangle ID to [6][0]. I'm gonna guess that when this variable falls within a certain value, it triggers certain events to happen (a fragment of the old Biggs scene and the unused slide above are there, the triangle IDs for them being stored in [6][2] and [6][4]; at least, the values here correspond to the triangles where these would be triggered).

The reason the Jessie group might not trigger it is because the game is only tracking the Cloud group's position. If changing Jessie's Contact to enabled doesn't work then you could maybe add these lines to the 'dir' group's Main, underneath the line tracking Cloud's Triangle ID:
-) 'Wait 1 Frame'
-) 'Store Triangle ID of the group 'av_j' in [6][0]
-) 'Wait 1 Frame'

If you're lucky, this'll make the Jessie group open the door when she reaches it, as the game will likely just check [6][0] against whatever it is that triggers the door. I don't know if the frame waits are necessary, but best to be safe. Only thing is, if the door is handled by a location group then the [6][0] check might not be used anymore; the other things, like the slide, don't seem to use it now either.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-07 22:48:39
Tried that already and no go...

Makou has a separate section for the door stuff.  I think it automatically knows where Cloud is, but I can't be sure.

Does anyone know if this occurred on PSX?
Title: Re: What condition sets this dialogue?
Post by: Sega Chief on 2014-09-07 23:08:27
Ah well. But yeah, it happens on the PSX PAL version too; just tried it out (console, not emulator just to make sure).
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-07 23:30:15
Well, either script error... or... they just didn't bother programming the game so that NPC / non main char can trigger doors  (and other position events).  Which would be a bit crap.
Title: Re: What condition sets this dialogue?
Post by: DLPB_ on 2014-09-07 23:49:23
There is a way around this , if doors cannot be automatically set by NPC walking near them.  That is to use the "Background" opcode to set the parameter (when NPC has satisfied a certain position).

Of course, this would also mean adding in the sound effect and what not, but I've just done some testing and it works fine.