Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(8 edits)

It's quite easy to set up, just launch a game with the coordinate sampling tool on (which is in the editor), use that tool by going into your menu in game to find positions of where you want them to go, write all the positions you want for them to hang at down in a notepad, then return to their NPC edit menu and set a possible routine in the NPC editing tool; give NPC A a target position somewhere in town like chairs in the tavern or some place in town, make them face eachother, say that that the activity of NPC A is 'Is hanging around with NPC B', and NPC B 'Is hanging around with NPC A' with their Visible activity being 'Sitting at the table with their friend' or 'loitering with their friend', after you've done that, check either 'random walk' or 'patrol' in the options under that and the AI will do the rest. Honestly you don't need the AI to set that up, you could simply add it to their Lua script as such;


function GetTargetRoutineID(hour)

    if hour == (insert hour you want it to happen here) then

        return "Is hanging with NPC B"

    elseif hour >= (insert hour here) or hour <= (insert hour it happens +1) then

        return "silverpine_leisure"

end

You can even make exceptions if you want it to be more immersive, like them not hanging out during a snowstorm by adding something like

else 

       if World.GetCurrentWeather() ~= "Snowstorm"         

            return "Hang at home" (or any activity you would create that'd be named like this for when you want them to hang at coordinates at home for example).

You can fine tune it with a bunch of functions that look up the day, weather, season etc, you can see those in the lua script tab of the NPC editor when you press 'copy documentation' which gives you all of them in your clipboard. 

If you mean you'd like them to organically meet with eachother without instructions at random times, then you could just put a routine like 'Hangs around with NPC A/B' as a description, give them both a general meet up point at certain coordinates, then check the dynamic routine writer on and hope the AI generates something for them at random.
Either way what this will do is have them just be near enough eachother to trigger a group conversation, and the activity and NPC lookup will probably make the AI improvise them talking with eachother and acknowledge that they were in the middle of a discussion or activity when you talk to one or both of them at their meeting spot.

If however you meant to say that you'd like the two NPCs to hold conversations, share information and such, I'm sorry to say but none of Silverpine's NPC can do that, the only real 'conversation' or rather NPC to NPC interaction possible that isn't directly controlled by the player is if during one of your conversations one NPC commit to loose memory a 'I will talk to X about that thing that I want to talk to them about after the player initiated conversation with me', and it's usually just a one sentence phrase they'll eventually repeat to another NPC without much context whenever they see them (If possible they usually just decide to rush the other NPC and tell them that sentence immediately).
Well, that or you threatening them or loitering in their house without their authorization, which has them calling for the guard, which breaks the conversation and has them run for Aldric who will then chase you around town to get an explanation from you.
And also that other exception with that one NPC that always ends in your demise... but anyways I digress.
 
Point is they never actually hold actual elaborate conversations that generate memories for them passively, it's always reliant on you as the player conversing with them.

Do you know if there is a Lua script for the gossip/rumor system and if it can be added to a custom NPC?

(4 edits)

All the functions available are listed in the editor when you copy them into your clipboard from the Lua script part of NPC editing.  

At first glance there is no such thing; there's a bunch of fetching functions for weather, time of day, day of the week and season meant to be used in conjunction with logic gates and conditions.

There's a check for 'sunlight' which I'm unsure is actual sunlight or the amount of light in an area within a float ranging from 0 to 1.

There's oddly a function that dictates the cost of the shed plot, one that states if either the shed is locked or unlocked and finally one that displays text when the conditions for it are met, likely used by Gareth when you try to buy the shed from him, which means you could very easily create a NPC that gives you the shed for free when interacted with using their Lua script editor, not that Gareth's AI needs much convincing to do so as well to begin with.

Everything else is just a garbage collector, math operators, tables.

There's however a list of defined 'default' routines that exist innately within the game which are the following;

read_in_bed, sleep, cook_breakfast, eat_breakfast, work, frollic_on_frozen_river (which is one of the example conditions on the default test character, under the condition that the weather is snowy) and finally silverpine_leisure which is the default activity for 'do whatever' that you should default to when you're done with whatever activity you've set for them if you don't want them to be immobile starring at a wall until the next activity comes up.
That's pretty much all there is.

To sum up the situation, the activity script in Lua isn't meant to interact with NPC knowledge, it's merely a list of activities for the NPC to do under different conditions during their day, it isn't dynamic but completely static, and the NPC will just follow it blindly until interrupted by the player in some way.

Basically a schedule to follow that's more or less complex based on what you tell the NPC to do, like staying at home if the weather is cold or rainy, or going every now and then to visit a certain NPC by walking to their house every tuesday, things like that.

The gossip system is part of a dynamic set of instructions that trigger after the player is done interacting directly with a NPC, and it isn't elaborate in the slightest as far as I know, the NPC just stores a gossip as a loose memory in the NPCMemories nmem file, and acts upon it whenever it is convenient, it's completely unrelated to routines, in fact you can open that nmem file and erase the line that says 'X Npc told me that Player did X' and the rumor vanishes permanently from their memory as if it never happened once you reimport it.

If you were hoping for this game's NPCs to be more flexible than that, and for what you say or do to change their habits, I'm sad to say, and can confirm as I've tried to do so myself even before the NPC editing tools were put in game; 

There is no way, and I mean absolutely none, to modify the habits of a NPC from their usual scheduling using dialogue alone, they'll just keep doing what they do whatever you tell them or convince them to do, with the only exception of following you, gossiping, trying to arrest or murder you, and inviting Mirel to live with you. And even that has its limits; for instance if you were to try and convince Mirel to follow you while her activity dictates that she must return to Thalassar, some invisible voice will force her AI to comply and cut off the conversation before returning to her usual programming. It isn't as elaborate as what you might expect.

(3 edits)

There simply isn't enough context window/intelligence/performance for these kind of elaborate systems with the local models that can run on the average person's machine. I have some ideas for an alternative to dynamic mode which queries the custom NPC's AI every in-game hour to let it choose from the list of possible routines in real time, taking into account everything that it has access to in dialog, but I have doubts about Gemma-4-Sparse, aka 26B-A4B, being able to handle this in a coherent way.

NPCs can change their daily routine in a very limited way if you plan a meeting at X location in Y hours/days, and them not being able to follow you outside the town perimeter has been solved with version 1.6.0.

Yeah, I was mainly concerned if a custom NPC could even interact with the rumor system. I had no idea if it was relationship based or routine based and have to script it in as a routine. Turns out, a few hours after I post that, I happened on the answer. It looks like only NPCs who are Friends or higher gossip with other NPCs can/will gossip with each other. So, yeah, I don't have to worry about making a routine for it. But thanks for the comprehensive amount of info.

I also found out while playing with the routines that after playing a session with dynamic mode on, it gives you the lua script from last session. So, I took it and spent last night learning some basic Lua and hammered out a shabby first script and told an AI look at it and tear into my mistakes while calling me a moron, while I fixed it manually. I'm going to test it out today and hope I don't get any errors.