[Mod] Advanced NPC (WIP) [advanced_npc]

KCoombes
Member
Posts: 427
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt
Location: SW Florida, USA

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by KCoombes » Post

Having a small issue with the mod - it seems to be missing male textures.

Code: Select all

2017-07-08 19:06:56: [Server]: [advanced_npc] INFO: Successfully initialized NPC with name "Rafa", sex: male, is child: nil, texture: {
	"npc_male2.png"
}
2017-07-08 19:06:56: INFO[Server]: Players:
2017-07-08 19:06:56: INFO[Server]: * singleplayer	RemoteClient 2: m_blocks_sent.size()=104, m_blocks_sending.size()=0, m_nearest_unsent_d=0, m_excess_gotblocks=0
2017-07-08 19:06:56: INFO[Main]: GenericCAO: Got init data
2017-07-08 19:06:56: INFO[Main]: ClientEnvironment::addActiveObject(): added (id=3)
2017-07-08 19:06:56: INFO[Main]: GenericCAO::addToScene(): mesh
2017-07-08 19:06:56: INFO[Main]: Irrlicht: Loaded mesh: character.b3d
2017-07-08 19:06:56: INFO[Main]: SourceImageCache::getOrLoad(): No path found for "npc_male2.png"
2017-07-08 19:06:56: ERROR[Main]: generateImage(): Could not load image "npc_male2.png" while building texture; Creating a dummy image 
I checked the texture folder and there is only 1 adult male texture present, but I have seen this error for npc_male2 through 6 generated ingame.

User avatar
Codesound
Member
Posts: 365
Joined: Thu Jun 09, 2016 14:56

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Codesound » Post

Hi,

first: many thanks for this mod!

I need help to understand:
why most villagers spawn without skin... I wrong anything?
And the torch are olds 2d mods: in the latest image I put one new 3d torch.

Image
Image
Image
Image

Thanks again

R

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Sokomine » Post

Codesound wrote: why most villagers spawn without skin... I wrong anything?
And the torch are olds 2d mods: in the latest image I put one new 3d torch.
Please update mg_villages, handle_schematics, mob_world_interaction, cottages and any village_* mods you might like. Newer versions of mg_villages use the new torches. I have no idea regarding the skins problem; except perhaps update minetest_game and advanced_npc to newest version?
A list of my mods can be found here.

lonestar
Member
Posts: 54
Joined: Mon Jul 17, 2017 03:25
Location: Texas,USA

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by lonestar » Post

Same issue here, male villages spawn without skin or skin is flat on the ground. I have created new world with only dependency mods and latest versions of these mods.

Mods I have enabled:
advanced_npc
handle_schematics
mg_villages
mobs_redo
unified_inventory

User avatar
Codesound
Member
Posts: 365
Joined: Thu Jun 09, 2016 14:56

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Codesound » Post

Sokomine wrote:
Codesound wrote: why most villagers spawn without skin... I wrong anything?
And the torch are olds 2d mods: in the latest image I put one new 3d torch.
Please update mg_villages, handle_schematics, mob_world_interaction, cottages and any village_* mods you might like. Newer versions of mg_villages use the new torches. I have no idea regarding the skins problem; except perhaps update minetest_game and advanced_npc to newest version?
Hi,

thanks, thanks, thanks for all your work and for your great support!

I work with Minetest 0.4.16 on Win10_x64 and I downloaded the .zip file that I find in this page:

viewtopic.php?f=9&t=17918

This problem may be due to the fact that the "mob_redo" folder has not been renamed "mob"..... ?
(I thought about it now... At noon I finish work and try to rename it)....

Thanks again

R

roboto
Member
Posts: 62
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by roboto » Post

I have the most up to date version of the dependencies, renamed mobs_redo to mob.

The males still have no skin.

User avatar
ErrorNull
Member
Posts: 270
Joined: Thu Mar 03, 2016 00:43
GitHub: ErrorNull0

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by ErrorNull » Post

From what i gather by browsing through npc.lua .. the code on line 953-957 refer to textures npc_male1.png through npc_male6.png. However, the mod's texture folder only contains npc_male1.png. It seems the texture folder is just missing textures npc_male2 through npc_male6. Removing the lines in npc.lua that refer to these missing textures will prevent the villagers from spawning in flat colors and replace them all with npc_male1.

User avatar
Codesound
Member
Posts: 365
Joined: Thu Jun 09, 2016 14:56

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Codesound » Post

ErrorNull wrote:From what i gather by browsing through npc.lua .. the code on line 953-957 refer to textures npc_male1.png through npc_male6.png. However, the mod's texture folder only contains npc_male1.png. It seems the texture folder is just missing textures npc_male2 through npc_male6. Removing the lines in npc.lua that refer to these missing textures will prevent the villagers from spawning in flat colors and replace them all with npc_male1.
Hi,

