Man character
From LSWiki
(diff) ←Older revision | Current revision | Newer revision→ (diff)
Contents |
Files
/def/descriptor/character.c /lib/descriptor/autonomon.h /daemon/characters.c /lib/characters.h
Description
Character descriptors are used by the random character selection system. Characters that are suitable for random generation are registered with the characters daemon using character descriptors, and the descriptors are used in the selection process.
The standard support module for control daemons includes functions for registering characters for use by the random character system, which is referred to as "publishing" them. Example of characters being registered from a project control daemon:
#include <Project.h>
inherit "/std/daemon"; inherit "/mod/daemon/control";
#include <daemon.h>
void configure() { ::configure(); // set_creator(), set_area(), extensions, and so on here... add_published_character(Project_Monster("orc"), Rarity_Very_Common); add_published_character(([ Character_File : Project_Monster("ogre_mage"), Character_Rarity : Rarity_Very_Rare, ])); add_published_character(([ Character_File : Project_NPC("golbrunk"), Character_Rarity : Rarity_Exotic, Character_Dangers : Danger_Hated, ])); }
Public Fields
Character_File: The string object name of the character blueprint object.
Character_Rarity: The general rarity with which the character is to be randomly generated. This is an integer rarity value from rarity.h. Required.
Character_Dangers: A field of bitmask flags indicating dangers associated with the character, which is mainly to do with the risk of them attacking or being attacked by other characters. These flags are normally assigned automatically to the extent possible. The danger flags are:
Character_Danger_Aggressive: The character attacks others (only incarnoi unless Character_Danger_Indiscriminate is also set). This flag is assigned automatically to characters who respond true to query_aggressive().
Character_Danger_Allied: The character is allied with a large social group, and attacking this character will earn the enmity of that social group; normally means that the character is attached to a project control daemon with guardian functionality and has its area control flag turned on. Note that it is generally best not to publish such characters for random generation. This flag is assigned automatically to characters who respond true to query_area_control().
Character_Danger_Bomb: The character is some variety of autonomous bomb, and may be dangerous to anyone around it. This flag is not assigned automatically.
Character_Danger_Enmity: There are other characters or classes of character that this character considers enemies, on a basis other than race, and who this character will attack. This flag is assigned automatically to characters who have non-race values in their setting for query_enemies().
Character_Danger_Friendly: There are other characters or classes of character that this character is friendly with and will assist in combat. This flag is assigned automatically to characters who respond to query_friends() with an array of greater than size 0.
Character_Danger_Hated: There are characters or classes of character which are aggressive specifically toward this character or class of character (characters to whom ordinary racism settings or other forms of aggression may apply need not set this flag). This flag is not assigned automatically.
Character_Danger_Indiscriminate: The character is as aggressive toward non-incarnoi as toward incarnoi. This flag is assigned automatically to characters who respond true to query_can_kill().
Character_Danger_Racist: The character considers specific races as enemies and will attack them. This flag is assigned automatically to characters who have race values in their setting for query_enemies().
Character_Flags: A set of bitmask flags. Currently there is only one:
Character_Defined_Dangers: Suppresses the normal analysis of the character for automatic assignment of Character_Dangers flags. This means the danger flags manually assigned are relied on exclusively, and so should be specified carefully.
Internal Fields
Character_Object: Query this field to retrieve a pointer to the character blueprint. The character will be loaded if it has not been yet. Do not set this field.
Character_Source: The string object name of the object that created the descriptor.
Character_Tag: The tag for the descriptor system.
Support Functions
object Character_Resolve(descriptor dxr)
Returns the final character object suitable for use as randomly generated content. In the case of monsters, this will be a clone of the blueprint; in the case of NPCs, it will be the blueprint itself.
See Also
descriptors(mechanisms), rarity(mechanisms), selection(mechanisms), item(descriptors), location(descriptors)