FANDOM


This quest covers the basics and death event. The complete quest file can be found in the RCE via "Ctrl+P: QquestExample1".

Quest Example 1 Raining Chain Editor05:33

Quest Example 1 Raining Chain Editor


IMPORTANT: This page assumes you have installed the Raining Chain Editor and you have read the basics of Quest Creation.

Logic Edit

  1. Talk with NPC who asks to kill Dragon.
  2. Kill Dragon
  3. Talk with NPC to complete quest

Pseudocode Edit

Variable Edit

  • haveKilledDragon = false

Events Edit

talkRingo (linked with "onDialogue" trigger of NPC Ringo)
    if haveKilledDragon == false
        ask player to kill dragon
    if haveKilledDragon == true
        quest complete

_

killDragon (linked with "onDeath" trigger of NPC Dragon)
    set haveKilledDragon = true


Real Code Edit

Variable Edit

[VAR.haveKilledDragon]:false

Events Edit

talkRingo(key:number){
    if(s.get(key,VAR.haveKilledDragon) === false)
       s.message(key,"Go kill the dragon.");
     else
        s.completeQuest(key);
}
killDragon(key:number){
    s.set(key,VAR.haveKilledDragon,true);
}

Map Edit

//Tiled project has a n1 and e1 spots on layer SPOT
m.spawnNpc(mapUid, spots.n1, NPC.npc, attrs => {
    attrs.onDialogue = EVENT.talkRingo;
});
 
m.spawnNpc(mapUid, spots.e1, NPC.dragon, attrs => {
    attrs.onDeath = EVENT.killDragon;
});


Walkthrough from Quest Template Edit

Create Template Edit

To create a new quest in the Raining Chain Editor:

  1. Open the command list with Ctrl+Shift+P.
  2. Select "RCE: New Project".
  3. Enter "Qexample1" as the new quest id.


RCE NewProject


Enums Edit

First, we need to declare all constant ids before being able to use them. On the Raining Chain Editor, press Ctrl+Shift+A while having your mouse over a undeclared id to automatically add it to the enum.

enum VAR {haveKilledDragon} //The list of quest variable ids
enum MAP {main} //The list of map ids

We also need to declare the list of built-in npcs we are planning to use. In this quest, we are using two: npc and dragon.

enum NPC {npc,dragon}

Variables Edit

Copy-paste the variable from the previous section.

n.newVariable({
    [VAR.haveKilledDragon]:false,
});

Events Edit

Copy-paste the events talkRingo and killDragon of the previous section.

class EVENT_CLASS extends API.CORE_EVENTS<LABEL> {
    talkRingo(key:number){
        if(s.get(key,VAR.haveKilledDragon) === false)
            s.message(key,"Go kill the dragon.");
        else
            s.completeQuest(key);
    }
 
    killDragon(key:number){
        s.set(key,VAR.haveKilledDragon,true);
    }
}


Maps Edit

The quest template already has the map main created. We need to edit it to add the two spots where the npc and the dragon will spawn.

Click "Open Map File" to open map editor Tiled. Go on the Tileset #9 and add n1 and e1 spots on the SPOT layer. Once new spots are added, you need to refresh the list of spots by clicking "Update Spots".

Note: If "Update Spots" doesn't work, make sure that you indeed added the n1 and e1 tiles on the SPOT layer.

Copy-paste the npc spawning logic from the previous step in the onLoad map function.

const SPOTS_main = {n1:S,e1:S};
n.newMapAddon(MAP.main,{
    spots:SPOTS_main,
    onLoad: function(mapUid:number,spots:typeof SPOTS_main){
        m.spawnNpc(mapUid, spots.n1, NPC.npc, attrs => {
            attrs.onDialogue = EVENT.talkRingo;
        });
 
        m.spawnNpc(mapUid, spots.e1, NPC.dragon, attrs => {
            attrs.onDeath = EVENT.killDragon;
        });
    }
});

Testing Edit

To test your new quest, you will need to start the game server.

  1. Run the command "RCE: Test Project" in the Raining Chain Editor (with Ctrl+Shift+P).
  2. Open Google Chrome and go to localhost:3000/game
  3. Sign in (or sign up) in the game.

Errors will appear in the Visual Studio code terminal. You will automatically be teleported in the first spot of the first quest map. Note: You can add m.setAsStartPoint() to spawn elsewhere.

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.