Thank you for your interest in my problem! Thanks, now works!!
Another solution is to create the others skins and put these in the texture folder...

Image
Image

thanks again!!!

R
Last edited by Codesound on Fri Aug 04, 2017 14:54, edited 1 time in total.

User avatar
BirgitLachner
Member
Posts: 393
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by BirgitLachner » Post

The features sounds very nice. I did not see that mod from the beginning. Thanks.

roboto
Member
Posts: 62
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by roboto » Post

Ok, that's cool.

How come no one is creating npc_male2.png through npc_male6.png?????? Why are they put in the code in the first place even though the .png files haven't been created?????

lonestar
Member
Posts: 54
Joined: Mon Jul 17, 2017 03:25
Location: Texas,USA

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by lonestar » Post

for a npc's favorite item, is this random gifts or a specific item(s)? Minecraft has a mod called MC Comes Alive, which is in the same aspect of this, but there are certain pre-determined items that you can give to work up to a relationship/marriage. Items like diamonds, gold and flowers for female npc's, diamonds giving the most points. Can't remember, but just a few diamonds and you can marry. Also, in creative mode, no need for relationship points, just give a ring to any npc and automatically married.

zorman2000
Member
Posts: 84
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Post

Hello all,

First of all, apologies for being missing in action the past weeks. I have been very busy in real life, but that doesn't mean I haven't been developing the mod, just absent from the forum.

Second, yes, the issue with the textures was a small issue that unfortunately happened by committing testing code. I have fixed it (edited first post) and now the latest *stable* version points to version with fix for the textures.

Third, I would like to announce that a new version will be coming soon. This version will not be compatible with the current version, as some parts have been entirely re-written in order to make Advanced NPC a usable API for other mods.

Hopefully will be back soon and not so absent anymore! And by the way, thanks to all who have tested and enjoy the mod!

zorman2000
Member
Posts: 84
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Post

lonestar wrote:for a npc's favorite item, is this random gifts or a specific item(s)? Minecraft has a mod called MC Comes Alive, which is in the same aspect of this, but there are certain pre-determined items that you can give to work up to a relationship/marriage. Items like diamonds, gold and flowers for female npc's, diamonds giving the most points. Can't remember, but just a few diamonds and you can marry. Also, in creative mode, no need for relationship points, just give a ring to any npc and automatically married.
Hi lonestar, thanks for the question, I will try to explain in the simplest manner possible!

First of all, a relationship with an NPC is divided into 6 phases, with phase 1 being the default for all NPCs and phase 6 being marriage. To work toward each phase, you need to give gifts to the NPC.

The NPC will have two favorite items during each phase which are randomly chosen from a pre-defined list of items.
(so answer to your question, yes, they are random, but not all items can be chosen as favorite, only a predetermined list)

How to know which items the NPC like? Talk to her or him. Each NPC give hints about items that it would like to have.
Giving the first favorite items (most liked) will increase your relationship points by 5, while giving the least liked item will increase relationship by 2.5 points.

When you accumulate enough points, the relationship will go to the next phase, and yes, much to Sokomine's sorrow, NPCs will throw a few hearts into the air to indicate that you have arrived to a new phase. At this point, new favorite items are chosen, and the NPC will also speak about other things.

When you get to the point where the NPC will not accept anymore gifts, he or she will actually tell you that you two should go a step further... this is the time to give them a marriage ring. They have a 50% chance to accept it or not, so you may have to try a few times.

NPCs also have two disliked items that stay the same during all relationship phases. Giving the most disliked item reduces your relationships by 5 points, and the less disliked item only by 2.5 points.
You can also check what the NPC doesn't like by talking to her or him.

The relationships will see a small tweaks in the near future, but it will not change heavily from what I have explained here! Hopefully this explains how the relationship system works for NPCs!

zorman2000
Member
Posts: 84
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Post

From now on, I will be providing development updates in this thread.
This mod is in constant development, even if they aren't new, user-visible features. Therefore, I want to make sure that you are up-to-date with its development.

