FF6 Hacking
Events: NPC scripts - Printable Version

+- FF6 Hacking (https://www.ff6hacking.com/forums)
+-- Forum: Discussion Forums (https://www.ff6hacking.com/forums/forum-5.html)
+--- Forum: Magitek Research Facility (https://www.ff6hacking.com/forums/forum-9.html)
+--- Thread: Events: NPC scripts (/thread-2310.html)



Events: NPC scripts - B-Run - 07-31-2013

So, early early in the game, I am working on NPC scripts for some NPCs that walk around, the problem I'm having is that when I enter a battle or even my menu window, when I come back the NPC script starts over from whatever position the NPC was in ending in the NPC traveling outside of where it is supposed to go.

There has got to be a setting or an override bit or something that remembers where the NPC is in the code so when the screen is restored, it doesn't start the script over. I just don't know what that bit or setting might be.

A little help?


RE: Events: NPC scripts - Gi Nattak - 07-31-2013

Ah yes, this is the bit you seek here:
1B6 B6:6 Maintains the state of NPCs (after a battle, for instance)

Needs to go in the entrance event.



RE: Events: NPC scripts - B-Run - 07-31-2013

(07-31-2013, 05:51 PM)Gi Nattak Wrote: Ah yes, this is the bit you seek here:
1B6 B6:6 Maintains the state of NPCs (after a battle, for instance)

Needs to go in the entrance event.

Thanks again Mike! Does it need to be set every time or is it persistent until i clear it?


RE: Events: NPC scripts - Gi Nattak - 07-31-2013

Hey np, glad I can help. =)

And yeah, it will stay persistent working as long as it's being set there in the maps entrance event. I've never used it outside of that. I'm still a little confused on how the bit works - like if you have it being set in a cetain map for an NPC(s) movement script, it does not effect any other maps NPC's movement scripts - so it seems to get cleared some other way I guess outside of the entrance event, as opposed to how most bits are set. Hm. Maybe it's one that is cleared on each step, which is why it would be used in the E.E., as to just stay set while on that map.


RE: Events: NPC scripts - B-Run - 07-31-2013

So it doesn't seem to be working. I set the bit, ive got the RAM opened and can verify that I am looking at the correct byte and correct bit, and it is definitely set... but when I go to the menu and back my sprites are still starting their scripts over... the sprites themselves stay exactly where they should be... just the scripts start over (which is exactly what it was doing before). Thoughts?


RE: Events: NPC scripts - Gi Nattak - 07-31-2013

Ah my bad, I forgot what it needs is a check for the bit instead of setting it - so like this:

C0 B6 81 B3 5E 00

= C0 If ($1E80($1B6) [$1EB6, bit 6] is set), branch to $CA5EB3 (simply returns)

Also to be safe make sure it's the first thing in the entrance event, but yeah that should do it now. Sorry about that =)


RE: Events: NPC scripts - B-Run - 07-31-2013

OOOOOOOHHHHH! That makes sense! because it runs the entrance event every time the screen loads for any reason... so by sending it to return, you are skipping the games queue to start the script over again! Thanks!