How to learn spells

I can't find anything in the QuestJS documentation on how to actually learn a spell.


If you create an Issue concerning this on the GitHub repo, Pixie would probably get a notification and respond sometime soon.


Found it.

https://github.com/ThePix/QuestJS/blob/f9680fb53365b0b79583d1cdb67e4e345a622605/rpg/commands.js#L193-L214

new Cmd('LearnSpell', {
  npcCmd:true,
  rules:[cmdRules.isPresent],
  objects:[
    {special:'text'}
  ],
  script:function(objects) {
    const spell = rpg.find(objects[0])
    if (!spell || spell.type !== 'spell') return failedmsg(lang.noSpellCalled, {text:objects[0]})
      
    // is there a spell book or whatever at hand to learn the spell from
    const source = rpg.isSpellAvailable(player, spell)
    if (!source) return world.FAILED
    
    // are there are other restrictions, such as level?
    if (player.isSpellLearningAllowed && !player.isSpellLearningAllowed(spell, source)) return world.FAILED
    
    player.skillsLearnt.push(spell.name)
    msg(lang.learnSpell, {spell:spell, item:source})
    return world.SUCCESS
  },
})

This topic is now closed. Topics are closed after 14 days of inactivity.

Support

Forums