Also please notice: compatibility with older, alpha release (https://github.com/hkzorman/advanced_np ... .0.0-alpha) will be broken in the near future. When this happens, you will have to remove all NPCs (using "/clearobjects quick") and then restore the villages' plotmarkers (using "/restore_plotmarkers <radius>") for them to spawn new NPCs.

Changelog Aug 25, 2017:

Content updates
  • Added 14 new male textures
  • Added 11 new female textures
Technical updates
  • Dialogues refactor and API
    • Dialogues now support a Minetest-like API, where any mod can register dialogue objects using:

      Code: Select all

      npc.dialogues.register_dialogue(def)
    • Dialogue definitions now contains tags, which allows you to classify and "tag" dialogues. This is used to associate dialogues to certain jobs, genders, relationship phases, etc.
    • Added functions to search the registered dialogues using based on a list of tags
  • Gift items API
    • Gift items (favorite and disliked items) can now be registered in similar fashion as the dialogues, namely, using:

      Code: Select all

      npc.relationships.register_favorite_item(item_name, def)
      or
      npc.relationships.register_disliked_item(item_name, def)
      
      The def contains the phase they like item (only applies to favorite items), hint and receive dialogue lines the NPC speaks.
  • Schedule API
    • Added "check" function: this is basically a function that searches, within a specified radius, for specific nodes. If one of these nodes are found, it will enqueue a list of actions associated to that node. This is how basically jobs like a farmer job will work: the NPC will check for crop nodes, dig it, get its seeds, plant a new one, and then do another check. This is repeated for the time the NPC will be working.
  • Occupations/jobs API
    • Defined occupation definition, which allows to override some of the default, random values that NPCs are initialized with. Occupations allow to override dialogues, initial inventory items, textures, and schedules.
    • Ability to register occupations:

      Code: Select all

      npc.occupations.register_occupation(occupation_name, def)
      
    • Added basic occupation definition
    • Added function to override NPC values based on occupation definitions
  • Spawner: large code refactor to remove dependency on plotmarker. This is needed to allow for manually spawned NPCs to also have knowledge of their surroundings.
  • Places: many of the node-scanning functions in spawner code where moved to places
The next item in the list is to implement node-scanning functions to search for workplaces. With this, and a proper, big round of testing, occupations should become a reality and we will see for sure the first farmer NPC lurking around a plot...

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by Sokomine » Post

zorman2000 wrote: The next item in the list is to implement node-scanning functions to search for workplaces.
You don't have to. The blueprints are analyzed and the positions of the workplaces stored. If you know which village and plot you're in/on, the position of the plotmarkers there can be calculated cheaply. There are even paths precalculated and stored that lead from the workplace to the front of the house. They're just not really walkable for any mobs yet as they don't know how to i.e. open the trapdoors. The next small update of mg_villages will offer more positions of places of intrest (soil/plants in the garden, straw in the stable, furnace, ...).
zorman2000 wrote: With this, and a proper, big round of testing, occupations should become a reality and we will see for sure the first farmer NPC lurking around a plot...
I'm looking forward to it :-) They definitely ought to go to their workplaces. Farmers are relatively easy (they love soil and plants that grow on it). Other workers are more tricky due to the movement they have to do to get to their workplace.
A list of my mods can be found here.

zorman2000
Member
Posts: 84
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Post

Sokomine wrote:You don't have to. The blueprints are analyzed and the positions of the workplaces stored. If you know which village and plot you're in/on, the position of the plotmarkers there can be calculated cheaply. There are even paths precalculated and stored that lead from the workplace to the front of the house. They're just not really walkable for any mobs yet as they don't know how to i.e. open the trapdoors. The next small update of mg_villages will offer more positions of places of intrest (soil/plants in the garden, straw in the stable, furnace, ...).
That is fantastic! Thanks a lot for these great news!
For now I will just focus on finding other plotmarkers and reading the workplaces based on the plotmarker's information. Regarding trapdoors, Advanced NPC currently just teleport to place if they can't find the way - therefore, they will find there way even with trapdoors.
Sokomine wrote: I'm looking forward to it :-) They definitely ought to go to their workplaces. Farmers are relatively easy (they love soil and plants that grow on it). Other workers are more tricky due to the movement they have to do to get to their workplace.
Yes, for the moment I'm just planning on farmers and maybe woodcutters. I'm afraid miners will take some time, but they will eventually come. First than miner, I can do others like cookers, bartenders, etc. and fill those village shops.

Thanks!

roboto
Member
Posts: 62
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by roboto » Post

One thing to be aware of:

The NPCs should stop and open the door before entering or exiting. Now, they just try to run through the door.

One more thing to be aware of, is that NPCs should dodge obstacles or go around them when going to a target such as a hostile mob.

zorman2000
Member
Posts: 84
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Post

Hi roboto, thanks for reporting these bugs!
roboto wrote: The NPCs should stop and open the door before entering or exiting. Now, they just try to run through the door.
The NPCs stop and open the door... but what you have seeing is a bug calculating wrong direction of the door. They believe it is open, so that's why they go through! I need to fix this, thanks.
roboto wrote: One more thing to be aware of, is that NPCs should dodge obstacles or go around them when going to a target such as a hostile mob.
The pathfinder code when going to a target is from mobs_redo.
This is actually either: 1) a bug from mobs_redo or 2) maybe I need to set pathfinder = 2 which is more smart and allows reaching hostile targets easier. I will consider this! Thanks!

User avatar
BirgitLachner
Member
Posts: 393
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by BirgitLachner » Post

