トップ 新規 差分 一覧 ソース 検索 ヘルプ PDF RSS ログイン

constant.index

掲示板(停止中) | About | Reference | Lyceum(スクリプト入門) | Resources | Contributors | LexiconJP-OLD | NWN Builders

Constants

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

定数は特定の値を表す記述として一ヶ所で定義しておけば、ソースコード上のその定数は全て同じ数値として振る舞います。
例えば年数を表す数値をソースコード上で扱います。その値を2002から2003に変更しようとします。
ソースコード上のあちこちにある2002という記述を2003に変更するよりも、定数"YEAR"をソースコード上に用いておけば、あとから"YEAR"の定義を2002から2003に変更するだけで済むのです。

また、定数は一意の名前を付けることにより、人間が解釈しやすいようにするといった用途でも用いられます。
例えば、白を表す数値(0xFFFFFF)の代わりにWHITEと書いた方が解釈しやすいでしょう。

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

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

The const keyword is now available for making real constants (rather than declaring variables for a value).

Constant Groups

Constant GroupDescription
ABILITY_*キャラクターの基本的な6つの能力値。
AC_*アーマークラス修正。
ACTION_*標準のアクション。
ACTION_MODE_*クリーチャーが使用できるアクションモード。SetActionMode() と GetActionMode() で使用します。
AI_LEVEL_*クリーチャーを動かしているAI(人工知能)のレベルを定めます。AIのレベルが”高度”ということはCPU時間がより多いということです。
ALIGNMENT_*属性の設定。気質(善と悪)と、道徳的規範(秩序と混沌)を含んでいます。
ANIMAL_COMPANION_CREATURE_TYPE_*動物の相棒に出来るカテゴリー。動物の相棒と使い魔が異なることに注意してください。
ANIMATION_*アニメーションのリスト。
AOE_MOB_*範囲エフェクトです。通常は移動するクリーチャーに設定します。
AOE_PER_*ある一点を中央とした範囲エフェクトです。位置のデータタイプは不明。
APPEARANCE_TYPE_*クリーチャーの外見。
AREA_*エリアの地形の種類。GetIsAreaAboveGround() と GetIsAreaNatural() で使用されます。
AREA_TRANSITION_*エリアをロード中に表示される画面の種類。
ASSOCIATE_COMMAND_*NPCに対する命令の種類。
ASSOCIATE_TYPE_*PCが利用可能なNPCのグループの種類。
ATTACK_BONUS_*EffectAttackIncrease() と EffectAttackDecrease() によって修正される種類
ATTITUDE_*クリーチャー間の態度。
BASE_ITEM_*アイテムの基本分類。
BODY_NODE_*体の部位、手と胸。EffectBeam() で使用されます。
CAMERA_MODE_*カメラモード。
CAMERA_TRANSITION_TYPE_*SetCameraFacing() でどの程度スムーズにカメラを移動させるかの設定
CLASS_TYPE_*クラスの種類。
COMBAT_MODE_*戦闘モードの種類。連打・受け流しなど
CREATURE_SIZE_*クリーチャーの身体サイズ。巨大サイズ、超巨大サイズは含まれない。
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.
DC_*AutoDC()関数で使用される難易度を指定する定数。Difficulty Class constants used by the AutoDC function. この定数を有効にするためには、nw_i0_plotをインクルードする必要がある。These constants require you to include nw_i0_plot, which is where they are declared. They are in this order, difficulty wise: DC_EASY DC_MEDIUM DC_HARD DC_SUPERIOR DC_MASTER DC_LEGENDARY DC_EPIC
DEFENSIVE_CASTING_MODE_*?Determines if a creature is casting a spell defensively so they suffer no attacks of opportunity.
DETECT_MODE_*?Determines how a perceptive a creature is being.
DIRECTION_*?Used for determining compass direction.
DISEASE_*Different types of Diseases used in creating disease effect objects.
DISTANCE_*Distances used for determining positions.
DOOR_ACTION_*?A list of actions that can be done on a door.
DURATION_TYPE_*ApplyEffectAtLocation() と ApplyEffectToObject() 関数で使用するエフェクトの持続時間の種類。
EFFECT_TYPE_*Constants that reflect the different effects that can be applied to creatures.
ENCOUNTER_DIFFICULTY_*?The list of encounter difficulties.
EVENT_*?User-defined event codes.
FADE_SPEED_*Determines the amount of time a fade screen effect takes.
FAMILIAR_CREATURE_TYPE_*?使い魔とはウィザードやソーサラーに特別に召喚され、仕えるクリーチャーです。彼らは術者の仕事を手伝います。例えば呪文のスクロールを集めたり、メッセージを届けたり、戦闘さえも参加します。しかしたいていは術者の肩や帽子の先に停まり、腕白な笑みをもらしています。ウィザードやソーサラーの使い魔が死ぬと術者は肉体的なショックを受けます。(1d6ダメージ)使い魔と動物の相棒は異なることに注意してください。
FEAT_*Constants that deal with different feats that can be performed.
FOG_COLOR_*The color of the fog, to be specified within SetFogColor(). Remember to check the documentation of SetFogColor() for the ability to get exactly the right color you want.
FOG_TYPE_*For use with SetFogColor(), it is to specify which time of day the color change will affect.
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_*装備スロットを表す定数群。These are the slots where items are placed when that are equiped (in use), and not the slots where items are just stored. Also there exists a constant NUM_INVENTORY_SLOTS which can be used with a for loop as an upper limit (start at 0) to iterate through all inventory slots for equiped items.
INVISIBILITY_TYPE_*Determines how a creature is protected from the sight of other creatures.
IP_CONST_ABILITY_*Itemproperty constants regarding abilities.
IP_CONST_ACMODIFIERTYPE_*Itemproperty constants relating to armor class modifier types.
IP_CONST_ALIGNMENT_*Itemproperty constants relating to specific alignments, such as AC bonus against an alignment.
IP_CONST_ALIGNMENTGROUP_*Constants used for itemproperties relating to specific alignment groups - for instance AC bonus vs an alignment group.
IP_CONST_AMMOTYPE_*Different types of ranged ammuniations.
IP_CONST_ARCANE_SPELL_FAILURE_*?Itemproperty constants relating to arcane spell failure.
IP_CONST_CASTSPELL_*?Itemproperty constants for adding "cast spell" to items.
IP_CONST_CASTSPELL_NUMUSES_*?Itemproperty constants relating to the number of uses an item has of a specific spell.
IP_CONST_CLASS_*?Itemproperty constants relating to classes.
IP_CONST_CONTAINERWEIGHTRED_*Itemproperty constants relating to containers reducing the weight of their contents.
IP_CONST_DAMAGEBONUS_*Itemproperty constants relating to damage bonus.
IP_CONST_DAMAGEIMMUNITY_*Itemproperty constants relating to damage immunity.
IP_CONST_DAMAGEREDUCTION_*Itemproperty constants relating to damage reduction.
IP_CONST_DAMAGERESIST_*Itemproperty constants relating to damage resistance.
IP_CONST_DAMAGESOAK_*?Itemproperty constants relating to damage soaking.
IP_CONST_DAMAGETYPE_*Constants relating to itemproperties specific to damagetypes, such as AC bonus against a specific damagetype.
IP_CONST_DAMAGEVULNERABILITY_*Itemproperty constants relating to damage vulnerability.
IP_CONST_FEAT_*Constants for feat related itemproperties. The descriptions here are identical to the ones in the FEAT_* constants section. Far from all the feats can be added to items. Note that even if a description says that a feat requires a prerequisite, this isn't the case when granting that feat through the use of an item.
IP_CONST_IMMUNITYMISC_*Itemproperty constants relating to miscellaneous immunities.
IP_CONST_IMMUNITYSPELL_*Itemproperty constants relating to spell immunities.
IP_CONST_LIGHTBRIGHTNESS_*Itemproperty constants relating to the brightness of light an item emits.
IP_CONST_LIGHTCOLOR_*Itemproperty constants relating to the color of light an item emits.
IP_CONST_MONSTERDAMAGE_*Different damage range (dice) for monsters.
IP_CONST_ONHIT_*Itemproperty constants relating to when a weapons successfully hits something.
IP_CONST_ONHIT_CASTSPELL_*?Itemproperty constants relating to OnHit: Cast spell. Please consult the SPELL_* constant section of the Lexicon for further info.
IP_CONST_ONHIT_DURATION_*Itemproperty constants relating to the duration / percentage of effecting the target of certain OnHit properties.
IP_CONST_ONHIT_SAVEDC_*Itemproperty constants relating to the save DC (saving throw difficulty class) against an OnHit property.
IP_CONST_ONMONSTERHIT_*?Special abilities a monster can perform when it scores a successful hit.
IP_CONST_POISON_*Itemproperty constants relating to OnHit: poison.
IP_CONST_RACIALTYPE_*?Itemproperty constants relating to racial types - e.g. AC bonus against a certain racial type.
IP_CONST_REDUCEDWEIGHT_*Constants for the reduced weight itemproperty.
IP_CONST_SAVEBASETYPE_*?Itemproperty constants relating to saving throw base types.
IP_CONST_SAVEVS_*Itemproperty constants relating to saving throws versus specific effects or damage types.
IP_CONST_SPELLLEVEL_*Denotes different levels of magical spells.
IP_CONST_SPELLRESISTANCEBONUS_*Itemproperty constants relating to spell resistance bonuses.
IP_CONST_SPELLSCHOOL_*?Itemproperty constants relating to spell schools.
IP_CONST_TRAPSTRENGTH_*Itemproperty constants relating to traps' strength.
IP_CONST_TRAPTYPE_*Itemproperty constants relating to trap types.
IP_CONST_UNLIMITEDAMMO_*Itemproperty constants relating to unlimited ammunition.
IP_CONST_WEIGHTINCREASE_*Itemproperty constants relating to weight increase of items.
ITEM_APPR_*Various item appearance constants which describe the way certain classes of items can appear.
ITEM_PROPERTY_*Magical or other properties that can be applied to an item.
ITEM_VISUAL_*Visual effects performed by an item.
METAMAGIC_*?Metamagic feats applied to a spell.
MISS_CHANCE_TYPE_*Used to specify the miss chance type for EffectMissChance?.
NW_ASC_*?Covers miscellaneous skills and settings not categorized into other subgroups. These are not actually constants, and do not exist in nwscript.nss. To use these, you must include nw_i0_generic.
NW_ASC_AGRESSIVE_*?Determines what skills or abilities an NPC associate uses automatically. These are not actually constants, and do not exist in nwscript.nss. Not sure if these even exist anymore ? unlike the other NW_ASC constants (well, variables), they are not defined in nw_i0_generic. If you know where these constants / variables are defined, please contact the Lexicon makers.
NW_ASC_DISTANCE_*?Determines the distance, in meters, the NPC associate follows the PC at. These are not actually constants, and do not exist in nwscript.nss. To use these, you must include nw_i0_generic.
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. These are not actually constants, and do not exist in nwscript.nss. To use these, you must include nw_i0_generic.
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.
OBJECT_TYPE_*?Used to categorize types of objects.
PACKAGE_*?Represent the default packages for classes. Used in conjunction with the LevelUpHenchman command.
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.
PHENOTYPE_*Phenotype constants (all 3) are meant to be used with the functions GetPhenoType() and SetPhenoType(). They should really only be used by custom content people who aim to take advantage of the new way of altering a Player Characters appearance easily.
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).
QUEST_*?Various quest statuses for quest functions.
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_*セービングスローの種類(頑健、反応、意志、の分類)Core saving throws.
SAVING_THROW_TYPE_*セービングスローの種類(対毒、対病気などの個別の分類)Describes different saving throw types.
SHAPE_*SHAPE_* constants are used in the GetFirstObjectInShape() and GetNextObjectInShape() functions.
SKILL_*Skills used in NWN. The SKILL_* constants are actually integers, the corresponding values of which can be found in nwscript.nss. Those integers, in turn, are references to row-numbers in the gamefile skills.2da.
SKYBOX_*Skybox constants must match those in the skyboxes.2da file. They are to be used with the SetSkyBox() function.
SPECIAL_ATTACK_*?Special attacks that can be performed during combat.
SPELL_*Magical spells cast by classes such as wizards, sorcerers, bards, clerics, and druids. More information about what the spells do can be found in the descriptions in manuals / spell scrolls, and by looking in the "spells.2da" file. Known bug: the spells which summon elements (Summon Creature VII through IX) can successfully summon air, water, and fire elements, but earth elements cannot be summoned.
SPELL_CRAFT_*Unknown.
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.
STEALTH_MODE_*Determines if stealth mode (moving silently, hiding in shadows) is activated. Characters move slower when stealth mode is activated.
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.
TILE_SOURCE_LIGHT_*Colors for dynamic lighting to shine upon tiles.
TRACK_*?Musical tracks played throughout the game.
TRAP_BASE_TYPE_*?Used to catagorize the strength and type of traps.
TREASURE_*?Treasure types.
VFX_BEAM_*?Beams fire in a straight line towards their targets. These constants are actually integers which can be found in nwscript.nss and refer to row numbers in the file visualeffects.2da - this file also contains visual effects for which there are no constants. If you want to use one of those, just use EffectVisualEffect(XXX) where XXX is the rownumber.
VFX_COM_*Common visual special effects. These constants are actually integers which can be found in nwscript.nss and refer to row numbers in the file visualeffects.2da - this file also contains visual effects for which there are no constants. If you want to use one of those, just use EffectVisualEffect(XXX) where XXX is the rownumber.
VFX_DUR_*Temporary visual effects that last for a specified duration. These constants are actually integers which can be found in nwscript.nss and refer to row numbers in the file visualeffects.2da - this file also contains visual effects for which there are no constants. If you want to use one of those, just use EffectVisualEffect(XXX) where XXX is the rownumber.
VFX_FNF_*?Bigger, flashier visual effects. These constants are actually integers which can be found in nwscript.nss and refer to row numbers in the file visualeffects.2da - this file also contains visual effects for which there are no constants. If you want to use one of those, just use EffectVisualEffect(XXX) where XXX is the rownumber.
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 These constants are actually integers which can be found in nwscript.nss and refer to row numbers in the file visualeffects.2da - this file also contains visual effects for which there are no constants. If you want to use one of those, just use EffectVisualEffect(XXX) where XXX is the rownumber.
VOICE_CHAT_*List of character voice sayings.
WEATHER_*?Different weather types.
X2_IP_ADDPROP_POLICY_*These constants are only available if you include x2_inc_itemprop in your script. They are used in the IPSafeAddItemProperty command in the same include file and determine what should happen when adding a type of itemproperty to an item that already has one of that type.
X2_IP_ARMORTYPE_*Armortype constants for use with various of the x2_inc_itemprop itemproperty functions.
X2_TL_GROUNDTILE_*Tile visual effects for use with the tile magic (tm) system.