Skip to content
NP Editor Docs

Tutorial "Mulgyeol" part 3 — Villagers and trading

Five villagers live in Mulgyeol: the fisher Gangmuli, the woodcutter Dandani, the miner Banjjaki, the farmer Deulpuli, and the general-store keeper Altteuli. In this part you build the fisher Gangmuli from scratch, making every piece of “trading without windows” once. You use no dialogue or shop windows. Talking, buying and selling, and getting items are all done by looking at something and clicking (in ▶ Play, F or right-click).

What you doWhat you build
Make a villagerA moving model (display actor + animation) · a name tag (component Text display) · a talk zone · a talk rule
MoneyA per-player variable money (initially 1000) · “Money 1000” on the action bar every 1.5 seconds
BuyingA stall (base block · item · price text · zone) + 3 rules — buy when you have the money, a hint when you are short
SellingA sales chest (chest block · text · zone) + 3 rules — sell all the apples in your bag and your money grows
Getting itemsA gathering spot (text · zone) + 1 rule — gives an item once every 5 seconds

One loop in Mulgyeol goes like this: get apples from the farmer’s apple tree → sell apples at the fisher’s sales chest (30 each) → buy a lantern at the fisher’s stall (120). You start with 1000, and at the general-store keeper’s stall you save toward a beacon (1500).

Preparation: in samples\showcase\ of the install folder, 7 villager, dancer, and protagonist models are in the models\ folder and already registered in the registry (assets\registry.json). The rule pictures (steps 6 to 9 and 13 to 15) show the bottom area enlarged and the left and right areas collapsed (the “Left area”, “Right top area”, and “Right bottom area” checks in the Window menu). You can follow along without the same screen, but before steps 10 to 12 (typing positions in Details) and before ▶ Play, turn the collapsed areas back on. If the front of a position number in Details looks cut off (181.5 shown as “81.5”), drag the left border of the right column to widen it (pictures 03 and 05 were taken cut off, but the values are 181.5, 70.04, 213.5 for 03 and 181.5, 70, 213.5 for 05).

A note on input fields: right after you type a value into a text or number field, Shift, WASD, and the number keys in ▶ Play go into that field and do not work. Put the mouse over the viewport and scroll the wheel one notch to leave the field, then click ▶ (it is fine if the view moves a little).

This tutorial’s sample world uses Korean names and messages. Type the Korean values given in code format exactly as shown, so your world matches the sample and the pictures; the English in parentheses is only a gloss.

