ClockLib with npcLib: having npcs go to certain locations at a certain time.

Atokrad
12 Feb 2022, 20:56

I need to have npcs run on a schedule by going to certain rooms at a specific time everyday, the same schedual daily, but I also want this to branch off if a attribute gets too low, like if they get hungry they go to a cafeteria to eat. Is this possible? If so how would I do it?


DarkLizerd
13 Feb 2022, 16:35

I would create some attributes: NPC.Hunger, NPC.Tired, and so on.
Then set some values on each room like "N,N,W,0,0,0"
("0" for future destinations.)
Each direction tells the NPC which direction to go for each destination.
Like, North to cafeteria, North to bedroom...
The next room north could have "N,E,S,0,0,0"
So now, it's North to cafeteria, East to bedroom.

I'm sure everyone else would have a different way of doing this, but that the nice thing about programming...
There is more than one way to do the same thing.


Atokrad
14 Feb 2022, 01:45

So how might I get an NBC to use a object, say talk to a fellow npc or sleep in a bed?


DarkLizerd
14 Feb 2022, 16:01

I think that is being discussed elsewhere right now.


mrangel
14 Feb 2022, 17:45

So how might I get an NBC to use a object, say talk to a fellow npc or sleep in a bed?

What do you want to happen?
Do you just want it to say "Bob talks to John" if the player is in the room? Or set an attribute on one of the NPCs?

In either case, you should be able to add that easily enough; I'm not familiar with NPClib, but it would just be a case of checking if the NPC and the object you want them to use are in the same room when you're deciding their next action.