FANDOM


This quest example covers switches and blocks. The complete quest file can be found in the RCE via "Ctrl+P: QquestExample2".

Logic Edit

  1. Rocks block path.
  2. Activate switch to destroy them.

Pseudocode Edit

Variable Edit

  • haveDestroyedRock = false

Events Edit

activateSwitch (linked with "toggle" trigger of NPC Lever)
    set haveDestroyedRock = true
_
getSwitchState (linked with "getState" attribute of NPC Lever)
    if haveDestroyedRock == false
       return false (not activated)
    if haveDestroyedRock == true
       return true (activated)
_
canSeeRock (linked with "viewedIf" attribute of NPC Rock)
    if haveDestroyedRock == false
        return true (visible)
    if haveDestroyedRock == true
        return false (not visible)

Maps Edit

  • Spawn block that are visible until the player activates the switch.
  • Spawn the switch


Real Code Edit

Variable Edit

[VAR.haveDestroyedRock]:false

Events Edit

activateSwitch(key:number){
    s.set(key,VAR.haveDestroyedRock,true);
}
getSwitchState(key:number){
    return s.get(key,VAR.haveDestroyedRock);
}
canSeeRock(key:number){
    return !s.get(key,VAR.haveDestroyedRock);
}

Map Edit

//Tiled project as a q1 and q2 spots on layer SPOT
m.spawnBlock(mapUid,spots.q1,EVENT.canSeeRock);
 
m.spawnToggle(mapUid,spots.q2,EVENT.getSwitchState,EVENT.activateSwitch);


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 variable in n.newVariable().
  4. Copy-paste the events in EVENT_CLASS.
  5. Add the q1 and q2 spots in the .tmx file then "Update Spots". Make sure the q2 lever tile is positioned inbetween tiles as specified in Map Creation Guide.

    • RCE QuestExample2 spots

  6. Copy-paste the npc spawning logic in the map onLoad().
  7. 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.