Open it the same way as “Starting file for this part” in part 2. In Explorer, copy the whole samples\showcase folder under your own working folder (if you already copied it in part 2, use that folder), open mulgyeol_start3.npworld in that folder with File > Open…, and immediately save it in the same folder as mulgyeol_part3.npworld with File > Save As…, then start. The sky, the registry (assets\), and the models (models\) must be in the folder together for the sky and models to look like the pictures. The 7 models (mg_fisher and others) should show in the Content Browser under props, and the woodcutter, miner, farmer, and shopkeeper should stand in human shape (if you see magenta boxes, the registry did not come along — check that you copied the whole folder). This file contains the part 2 cutscene and the following.

  • 4 villagers (woodcutter, miner, farmer, shopkeeper): finished, with model, name tag, talk zone, and talk rule.
  • 3 stalls (cake, poppy, beacon) · 3 sales chests · 3 gathering spots (apples, ore vein, log): the blocks, text, and zones are placed. The gathering rules exist; the buying and selling rules do not exist yet because there is no money.
  • What is missing: everything for the fisher Gangmuli, and the money variable, the money display, and all buying and selling rules. You build the fisher’s part yourself in this part. For the other stalls and sales chests, copy the fisher’s rules and change only the ids and values; they are all built in the finished map (mulgyeol_final.npworld).
  1. In the Content Browser in the bottom area, open Prop and type mg_fisher in the search field. One fisher model in a yellow raincoat appears. This model has 11 bones and 6 animations (idle_a · idle_b · idle_c · bow · dance · hero_stand). To use your own model, bring in a .bbmodel with Import (the file name becomes the id as is).

    mg_fisher found in the Content Browser props

  2. Click Add on the toolbar, type item model in the search field, and double-click Display — item model (Item Display). A display actor is placed and selected.

    Choosing Display — item model in the quick-add window

  3. In Details, set Model to mg_fisher and Animation to idle_a. Type 181.5, 70.04, 213.5 in the X, Y, Z fields of the Position row and 90 in the first field (yaw) of the Rotate row. Type 어부 강물이 (Fisher Gangmuli) in Name at the top and mg_fisher in id below. Write the id in English letters. The rules point to the actor by this id.

    The display actor's model, animation, and position

    The position of a display actor is the center of the model’s bounds. The fisher is a little over 2 blocks tall, so place him about 1 block above foot height (69) (70.04 in the picture).

  4. Under Components at the top of Details, click Add and choose Text display. Type 어부 강물이 in Text, 1.5 in the middle field (Y) of Offset, #fff4c8 in Text color, and #70000000 in Base. A name tag appears above the head and mg_fisher.label is added in the outliner.

    The Text, Offset, Text color, and Base of the Text display component

  5. Make the zone where you talk to the fisher. Under Add on the toolbar, place Trigger zone — box (4×3×4), and in Details type 1, 2, 1 in the X, Y, Z fields of the Size row and 181.5, 70, 213.5 in the Position row. Type 어부 말 걸기 (Talk to fisher) in Name and mg_fisher_talk in id. It overlaps the model at the same spot, so if you look at the fisher and press F, you trigger this zone.

    The talk zone's size, position, and id

  6. In the World logic tab of the bottom area, click the ”+” (new rule) at the top left. The id field in the properties starts as rule_1. Click the field, select all with Ctrl+A, type r_talk_mg_fisher, and confirm with Enter (it changes only after you press Enter. If you move to another field without Enter, the text you typed stays in the field but the rule id is still rule_1, and the field returns to rule_1 the next time the screen is redrawn, such as when you add an action). For the rule name, select all in the bold field above the id row (it starts as “New rule”) the same way and type 어부 강물이 말 걸기 (Fisher Gangmuli talk). Clear and type the id and name fields of later rules the same way. Change the trigger to Right-click actor and choose 어부 말 걸기 · mg_fisher_talk in Actor. In Text of the default Chat message, type 어부 강물이: 강물이 맑아서 오늘은 대구가 잘 잡혀요. (“Fisher Gangmuli: The water is clear, so the cod are biting today.”). With Add action, add Wait (s 1.5) and Chat message (Text 어부 강물이: 사과를 가져오면 한 알에 30원 쳐 줄게요. 나루 끝에서 낚시도 해 보고요., “Fisher Gangmuli: Bring me apples and I’ll pay 30 each. Try fishing at the end of the pier too.”). Type 3 in Cooldown under the filter.

    Rule r_talk_mg_fisher — right-click actor → chat · wait · chat

  1. Click Variables in the World logic tab. With Add variable, enter the name money, type int, scope Player, and initial value 1000, then click Apply. The initial scope value is “Global”, so always change it to Player (with global, everyone shares one amount of money).

    Adding money in the variable window and applying

  2. Make the function that shows the money. In a new rule, set id fn_show_money (confirm with Enter) and name 돈 표시 (Show money). In the trigger Function, type show_money in Function name. With Add condition, add Compare (Left {in_cutscene} · Compare == · Right 0), and change the action to Action bar text (Text 돈 {money}원, “Money {money}”). During the cutscene (in_cutscene is 1), this function is skipped and no money shows.

    Rule fn_show_money — function · condition compare · action bar text

  3. Call this function for all players every 1.5 seconds. In a new rule, set id r_money_tick (confirm with Enter) and name 돈 표시 되풀이 (Repeat money display). The trigger is Timer (global) with Interval (s) 1.5. Change the type of action 1 to For each player, with Function show_money and To whom left at world. It is called for each player, so each person sees their own money. If you read a variable directly inside a global timer rule, it reads the global value.

    Rule r_money_tick — timer 1.5 seconds → for each player show_money

    The action bar is a single line, so it covers other hints. Send hint text through chat or a title, and on the server also use the Sidebar action so the money is always visible (the finished map’s fn_show_money does it that way). ▶ in the editor does not draw the sidebar, so this tutorial builds only the action bar.

  1. Make a lantern stall on the road beside the fisher’s hut. With the block brush, place one spruce_planks (spruce planks) block at 177, 68, 219. The coordinates of the block under the mouse appear in “Under mouse” in Details, and clicking the top face of that block places it on the block directly above. Then place the 3 actors in the table below with Add on the toolbar and enter the values. Type the id in the first column of the table exactly into the id field of Details (that way it shows in the Actor field in steps 13 to 15). To match the pictures, type the Name from the table. The Block field starts with another block name, so click the field, clear it with Ctrl+A and Delete, type the new one, and confirm with Enter for it to change.

    Actor (id)NameType (Add item)PositionOther fields
    mg_stall_lantern_item등불 진열 물건 (Lantern display item)Display — block (Block Display)177.5, 69.36, 219.5Block minecraft:lantern[hanging=false] · Multiplier 0.7, 0.7, 0.7 · Rotate yaw 20
    mg_stall_lantern_txt등불 값 글 (Lantern price text)Text (hologram Text Display)177.5, 70.25, 219.5Text 등불 120원 (Lantern 120)
    mg_stall_lantern등불 진열대 (Lantern stall)Trigger zone — box177.5, 69, 219.5Size 1.2, 2, 1.2

    The lantern, price text, and zone above the base plank

  2. Make the sales chest. Place a chest[facing=south] block at 183, 69, 212 and place 2 actors.

    Actor (id)NameTypePositionOther fields
    mg_sell_fisher_txt사과 삽니다 글 (Buying apples text)Text183.5, 70.6, 212.5Text 사과 삽니다 · 1알 30원 (Buying apples · 30 each)
    mg_sell_fisher사과 판매 상자 (Apple sales chest)Trigger zone — box183.5, 69.5, 212.5Size 1.2, 1.2, 1.2

    The text and zone above the chest

  3. Make the fishing spot (there is no block).

    Actor (id)NameTypePositionOther fields
    mg_gather_fish_txt낚시 자리 글 (Fishing spot text)Text187.5, 71, 213.5Text 낚시 자리 (F) (Fishing spot (F))
    mg_gather_fish낚시 자리 (Fishing spot)Trigger zone — box187.5, 69.5, 213.5Size 2, 3, 2

    The fishing spot text and zone at the end of the pier

  1. For every rule, type the id and confirm with Enter. Action 1 of a new rule starts as Chat message, so change its type to the first action in the table and add the rest with Add action. There are 3 buying rules. A branch (if) calls a function to do its work, so make the two function rules first and the right-click rule last (a rule that points to a function that does not exist is created, but the check marks it with the error “Missing function “name"").

    idTriggerActions
    fn_buy_mg_stall_lanternFunction · function name buy_mg_stall_lanternSet variable (Variables money · Calculate sub · Values 120) → Give item (Item minecraft:lantern · Count 1) → Chat message (등불을 샀습니다. 남은 돈 {money}원, “You bought a lantern. Money left {money}”)
    fn_short_mg_stall_lanternFunction · function name short_mg_stall_lanternChat message (돈이 모자랍니다. 등불 120원 · 가진 돈 {money}원, “Not enough money. Lantern 120 · you have {money}”)
    r_buy_mg_stall_lanternRight-click actor · Actor mg_stall_lantern · cooldown 0.5Branch (if) (Left {money} · Compare >= · Right 120 · If true buy_mg_stall_lantern · If false short_mg_stall_lantern)

    Rule r_buy_mg_stall_lantern — right-click actor → branch (if)

    With exactly 120 you buy it (money left 0); with 119 you do not buy it and only the hint appears. Thanks to the 0.5-second cooldown, two quick clicks buy only once.

  2. There are also 3 selling rules. The right-click rule first takes all the apples from the bag (putting the count taken into sold), and if there are any, adds the selling price.

    idTriggerActions
    fn_sold_mg_sell_fisherFunction · function name sold_mg_sell_fisherSet variable (money · add · Values {sold} * 30) → Chat message (사과 {sold}알을 팔았습니다. 돈 {money}원, “You sold {sold} apples. Money {money}”)
    fn_nosell_mg_sell_fisherFunction · function name nosell_mg_sell_fisherChat message (팔 사과가 없습니다. 1알에 30원에 사요., “You have no apples to sell. I pay 30 each.”)
    r_sell_mg_sell_fisherRight-click actor · Actor mg_sell_fisher · cooldown 0.5Take item (Item minecraft:apple · Count 2304 · Result variable (optional) sold) → Branch (if) (Left {sold} · Compare > · Right 0 · If true sold_mg_sell_fisher · If false nosell_mg_sell_fisher)

    Rule r_sell_mg_sell_fisher — take item → branch (if)

  3. The fishing rule. Set id r_gather_mg_gather_fish (confirm with Enter) and name 낚시 자리 (Fishing spot). The trigger is Right-click actor (Actor mg_gather_fish), the actions are Give item (minecraft:cod · 1) → Chat message (대구를 한 마리 낚았습니다., “You caught a cod.”), and Cooldown 5. It gives an item only once every 5 seconds.

    Rule r_gather_mg_gather_fish — right-click → give item · chat

  1. Open the left and right areas again and click the ▶ (Play) button. When the part 2 opening cutscene plays, skip it with Shift. Walk up to the fisher, look at him, and press F. The first line of dialogue appears, and the second line follows 1.5 seconds later. You see the name tag above the fisher’s head and, below, the talk zone box (an editing line shown only in ▶).

    Talking to the fisher in Play — two lines of dialogue

  2. When the cutscene ends, “Money 1000” appears on the action bar (updated every 1.5 seconds). You see it after the chat hint disappears.

    Money 1000 on the action bar at the bottom of the Play screen

  3. Look at the sales chest and press F. With no apples you get “You have no apples to sell. I pay 30 each.” (in Korean in the sample) and your money stays the same. With apples (you get them at the farmer’s apple tree gathering spot, “Pick apples”) and a click on the same chest, they all sell and your money grows (3 apples = 90, 1000 → 1090).

    Money at 1090 after selling 3 apples

  4. Look at the fisher’s stall (lantern) and press F. With 120 or more, “You bought a lantern. Money left …” appears, your money drops, and the lantern goes into your bag. If you are short, you get “Not enough money. Lantern 120 · you have … ”. The “when short” part of the picture below was taken with the money changed, so it does not appear as is. Starting with 1000, you buy the lantern 8 times, and the hint “you have 40” appears on the 9th click (if you sold apples in step 18, you can buy that many more).

    The chat when short of money before buying a lantern, and after buying

  5. Look at the fishing spot at the end of the pier and press F. “You caught a cod.” appears and a cod goes into your bag. If you click again within 5 seconds, nothing is given. End Play with Esc.

    A cod caught at the fishing spot

  1. The fisher Gangmuli now has a name tag, talking, fishing, buying apples, and selling lanterns, and money starts at 1000 separately for each player. For the other villagers (woodcutter, miner, farmer, shopkeeper), you can make their stall and sales chest rules the same way by changing only the ids and values. Starting file 4 (mulgyeol_start4.npworld) is the result of this part plus the square and dance preparation, so continue part 4 with your own file or start from starting file 4.

    The fisher Gangmuli and the hut's pier (game view)

  • Use the icon that duplicates a rule (next to the ”+” in the row above the rule list in the World logic tab; hovering shows “Duplicate selected rule”) to make the other stall and sales chest rules quickly. Change only the duplicated rule’s id, name, Actor, and values.
  • A rule’s Cooldown stops the same person from mashing. Talking 3 seconds, buying and selling 0.5 seconds, and gathering 5 seconds are the values in this tutorial.
idWhat it does
r_talk_mg_fisherTalking to the fisher (chat · wait · chat)
fn_show_money · r_money_tickThe money display function · the 1.5-second timer
fn_buy_… · fn_short_… · r_buy_…Buying a lantern (when there is money · when short · right-click)
fn_sold_… · fn_nosell_… · r_sell_…Selling apples (the price · nothing to sell · right-click)
r_gather_mg_gather_fishFishing
  • On the server (the game), a moving-model villager is sent as a static model if its actor id appears anywhere in the text of a rule or sequence. So use an English id (mg_fisher) and do not use the id word in dialogue or name tag text.
  • In ▶ in the editor, trigger boxes such as the talk zone are visible (editing lines), but they are not visible in the real game.

The detailed explanation of each feature is in the pages below.