Author Topic: [2238] How to change NPC look throw the walls?  (Read 2971 times)

Offline SEGA_RUS

  • Arbeit macht frei
[2238] How to change NPC look throw the walls?
« on: August 21, 2013, 10:51:29 am »
Default NPC can see throw the walls
How to disable this?
Skype - sega_75rus

Offline SEGA_RUS

  • Arbeit macht frei
Re: [2238] How to change NPC look throw the walls?
« Reply #1 on: August 21, 2013, 11:58:23 pm »
may-be set
Code: [Select]
bool MustInitWalkProcessing = false; in main.fos?
Skype - sega_75rus

Re: [2238] How to change NPC look throw the walls?
« Reply #2 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.

Offline Atom

  • Rotator
Re: [2238] How to change NPC look throw the walls?
« Reply #3 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.