RPG Library: List of Attributes - ThePix/QuestJS GitHub Wiki

Name Applies to Type Comments
STATUS - - Attributes that are not situation flags, but that are likely to change during play to track the status of the character
skillOptions npc array of strings When attacking, a skill will usually be randomly selected from this list of skill names.
spellsLearnt char array of strings When attacking, a skill will usually be randomly selected from this list of skill names.
activeEffects all array of strings As with items, you can give the player and NPC special effects that modify incoming and outgoing attacks.
dead npc Boolean True if dead.
aggressive npc Boolean
SITUATION FLAGS - - Attributes that are Booleans that are likely to change during play because of effects - you should not change these directly, only throygh the "flags" attribute of an effect
asleep npc Boolean True if asleep.
blinded all Boolean Can talk but nothing else
stunned all Boolean Cannot do anything
petrified all Boolean Cannot do anything
mute all Boolean Cannot talk or cast spells
befuddled all Boolean Cannot do anything
immobilised all Boolean Cannot leave this location
paralysed all Boolean Cannot do anything
unhanded all Boolean No hands, so cannot attack, cast spells, pick stuff up, but can talk and go to other locations
nullified all Boolean Cannot cast spells
DESCRIPTIONS - - Attributes that are mostly strings, used to describe something or a situation; these are unlikely to change for a given NPC
beast all Boolean Flag this as a beast.
fey all Boolean Flag this as fey, such as a pixie.
noCorpse npc Boolean When the thing dies, there are no remains.
ex all string or function Use this for the NPCs descripotion instead of examine, to allow Quest to append tactical data. If a function, it should return the description as a string, rather than printing it itself.
exDead npc string Description to use when dead.
exAsleep npc string Description to use when asleep.
msgDeath npc string Used when the thing dies.
msgPoisonImmunity all string Used when a poisoned weapon is used and the poison is ignored. If a character has this attribute, it is taken as being immune to poison.
allegiance all string Defaults to "foe". Set to "friend" to have the NPC fight with the player. You could potentially split enemies into different teams too.
element npc string You can give an element, such as fire or earth, to an NPC.
COMBAT STATS - - Basic stats used in combat
damage npc string For an NPC, the damage done on a successful attack. This is a string in standard RPG dice notation, such as "36d+2".
armour npc number For an NPC, the damage received will be reduced by this (for the player it is determined from what is worn). A value of four or five will make for a very tough monster.
health all number The number of hits the character has. At zero, the character is dead.
maxHealth all number The character's maximum health. Defaults to the same value as "health" if not set.
offensiveBonus all number Attacks made by this character will usually get this added to the "to hit" roll; represents how skilled the character can make an attack. But see the next three attributes, as these can override this (and you can use your own types too, it all keys off the skill.type attribute). Defaults to 0.
offensiveBonus_natural all number Natural attacks made by this character will usually get this added to the "to hit" roll; defaults to offensiveBonus.
offensiveBonus_weapon all number Weapon attacks made by this character will usually get this added to the "to hit" roll; defaults to offensiveBonus.
offensiveBonus_spell all number Spell attacks made by this character will usually get this added to the "to hit" roll; defaults to offensiveBonus.
defensiveBonus all number Attacks targeting this character will usually get this taken off the "to hit" roll; represents how readily the character can dodge an incoming attack.
defensiveBonus_natural all number Natural attacks made against this character will usually get this subtracted from the "to hit" roll; defaults to defensiveBonus.
defensiveBonus_weapon all number Weapon attacks made against this character will usually get this subtracted from the "to hit" roll; defaults to defensiveBonus.
defensiveBonus_spell all number Spell attacks made against this character will usually get this subtracted from the "to hit" roll; defaults to defensiveBonus.
FUNCTIONS - - Function attributes
modifyIncomingAttack all function This function is run when a character receives an attack; it could be used to make the character immune to fire, for example. Takes the attack as the parameter.
modifyOutgoingAttack all function This function is run when a character makes an attack; it could be used to make the character super strong, for example. The default version sets the offensiveBonus in the attack; if you add your own, remember to do that yourself. Takes the attack as the parameter.
getEquippedWeapon all function Returns the currently equipped weapon. By default it returns the NPC itself, as it is usually more convenient to put the weapon stats on the creature (and if that is done, there is no need to give the NPC the WEAPON template). For the player, if she is unarmed, it will return the special object w.weapon_unarmed for an unarmed attack. It should always return something that has the right set of attributes.
getEquippedShield all function Returns the currently equipped shield, or null if there is none.
isHostile npc function Returns whether the NPC is currently hostile. The default function just returns true, so all NPCs are hostile all of the time.
getArmour all function Returns the value of the "armour" attribute by default, but RPG_PLAYER does it by totally armour worn and dividing by 10. Generally you will not want to set this, but you might need to use it.
pursueToAttack npc function If set, an attacking NPC will potentially chase the player to adjacent locations to continue the fight (you can set it to rpg.pursueToAttack to do that).
unillusion all function Runs when a spell or whatever dispels illusions
afterAttack all function Runs after this NPC is the target of an attack; sent the attack object.
afterDeath npc function Runs after this NPC dies; sent the attack object.
maxNumberOfRings char number Maximum number of rings this character can wear.