fodev.net

FOnline Development => Questions and Answers => Topic started by: SEGA_RUS on August 21, 2013, 10:51:29 am

Title: [2238] How to change NPC look throw the walls?
Post by: SEGA_RUS on August 21, 2013, 10:51:29 am
Default NPC can see throw the walls
How to disable this?
Title: Re: [2238] How to change NPC look throw the walls?
Post by: SEGA_RUS on August 21, 2013, 11:58:23 pm
may-be set
Code: [Select]
bool MustInitWalkProcessing = false; in main.fos?
Title: Re: [2238] How to change NPC look throw the walls?
Post by: Lidae on September 09, 2013, 05:26:03 pm
I haven't tested it, but I think this is a good clue:

Code: [Select]
  if (!cr.CritterIsNpc)
  {
max_range = TraceWall(cx, cy, ox, oy, map, max_range); // in case wall is blocking
return dist <= max_range; // behind a wall
  }
  return true; // max pe range handled before

From check_look.cpp, which handles whether critters are visible or not. But I think it might depend on the AI usage as well - if you use CRITTER_EVENT_SHOW_CRITTER_# events, then that will "detect through walls" I think.
Title: Re: [2238] How to change NPC look throw the walls?
Post by: Atom on September 19, 2013, 11:05:53 pm
Code: [Select]
  if (!cr.CritterIsNpc)
  {
max_range = TraceWall(cx, cy, ox, oy, map, max_range); // in case wall is blocking
return dist <= max_range; // behind a wall
  }
  return true; // max pe range handled before

From check_look.cpp, which handles whether critters are visible or not.

That is correct, removing the check for non-npc and recompiling check_look.dll will make NPCs' LOS affected by walls. However, AI is known to behave badly when this is the case, which was the reason to make the walls invisible for them. The only exception are sneaking players, where raytracing for obstacles is done regardless, with walls blocking the vision completely. This can be seen later in the code.