Is there a possibility to use those NPC in my own world without the mod "mg_villages"?

Is there yet an instruction how to do that?

Thanks, Birgit

zorman2000
Member
Posts: 84
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Post

Hi Birgit,

Yes, there is! Just use the spawn egg in the inventory. The name is "NPC" and has brown spots.
The only downside to this method is that the NPC will not know anything of its environment, so don't expect them to open doors, sleep on beds, etc. They can, however, trade and talk with you.

Also, soon-ish, this limtation will be gone and NPCs spawned with eggs will also be aware of their environment, so stay tuned!

Thanks!

zorman2000
Member
Posts: 84
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Post

Time for a quick update!

Changelog Aug 29, 2017

Content updates
  • Add new, WIP priest occupation. Spawns in houses near a church building.
Features update
  • (WIP) Occupations assignment based on surrounding buildings and workplaces is finally working. This is still WIP and requires lots of fine-tuning. For now, a test priest spawns in any house, hut or farm close to a church building
Technical updates
  • Places API
    • Nearby plotmarkers can be scanned by giving a certain position
    • Workplaces can be gathered from the plotmarkers
    • NPC-usable node list now contains also workplaces and is ready to also support, in the future, nodes that the NPC might use during work.
  • Spawner API
    • Function added to determine occupation names given the surrounding buildings and workplaces
    • (WIP) Assign occupations to NPCs based on surrounding buildings and workplaces
  • Occupations API
    • Added ability to set initial trader status. Useful for e.g. priests who don't trade at all
    • Fixed lots of bugs in the initialization code.
    • NPC sex is now chosen out of the texture that occupation provides.
Stay tuned! More coming soon!

zorman2000
Member
Posts: 84
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Post

Update
Changelog for Sep 5, 2017

Content updates:
  • Improve basic priest. A priest will spawn in a house near a village's church. The priest will be in the church most of the day, and while there, may heal you and teach universal wisdom.
Here is a priest on his church:
Image

Technical changes:
  • Occupations API
    • Add ability to enable/disable gift item hints on initialization
    • Fix multiple initialization bugs
  • Schedules API:
    • Add ability to enable/disable gift item hints
    • Add ability to add and edit flags

roboto
Member
Posts: 62
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by roboto » Post

Hello,

You can merge this directory to your repository. I did nothing but remove occupations_data.lua and add its contents to init.lua (A bit of cleaning up in the repository :) ) and I added 11 new "teachings" to the priest.

There are some far out things that I have absolutely no idea on what to do considering that I'm new to Lua. Example: When you get married to an npc, it might be preferably done at the church in the village where the priest engages in the marriage.

Thanks!
Attachments
advanced_npc.zip
(718.38 KiB) Downloaded 68 times

zorman2000
Member
Posts: 84
Joined: Tue Jul 26, 2016 18:18
GitHub: hkzorman
In-game: zorman2000

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by zorman2000 » Post

roboto wrote:Hello,

You can merge this directory to your repository. I did nothing but remove occupations_data.lua and add its contents to init.lua (A bit of cleaning up in the repository :) ) and I added 11 new "teachings" to the priest.

There are some far out things that I have absolutely no idea on what to do considering that I'm new to Lua. Example: When you get married to an npc, it might be preferably done at the church in the village where the priest engages in the marriage.

Thanks!
Hi roboto!
First of all, thanks a lot! I really appreciate your contributions! You are welcome to do them as a pull request as well in the Github repo!

I may or may not (but probably will) add the changes for cleanup, since I'm still unsure about what occupations_data.lua will do. But I do appreciate this and probably will merge it.
Also, thanks a lot for the 11 new teachings! This will definitely will be added!

I'm also new to Lua, so we are in the same boat. Regarding that weddings should be at church, I agree 100% on that. I was actually planning to add myself that in the future and have some idea on how to do it. I will explain the design I had in mind.

First, we need player flags. This will do the same effect as NPC flags, which are just variables to put data in and help you code different behavior. For example, when a NPC has accepted to marry the player, a player flag will be set to indicate this. Then, when the player speaks to the priest, and this flag is present, the priest can have a new dialogue option where player can ask to get married. And then, once priest accepts to marry them, then I guess the player can ask the NPC to follow him/her and then go to church together, talk to priest again, and then the ceremony occurs.

This requires a few things, it requires player flags, it requires that dialogue option are conditioned by flags, and a few more things.

Hope I have given you some ideas! I plan to do this myself in the future anyways, but if you want to start on it, feel free!

Thanks!

roboto
Member
Posts: 62
Joined: Wed Jul 19, 2017 15:21
GitHub: NewbProgrammer101
In-game: akoek

Re: [Mod] Advanced NPC (WIP) [advanced_npc]

by roboto » Post

I sent you the pull request for the mod.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 8 guests