Aller au contenu

Photo

NPC Placement


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
johnbgardner

johnbgardner
  • Members
  • 185 messages
Just a (hopefully) quick question.  I want to have NPCs appear in different places in an area depending on the time of day.  E.g. working, at a shop counter, in bed.  Is the "On area entry" the proper place to do this?  I'm thinking it would bog down the area if I tried to move NPCs in a module heartbeat script.  My only concern is if I use the area entry one the NPC might "pop in" after the PC enters.

#2
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
On area enter is the quick and dirty way to do it, and will work most of the time. I also use an area on-heartbeat script that spawns in NPCs at the appropriate doorway, when that kind of realism is necessary. The general rule of thumb with heartbeat scripts is that you want to shut them down if the PC can't see what's going on, so a general check to see if the PC is in the area is usually good enough. Computers can handle a lot, just keep yourself within some reasonable limits.

The on-area-enter script fires as the player is looking at the loading screen, so there is no chance that they'll see the NPC 'pop-in'.

If you're thinking about having the same NPCs move between different areas (like home to work to the tavern at night), I'd urge you think about simply faking it, having multiple copies of the NPC, and then just setting them to script-hidden if they're not supposed to be in the area at that time.

#3
johnbgardner

johnbgardner
  • Members
  • 185 messages
Thanks muchly for the reply. I'm trying the KISS (keep it simple, stupid) method and not have NPCs spawn all over the module. Since the main module is a village most folks will be working out of their own home, so they'd either be at the shop counter or in their bedroom.

#4
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 603 messages
I suspect you will find having NPC's transition between areas is a violation of the KISS principle. In my campaigns I have some NPC's walk to their home in the evening, open their door, and then set them to script-hidden. In the morning I unhide them and they walk back to their shopping point or whatever. For named NPC's like a shop keeper I would consider just having their shop door locked in the evening.

Regards

#5
kamal_

kamal_
  • Members
  • 5 260 messages
Uncle FB's npc scripts are designed to do exactly what you are asking. You can see them in use in PJ156's modules. It's not super simple, but it does what you ask about. If you just want some nameless npcs wandering around or doing stuff and then going home at night, look at my commoner ai, which is simple to implement.

#6
johnbgardner

johnbgardner
  • Members
  • 185 messages
Thanks muchly for the replies. I'll take a look at the scripts. I'm leaning toward multiple instances of the NPC and using the area OnEnter to check the time and set the hidden flag accordingly. Thanks all