How do I identify a monster programmatically on a screen?

cargo

spam bots yandex
Hello. I was wondering if anyone could help me figure out this technical problem.

Say I got 4 monster NPCs on a monster group placed on a particular overworld screen. The player talks to one of them. How can I find out which of the four NPC monsters in the group the player talked to? For example get a number from 0 to 3 that tells me which one of the four player is talking to. I mean if that's the way the engine works. I have some idea of what is going on but not this specific. The purpose being to uniquely identify the NPC programmatically (at least for the purposes of a single screen).
 

dale_coop

Moderator
Staff member
I think you can get this information from:
Code:
	LDA Object_ID,x  ;; <<--- returns 0, 1, 2 or 3
In the HandleObjectCollision.asm script, the isAnNPC subroutine uses it (when assigning the correct Text to the NPC).
 

cargo

spam bots yandex
So the value in register x only counts up to four for that particular routine? I wasn't sure if it did. Thanks Dale.
 
Top Bottom