FANDOM


This quest example covers dialogues, items and teleporters. The complete quest file can be found in the RCE via "Ctrl+P: QquestExample3".

Logic Edit

  1. Guy asks the player to get a letter from Girl.
  2. Player teleports to Girl.
  3. Player talks with Girl and receive the letter.
  4. Player comes back and talk with Guy.

Pseudocode Edit

Variable Edit

  • None. (Have letter will be tested by checking inventory.)

Item Edit

  • Letter


Dialogues Edit

Guy:

  • Dialogue 1: Ask player to get letter.
    • - Option 1: Accept


Girl:

  • Dialogue 1: Ask player what he wants.
    • - Option 1: I want letter. (If selected, give item)
    • - Option 2: Nothing...
  • Dialogue 2: She mentions that she gave the letter.
  • Dialogue 3: Ask player to deliver it to Guy.


Events Edit

talkGuy (linked with "dialogue" trigger of NPC Guy)
    if player has item letter
        quest complete
    else
        start dialogue asking player to get letter

_

talkGirl (linked with "dialogue" trigger of NPC Guy)
    if player has item letter
        start dialogue asking player to deliver it to Guy
    else
        start dialogue where she will give letter

_

giveLetter (triggered within Girl dialogue)
    give letter

_

teleportToGirl (linked with "teleport" attribute of NPC Teleport1)
    teleport player near Girl

_

teleportToGuy (linked with "teleport" attribute of NPC Teleport2)
    teleport player near Guy

Real Code Edit

Item Edit

n.newItem(ITEM.letter, "Letter", CST.ICON.planEquip,[]);

Dialogue Edit

n.newDialogue("Guy",s.FACE.villagerMale0,[ 
    n.newDialogue_node(DIALOGUE.Guy_intro,"Please. Could you ask Girl for a letter?",[ 
        n.newDialogue_option("Okay"),
    ]),
]); 
 
n.newDialogue("Girl",s.FACE.villagerFemale0,[ 
    n.newDialogue_node(DIALOGUE.Girl_intro,"What do you want?",[ 
        n.newDialogue_option("I want a letter", DIALOGUE.Girl_giveLetter, EVENT.giveLetter),
        n.newDialogue_option("Nothing..."),
    ]),
    n.newDialogue_node(DIALOGUE.Girl_giveLetter,"There you go. Now go give the letter to Guy.",[ 
        n.newDialogue_option("Thanks"),
    ]),
    n.newDialogue_node(DIALOGUE.Girl_after,"Go give the letter to Guy.",[ 
    ]),
]);

Events Edit

talkGuy(key:number){
    if(s.hasItem(key,ITEM.letter))
        s.completeQuest(key);
    else
        s.startDialogue(key,DIALOGUE.Guy_intro);
}
talkGirl(key:number){
    if(s.hasItem(key,ITEM.letter))
        s.startDialogue(key,DIALOGUE.Girl_after);
    else
        s.startDialogue(key,DIALOGUE.Girl_intro);
}
giveLetter(key:number){
    s.addItem(key,ITEM.letter);
}
teleportToGirl(key:number){
    s.teleport(key,SPOTS_main.t3);
}
teleportToGuy(key:number){
    s.teleport(key,SPOTS_main.t2);
}

Map Edit

//Tiled project has a n1, n2, t2, t3 spots on layer SPOT
m.spawnNpc(mapUid,spots.n1,NPC.npc,attrs => {
    attrs.name = 'Guy';
    attrs.onDialogue = EVENT.talkGuy;
    attrs.spriteBase = n.newNpc_spriteBase(CST.SPRITE.villagerMale0,1);
});
 
m.spawnNpc(mapUid,spots.n2,NPC.npc,attrs => {
    attrs.name = 'Girl';
    attrs.onDialogue = EVENT.talkGirl;
    attrs.spriteBase = n.newNpc_sprite(CST.SPRITE.villagerFemale0,1);
});
 
m.spawnTeleporter(mapUid,spots.t2,EVENT.teleportToGirl);
m.spawnTeleporter(mapUid,spots.t3,EVENT.teleportToGuy);


Walkthrough from Quest Template Edit

To create a new quest in the Raining Chain Editor:

  1. Create new quest. (Ctrl+Shift+P RCE:New Project)
  2. Add ids to the enums.
  3. Copy-paste the item.
  4. Copy-paste the dialogues.
  5. Copy-paste the events in EVENT_CLASS.
  6. Add the n1, n2, t2, t3 spots in the .tmx file then "Update Spots".
  7. Copy-paste the npc spawning logic in the map onLoad().
  8. Test the quest. (Ctrl+Shift+P RCE:Test Project)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.