new Npc()
Properties:
| Name | Type | Description |
|---|---|---|
id |
number | Area-relative id (vnum) |
area |
Area | Area npc belongs to (not necessarily the area they're currently in) |
behaviors |
Map |
- Mixes In:
- Scriptable
Extends
Members
-
isNpc
-
- Overrides:
Methods
-
addAttribute()
-
- Inherited From:
- See:
-
addCombatant(target)
-
Parameters:
Name Type Description targetCharacter Fires:
- Inherited From:
-
addEffect(effect) → {boolean}
-
Parameters:
Name Type Description effectEffect Returns:
boolean- Inherited From:
-
addFollower(follower)
-
Parameters:
Name Type Description followerCharacter Fires:
- Inherited From:
-
addItem(item)
-
Move an item to the character's inventory
Parameters:
Name Type Description itemItem - Inherited From:
-
emit(event, …args)
-
Proxy all events on the player to effects
Parameters:
Name Type Attributes Description eventstring args* <repeatable>
- Inherited From:
-
equip(item, slot)
-
Parameters:
Name Type Description itemItem slotstring Slot to equip the item in
Fires:
Throws:
-
EquipSlotTakenError
-
EquipAlreadyEquippedError
- Inherited From:
-
-
evaluateIncomingDamage(damage) → {number}
-
Parameters:
Name Type Description damageDamage Returns:
number- Inherited From:
- See:
-
- EffectList.evaluateIncomingDamage
-
evaluateOutgoingDamage(damage, currentAmount) → {number}
-
Parameters:
Name Type Description damageDamage currentAmountnumber Returns:
number- Inherited From:
- See:
-
- EffectList.evaluateOutgoingDamage
-
follow(target)
-
Begin following another character. If the character follows itself they stop following.
Parameters:
Name Type Description targetCharacter - Inherited From:
-
getAttribute(attr) → {number}
-
Get the current value of an attribute (base modified by delta)
Parameters:
Name Type Description attrstring Returns:
number- Inherited From:
-
getBaseAttribute(attr) → {number}
-
Get the base value for a given attribute
Parameters:
Name Type Description attrstring Attribute name
Returns:
number- Inherited From:
-
getBroadcastTargets()
-
- Inherited From:
- See:
-
getMaxAttribute(attr) → {number}
-
Get current maximum value of attribute (as modified by effects.)
Parameters:
Name Type Description attrstring Returns:
number- Inherited From:
-
hasAttribute(attr) → {boolean}
-
Parameters:
Name Type Description attrstring Attribute name
Returns:
boolean- Inherited From:
-
hasEffectType(type) → {boolean}
-
Parameters:
Name Type Description typestring Returns:
boolean- Inherited From:
- See:
-
hasFollower(target) → {boolean}
-
Parameters:
Name Type Description targetCharacter Returns:
boolean- Inherited From:
-
hasItem(itemReference) → {Item|boolean}
-
Check to see if this character has a particular item by EntityReference
Parameters:
Name Type Description itemReferenceEntityReference - Inherited From:
-
hydrate(state)
-
Initialize the character from storage
Parameters:
Name Type Description stateGameState - Overrides:
-
initiateCombat(target, lagnullable)
-
Start combat with a given target.
Parameters:
Name Type Attributes Default Description targetCharacter lagnumber <nullable>
0 Optional milliseconds of lag to apply before the first attack
Fires:
- Inherited From:
-
isFollowing(target) → {boolean}
-
Parameters:
Name Type Description targetCharacter Returns:
boolean- Inherited From:
-
isInCombat(targetnullable)
-
Check to see if this character is currently in combat or if they are currently in combat with a specific character
Parameters:
Name Type Attributes Description targetCharacter <nullable>
Returns:
-boolean
- Inherited From:
-
isInventoryFull() → {boolean}
-
Returns:
boolean- Inherited From:
-
lowerAttribute(attr, amount)
-
Lower an attribute by name
Parameters:
Name Type Description attrstring amountnumber Fires:
- Inherited From:
- See:
-
Attributes#lower
-
moveTo(nextRoom, onMoved)
-
Move the npc to the given room, emitting events appropriately
Parameters:
Name Type Description nextRoomRoom onMovedfunction Function to run after the npc is moved to the next room but before enter events are fired
Fires:
-
raiseAttribute(attr, amount)
-
Raise an attribute by name
Parameters:
Name Type Description attrstring amountnumber Fires:
- Inherited From:
- See:
-
Attributes#raise
-
removeCombatant(target)
-
Parameters:
Name Type Description targetCharacter Fires:
- Inherited From:
-
removeEffect(effect)
-
Parameters:
Name Type Description effectEffect - Inherited From:
- See:
-
removeFollower(follower)
-
Parameters:
Name Type Description followerCharacter Fires:
- Inherited From:
-
removeFromCombat()
-
Fully remove this character from combat
- Inherited From:
-
removeItem(item)
-
Remove an item from the character's inventory. Warning: This does not automatically place the item in any particular place. You will need to manually add it to the room or another character's inventory
Parameters:
Name Type Description itemItem - Inherited From:
-
serialize() → {Object}
-
Gather data to be persisted
Returns:
Object- Inherited From:
-
setAttributeBase(attr, newBase)
-
Update an attribute's base value.
NOTE: You probably don't want to use this the way you think you do. You should not use this for any temporary modifications to an attribute, instead you should use an Effect modifier.
This will permanently update the base value for an attribute to be used for things like a player purchasing a permanent upgrade or increasing a stat on level up
Parameters:
Name Type Description attrstring Attribute name
newBasenumber New base value
Fires:
- Inherited From:
-
setAttributeToMax(attr)
-
Clears any changes to the attribute, setting it to its base value.
Parameters:
Name Type Description attrstring Fires:
- Inherited From:
-
unequip(slot)
-
Remove equipment in a given slot and move it to the character's inventory
Parameters:
Name Type Description slotstring Fires:
Throws:
InventoryFullError
- Inherited From:
-
unfollow()
-
Stop following whoever the character was following
Fires:
- Inherited From:
Events
-
attributeUpdate
-
Fired when a Character's attribute is set, raised, or lowered
Parameters:
Name Type Description attributeNamestring attributeAttribute - Inherited From:
-
combatantAdded
-
Parameters:
Name Type Description targetCharacter - Inherited From:
-
combatantRemoved
-
Parameters:
Name Type Description targetCharacter - Inherited From:
-
combatEnd
-
- Inherited From:
-
combatStart
-
Fired when Character#initiateCombat is called
- Inherited From:
-
damaged
-
Parameters:
Name Type Description damageDamage finalAmountNumber - Inherited From:
-
effectAdded
-
- Inherited From:
-
effectRemoved
-
- Inherited From:
-
enterRoom
-
Parameters:
Name Type Description roomRoom -
equip
-
Parameters:
Name Type Description slotstring itemItem - Inherited From:
-
followed
-
Parameters:
Name Type Description targetCharacter - Inherited From:
-
gainedFollower
-
Parameters:
Name Type Description followerCharacter - Inherited From:
-
heal
-
- Inherited From:
-
healed
-
Parameters:
Name Type Description healHeal finalAmountnumber - Inherited From:
-
hit
-
- Inherited From:
-
lostFollower
-
Parameters:
Name Type Description followerCharacter - Inherited From:
-
spawn
-
-
unequip
-
Parameters:
Name Type Description slotstring itemItem - Inherited From:
-
unfollowed
-
Parameters:
Name Type Description followingCharacter - Inherited From:
-
updateTick
-
- See: