Welcome to PenUltima Online. Click to login or register.

File: Vitals.em

Description: Functions for working with mobile vitals.
Last Modified: 10/27/2007

ApplyDamage( Character, Hits )
Parameters:
Name Type
Character Character Reference
Hits Real (0.0 to 30000.0)
Explanation
Decreases a character's hit points, after reducing damage due to armor.
(Old notes:) The steps taken are as follows: A piece of armor is chosen randomly, based on probabilities in ARMRZONE.CFG. Damage is reduced by 50% to 100% of the armor's AR. Remaining damage is halved. "I'm Hit" animation is played. Damage is applied. Mobile is killed if hit points are now zero. Invokes Reputation system effects.
Return values
Real damage applied to mobile on success
Errors
"Invalid parameter type"
"Damage is out of range"
Related
Character
ApplyRawDamage( Character, Hits )
Parameters:
Name Type
Character Character Reference
Hits Integer (0..255)
Explanation
Decreases a character's hit points. If this causes hit points to drop to zero, kills the character.
Notes: Armor is ignored.
Invokes Reputation system effects.
Return values
1 on success
Errors
none (returns 0 on invalid parameter)
Related
Character
ConsumeMana( who, spellid )
Parameters:
Name Type
who Character Reference
spellid Integer
Explanation
Consumes amount of "Mana" for "who" for the spell as defined in spells.cfg
Notes: spells.cfg files define spells and spell ids.
Consumes from "Mana" vital.
Return values
1 on success
Errors
"Invalid parameter"
"No such spell"
"Spell ID out of range"
Related
Character
Related Configs
spells.cfg
ConsumeVital( who, vital, hundredths )
Parameters:
Name Type
who Character Reference
vital String (vital name)
hundreths Integer
Explanation
Consumes an amount of vital "vital" in hundreths. for example, ConsumeVital(who, "Stamina", 100) consumes one point of stamina.
Return values
1 on consume success or 0 on failure (insufficient value for the vital)
Errors
"Invalid parameter type" including if vital was not found as a vital name
Related
Character
Related Configs
vitals.cfg
GetVital( character, vitalname )
Parameters:
Name Type
character Character Reference
vitalname String (vital name)
Explanation
Gets the current value of "vitalname" on "character".
Return values
Integer current value of the vital on success or Error
Errors
"Invalid parameter type" including if vitalname was not found as a vital
Related
Character
Related Configs
vitals.cfg
GetVitalMaximumValue( character, vitalname )
Parameters:
Name Type
character Character Reference
vitalname String (vital name)
Explanation
Gets the maximum value of "vitalname" on "character"
Return values
Integer maximum value of the vital on success or Error
Errors
"Invalid parameter type" including if vitalname was not found as a vital
Related
Character
Related Configs
vitals.cfg
GetVitalName( alias_name )
Parameters:
Name Type
alias_name String
Explanation
Returns the real vital name from an alias
Return values
String
Errors
"Invalid parameter type"
Related
Character
Related Configs
vitals.cfg
GetVitalRegenRate( character, vitalname )
Parameters:
Name Type
character Character Reference
vitalname String (vital name)
Explanation
Returns the regeneration rate for "vitalname" on "character"
Return values
Integer regeneration rate of the vital on success
Errors
"Invalid parameter type" including if vitalname was not found as a vital
Related
Character
String
Related Configs
vitals.cfg
HealDamage( Character, Hits )
Parameters:
Name Type
Character Character Reference
Hits Integer (0..255)
Explanation
Increases a character's hit points, up to the character's maximum.
Notes: Invokes Reputation system effects.
Return values
1 if some part of the damage could be healed.
Errors
"Invalid parameter"
Related
Character
RecalcVitals( character )
Parameters:
Name Type
character Character Reference
Explanation
Recalculates regen rates and maximum values from the exported functions in vitals.cfg for all vitals on a mobile
Call this if you changed the regen rates or maximums for a vital, or the intrinsic modifier exported function for an attribute.
Return values
true
Errors
"Mobile must not be offline"
"Invalid parameter type"
Related
Character
Related Configs
vitals.cfg
SetVital( character, vitalname, value )
Parameters:
Name Type
character Character Reference
vitalname String (vital name)
value Integer (in hundreths)
Explanation
Sets the current value for "vitalname" on "character" in hundreths.
Return values
1 on success
Errors
"Invalid parameter type" including if vitalname was not found as a vital
Related
Character
Related Configs
vitals.cfg