Aller au contenu

Photo

NPC's going to bed at night?


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

#1
K Kin

K Kin
  • Members
  • 109 messages

I've read and double checked the wiki on how to actually do this, because it seems so simple.

Pretty much, I want some realism into my module, npcs moving around in the day (check), then going into their houses at night.

 

 

My current stage;

dbd697ebc8f9af5be9a327c5d6c160f0.pngNpcs movement in the day (WP tag etc)

 

 

 

c0595dbed9889bdc78305b1d35fb5df3.pngNIGHT waypoint in a house. Outside is the pic above.

 

 

40801e21aa9ce4a86854c853f2f0d0ec.pngWaypoints tag inside the house

 

 

ed4d771aeaa2e198eac97bb6b0bc9a2d.pngModule variables.

 

 

 

 

 

What am I not doing right? The npc just continues to walk around using the daytime waypoints.



#2
kevL

kevL
  • Members
  • 4 056 messages
I haven't toyed with Day/Night wwps
but i'll start the discussion, saying NwN2 does not handle area-transitions (by NPC) as well as NwN1 does.

that is, you may have to babbysit the NPC to the door and usher him inside every step of the way. by hooks & crooks ...

#3
Dann-J

Dann-J
  • Members
  • 3 161 messages

It looks like the day/night waypoint system used in NWN doesn't work in NWN2:

 

http://forum.bioware...-npc-waypoints/

 

Chances are you'll have to script it yourself - unless someone else has a system they're willing to share.

 

I tend to have usable objects function as mediators, so I don't have to try to queue up multiple actions in a sequence. I might have an NPC's heartbeat script check the time of day, and check what area they're in, and if the two don't belong together I have the HB script:

  • Check that their action queue is empty, they're not in conversation, and they're not in combat. Have the script fall through if they're otherwise engaged.
  • If they're free to do something, command them to use a certain placeable or open a certain door. They'll run to use it automatically. An action will be added to their action queue, preventing the HB script from adding multiple instances of that action if it takes more than six seconds to reach the placeable or door.
  • Give the placeable or door an OnUsed or OnOpened script that checks who is using/opening it
  • If it's a certain NPC using it, then do something special. Ignore anyone else using it (or have it function as usual).

If the player interrupts the NPC's action queue (such as by talking to them), the NPC's HB script will simply start again from scratch once they're no longer in conversation, sending them off to try to use the placeable or door again.



#4
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 585 messages
In my Silverwand Sample Campaign I demonstrate NPCs that go home at night and return in the morning. However, I did not have them change areas, just open their home door and then they are script hidden until morning when they then reappear and walk back into town. As I recall there were some issues with transitioning across areas and I didn't really require it so I didn't pursue it. It has been a long while.

Regards

#5
Dann-J

Dann-J
  • Members
  • 3 161 messages

In my Silverwand Sample Campaign I demonstrate NPCs that go home at night and return in the morning. However, I did not have them change areas, just open their home door and then they are script hidden until morning when they then reappear and walk back into town. As I recall there were some issues with transitioning across areas and I didn't really require it so I didn't pursue it. It has been a long while.

Regards

 

That's certainly one way to do it, especially if the house placeables are purely cosmetic with no actual interior areas.

 

If you did create interiors that players could visit, you could have two versions of each NPC (one in each area). When one is script-hidden, the other isn't. The interior version could even be wearing pajamas and a nightcap. :)

 

I have an NPC in a module I'm working on who transitions to a different area without complication. At first he stands around in town, watching over his herd of pigs in a fenced-off pig pen. If the players complete a quest for him, his HB script does several things in sequence. First he opens a gate, which changes a local variable on him. Then he walks to the other side of the pig pen and opens a second gate, which changes the local variable again. Then he walks towards an area transition (with his pigs in tow). When either him or one of his pigs enters the trigger, they get jumped to a forest area where his pigs will forage while he keeps watch.



#6
kamal_

kamal_
  • Members
  • 5 240 messages

Uncle FB's npc control scripts can do what you want, including area transitioning. He made documentation and a demo module as well. pj156 uses it in Sheep and Stone and Caravan Club for instance.



#7
PJ156

PJ156
  • Members
  • 2 982 messages

What Kamal said, don't reinvent the wheel in this unless you've a wish to. FB's scripts will do this and a lot more.

 

PJ



#8
kevL

kevL
  • Members
  • 4 056 messages
quicklinks


Uncle FB's NPC control

also
Uncle FB's NPC Light Keeper
Uncle FB's NPC Barmaid

#9
K Kin

K Kin
  • Members
  • 109 messages

Uncle FB's npc control scripts can do what you want, including area transitioning. He made documentation and a demo module as well. pj156 uses it in Sheep and Stone and Caravan Club for instance.

Thanks for the info, wanted to test them out before replying and they're great ^_^