Help

JS-CHAR

For immortals Also: JAVASCRIPT-CHAR

The Char object represents mobiles and player characters.

Class Methods:

count()Counts mobiles. See JS-ELEMENT-COUNT.
invoke()This method is used to invoke new mobiles. See JS-CHAR-INVOKE for more information.

Properties:

fightingWho this char is fighting, or null.
numAttackersThe number of characters attacking this character.
followingWho this char is following or null if not following.
masterWho this char is controlled by or null if not currently being controlled.
controllerWho is this char's controller? (see JS-CONTROLLER)
mountThis character's mount, or null if not mounted.
inRoomRoom object that this character is in (see JS-ROOM).
inRoomNumberThe room number that this character is in.
inZoneZone object that this character is in (see JS-ZONE).
inWorldWorld object that this character is in (see JS-WORLD).
vnumThe virtual number of this char (returns -1 for players).
dbThe database object for this char (see JS-DB)
homeThis character's home room (null if none); set it to a room or an address: actor.home = 'moz.temple'.
homeNumberThe room number of this character's home (the old form of home).
lagThe wait in pulses for the current char. (For example, after landing a stun your wait is increased.)
idleHow many mud hours this character has been idle.
keyNameThe key name of this character.
nameThe key name and nicknames of this character.
shortDescThe short description of this character.
mediumDescThe medium description of this character.
longDescThe long description of this character.
titleThe title of this character (PCs only).
ageReturns the age in years of the player.
raceRace object for the race of this character (see JS-RACE).
drunkThe character's drunk condition.
hungerThe character's hunger condition.
thirstThe character's thirst condition.
sanityThe character's sanity condition.
attackTypeThe attack type of this mobile (see ATTACKTYPES).
speakThe language this char is speaking (see POSITION-TYPES).
positionThe position of this char (see POSITION-TYPES).
postureThe posture of this char (see POSTURE).
placementThe placement of this char (see PLACEMENT).
goldThe amount of gold this character has on-hand.
bankGoldThe amount of gold in this character's bank account.
expThe amount of experience this character has total.
poolThe amount of experience in this character's pool.
worthExpThe amount of experience this mobile is worth according to the experience point formula. The difficulty multiplier has not been applied.
worthGoldThe amount of gold this mobile is worth according to the gold formula. Difficulty and gold multipliers have not been applied.
numAttacksThe number of attacks an NPC has.
bareNumDieThe number of barehand attack die for NPC barehand damage.
bareSizeDieThe size of the barehand attack die for NPC barehand damage.
alignmentThe alignment of this char as a number (-1000 to 1000)
sexCan be 'male', 'female', or 'neuter'.
inGroupReturns the group object for the group this character is in or null if the character is groupless (see JS-GROUP).
clanReturns the name of the clan this character is a member of.
inClanReturns the clan object for the clan this character is a member of or null if this character isn't in a clan (see JS-CLAN).
maxLevelReturns the maximum level of this character.
maxPowerLevelReturns the maximum power level of this character.
hitThe current hit points of this character.
maxHitThe maximum hit points of this character.
wimpHitThe wimp hit points of this character.
manaThe current mana points of this character.
maxManaThe maximum mana points of this character.
vitalityThe current vitality points of this character.
maxVitalityThe maximum vitality points of this character.
hitrollThe character's hitroll.
damrollThe character's damroll.
dualHitrollThe character's dual-wielding hitroll.
dualDamrollThe character's dual-wielding damroll.
bowHitrollThe character's hitroll with bows.
bowDamrollThe character's damroll with bows.
strThe strength of this character.
dexThe dexterity of this character.
iqThe intelligence of this character.
wisThe wisdom of this character.
conThe constitution of this character.
chaThe charisma of this character.
heightThe height of this character.
weightThe weight of this character.
killPointsThe total kill points for this character. Addings points to this will automatically update the clan associated with this character.
killPoolThe total kill pool for this character.
tournamentPointsThe total tournament points for this character. Adding points to this will automatically update the clan associated with this character.
tournamentPoolThe total tournament pool for this character.
questPointsThe total quest points for this character.
questPoolThe total quest pool for this character.
buildPointsThe total build points for this character.

Methods:

cast()Casts a spell. See JS-ELEMENT-CAST.
damage()Does damage. See JS-ELEMENT-DAMAGE.
go( d )Teleports the character to the specified destination which can be either a room, object, or mobile or a room number. Pass in the string 'fadeout' if you would like fadeout messages to be displayed and 'nolook' if you do not want the character to automatically enter a look command upon entering the room. Example: "actor.go( 1002, 'fadeout', 'nolook' )"
attack( t )Causes this character to enage the other character in combat. (This method uses initcombat, so special skills like backstab and so on will be utilized by mobiles if they have it.)
rescue()Rescues target from attackers. See JS-CHAR-RESCUE.
mirror( t )Become a mirror image of t. See JS-CHAR-MIRROR.
purge()Purges this character without printing any messages or dropping any corpses.
slay()Kills this character and displays a death cry. If the character is a player, no experience is lost. By default no corpse is dropped. You can cause a corpse to be dropped by passing in the optional "corpse" option. For example: actor.slay( 'corpse' )
restore()Restores this character as if by the immortal restore command.
editor()Invokes the editor on a property. See JS-CHAR-EDITOR.
canSee( t )Returns true if this character can see the target character or object.
canTeleport( t )Returns true if this character can teleport/travel/etc. from where they currently are. If the optional destination is supplied then method will also verify that they the target room can be teleported to. The character will get a message explaining why they cannot teleport.
isControlledByPC()Returns true if this mobile is either a PC or controlled directly or indirectly by one (i.e. charm, and so on)
isPetOf( c )Returns true if this character is a pet of character c.
namePet( p, n )Names the given pet p with the name n.
curPetLevels()Returns the number of power levels of pets that this character currently has under their control. See CHARISMA.
maxPetLevels()Returns the max number of power levels of pets that this character can have under their control.
canHavePet( v )Returns true if the caster is able to have v as a pet based on their charisma and pet masteries. See CHARISMA.
isInWarClan()Returns true if this character is in a war clan.
isAtWar()Returns true if this character is in a clan that is at war.
isAtWarWith( c )Returns true if this character is in a clan that is at war with clan c or character c's clan.
isAlliedWith( c )Returns true if this character is in a clan that is allied with clan c or character c's clan.
isSameClanWith( t )Returns true if this character is in the same clan that character t is.
isGroupedWith( t )Returns true if this character is grouped with the target t.
isAllyOrNice( c )Returns true if this character is allied with or nice to the given character or clan c.
randomGroupie()Returns a random group member that is in the same room with this character or null if there isn't another groupie.
swarm()The swarm method is used to swarm mobiles after the character. See JS-CHAR-SWARM for more information.
act( string )Causes the character to enter the command. If you specify more than one argument they will be appended together with spaces in between them. ex: "act( 'give', subject, actor );"
keepNextChannelLine()Keeps this mob's next channel line (in this run of the script) in the channel history. A mob's own lines are not kept (see CHAT-HISTORY); use this for a line players should find later, such as a world boss waking: "self.keepNextChannelLine(); self.act( 'gossip The dragon of the north wakes!' );". A line said in an event's hook is kept without it.
social()See JS-SOCIALS for more information.
isActive()Returns true if the character is active (returns false if they quit, rented, or are dead)
isAura()Returns false
isMobile()Returns true
isObj()Returns false
isRoom()Returns false
like()See JS-LIKE.
reroll()Rerolls a character's ability scores
hasClass( cls )Returns true if the character has the specified class. This method supports cardinalities -- see JS-CARDINALITY.
classLevel( cls )Returns the level of the character in the specified class. (Returns 0 if the character does not have that class.)
jobLevel( job )Returns the job level of the character in the specified job. (0 = doesn't have the job, 1 = aspirer, ..., 7 = arch)
hasFlag( f )Returns true if the character has the specified character flag (see ACTFLAGS, AFFFLAGS, BUILD-FLAGS). This method supports cardinalities -- see JS-CARDINALITY.
setFlag( f, v )Sets the object flag "f" to the value "v" which should evaluate to true or false.
isPC()Returns true if the character is a player character.
isNPC()Returns true if the character is a non-player character.
isSpawn()Returns true if the character is spawned mobile.
isMounted()Returns true if the character is mounted.
isMortal()Returns true if the character is a mortal.
isAvatar()Returns true if the character is an avatar.
isImmortal()Returns true if the character is an immortal.
isOutlaw()Returns true if char is a killer, thief, or has a warrant.
isKiller()Returns true if the character committed an unpunished pkill.
isThief()Returns true if the character committed an unpunished theft.
isWarrant()Returns true if the character has a warrant out on them.
isGood()Returns true if the character is of good alignment.
isNeutral()Returns true if the character is of neutral alignment.
isEvil()Returns true if the character is of evil alignment.
isUndead()Returns true if the character is undead.
isNegativeEnergy()Returns true if char is made up of negative energy.
isColdBlooded()Returns true if the character is cold-blooded.
hasHeatShroud()Returns true if the character is cold-blooded or has heat shroud.
isGrounded()Returns true if the character is not floating or flying.
isFloating()Returns true if the character is floating.
isFlying()Returns true if the character is flying.
isSilenced()Returns true if the character is silenced from either a silence spell or if they are in a soundproof room.
isWaterbreathing()Returns true if the character is waterbreathing.
equippedAt( l )Returns whatever the character is equipping at the specified location or null if nothing is being equipped. See EQUIPMENT-LOCATIONS. Ex: actor.equippedAt( 'head' );
isDualWielding()Returns true if the character is dual wielding.
proficiencyIn( s )Returns this character's proficiency in the proficiency s.
factionWith( f )Returns the character's standing with the given faction
addFaction( f, s )Adds the specified standing to the given faction, you can also add multiple factions, for example: actor.addFaction( 'endor', 10, 'agsded', -10 ); If you add multiple factions at once with one call to "addFaction()" then a player's "brief faction" setting will work properly.
hasAura( n )Returns true if the character has the aura on themself or any of their equipped items. This method supports cardinalities -- see JS-CARDINALITY.
hasAuraOnSelf( n )Returns true if the character has this aura on themself. This method supports cardinalities -- see JS-CARDINALITY.
hasAuraOnItem( n )Returns true if the character has this aura on any of their equipped items. This method supports cardinalities -- see JS-CARDINALITY.
addAura()See JS-ELEMENT.
removeAura()See JS-ELEMENT.
addAuraCat()See JS-ELEMENT.
removeAuraCat()See JS-ELEMENT.
resistFor( r )Returns the given resistance (see RESISTANCE) You can also use the 'average' option to get the average resist.
addResist( r, a )Adds the amount a to the given resistance r.
gainExp( xp )Adds the specified XP to the character. You can also specify the 'nocap' option to grant uncapped xp. You can also specify the 'description' option to provide a description of why the exp is being granted. Ex: "actor.gain( exp, 'nocap', 'desc', 'armonte quest' );" ("armonte quest" is the description.)
has()Returns true if the character has the object. This method supports cardinalities -- see JS-CARDINALITY.
hasEq()Returns true if the character has the object equipped. This method supports cardinalities -- see JS-CARDINALITY.
hasVis()Returns true if the character has the object visible. (Items in a container are not visible.) This method supports cardinalities -- see JS-CARDINALITY.
find( vnum )Like has() except this method returns the object if present.
findEq( vnum )Like hasEq() except this method returns the object if present.
findVis( vnum )Like hasVis() except this method returns the object if present.
findPlayer( n )Finds a player by the specified name on the mud and returns the character object or null if the player could not be found. The player must be visible to the current player in order to be found.
msg( string )Sends the specified message to the character. See JS-MSG for more information.
say( string )Causes the character to say the string. See JS-MSG for more information.
talk( t, s )Causes the character to say the string "s" to the character "t". See JS-MSG for more information.
shout( s )Causes the character to shout the message. Most of the time the shout will just be heard in the room. Occassionally the shout will be heard in the zone, and rarely will it be heard mud-wide. This method provides an easy way to have your mobs occassionally be heard far and wide without causing a lot of spam. See JS-MSG for more information.
randomAttacker()This returns one of the chars attacking this char in this room randomly or null if there are no attackers in this room.
visitAttackers( f )Applies the passed in function to all of the chars attacking this char. See JS-VISIT for more information.
visitGroup( f )Applies the passed in function to all of the chars in this chars group who are the same room with this char. See JS-VISIT for more information.
visitNotGroup( f )Applies the passed in function to all chars in self's room who are not in self's group. If self is a player with the nice flag on then other players will be skipped as well even if they are not grouped. See JS-VISIT for more information.
visitPets( f )Applies the passed in function to all of the pets for this character. Pets will be visited even if they are in a different room than their master. See JS-VISIT.
visitEq( f )Applies the passed in function or array to all of the equipped equipment on this char. See JS-VISIT for more information.
visitVisInv( f )Applies the passed in function or array to all of the inventory on this char which is not equipped or in a contained. See JS-VISIT for more information.
savingFor( type )Returns the character's saving throw for the specified type (see SAVING-THROWS). You can also specify "average" to retrieve the average saving throw.
makesSave( t, m )Makes a saving throw roll and returns true if the character successfully saved against the type "t" (see SAVING-THROWS) with the optional modifier "m" (if no modifier is provided, a modifier of 0 is used). Example: if ( !actor.makesSave( 'ethos', -5 ) ) ...
acAt( area )Returns the character's AC at the specified area. Area can be 'average', 'head', 'body', 'larm' (left arm), 'rarm' (right arm), 'lleg' (left leg), or 'rleg' (right leg).
acBonus()This returns the current AC bonus due to dexterity, posture, and so on.
stoppingAt( area )Returns the character's stopping at the specified area. The values for area are the same as for 'acAt()'.
toString()Returns the key name of the character.
valueOf()Returns the key name of the character.

Last edited by Frosty in May 2004.