Spawning villager with custom trades doesn't properly put amount of items in trade menu

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

yv2

New Member
Jan 29, 2025
9
0
1
When I use this skript to spawn a custom Villager with custom trades, all the trades work, except the fact that the amount of items the player needs to trade is only 1. I have tried this with replacing the variables with actual numbers but it still doesnt work. Also the enchanted book doesn't display the enchantment and is only a enchanted book with no enchants. The skript is below.
1740642492818.png

Code:
on right click on zombie nitwit with enchanted golden apple:
   
   
    if clicked entity doesn't have potion effect weakness:
        exit
    if metadata tag "godVillager" of clicked entity is true:
        exit
    if (clicked entity).isConverting() is true:
        exit
    make player swing their hand
    remove 1 of enchanted golden apple from player's held item


    set {_oxidizedCopper} to random integer from 20 and 50
    set {_phantomMembrane} to random integer from 20 and 50
    set {_nautilusShell} to random integer from 16 and 32
    set {_emeraldBlock} to random integer from 16 and 32
   
   
    set {_nbt} to nbt of "{VillagerData:{type:emoji_stuck_out_tongue:lains,profession:nitwit,level:99},Offers:{Recipes:[{maxUses:1,buy:{id:emoji_astonished:xidized_copper,Count:%{_oxidizedCopper}%},buyB:{id:heart_of_the_sea,Count:1},sell:{id:trident,Count:1}},{maxUses:8,buy:{id:emoji_stuck_out_tongue:hantom_membrane,Count:%{_phantomMembrane}%},buyB:{id:nautilus_shell,Count:%{_nautilusShell}%},sell:{id:shulker_shell,Count:1}},{maxUses:4,buy:{id:emerald_block,Count:%{_emeraldBlock}%},buyB:{id:book,Count:1},sell:{id:enchanted_book,Count:1,tag:{StoredEnchantments:[{id:""minecraft:swift_sneak"",lvl:3s}]}}}]}}"
    if clicked entity is baby zombie nitwit:
        spawn baby zombie nitwit at clicked entity's location with nbt {_nbt}
    else:
        spawn adult zombie nitwit at clicked entity's location with nbt {_nbt}
    clear clicked entity
    (last spawned zombie nitwit).setConversionTime(100)