TopLayer is right, but you can still improve your ZS_GuidePC function a little bit by increasing self.senses_range:
Code:
func void ZS_GuidePC () {
...
self.senses_range = 5000; //default G1 self.senses_range = HAI_DIST_ASSESS_MONSTER; //1000
If you are working with G1, then vanilla ZS_GuidePC function has 2 active perceptions - first is perception for enemies, second for player.
If NPC detects enemy second perception will not be activated. But we can 'fix' that -->
Code:
func void ZS_GuidePC () {
Npc_PercEnable (self, PERC_ASSESSENEMY, B_AssessEnemy);
Npc_PercEnable (self, PERC_ASSESSPLAYER, B_GuidePC_AssessPlayer);
...
For perception PERC_ASSESSENEMY you can call new function B_GuidePC_AssessEnemy that will first call B_GuidePC_AssessPlayer and only afterwards B_AssessEnemy:
Code:
func void B_GuidePC_AssessEnemy () {
var otherBackup; otherBackup = Hlp_GetNPC (other);
other = Hlp_GetNPC (hero);
B_GuidePC_AssessPlayer ();
other = Hlp_GetNPC (otherBackup);
B_AssessEnemy ();
};
func void ZS_GuidePC () {
Npc_PercEnable (self, PERC_ASSESSENEMY, B_GuidePC_AssessEnemy);
Npc_PercEnable (self, PERC_ASSESSPLAYER, B_GuidePC_AssessPlayer);
...