Aller au contenu

Photo

Schedule-based NPC ambient behavior control system?


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

#1
rjshae

rjshae
  • Members
  • 4 497 messages
Hello. I have a town built with about 30 or so NPCs and I would like to give them a semblance of a community by using schedule-based behavior. Each of them will follow a specific movement behavior schedule, moving between areas, interacting in groups, crafting, waiting at a store counter, following specific waypoint sequences, and so forth. I seem to recall there were a set of scripts that allowed a designer to do this, but I'm having difficulty tracking it down. Does anybody have a suggestion? Writing this from scratch looks like a significant amount of work, so I'd prefer not to re-invent the wheel. Thanks.

#2
kamal_

kamal_
  • Members
  • 5 254 messages
Uncle FB's NPC control, as seen in PJ's modules.
http://nwvault.ign.c...s.Detail&id=278

Or you can fix bugs in my generic commoner ai system, but that's just for generic npc's, not ones you want to do specific things.

#3
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
++ on Uncle FB. I've talked to PJ about it several times and he says once you get used to it you can set up ambience quickly.

#4
PJ156

PJ156
  • Members
  • 2 985 messages
Like what the others ahve said. FB scripts do what you want.

It's quick to set up and flexible. With some nice touches like the barman/barmaid and light keeper.

I would thoroughly recomend it for what you have described though for wandering around ambience it needs some work. the ambience script were a little flaky for me but they are there. kamals_scripts might serve you better there.

My only advice is don't use the 0 (hidden) activity. It does bad things, like they don't always come back.

I use a transisiton to a dummy area that serves no other purpose than holding npcs that are not in the game. (Heh I even gave them a sofa and a drinks cabinet). That works nice as the market sellers walk up the road at the end of the day before they transition to the holding area.

Marshal V has done some ambient scripts as well but they are more like what Kamal_ has done I think.

PJ

#5
kamal_

kamal_
  • Members
  • 5 254 messages
Marshall V's scripts only cover a few (like 5 maybe) basic things, since that was all he needed for his PW. What he does include works perfectly well, it's very easy to set up patrols for instance, and I'm using it to do guard patrols.

My scripts are just an implementation of Uncle FB, addressing some weaknesses and adding some features, with extra activities courtesy of Lugaid. I got things to "buggy but working in principle" before getting tired of working on it (I don't enjoy scripting much) I'll get back to it at some point since I need it.

Naturally I'd rather you fixed up my code :) , but for only 30 villagers, I'd say Uncle Fb's stuff is better suited. You'd spend more time fixing the bugs in my system than it would probably take to get Uncle Fb's running for 30 npcs, and you're going to need to use Uncle FB or some other system anyway for any NPC you want doing specific things, since mine is for generic nameless commoner npcs. With 30 villagers, I'd guess most aren't generic commoners.

#6
rjshae

rjshae
  • Members
  • 4 497 messages
Thanks, I'll check out the scripts. Yes, I went a little overboard in personalizing the locals, although most are commoners. I'm trying to make the place feel lived in, which is a feeling I just don't get when a town is full of stock characters. Unfortunately, doing so is proving to be a lot more work.

#7
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
You're welcome to open up 'The Dana'an Unvanquished' and strip out the ambient system there. It's really just one master script, 'ambienttasks', and some calls to the script from the area on-enter, heartbeat, and NPC heartbeat scripts. TDU doesn't have NPCs crossing areas, but LotD does.

Everything is handled with laying down waypoints and setting variables on the NPCs, which is why kamalpoe wanted to modify it, to make it so that the builder didn't have to set all those variables by hand.

That and the OEI walkwaypoints system were all I needed to do what I wanted, but if you have other specific tasks or behaviors in mind, I might be able to script them into an updated version.

#8
johnbgardner

johnbgardner
  • Members
  • 185 messages
I'm working on a system right now that stores waypoint numbers on the NPC by hour, i.e. 0, 1, 2...23. The NPC heartbeat checks if the hour has changed and directs them to a new waypoint on the hour (or the same one if desired like at night when they're sleeping). The NPC variables are integer values with the names "0", "1", etc. and it's easy to get the next waypoint like this:

int nHour = GetTimeHour();
string sHour = IntToString(nHour);
int iNextWP = GetLocalInt(OBJECT_SELF, sHour);

Also, each waypoint has a set of animations defined, item to be equipped if any, a flag telling the NPC to stick around this waypoint until the next hour or go immediately to the next wp which is defined on the WP as override. If I set override to 0 it selects from a random set of waypoints.
If you're interested in more details, pm me.