Page 6 of 7

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Mon Aug 07, 2017 20:04
by KCoombes
pulled new copy, but not sure if I needed to for this hotfix (not sure if I bothered with the latest MT)

Did not need hotfix after all.

Continued testing trading and got this from a bricklayer in a sandcity village:

Code: Select all
2017-08-07 19:04:10: INFO[Main]: Right-clicked object
2017-08-07 19:04:10: ACTION[Server]: singleplayer right-clicks object 515: LuaEntitySAO at (164,3.7,512)
2017-08-07 19:04:10: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'villagers' in callback ScriptApiEntity::luaentity_Rightclick(): ...test-0.4.16-win32-msvc\bin\..\mods\villagers/trading.lua:760: attempt to concatenate local 'item_stock' (a nil value)
2017-08-07 19:04:10: ERROR[Main]: stack traceback:
2017-08-07 19:04:10: ERROR[Main]:    ...test-0.4.16-win32-msvc\bin\..\mods\villagers/trading.lua:760: in function 'getTradingFormspec'
2017-08-07 19:04:10: ERROR[Main]:    ...test-0.4.16-win32-msvc\bin\..\mods\villagers/trading.lua:809: in function 'tradeVillager'
2017-08-07 19:04:10: ERROR[Main]:    ...test-0.4.16-win32-msvc\bin\..\mods\villagers/actions.lua:641: in function 'on_rightclick'
2017-08-07 19:04:10: ERROR[Main]:    ...netest-0.4.16-win32-msvc\bin\..\mods\villagers/spawn.lua:785: in function <...netest-0.4.16-win32-msvc\bin\..\mods\villagers/spawn.lua:785>

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Tue Aug 08, 2017 05:30
by ErrorNull
if you right click on the node located at the village position, does the formspec that pops up show any errors? you can use /villages command to verify what the village position is for the village you're currently in.. then go to that position and right click on it.

note: the next update coming up has the trading inventory algorithm redone to be more efficient and prevent these 'item_stock' errors.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Tue Aug 08, 2017 13:54
by azekill_DIABLO
okay then, let's give it a chance!

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Tue Aug 08, 2017 22:09
by KCoombes
Only found two issues this time:

If you sell to a trader, say 'landlord' and wipe out his stock of coins, the next 'landlord' will also have no coins left for the same item... but will have coins for a different item...

and this one:

Image

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Wed Aug 09, 2017 05:26
by ErrorNull
KCoombes - the screenshot shows a job title i didn't anticipate called "soldier". i have added that in now. go ahead and grab the latest from github or just grab the traders.lua which is the only file i altered in this case.

regarding the stock item counts seemingly being updated globally instead of locally for each trader.. i will need to look into that a bit further. thanks for letting me know.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Wed Aug 09, 2017 15:28
by Sokomine
The villagers living and working in castles are called "soldiers" now. The ones working in i.e. towers are called "guards". Seemed most reasonable to me.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Wed Aug 09, 2017 16:31
by Lord_Vlad
Just a little issue here, very specific case so don't pay too much attention : when you blow up the surroundings with says... the nuke mod, the villagers will stay in place, flying where the ground used to be and acting like nothing happened (protection removed, ofc)

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Wed Aug 09, 2017 19:59
by Sokomine
Lord_Vlad wrote:Just a little issue here, very specific case so don't pay too much attention : when you blow up the surroundings with says... the nuke mod, the villagers will stay in place, flying where the ground used to be and acting like nothing happened (protection removed, ofc)

Perfectly correct behaviour of them :-) Nukes and TNT and the like are reserved for deep deep mining, far away from any settlements.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Thu Aug 10, 2017 00:18
by ErrorNull
Sokomine wrote:
Lord_Vlad wrote:Just a little issue here, very specific case so don't pay too much attention : when you blow up the surroundings with says... the nuke mod, the villagers will stay in place, flying where the ground used to be and acting like nothing happened (protection removed, ofc)

Perfectly correct behaviour of them :-) Nukes and TNT and the like are reserved for deep deep mining, far away from any settlements.


yes, my code currently agrees!

