Quote
Originally posted by diordna:
Okay, then here's an idea: does the NPC follow the player around? If so, you could be able to determine the NPC's approximate location, within a 1-square radius around the player or something like that. As I said before, just use globals for X and Y. Hmm...
This idea would work, kind of.
If the NPC is set to reach the player then it will always follow the player. However, if an external event calls the NPC switch(ie, doing an action independant of that NPC) then you run into some problems.
First, the "reach the player" NPC mode isn't perfect. The NPC will attempt to reach the player, but depending on its speed in relation to the Player, plus the path that the player moves in, the NPC sometimes can get lost, lag behind, or go another way to catch the player(ie, if the player goes east and north around a rock, the NPC might go west and north and meet the player on the other side of the rock). Thus when you use the global positioning you can certainly be off by more than a 1 tile radius.
Also, if the NPC is right next to the player, you are correct in that it is a 1 tile radius from the player. But you are talking up to a 3 tile difference if the NPC switches sides. Plus, the NPC disappearing suddenly from the player's right side and instantly reappearing on the player's left side is kinda goofy.
But the bottom line is yes, this will work, if you overlook the above problems. And those problems are really just asthetic problems.
Good thinking.
------------------
(url="http://"http://stark.evula.net/pogwalkthrough.htm")PoG Walkthrough and Compendium(/url) | (url="http://"http://stark.evula.net/plugins/dev_tools.htm")PoG Dev Tools(/url) | (url="http://"http://stark.evula.net/plugins/spells_expander.htm")Spells Expander(/url)
(url="http://"http://stark.evula.net")Stark.evula.net(/url) now on (url="http://"http://www.evula.net")EVula.net(/url)