RPG Library: Systema Naturae - ThePix/QuestJS GitHub Wiki

There are various templates for specific types of monsters.

Go here for the introduction to RPG.

[This page takes its name from the book by Carl Linnaeus in case you are wondering]

It is convenient to divide the creatures of the multiverse into different categories, and give each category its own template. When creating a new monster, give it the right category and half the work is done.

  • RPG_NPC*: Any humanoid - eg man, goblin
  • RPG_FEY*: A creature from the fey realm - eg pixie, perhaps elf
  • RPG_CORPOREAL_UNDEAD: The undead with physical bodies - eg zombie, skeleton, lich
  • RPG_NON_CORPOREAL_UNDEAD: The undead without physical bodies - eg ghost, wraith
  • RPG_PHANTOM: Illusions
  • RPG_ELEMENTAL: The embodiment of a magical element; you should pass the name of the element to the template
  • RPG_DEMON: A creature summoned from the demonic planes
  • RPG_BEAST: A natural creature of this world - eg rabbit, hydra
  • RPG_PLANT: A plant that poses a threat in someway - eg triffid
  • RPG_CORRUPTED: A creature of this world that has been twisted into something different
  • RPG_CREATED: A creature that was created - eg construct, golem

Those mark * can be male or female (pass true in the template for female as usual), others will be referred to as "it" by default.

All these include the standard RPG_TEMPLATE. An example of one in use:

  createItem("iron_cobra", RPG_CONSTRUCT(), {
    "alias": "Iron cobra",
    "desc": "A huge, mechanical snake, constructed of articulated segments.",
    "hitpoints":50,
    "armour":4,
    "level":10,
  }),          

Custom templates

You may want to create you own templates. If you are creating a science fiction world, you might want a template for each alien race, for example.

This example is for RPG_NON_CORPOREAL_UNDEAD, and shows how you can build on an existing template, in this case RPG_CORPOREAL_UNDEAD. Modify the first line to the name of your new template and the second to the base template it uses. The last two lines should not be altered. All the rest add or modify attributes as you desire.

const RPG_NON_CORPOREAL_UNDEAD = function() {
  const res = RPG_CORPOREAL_UNDEAD();
  res.noCorpse = true
  res.msgDeath = lang.deathUndeadNoCorpse
  res.modifyIncomingAttack = function(attack) {
    if (attack.element || attack.isMagic || attack.spell) {
      attack.damageMultiplier = 0
      attack.primarySuccess = attack.primarySuccess.replace(/[.!]/, ", but it passes straight through {sb:target}.")
    }
  }
  return res
}

Note how "modifyIncomingAttack" is used to make these monsters immune to normal weapons.