Creature Switches and AI Enhancements
Locked
User avatar
Pstemarie
Posts: 157
Joined: Sun Sep 12, 2010 6:42 pm

Creature Switches and AI Enhancements

Post by Pstemarie »

[quote]
Can you explain what the new creature switches do? They are not very well documented.
[/quote]

From the upcoming Builder's Handbook (I have also included the original Bioware documentation on the XP1 and XP2 switches)...

CREATURE SWITCHES AND AI ENHANCEMENTS

Neverwinter Nights™ Enhanced includes several switches which allow Builders to customize the default creature AI.

Ambient Animation Conditions

The following variables can only be set on a creature that has the variable X2_L_SPAWN_USE_AMBIENT set on it (see Spawn Conditions below).

X4_L_USE_AMBIENT_CIVILIZED –If this variable is set to “1”, the creature will interact with placeables in its area that have the tag "NW_INTERACTIVE" and "talk" to other civilized creatures.

Note that humanoid races are civilized by default, so only set this flag for monster races that you want to behave the same way.

X4_L_USE_AMBIENT_CONSTANT – If set to “1”, the creature will constantly be acting. Otherwise, creatures will only start performing their ambient animations when they first perceive a player, and they will stop when the player moves away.

X4_L_USE_AMBIENT_CHATTER – If set to “1”, the creature will randomly use a few voicechats.

Note that it's a good idea to avoid putting this on multiple creatures using the same voiceset.

X4_L_USE_AMBIENT_IMMOBILE – If this switch is set to “1”, the creature will become mobile at close range (provided it has immobile animations). The creature will never leave its immediate area, but will move around in it, frequently returning to its starting point.
Note that creatures spawned inside interior areas that contain a waypoint with one of the tags "NW_HOME", "NW_TAVERN", "NW_SHOP" will automatically have this condition set.

Spawn Conditions

These variables setup special conditions when a creature first spawns in.

X1_L_IMMUNE_TO_DISPEL – If set to “1”, the creature will become immune to dispel magic (used for the statues in SoU).

X2_L_BEH_COMPASSION
– If set on a creature, the value of this variable sets the percentage chance it will aid friendly creatures in combat (set to 100 for always, 0 for never).

X2_L_BEH_MAGIC
– If set on a creature, the value of this variable sets the percentage chance it will use magic in combat (set to 100 for always, 0 for never).

X2_L_BEH_OFFENSE
– If set on a creature, the value of this variable sets the percentage chance it will use offensive capabilities in combat (set to 100 for always, 0 for never – make it flee).

X2_L_IS_INCORPOREAL
– If set to “1”, the creature can walk through other creatures.

X2_L_NUMBER_OF_ATTACKS
– If set on a creature (valid range 1-6), this variable overrides the creature’s number of attacks based upon its base attack bonus.

X2_L_SPAWN_USE_AMBIENT
– If set to “1”, the creature will use immobile ambient animations after it spawns.

X2_L_SPAWN_USE_SEARCH
– If set to “1”, the creature will go into detect mode after it spawns.

X2_L_SPAWN_USE_STEALTH
– If set to “1”, the creature will go into stealth mode after it spawns. When used with one or more of the Ambient Animation Conditions, this variable can be used to heavily modify a creature’s behavior.

X2_S_PM_SPECIAL_ITEM
–This allows you to script special items that enhance a palemaster’s summoned creatures. You need to put the name of a script into this variable that will be run on any creature called by the palemaster’s summon undead ability. You can use this script to add effects to the creature.
Note that you can use the OnEquip and OnUnEquip event hooks to set this variable.

X4_L_SPAWN_USE_APPEAR_ANIM
– If set to “1” on a creature, it will appear using the "EffectAppear" animation instead of fading in (but only if SetListeningPatterns() is called).

Special Combat Tactics

These variables override the creature’s default combat behavior. Only one of these variables can be set on a creature; however, they may be used in conjunction with one of the Special Escape Tactics variables described below.

X4_L_AI_COMBAT_RANGED
– If set to “1”, the creature will attempt to stay at “ranged” distance from their target.

X4_L_AI_COMBAT_DEFENSE
– If set to “1”, the creature will use defensive combat feats (such as parry) in combat.

X4_L_AI_COMBAT_AMBUSH
– If set to “1”, the creature will go stealthy (e.g. invisible) and attack, then run away and try to go stealthy again before attacking anew.

X4_L_AI_COMBAT_COWARD
– If set to “1”, the creature will attempt to flee from its attacker.

Special Escape Tactics

The following variables override the creature’s default combat behavior. Only one of these variables can be set on a creature; however, they may be used in conjunction with one of the Special Combat Tactics variables described above.

X4_L_AI_ESCAPE_RETURN
– If set to “1”, the creature will flee to a waypoint, returning a short time later.

X4_L_AI_ESCAPE_LEAVE –
As above, but the creature does not return.

X4_L_AI_TELEPORT_LEAVE –
If set to “1”, the creature teleports to safety and does not return.

X4_L_AI_TELEPORT_RETURN –
As above, but the creature returns a short time later.

Miscellaneous Switches

The following variables may be set on a creature to customize its behavior within the constraints of the default Bioware AI.

X4_SPECIAL_CONVERSATION
- If set to “1”, this variable will make a creature say a one-line greeting from its conversation file upon perceiving the player.

Note that [NW_D2_GenCheck] must be placed in the "Text Appears When" field of the greeting in the conversation file. Don't attach any player responses.

X4_SPECIAL_COMBAT_CONVERSATION –
Same as above, but for hostile creatures to make them say a line before attacking.

X4_L_ASSIST_ALLIES –
If set to “1”, the creature will attack when its allies call for help.

X4_L_SHOUT_WARNING –
If set to “1”, the creature will shout a warning to non-enemies before attacking.

X4_L_DAY_NIGHT_POST –
If set to “1”, the creature’s waypoints will be separated into day & night postings. If you create waypoints with the tags "WN_" + NPC Tag + "_##", those will be walked at night. The standard waypoints will be walked during the day. The night "posting" waypoint tag is simply "NIGHT_" + NPC tag.

X4_FLAG_LIGHT_SENSITIVE –
Marks the creature as being light sensitive, suffering a -1 to attack rolls and search and spot checks.

User Defined Events

Setting one of these variables on a creature will cause it to fire the designated user defined event. A creature may have multiple user defined events. Furthermore, as the name implies, user defined events must be coded by the Builder in the creature’s OnUserDefined event script.

X4_L_SPAWN_UD_HEARTBEAT
X4_L_SPAWN_UD_PERCIEVE
X4_L_SPAWN_UD_END_COMBAT
X4_L_SPAWN_UD_DIALOG
X4_L_SPAWN_UD_ATTACK
X4_L_SPAWN_UD_DAMAGED
X4_L_SPAWN_UD_DEATH
X4_L_SPAWN_UD_DISTURBED

Locked