and lord_vlad, seems like you are so interested in mass pvp. lol. first it was just hitting one villager at a time, and now targeting entire villages. :O at this time, the villagers and invincible and do not follow any rules of gravity. at some point they will.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Thu Aug 10, 2017 17:08
by ManElevation
ErrorNull wrote:This mod spawns villagers in Sokomine's mg_villages mod. I want to provide a light-weight and simple mod where villagers have enough basic interactivity to make the villages more fun to visit and explore. The villagers will walk around, dig some things, provide random facts or smalltalk by chatting, and buy sell items by trading. They will not befriend you, become your travel buddy, or similate a daily routine or social community.

I also focus on making the villager's appearance (skin, hair, clothing, etc) and chat dialogue random but also based on the region, climate, and type of village and building.

Image
Image

VISAUL FEATURES:
-chat popup bubbles and not player console
-skin, hair, clothing types randomly chosen
-random chat dialogue but also based on job
-random names but also based on region & age
-villagers stay near their assigned plots
-remembers prior position & actions on re-spawn
-continues prior action after chatting/trading
-villagers cannot 'hear you' if chatting to fast

TECHNICAL FEATURES:
-villagers spawn using LBM's and not ABM's
-infrequent action calculations - every 4-6 sec
-minimal walking & standing animation glitches
-checks if multiplayers chat/trade same villager

REQUIREMENTS: Sokomine's main villages mod: [mg_villages]

RECOMMENDED MODS:
[cottages] - adds more village types: medieval, charachoal, lumberjack, claytrader, logcabin, tent
[village_gambit] - adds village type 'gambit'
[village_towntest] - adds village type 'cornernote'
[village_sandcity] - adds village type 'sandcity'
[village_ruins] - adds village type 'ruins'

VERSION: v0.17
Warning! Mod is still very work-on-progress. Expect errors and halfway implemented features. It is available now to simply test and gather your feedback and report errors. Villagers do not yet support the GRASSHUT village type, so it may not work correctly or at all - or crash the game. My expected roadmap:
* v0.18 = playable trading system
* v0.20 = support more farming/food/drinks mods
* v0.25 = create chat dialogue based on each job type
* v0.30 = improve movement & actions algorithm
* v0.35 = hostile mob interaction
* v0.40 = unique clothes for certain jobs

LICENCE: WTFPL
TODO: TODO.txt on GitHub
CHANGELOG: README.txt on GitHub

DOWNLOAD [VILLAGERS] HERE! GitHub page for Villagers

love the priest!

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Thu Aug 17, 2017 14:50
by LouisCyfer
love the updates!!

I know there's always the option to use this commands "/giveme villagers:coins xxx" and "/giveme villagers:coins_gold xxx" (or via unified inventory search etc :P)

Also the trader hunting you mentioned earlier, I came up with an idea!

What you think of a reasonable coin production via technic compressor for coin making .. or a coin press to produce coins with gold or silver or copper .. also bronze (copper combined with tin)?

possible way in my idea:
metal ingot --> compress --> raw coin --> compress or via coin press --> coin (normal or gold)

EDIT:
additional idea: coin findings via default:dirt_with_grass digging!!

optional items.lua modification (suggestion!)
Code: Select all
minetest.register_craftitem("villagers:coins", {
   description = "Silver Coin",
   inventory_image = "coins.png",
})

minetest.register_craftitem("villagers:coins_gold", {
   description = "Gold Coin",
   inventory_image = "coins_g.png",
})

-- coin findings in 'default:dirt_with_grass'
local set_item_def = {
   { items = {'villagers:coins', 'default:dirt'}, rarity = 30 },
   { items = {'villagers:coins_gold', 'default:dirt'}, rarity = 50 },
   { items = {'default:dirt'} }
}

minetest.override_item("default:dirt_with_grass", { drop = { max_items = 1, items = set_item_def } })


Alternately I could write a small additional mod, including a manual coin press.
Please let me know your feedback!
ty

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Fri Aug 18, 2017 00:13
by ErrorNull
ErrorNull wrote:love the priest!
Thanks... and the priest loves you too! :p

LouisCyfer wrote:love the updates!!

