1

Trouble getting a villager to buy books

Ontvlambaar's Avatar Ontvlambaar10/6/17 7:37 am history
1 emeralds 228 7
10/6/2017 1:11 pm
Ontvlambaar's Avatar Ontvlambaar
So I'm working with custom villagers. Upon trading villager #1, you get Quest book #1.
You have to deliver Quest book #1 to villager #2 to get the next questbook and so on..

I tried using villager /summon's, and for the first villager everything works flawless - but as soon as I try to get Villager #2 to buy the first quest book, it wont give in.

Villager 1 summon command:
/summon villager ~ ~-0.5 ~ {OnGround:1b,NoGravity:0b,Invulnerable:1b,CustomName:"Bruce",CustomNameVisible:1b,FallFlying:1b,PersistenceRequired:0b,NoAI:1b,CanPickUpLoot:0b,Profession:5,Career:1,CareerLevel:1,Rotation:[180F,0F],Offers:{Recipes:[{rewardExp:1b,maxUses:210000,buy:{id:"minecraft:emerald",Count:5b},sell:{id:"minecraft:written_book",Count:1b,tag:{display:{Name:"Halloween Questbook #1",Lore:"Halloween 2017"]},title:"",author:"VW Staff",pages:["{\"text\":\"Halloween 2017 Questbook\",\"color\":\"light_purple\",\"extra\":{\"text\":\"\\n\\nHi, the name's bruce. Welcome to the town of Sleepy Hollow!\\n\\nOur town is a popular tourist attraction because of Notch's tombstone!\\n \",\"color\":\"black\"},{\"text\":\"\\nOr well.. was popular..\",\"color\":\"gray\",\"italic\":true}]}","{\"text\":\"The popularity of our town has decreased last week after some girl, Janet, went missing.\\nJanet is.. or was.. the daughter of the well-known salesman Hugh Townley. \",\"color\":\"black\",\"extra\":[{\"text\":\"\\n\\nAfter she went missing, the villagers have been hearing screams every day.\",\"color\":\"black\"}]}","{\"text\":\"Hugh sent out a private investigator to find his daughter.\\n\\nThat investigator, Peter Holmes, incriminates every single villager..\",\"color\":\"black\",\"extra\":[{\"text\":\"\\nI'm certain no-one here will put our main source of income at stake..\",\"color\":\"black\"}]}","{\"text\":\"My brother, Dan, was out of town to get supplies for Halloween. He doesn't know about the ongoing events yet. \",\"color\":\"black\",\"extra\":[{\"text\":\"\\n\\nCan you please find him and tell him what I've just told you?\",\"color\":\"black\"}]}","{\"text\":\"New objective:\",\"color\":\"black\",\"bold\":true,\"extra\":[{\"text\":\"\\n\\n-Find Dan\",\"color\":\"green\",\"bold\":false,\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Dan's Last-known location is near the pumpkin farm.\"}}]}"]}}}]}}

