Constants

定数とは数値を表す名称です。

定数は特定の値を表す記述として一ヶ所で定義しておけば、ソースコード上のその定数は全て同じ数値として振る舞います。

例えば年数を表す数値をソースコード上で扱います。その値を2002から2003に変更しようとします。

ソースコード上のあちこちにある2002という記述を2003に変更するよりも、定数"YEAR"をソースコード上に用いておけば、あとから"YEAR"の定義を2002から2003に変更するだけで済むのです。

また、定数は一意の名前を付けることにより、人間が解釈しやすいようにするといった用途でも用いられます。

例えば、白を表す数値(0xFFFFFF)の代わりにWHITEと書いた方が解釈しやすいでしょう。

定数は変数と異なり一定の値をとり、その値を動的に変えることはできません。

コンパイル時にプリコンパイラーがソースコード上の定数を意味するコードを探し出して実際の数値に置き換えます。

Constant Groups

Constant GroupDescription
ABILITY_*キャラクターの基本的な6つの能力値
AC_*Armor class adjustments.
ACTION_*Standard actions.
ALIGNMENT_*属性の設定。気質(善と悪)と、道徳的規範(秩序と混沌)を含んでいます。
ANIMAL_COMPANION_CREATURE_TYPE_*動物の相棒に出来るカテゴリー。動物の相棒と使い魔が異なることに注意してください。
ANIMATION_*List of animations.
AOE_MOB_*Area effects with mobile areas. Usually fixed on a mobile creature or target.
AOE_PER_*Area effects centered on a fixed point. Location data type? UNKNOWN
AREA_TRANSITION_*Defines the various different categories of area transition screens that are displayed when an area is loading.
ASSOCIATE_COMMAND_*Used to define various commands that can be issued to NPC associates.
ASSOCIATE_TYPE_*プレイヤーキャラクターが仲間に出来るNPCの種類。
ATTACK_BONUS_*Used to specify which attacks are modified by an EffectAttackIncrease() or EffectAttackDecrease() effect.
ATTITUDE_*Determines attitudes between creatures.
BASE_ITEM_*Base items that other items can be built on top of.
BODY_NODE_*Location on a body; either hand or chest. Purpose unknown.
CAMERA_MODE_*Selects one of the three perspective views available in the game.
CAMERA_TRANSITION_TYPE_*Used with SetCameraFacing() to determine how smoothly to transition the camera.
CLASS_TYPE_*Defines the standard class types.
COMBAT_MODE_*Different combat modes.
CREATURE_SIZE_*The size classes that creatures can belong to. Does not include gargantuan and colossal.
CREATURE_TYPE_*NWN-specific subtype denoting special attributes for a given creature.
DAMAGE_BONUS_*Determines magical adjustments to damage. Not treated the same as DAMAGE_POWER_*, which determines if an attack can penetrate damage reduction.
DAMAGE_POWER_*Determines the magical strength of a melee or missile attack (for harming creatures with damage reduction). Does not determine actual magical bonus (see DAMAGE_BONUS_*), just determines what damage reductions an attack bypasses.
DAMAGE_TYPE_*The type of damage that can be inflicted.
DIRECTION_*Used for determining compass direction.
DISEASE_*Different types of Diseases used in creating disease effect objects.
DOOR_ACTION_*A list of actions that can be done on a door.
DURATION_TYPE_*Duration types for ApplyEffectAtLocation and ApplyEffectToObject functions.
EFFECT_TYPE_*Constants that reflect the different effects that can be applied to creatures.
ENCOUNTER_DIFFICULTY_*The list of encounter difficulties.
FAMILIAR_CREATURE_TYPE_*使い魔とはウィザードやソーサラーに特別に召喚され、仕えるクリーチャーです。

彼らは術者の仕事を手伝います。例えば呪文のスクロールを集めたり、メッセージを届けたり、戦闘さえも参加します。

しかしたいていは術者の肩や帽子の先に停まり、腕白な笑みをもらしています。

ウィザードやソーサラーの使い魔が死ぬと術者は肉体的なショックを受けます。(1d6ダメージ)

使い魔と動物の相棒は異なることに注意してください。