I know there's always the option to use this commands "/giveme villagers:coins xxx" and "/giveme villagers:coins_gold xxx" (or via unified inventory search etc :P) Also the trader hunting you mentioned earlier, I came up with an idea!

What you think of a reasonable coin production via technic compressor for coin making .. or a coin press to produce coins with gold or silver or copper .. also bronze (copper combined with tin)? possible way in my idea:
metal ingot --> compress --> raw coin --> compress or via coin press --> coin (normal or gold)

EDIT: additional idea: coin findings via default:dirt_with_grass digging!!

Alternately I could write a small additional mod, including a manual coin press.
I like the idea of dirt dropping some coins. I will incorporate that into my next update as an option that can be enabled/disabled and ability to adjust the drop probability from the config.lua file. Sidenote: I also plan to have dirt drop bones on rare occasions too. That is something my kids enjoy in order to make bonemeal for farming and have bones for crafting other things too.

Regarding the coin press, i personally don't user technic mods when i play, but a coin press seems interesting. I'll be open to include it into my villagers mod as another option that can be enabled or disabled from config.lua. If you can write me the code, i'll throw it in there!

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Fri Aug 18, 2017 07:08
by LouisCyfer
@your sidenote: ethereal already adds bones to default:dirt via bonemeal.lua

maybe a routine to read out current drop and add the new drop with rarity would be a great idea! .. like having additional drop on demand. I assume 0 or 1 is very often, 100 is far rare, but haven't found any documentation about item rarity yet.
For the coin press, I'm working on a mesh for that aswell but need a routine for production for a manual way.

If you wish I could write a routine for that both in a seperate lua file, which I could do a PR via GH if thats ok.

@having settings in options menu: built-in incl documnentation

EDIT:

I put everything in a PR, hope you like it!
link

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Tue Aug 22, 2017 00:56
by ErrorNull
LouisCyfer wrote:ethereal already adds bones to default:dirt via bonemeal.lua
the ethereal mod is one i'd like to support, won't be until later down the line. but i may just throw in the bonemeal mod in sooner along with the other food mods i'm adding now.

LouisCyfer wrote:I put everything in a PR, hope you like it!
Ok this is cool. didn't get a chance to look through it yet, but will do in the next day or two.. and most likely add it in. Thanks for putting that together!

Past few weeks have been busy with other personal things, but things starting to settle down and so plan to put out my next update this week by thurs or friday.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Tue Aug 22, 2017 05:29
by LouisCyfer
ErrorNull wrote:the ethereal mod is one i'd like to support, won't be until later down the line. but i may just throw in the bonemeal mod in sooner along with the other food mods i'm adding now.

very awesome! (I love the mushroom biome :D)

ErrorNull wrote:Ok this is cool. didn't get a chance to look through it yet, but will do in the next day or two.. and most likely add it in. Thanks for putting that together!

If there is anything plz let me know! I'm glad I can help :)

ErrorNull wrote:Past few weeks have been busy with other personal things, but things starting to settle down and so plan to put out my next update this week by thurs or friday.

no worries, last week had me busy aswell (RL and stuff) .. I know the feeling and no worries, good things need time and enthusiasm, also motivation.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Tue Aug 22, 2017 10:08
by azekill_DIABLO
great job!

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Thu Aug 24, 2017 14:10
by ErrorNull
Hey LouisCyfer - I've merged in your pull request. Players now will find coins on rare occasions when digging dirt type nodes. After testing a bit i can see the silver and gold coins count in the player inventory occasionally increase while digging the dirt. I also like how we can enable/disable the coin-drop and startup-coins settings from the main minetest settings menu now. cool cool.
Image

I would like to have the coins sound effect (coins.ogg) play whenever coins are collected this way. Would you like to look into that update for me? That would let make it more apparent when coins are found, what do you think?

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Thu Aug 24, 2017 19:09
by LouisCyfer
YAY!!
I'm lad your excited about the PR and how it works .. let me know if there are any issues or something i might need to know anyways.

The sound might just be a function hook while item pickup .. no biggie!

As far I heard the "coins.ogg" does not really sound like a "super mario coin pickup" .. unsure if you planned to replace that file or if this one is a placeholder or something. I could write a small routine with that sound implented. (of course the file string can be exchanged later :) )

regards

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Fri Aug 25, 2017 00:46
by ErrorNull
ErrorNull wrote:let me know if there are any issues or something i might need to know anyways.

On line 46 of coins.lua I tweaked the variable declaration to empty string. Otherwise there would be error if it stays nil later in the code...
Code: Select all
local debug = ""


ehh.. i wouldn't want something like the super mario coin pickup sound, which i feel is a bit too artificial or synthesized sounding. the coins.ogg sound that's currently in use (when trading with a villager) sounds like coins hitting each other.. which I prefer. i'd be open to other coin jingle sounds that are similar though.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Fri Aug 25, 2017 04:01
by LouisCyfer
no problem, the debug is just for debug purposes >.< and only ment for that hehe

By any means, I respect the way you design your mod also will follow with whatever your vision floats you!

For me this ogg file sort of sounds like paper to me, maybe another sound would be more appropiate but I would not mind agreeing to exchange. If that's ok I look out for another coins.ogg :)

EDIT:
a quick search gave me this result which is licensed CC0 aswell so we can use it and it is a better sound in my opinion, but it depends on you because your the mod creator.

CoinToJar.mp3
Natural Metal Coin Sound 3.wav

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Tue Jul 24, 2018 11:45
by daddaaddaaad
Image

Hello, I really like this villagers mod but I have a problem with the villagers spawning bellow ground.
I changed the value for pos.y = village_data.vh + 0.5 to pos.y = village_data.vh + 2 and the result is in the linked image. (line 345-ish?)
-edit 25/7/18: the edited file is spawn.lua

It looks like the hitbox for the villagers is not at their correct position. Can anyone point which line I should edit? I'm new to editing lua files, but been enjoying minetest since 4.14.

-edit 25/7/18: should I be looking into attributes.lua? There's this "collision box" thing right at the end.
Again, I really like this mod and been playing minetest with my son since 4.14. We'd like to have other things to do besides building and fighting mobs.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Wed Jul 25, 2018 06:18
by daddaaddaaad
Image

So... here's what I did:

In spawn.lua I used this value pos.y = village_data.vh + 1.25
I think the spawned villagers' feet touch the ground closest with this setting (at least for me)
I still have problems with villagers' children who spawned on snow, they float even after the snow was dug (where you get snowballs).
Now the villagers roam and are doing their stuff.

And for the collision box (edit = this is in attributes.lua) since I don't really know which value controls which axis it's a bit of trial and error and here's the values I use:
local new_collision_box = {
- 0.25*new_size, - 0.25*new_size, - 0.25*new_size,
0.25*new_size, 0.5*new_size, 0.25*new_size
}
The result is that small box right around the chest of the villagers themselves, but it's usable for trading I guess.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Wed Jul 25, 2018 16:25
by Sokomine
daddaaddaaad wrote:I still have problems with villagers' children who spawned on snow, they float even after the snow was dug (where you get snowballs).

The 3d models for the children are usually scaled-down versions of the adults. With just the size beeing changed, the model will float in midair. I've seen the effect in my mobf_trader mod as well but don't know a workaround.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Thu Jul 26, 2018 02:45
by daddaaddaaad
Sokomine wrote:The 3d models for the children are usually scaled-down versions of the adults. With just the size beeing changed, the model will float in midair. I've seen the effect in my mobf_trader mod as well but don't know a workaround.


I gues the origin for the axis isn't at their feet? I mean where the coordinates of x,y,z is at 0,0,0

Anyway, it isn't much of a problem because it seems the villagers are doing what they are supposed to do now. And it looks like the floating children only happens in arctic region.

Re: [Mod] Villagers for Minetest [villagers][v0.17]

PostPosted: Thu Jul 26, 2018 14:59
by Sokomine
daddaaddaaad wrote:Anyway, it isn't much of a problem because it seems the villagers are doing what they are supposed to do now. And it looks like the floating children only happens in arctic region.

Maybe they don't want to freeze their feet ,-)