Perception Range

This is my first time posting on this forum. Thanks so much to everyone for all your work here on this forum and in the vault.

I’m sure this has come up before, but I can’t find the answer anywhere. For NWNEE, I’m building my first adventure module and learning as I go. In an area, I set some of the monsters’ range to “Long.” Even though it works initially, if I save and reload, it keeps resetting to what seems like the default range. I think it has something to do with the .2da files, but I am a bit clueless in that department as of yet.

I’m only working with the current vanilla toolset and haven’t tried out various hakpaks and so on yet. I’m wondering if anyone can recommend a quick and seamless work around for this. Like is there a different .2da file I can download somewhere? Or is this bug fixed in any of the overhauls by any chance?

Or is there even a way to script a monster’s range? I can’t seem to find a function for that.

If scripting is the way to go, I imagine I can try some kind of heartbeat script, but if I want to keep a lot of monsters on “Long,” that might affect performance I imagine. Or maybe I can try an OnEnter script for that area, but that could get messy because it might have to keep tabs on the current state of the monsters.

Or maybe OnSpawn could work somehow? Or could it be that I should spawn monsters in each time using triggers instead of just placing them on the map?

Based on a Google search, it appears that this was discussed before on Bioware’s site. Alas, the link doesn’t work anymore.

I haven’t heard of that bug before. If you’re using EE, you can made a demo mod and submit a ticket to Beamdog. Something simple, like approaching a creature whose OnPerception script sends a message. If it’s bugged, you should see the message at different distances before and after save/load.

Perception range can’t be changed by scripting. As you know, it can be selected in the creature template. The values in metres are held in ranges.2da, but changing that will change every creature with the range in question.

How exactly are you doing this? Is this a placed creature in an area? or are you editing a template in your creature palette? If the latter, is it a custom creature you created?

I’ve never heard of this before either, so it may just be the way you articulating the phenomenon and we aren’t understanding your methods.

Thanks very much for your responses. I tried this again by making a new module with just a simple outdoor area. I placed two orcs from the standard list just out of range of the starting point. I changed the perception range of one of the orcs to “Long” and kept the other orc at “Default.” I did not change anything else at all. When I loaded up the module, the same thing happens as before. Without saving and reloading, it’s fine and the orc with “Long” perception clearly sees me and attacks as soon as I get in virtually the same range generally provided to the PC. The other orc never attacks from that far range. On the other hand, if I save and reload right after starting the module and then move forward, the “Long” range orc always behaves the same way as the control orc, meaning his range has been reset somehow. He loses his long range sight every time without fail.

Thanks for confirming that this is not a typical bug. I’m using Game Version 1.80, NW Toolset Version vts80, for what it’s worth.

I will try to raise this with Beamdog. In the meantime, maybe I will use triggers to spawn monsters instead of just placing them. Cheers!

It also happens in 1.69.

Apparently the game does not copy the PerceptionRange property from any creature’s template to area’s git file on game save, which causes it on save load to use the default perception range, effectively resetting it to the default (it isn’t pulled from the template either).

Testing script (creature’s OnPerception):

void main()
{
    object oPerceived = GetLastPerceived();

    if(!GetIsPC(oPerceived))
    {
        return;
    }

    if(GetLastPerceptionSeen())
    {
        SendMessageToPC(oPerceived, GetName(OBJECT_SELF) + ": seen at " +
            FloatToString(GetDistanceBetween(OBJECT_SELF, oPerceived), 0, 2));
    }
    else if(GetLastPerceptionVanished())
    {
        SendMessageToPC(oPerceived, GetName(OBJECT_SELF) + ": vanished at " +
            FloatToString(GetDistanceBetween(OBJECT_SELF, oPerceived), 0, 2));
    }
}

Moving to and away from the creature should trigger the messages. And as @BlackguardRogue says, the long ranges (35) change to default (20) on game load.

First time I hear about it as well, but that is probably because the use case is extremely specific. Placing creatures into area directly isn’t very common and changing their properties after you place them is completely uncommon.

Either way, be sure to report it to BeamDog they might want to fix it. Meanwhile, make sure you make a blueprint copy where you change the properties you want to change and then place that changed creature into area.

Creatures spawned in runtime are affected by this issue as well. They have to, as explained in the post above.

I missed the detail that it happens when loading a save game… That means there is no workaround.

Thanks very much, @NWShacker, for verifying that. Your explanation makes perfect sense to me. I’ll implement your script into that test mod I made and then attach that mod in my report to Beamdog. I’ll let you guys know what they say.

In the meantime, I’ll just strategically place triggers to spawn in monsters with long sight range. The gameplay feels exactly the same, except I know that on the small chance that the PC doesn’t clear such monsters, the perception range will reset to default if the player saves and reloads.

1 Like