FEAT_*Constants that deal with different feats that can be performed.
GAME_DIFFICULTY_*Specifies the list of available setting for game difficulty.
GENDER_*List of genders
GlobalsGlobal, non-grouped constant values.
GUI_PANEL_*List of all graphical panels (dialogs in windows programming terminology).
IMMUNITY_TYPE_*Constants to identify different immunities that creatures could possible have.
INVENTORY_DISTURB_TYPE_*The list of possible ways an inventory can be disturbed.
INVENTORY_SLOT_*Constant group for inventory equipment slots. These are the slots where items are placed when that are equiped (in use), and not the slots where items are just stored.
INVISIBILITY_TYPE_*Determines how a creature is protected from the sight of other creatures.
ITEM_PROPERTY_*Magical or other properties that can be applied to an item.
METAMAGIC_*Metamagic feats applied to a spell.
NW_ASC_*Covers miscellaneous skills and settings not categorized into other subgroups.
NW_ASC_AGRESSIVE_*Determines what skills or abilities an NPC associate uses automatically.
NW_ASC_DISTANCE_*Determines the distance, in meters, the NPC associate follows the PC at.
NW_ASC_HEAL_AT_*Used to determine at which percentage of the master's hit points an NPC associate should attempt to heal the master.
NW_FLAG_*Used to cause events to fire various numeric signals to OnUserDefined and set other attributes of a creature during the OnSpawn script using SetSpawnInCondition. The OnUserDefined event can thus be used to customize the behavior of an object without actually modifying the default behavior.
NW_FLAG_BEHAVIOR_*Determines how an NPC reacts, irregardless of faction. "NW_I0_GENERIC" must be included to use these constants (include "NW_I0_GENERIC using the #include compiler directive).
OBJECT_TYPE_*Used to categorize types of objects.
PANEL_BUTTON_*Client panel buttons including character sheet, inventory, journal, map, options, player vs player, resting and spellbook.
PERCEPTION_*Determines if a creature perceives another creature using its Spot skill vs. the other creature's Hide skill and its Listen skill vs. the other creature's Move Silently skill.
PERSISTENT_ZONE_*Used with GetFirstInPersistentObject() and GetNextInPersistentObject() functions.
PLACEABLE_ACTION_*Actions that can be performed on placeable objects.
PLAYER_CHAR_*Used for testing if a PC is actually controlled by a player.
POISON_*This constant group defines the many in game poisons.
POLYMORPH_TYPE_*These constants define the properties applied to targets when they are polymorphed into different creatures.
PROJECTILE_PATH_TYPE_*Different types of project paths (the path a missile weapon or other projectile follows as it travels).
RACIAL_TYPE_*Constants used to identify different races (human, dwarf etc)
RADIUS_SIZE_*Different degrees of radius size used in area-based functions.
REPUTATION_TYPE_*Determines how creatures react to one another.
REST_EVENTTYPE_*Determines the status of the last rest event for the PC.
SAVING_THROW_TYPE_*Describes different saving throw types.
SHAPE_*SHAPE_* constants are used in the GetFirstObjectInShape() and GetNextObjectInShape() functions.
SKILL_*Skills used in NWN.
SPECIAL_ATTACK_*Special attacks that can be performed during combat.
SPELL_*Magical spells cast by classes such as wizards, sorcerers, bards, clerics, and druids.
SPELL_SCHOOL_*Schools of spells.
SPELLABILITY_*Magical spell-like abilities some creatures possess.
STANDARD_FACTION_*The four generic factions used to determine enmity and friendship by NPCs.
SUBSKILL_*Subskills for dealing with traps; additions for Rogues to their standard Search skill.
SUBTYPE_*Effect subtypes.
TALENT_CATEGORY_*Groups the talents into categories.
TALENT_TYPE_*Primary category of talents for use by creatures in game.
TALKVOLUME_*Sets the broadcast range of text displayed using SpeakString() and ActionSpeakString() functions.
TILE_MAIN_LIGHT_COLOR_*List of available colors to be used as the main light source of a tile.
TRAP_BASE_TYPE_*Used to catagorize the strength and type of traps.
TREASURE_*Treasure types. These constants are defined in "nw_o2_coninclude"; in order to use the constant values the file "nw_o2_coninclude" must be included (using the "#include" compiler directive).
VFX_BEAM_*Beams fire in a straight line towards their targets.
VFX_COM_*Common visual special effects.
VFX_DUR_*Temporary visual effects that last for a specified duration.
VFX_FNF_*Bigger, flashier visual effects.
VFX_IMP_*Impact visual effects that are generally used for spells when the spell effect hits someone. VFX_IMP_* -type effects can only be applied with DURATION_TYPE_INSTANT
VOICE_CHAT_*List of character voice sayings.
WEATHER_*Different weather types.


JP team: marshall, geshi

Send comments on this topic.