Villager 2:
/summon villager ~ ~-0.5 ~ {OnGround:1b,NoGravity:0b,Invulnerable:1b,CustomName:"Dan",CustomNameVisible:1b,FallFlying:0b,PersistenceRequired:0b,NoAI:1b,CanPickUpLoot:0b,Profession:5,Career:1,CareerLevel:1,Willing:0b,Rotation:[275F,0F],Tags:["Bruce's brother"],Offers:{Recipes:[{rewardExp:1b,maxUses:21000,buy:{id:"minecraft:written_book",Count:1b,tag:{display:{Name:"Halloween Questbook #1",Lore:"Halloween 2017"]},title:"",author:"VW Staff",generation:0,pages:["{\"text\":\"Halloween 2017 Questbook\",\"color\":\"light_purple\",\"extra\":{\"text\":\"\\n\\nHi, the name's bruce. Welcome to the town of Sleepy Hollow!\\n\\nOur town is a popular tourist attraction because of Notch's tombstone!\\n \",\"color\":\"black\"},{\"text\":\"\\nOr well.. was popular..\",\"color\":\"gray\",\"italic\":true}]}","{\"text\":\"The popularity of our town has decreased last week after some girl, Janet, went missing.\\nJanet is.. or was.. the daughter of the well-known salesman Hugh Townley. \",\"color\":\"black\",\"extra\":[{\"text\":\"\\n\\nAfter she went missing, the villagers have been hearing screams every day.\",\"color\":\"black\"}]}","{\"text\":\"Hugh sent out a private investigator to find his daughter.\\n\\nThat investigator, Peter Holmes, incriminates every single villager..\",\"color\":\"black\",\"extra\":[{\"text\":\"\\nI'm certain no-one here will put our main source of income at stake..\",\"color\":\"black\"}]}","{\"text\":\"My brother, Dan, was out of town to get supplies for Halloween. He doesn't know about the ongoing events yet. \",\"color\":\"black\",\"extra\":[{\"text\":\"\\n\\nCan you please find him and tell him what I've just told you?\",\"color\":\"black\"}]}","{\"text\":\"New objective:\",\"color\":\"black\",\"bold\":true,\"extra\":[{\"text\":\"\\n\\n-Find Dan\",\"color\":\"green\",\"bold\":false,\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Dan's Last-known location is near the pumpkin farm.\"}}]}"]}},buyB:{id:"minecraft:emerald",Count:1b},sell:{id:"minecraft:planks",Damage:2,Count:1b}}]}

As an attempt to fix this, I tried copying the sellitem from the command into the buy slot of villager #2, but that didn't work.

Does anyone here have experience with that? Or suggestions on how to make this work? Been cracking my brain all morning trying to fix this..
Posted by Ontvlambaar's Avatar
Ontvlambaar
Level 61 : High Grandmaster Artist
188

Create an account or sign in to comment.

7

2
10/06/2017 8:32 am
Level 57 : Grandmaster Cyborg
Pepijn
Pepijn's Avatar
These commands should work:

Villager 1:
https://pastebin.com/wDbMRRAp

Villager 2:
https://pastebin.com/xPvEdMFZ
1
10/06/2017 10:44 amhistory
Level 61 : High Grandmaster Artist
Ontvlambaar
Ontvlambaar's Avatar
Upon reading the book, the nbt-count increases from 4 to 5 again. Villager 2 doesn't buy the books after they've been read.. Not sure what's causing this, but it sure is annoying.


Using NBT-explorer I found that the book's nbt-tag entry that's being added upon reading is "resolved:1". Would adding resolved:1b after the author in the command work?
2
10/06/2017 11:31 amhistory
Level 57 : Grandmaster Cyborg
Pepijn
Pepijn's Avatar
I would personally just add a "Book:1" tag to book from the first villager:
https://pastebin.com/pURrSavM

And only test for that in the second villager:
https://pastebin.com/bXxvMzPY

This way you don't have to check every single tag the book has (so you don't have to worry about things changing around when you read the book. Because that's what is happening, it's rearranging some tags after you read it for the first time and that's causing an issue it seems), but it will still only work with the book you want (because of the custom Book:1 tag). For the second quest book, you just use Book:2, etc etc.
1
10/06/2017 1:11 pm
Level 61 : High Grandmaster Artist
Ontvlambaar
Ontvlambaar's Avatar
That works for me too! Thanks!
1
10/06/2017 10:28 am
Level 61 : High Grandmaster Artist
Ontvlambaar
Ontvlambaar's Avatar
That worked, awesome! I compared the commands you sent me with the ones I was using. Only noticed a space as difference, was that causing the book to not be bought? The NBT-tag of the book reduced from 5 to 4 it seems?

Thanks ALOT!
2
10/06/2017 11:23 am
Level 57 : Grandmaster Cyborg
Pepijn
Pepijn's Avatar
You must be using different commands than the commands you pasted in here, because both of them had errors in them.
1
10/06/2017 7:40 am
Level 61 : High Grandmaster Artist
Ontvlambaar
Ontvlambaar's Avatar
Forgot to mention.. BuyB for Villager #2 is not what I really want him to buy. I tried adding another buy item to go alongside the book to fix this.

The sell item for Villager #2 is incorrect too. That should become a second quest book later.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome