Flag an area so the AI won't walk on it

Information and Discussion Relating to NWN2 Area Design

Moderators: Moderator, Developer, DM

User avatar
gedweyignasia
Custom Content
Posts: 1353
Joined: Sat Nov 23, 2013 11:27 pm
Location: EST/UTC-4

Flag an area so the AI won't walk on it

Unread post by gedweyignasia »

Is it possible to mark an area so that the AI won't cross it without preventing PCs from moving there? I just want to mark a place as off-limits to AI so it won't try to step on something dangerous. (I could make it only harmful to PCs, but I'd prefer not to.)
Dagesh
Posts: 891
Joined: Mon Jan 16, 2012 11:03 pm

Re: Flag an area so the AI won't walk on it

Unread post by Dagesh »

Unless there's a walkmesh that allows that, I'd wager it's an AI thing and, if it's an AI thing, it's possible that it's buried in there but, as far as I know, it's not.
ουκ εστιν ωδε, ηγερθη γαρ καθως ειπεν



PCs:
Rorick Runegraph (Check out Rorick's Rune of Light)
Ckalthea Chenfur
Aeric
Squire Brevin of Lathander
User avatar
ThornsM
Posts: 109
Joined: Tue Sep 07, 2010 10:12 am

Re: Flag an area so the AI won't walk on it

Unread post by ThornsM »

I'd be taken aback if there was such a thing. The walkmesh is the same for all moving creatures and the capacity of objects to cause collisions is similar. Changing the AI may not be sufficient either because the pathing in the game is so flawed. The AI determines the position the creature will move to, and even if you could exclude certain areas from being intended destinations by the AI, the pathing will interfere and may cause it to cross that area you wished excluded.
Rather than a general solution, you may need to find one that would work for your specific case, whatever that may be.
User avatar
Valefort
Retired Admin
Posts: 9779
Joined: Thu Apr 28, 2011 5:07 pm
Location: France, GMT +2

Re: Flag an area so the AI won't walk on it

Unread post by Valefort »

Paint a trigger that checks if the entering creature is a PC and teleports it back if not ?
Mealir Ostirel - Incorrigible swashbuckler
User avatar
Wandering_Woodsman
Posts: 252
Joined: Mon Dec 29, 2014 7:34 pm
Location: The Phoenix Company Forge

Re: Flag an area so the AI won't walk on it

Unread post by Wandering_Woodsman »

I'd like to see this too. Especially in some areas that are designated 'faction' based.

One example is that Fist guards, once done chasin' after someone who has a weapon out, will just lounge around outside the Phoenix company roadhouse.

Call me crazy, but isn't this more or less under the watch of thee pair of heavily armored guards right outside said roadhouse? Why does the Fist, with no reason to stay there anymore, hang around? Especially if they just traveled halfway down the bridgee aftr someone?
"Now see, that's good information there. For a second, I thought you'd just met a chicken god."

Toman Ironarm
- Blacksmith of the Phoenix Company

You know, only on the Coast would that have needed to be said. :?
User avatar
Aspect of Sorrow
Custom Content
Posts: 2699
Joined: Fri Mar 28, 2014 7:11 pm
Location: Reliquary

Re: Flag an area so the AI won't walk on it

Unread post by Aspect of Sorrow »

Have an NPC on spawn identify it's location. Area onenter/onleave event the NPC to evaluate it's distance from origin and with a threshold var set, if exceeded, returns to their original position if not in conversation, or in combat.

For OP, triggers.
User avatar
gedweyignasia
Custom Content
Posts: 1353
Joined: Sat Nov 23, 2013 11:27 pm
Location: EST/UTC-4

Re: Flag an area so the AI won't walk on it

Unread post by gedweyignasia »

AoS - I have a little square of floor that's a "trap" I don't want monsters to step on (preferably not summons either). I can do this with triggers?
User avatar
Aspect of Sorrow
Custom Content
Posts: 2699
Joined: Fri Mar 28, 2014 7:11 pm
Location: Reliquary

Re: Flag an area so the AI won't walk on it

Unread post by Aspect of Sorrow »

A trigger larger than the space that will cause damage, tell it to cease action, turn 180 from it's vector and move forward enough to steer away.
Dagesh
Posts: 891
Joined: Mon Jan 16, 2012 11:03 pm

Re: Flag an area so the AI won't walk on it

Unread post by Dagesh »

Copy the NPC's faction over to the traps faction. If they walk over the trap, it won't trigger. It's under Properties->Basics->Faction ID.
ουκ εστιν ωδε, ηγερθη γαρ καθως ειπεν



PCs:
Rorick Runegraph (Check out Rorick's Rune of Light)
Ckalthea Chenfur
Aeric
Squire Brevin of Lathander
User avatar
Aspect of Sorrow
Custom Content
Posts: 2699
Joined: Fri Mar 28, 2014 7:11 pm
Location: Reliquary

Re: Flag an area so the AI won't walk on it

Unread post by Aspect of Sorrow »

The non default faction handling isn't reliable unfortunately.
User avatar
gedweyignasia
Custom Content
Posts: 1353
Joined: Sat Nov 23, 2013 11:27 pm
Location: EST/UTC-4

Re: Flag an area so the AI won't walk on it

Unread post by gedweyignasia »

Dagesh wrote:Copy the NPC's faction over to the traps faction. If they walk over the trap, it won't trigger. It's under Properties->Basics->Faction ID.
It's a scripted trap, not a regular one. I can make it only affect PCs, but then you have enemies just casually strolling over hot lava.
Dagesh
Posts: 891
Joined: Mon Jan 16, 2012 11:03 pm

Re: Flag an area so the AI won't walk on it

Unread post by Dagesh »

gedweyignasia wrote:
Dagesh wrote:Copy the NPC's faction over to the traps faction. If they walk over the trap, it won't trigger. It's under Properties->Basics->Faction ID.
It's a scripted trap, not a regular one. I can make it only affect PCs, but then you have enemies just casually strolling over hot lava.
In that case, as was previously mentioned, have NPCs do a 180 and walk a little. No need to make another script/trigger. Use the same one. In the OnEnter, just check GetEnteringObject for GetIsPC. If it's FALSE, ClearAllActions. GetFacing of the entering object and then SetFacing to the opposite of that. If you want, find a location a meter in front of the NPC and AssignCommand the NPC to move to that location.
ουκ εστιν ωδε, ηγερθη γαρ καθως ειπεν



PCs:
Rorick Runegraph (Check out Rorick's Rune of Light)
Ckalthea Chenfur
Aeric
Squire Brevin of Lathander
User avatar
gedweyignasia
Custom Content
Posts: 1353
Joined: Sat Nov 23, 2013 11:27 pm
Location: EST/UTC-4

Re: Flag an area so the AI won't walk on it

Unread post by gedweyignasia »

Dagesh wrote:
gedweyignasia wrote:
Dagesh wrote:Copy the NPC's faction over to the traps faction. If they walk over the trap, it won't trigger. It's under Properties->Basics->Faction ID.
It's a scripted trap, not a regular one. I can make it only affect PCs, but then you have enemies just casually strolling over hot lava.
In that case, as was previously mentioned, have NPCs do a 180 and walk a little. No need to make another script/trigger. Use the same one. In the OnEnter, just check GetEnteringObject for GetIsPC. If it's FALSE, ClearAllActions. GetFacing of the entering object and then SetFacing to the opposite of that. If you want, find a location a meter in front of the NPC and AssignCommand the NPC to move to that location.
The downside is that this will cause an enemy to keep wiggling back and forth around the trap if it's trying to get to a player on the other side. Not sure I have a better option without surrounding each with waypoints, though.
tfunke
Retired Staff
Posts: 2305
Joined: Sat May 07, 2011 9:09 pm
Location: Australia- GMT+10

Re: Flag an area so the AI won't walk on it

Unread post by tfunke »

Hi Ged,
Take a look at Corm Orp area. The surrounding region uses some triggers for the spawns, to ensure they keep away from the township itself. This sounds similar to what you are seeking.
Per aspera ad astra

Return to “NWN2 Area Design”