Users browsing this thread: 1 Guest(s)
Events: NPC scripts

#1
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
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?
  Find
Quote  

#2
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
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.


We are born, live, die and then do the same thing over again.
Quote  
[-] The following 1 user says Thank You to Gi Nattak for this post:
  • Jeff (02-01-2014)

#3
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
(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?
  Find
Quote  

#4
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
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.


We are born, live, die and then do the same thing over again.
Quote  

#5
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
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?
  Find
Quote  

#6
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
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 =)


We are born, live, die and then do the same thing over again.
Quote  

#7
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
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!
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite