Jump to content

AI: Difference between revisions

77 bytes removed ,  18 December 2015
continuing rewrite
(continuing rewrite)
(continuing rewrite)
Line 269: Line 269:




OK, we have positioning down; now for the actual behaviors that an AI can be set to execute within these ranges. There are fourteen possible combat behaviors (in brackets are the XML strings):
OK, we have positioning down; now for the actual behaviors that an AI can be set to execute within these ranges. There are fourteen possible combat behaviors (in parentheses are the XML strings):
:*None (None): simply nothing.
:*None (None): simply nothing.
:*Stare (Stare): the AI stands and stares; it does not even rotate to face the enemy.
:*Stare (Stare): the AI stands and stares; it does not even rotate to face the enemy.
Line 311: Line 311:


==Extra combat behaviors==
==Extra combat behaviors==
Combat ranges and various AI combat behavior was discussed in previous section. Even with combat ranges, there are still other parts of combat to be taken care of - picking up weapons from the ground, melee overrides of weapons, behavior if character is unarmed and of course, firing weapons or using hand to hand combat. Files inspected in this section will be [[CMBT]] profiles and [[ONCC]] files.
Combat ranges and various AI combat behaviors were discussed in the previous section. Even in terms of combat ranges, there are still other aspects of combat to cover: picking up weapons from the ground, melee overrides of weapons, behaviors if the character is unarmed, and, of course, firing weapons or using hand-to-hand combat.


'''"Melee override" ([[CMBT]] profile)''' - similar to [[BSL]] command '''chr_dontaim''', this behavior bids the AI character to use hand to hand animation varient (see [[TRAM]]) and to switch from whatsoever other behavior to melee combat. This field was probably added to deal with conflicts when multiple AI behaviors are applied on character. Possible values are (xml strings in brackets):
'''"Melee override" ([[CMBT]] profile)''': Similar to the BSL command [[chr_dontaim]], this behavior urges the AI to use its hand-to-hand animation variant (see [[TRAM]]) and to switch from some other behavior to melee combat. This field was probably added to deal with conflicts when multiple AI behaviors are applied on a character. The possible values are (XML strings in parentheses):
:*None (None) - no override is used.
:*None (None): no override is used.
:*If Punched (IfPunched) - melee override applied when AI character is melee attacked by its enemy. Does not work when the character is invincible (cheat).
:*If Punched (IfPunched): melee override is applied when the AI is melee-attacked by its enemy. Does not work when the character is invincible.
:*Cancelled - unfinished stuff, does nothing. Remains only the question what it was meant to be...
:*Cancelled: unfinished feature; does nothing. There remains only the question of what it was meant to be....
:*Short (ShortRange) - Melee override is applied when enemy is within Short range.
:*Short (ShortRange): Melee override is applied when the enemy is within Short range.
:*Medium (MediumRange) - Melee override is applied when enemy is within Medium or Short range.
:*Medium (MediumRange): Melee override is applied when the enemy is within Medium or Short range.
:*Always melee (AlwaysMelee) - Melee override is applied withing all combat ranges
:*Always Melee (AlwaysMelee): Melee override is applied within all combat ranges.


:This override can affect:
:This override can affect:
:*Alarm running - It is even required if alarm run is called via "If no gun" alarm run behavior, otherwise glitches will appear.
:*Alarm running: It is actually required if an alarm run is called via the no-gun alarm run behavior, otherwise glitches will appear.
:*Retreating behavior - When "If no gun" is set as "Retreat", unarmed AI character will try to run away from its enemy. However, if enemy meets Melee override parameter (for example get into Short range while Melee overrride is set to ShortRange), then this AI stops running away and starts attacking the enemy.
:*Retreating behavior - When the no-gun behavior is set as "Retreat", an unarmed AI will try to run away from its enemy. However, if enemy meets the Melee override parameter (for example getting into the Short range while the melee override is set to ShortRange), then this AI stops running away and starts attacking the enemy.
:*Weapon firing - If distance between AI character and its enemy is smaller than minimal shooting distance, AI tries to run away from its enemy (still facing the enemy) till distance between characters is greater than minimal shooting distance. However, this backpedal behavior can be overriden by "Melee override" if all conditions are met - AI character then starts using melee (even with loaded weapon in hand) for at least 10 seconds (hardcoded timer) After ten seconds AI tries to restore its previous behavior. If enemy is still too close, Melee override is immediately applied again.  
:*Weapon firing: If the distance between the AI and its enemy is smaller than the minimal shooting distance, the AI tries to backpedal away from its enemy till the distance between characters is greater than the minimal shooting distance. However, this backpedal behavior can be overridden by the melee override if all conditions are met; the AI then starts using melee (even with a loaded weapon in hand) for at least 10 seconds (hardcoded timer). After ten seconds, the AI tries to resume its previous behavior. If the enemy is still too close, the melee override is immediately applied again.
:*Weapon pickup - if AI is trying to pick up a weapon and enemy crosses the range specified in MeleeOverride, then weapon pickup behavior is overridden by melee.
:*Weapon pickup: if the AI is trying to pick up a weapon and an enemy crosses the range specified in MeleeOverride, then the weapon pickup behavior is overridden by melee.
:*Maybe some other aspects of AI behavior?
:*Maybe some other aspects of AI behavior?






'''"If no gun" behavior ([[CMBT]] profile)''' - this parameter tells AI character what kind of action AI should do if it is unarmed or has empty weapon and no spare clips. Possibilites are (xml strings in brackets):
'''No-gun behavior ([[CMBT]] profile)''': This parameter tells the AI what kind of action it should take if it is unarmed or has an empty weapon and no spare clips. Possibilities are (XML strings in parentheses):
:*Melee (Melee) - AI character attacks enemy with hand to hand combat  
:*Melee (Melee): The AI attacks the enemy with hand-to-hand combat.
:*Retreat (Retreat) - AI character runs away from its enemy (a bit glitchy, but works)
:*Retreat (Retreat): The AI runs away from its enemy (a bit glitchy, but works).
:*Run For Alarm (RunForAlarm) - see section [[#Alarm behavior - "She's everywhere!"|Alarm behavior]]. Remainder: this alarm calling behavior requires Melee override set as ShortRange, MediumRange or AlwaysMelee, otherwise alarm behavior gets glitched and AI character gets stuck. If no alarm console is found within Alarm search distance, AI character resorts to melee.
:*Run For Alarm (RunForAlarm): see section [[#Alarm behavior|Alarm behavior]]. Reminder: this alarm-running behavior requires the melee override to be set in ShortRange, MediumRange or AlwaysMelee, otherwise the alarm behavior gets glitched and the AI gets stuck. If no alarm console is found within the alarm search distance, the AI resorts to melee.




[[File:GoForGun.JPG|thumb|right|alt=Picture showing AI moving to a weapon.|AI character moving to a weapon.]]
[[File:GoForGun.JPG|thumb|right|alt=Picture showing AI moving to a weapon.|AI moving towards a weapon.]]
'''Weapon pickup behavior ([[ONCC]] file)''' - when in combat mode, unarmed AI character can be told to move to a loaded weapon and pick it up or to switch held empty gun for a loaded gun which is lying on the floor. Overall, AI characters only register pickable weapons which are lying around them up to a distance of 60 units (hardcoded). Weapons which are lying further than 60 units from the AI character are ignored. In [[ONCC]] file these parameters can be set to alter gun pickup behavior (xml tags in brackets ):
'''Weapon pickup behavior ([[ONCC]] file)''': When in combat mode, an unarmed AI can be told to move to a loaded weapon and pick it up or to swap a held, empty gun for a loaded gun which is lying on the floor. Overall, AIs can only register pickup-able weapons up to a distance of 60 world units (hardcoded). In the ONCC file, these parameters can be set to alter the gun pickup behavior (XML tags in parentheses):
:*Chance for pickup (GoForGunChance) - percentual chance of AI being told to go and pick up a weapon. It seems that the weapon closest to the AI character is always chosen to be picked up.
:*Chance for pickup (GoForGunChance): percent chance of AI deciding to go and pick up a weapon. It seems that the weapon closest to the AI character is always chosen to be picked up.
:*Running pickup (RunPickupChance) - percentual chance of AI picking the weapon by performing an evasion move (melee dodge move).
:*Running pickup (RunPickupChance): percent chance of AI picking up the weapon by performing an evasion (melee dodge) move.






'''Getting up after being knocked down ([[ONCC]] file)''' - if AI character is knocked to the ground, it stays on the ground for a while (simulation of concussion) then gets up. In [[ONCC]] file there are two parameters regarding getups (xml tags in brackets):
'''Getting up after being knocked down (ONCC file)''': If an AI is knocked to the ground, it stays on the ground for a while (a simulation of being stunned), then gets up. In the ONCC file there are two parameters regarding getting up (XML tags in parentheses):
:*Knockdown minimal number of frames (DazedMinFrames) - minimal number of frames for which AI character stays on the ground.
:*Knockdown minimal number of frames (DazedMinFrames): minimal number of frames that AI stays on the ground.
:*Knockdown maximal number of frames (DazedmaxFrames) - maximal number of frames for which AI character stays on the ground.
:*Knockdown maximal number of frames (DazedmaxFrames): maximum number of frames that AI stays on the ground.


:If knockdowned AI character gets hit by melee, it gets up immediately after the hit. Being hit by weapons does not make AI character instantly get up. Standard getups are simple ones (as if knockdowned player hit some direction key). If AI character is in melee combat mode, its MELE profile has getup attacks listed and enemy is within the required range, chance is this AI character will use getup attacks or instead of simple getups.
:If a knocked-down AI gets hit by melee, it gets up immediately after the hit. Being hit by weapons does not make AI character instantly get up. Standard get-ups are simple ones (the same result as if the knocked-down player hits a directional key). If the AI is in melee combat mode, its [[MELE]] profile has get-up attacks listed, and the enemy is within the required range, there is a chance that this AI will use a get-up attack instead of a simple get-up animation.






'''Making sure enemy is dead ([[ONCC]] file)''' - yes, even this is a part of Oni combat Artificial Intelligence.
'''Making sure enemy is dead (ONCC file)''': Yes, even this is a part of Oni's combat AI.
:When enemy is defeated in hand to hand fighting, AI character stands for a while and "checks" if enemy is dead. During this interval AI character can utter a short victory speech if corresponding sound slot in [[ONCC]] is filled and percentual chance roll is successful. Also during "check body" time interval AI character can perform a taunt animation if percentual roll is successful. Here are listed all related fields from [[ONCC]] file (xml tags in brackets):
:When the enemy is defeated in hand-to-hand fighting, the AI stands over them for a while to decide if the enemy is dead. During this interval, the AI can utter a short victory speech if the corresponding sound slot in its ONCC is filled and the percent chance roll is successful. Also during the "check body" time interval, the AI can perform a taunt animation if that roll is successful. Here are listed all the related fields from the ONCC file (XML tags in parentheses):
:*Investigate body (InvestigateBodyDelay) - time interval for which AI character stands next to its defeated enemy and stares at him.
:*Investigate body (InvestigateBodyDelay): Time period for which AI stands over its defeated enemy and stares at him/her.
:*Dead taunt chance (DeadTauntChance) - percentual chance of performing taunt animation.  
:*Dead taunt chance (DeadTauntChance): Percent chance of performing a taunt animation.  
:*Check body sound probability (CheckBodyProbability) - Percentual chance of playing victory speech.
:*Check body sound probability (CheckBodyProbability): Percent chance of playing a victory speech.
:*Check body sound (CheckBodySound) - link to Oni Ambient sound file ([[OBD:OSBD/OSAm]]).
:*Check body sound (CheckBodySound): A link to an Oni ambient sound file ([[OBD:OSBD/OSAm|OSAm]]).




:If the enemy is defeated by weapon, then AI character keeps shooting this dead enemy for some extra time to "make sure" the enemy is dead, then comes close to investigate the body. No taunts, no win phrases. Parameters of this behavior are:
:If the enemy is defeated by weapon, then the AI keeps shooting this dead enemy for some extra time to make sure the enemy is dead, then comes close to investigate the body. No taunts, no win phrases. The parameters of this behavior are:
:*Dead make sure (DeadMakeSureDelay) - time interval for which AI character keeps shooting the dead enemy
:*Dead make sure (DeadMakeSureDelay): Time period for which the AI keeps shooting the dead enemy.
:*Investigate body (InvestigateBodyDelay) - it is the same as the one listed above.
:*Investigate body (InvestigateBodyDelay): Same as the one listed above for melee.




Modding hints - behaviors enlisted in this section can be combined to achieve quite impressive results.
Modding hints - the behaviors listed in this section can be combined to achieve quite impressive results.
:*Unfortuantely, Oni does not provide (code-wise) any AI routines to deal with dynamic holstering and unholstering of possessed weapons. Thus, melee overrides are the only way how make armed AI character somehow defend itself when enemy gets too close.  
:*Unfortunately, Oni does not provide any AI settings that deal with intelligent holstering and unholstering of weapons in their possession. Thus, melee overrides are the only way to make an armed AI somehow defend itself when the enemy gets too close to use its weapon.
::Nevertheless, [[BSL]] provides function to make character holster or unholster a weapon - '''chr_forceholster'''. In order to make a character holster the held weapon, this character has to be using pistol or rifle animation variant (see [[TRAM]]). Since AI characters can use walk_noaim and run_noaim movmement modes (which disable weapon variant i.e. aiming with weapon), the weapon variant should be explicitly coerced via BSL function '''chr_dontaim'''. Unholster is easier, simply character has to be be executign some overlay-comaptible animation at the moment when chr_forceholster is executed. That means standing/running/crouching/walking/jumping is OK and function will succeed, but attack animations or animations of getting hit are not OK and function will fail.
::Nevertheless, BSL does provide a function to make a character holster or unholster a weapon: [[chr_forceholster]]. In order to make a character holster a held weapon, this character has to be using a pistol or rifle animation variant (see [[TRAM]]). Since AI can use "walk_noaim" and "run_noaim" movement modes (which disable weapon variants, i.e., aiming with weapons), the weapon variant should be explicitly forced on via the BSL function [[chr_dontaim]]. Unholstering is easier: the character simply has to be be executing some aiming overlay-compatible animation at the moment when chr_forceholster is executed. That means standing, running, crouching, walking, and jumping are OK -- the function will succeed -- but attack animations or animations of getting hit are not OK and the function will fail.
::*IMPORTANT NOTE: The AI character must be "active" all the time in order to perform BSL animation checks ('''chr_wait_'''''animation/animtype/animstate'' checks). Remember that Oni was made back in years 2000/2001, so various tricks were used to save memory and enhance performance. One of these feints is making invisible characters (behind wall, behind closed doors etc) go into INACTIVE mode, which means they are only stored in a RAM memory as a structure, but no physics, no checks for collisions and no drawing functions are applied on them in order to save system resources (BTW yes, that means inactive characters can walk in air and pass through walls). On the contrary when character is ACTIVE, it is fully operational, physics working, collisions being checked and character being ready in graphics memory to be drawn anytime. To make sure character stays active means either applying individually "'''chr_lock_active''' ''ai_name''", or (since now is year 2011 ^_^) simply applying "'''chr_all_active=1'''" to make all characters be ready to be drawn anytime.
::*IMPORTANT NOTE: The AI must be "active" all the time in order to perform BSL animation checks ([[chr_wait_animation]]/[[chr_wait_animtype|animtype]]/[[chr_wait_animstate|animstate]] checks). Remember that Oni was developed mostly in the '90s, so various tricks were used to save memory and enhance performance. One technique was to make unseen characters (behind a wall, closed doors, etc.) go into an "inactive" mode, which means they are only stored in RAM as a structure, but no physics, collision checks, or drawing functions are performed on them in order to save system resources (and yes, that means inactive characters can [https://www.youtube.com/watch?v=GC4HLDekxQI walk in mid-air and pass through walls]). On the other hand, when a character is active, it is fully operational, with physics working, collisions being checked, and character being ready in graphics memory to be drawn any time. To make sure a character stays active requires either applying [[chr_lock_active]] to each AI, or (since computers have a lot more memory these days) simply setting [[chr_all_active]] to 1 to force all characters active.
::Here is a simple example of a BSL scripted holster behavior. Character is given a gun, then weapon is holstered. When this AI character notices enemy and plays startle animation, then unholster is called. [http://www.youtube.com/watch?v=2WNMh8u5wBI THIS YouTube video] shows the script in action.
::Here is a simple example of a holster behavior scripted in BSL. A character is given a gun, then the weapon is holstered. When this AI notices an enemy and plays its startle animation, then an unholster is called for. [http://www.youtube.com/watch?v=2WNMh8u5wBI This YouTube video] shows the script in action.


   #Setup of AI - gets spawned, forced to be always active, weapon gets holstered.
   #Setup of AI - gets spawned, forced to be always active, weapon gets holstered.
Line 388: Line 388:




:*Melee override can be used together with "Go For Gun" behavior and properly sized Short combat range to create AI characters who jump the gun each time they have a chance yet they are not allowing enemy to land free hits in the process (If enemy gets too close, Short range melee override kicks in).
:*A melee override can be used together with the "Go For Gun" behavior and a properly-set Short combat range to create AIs who go for a gun any time they have a chance, yet they are not allowing an enemy to land free hits in the process (if the enemy gets too close, the Short range melee override kicks in).


:*"If No Gun" behavior "Retreat" works in a rather simple manner - if unarmed, AI character is given a desire to run as far away from the enemy as possible. This behavior can look a bit awkward, but is useful for making more life-like civilians. Combined with Melee override at "short range" or "if punched" and a bit of BSL scripting to deliberately switch between "combatant" and "non-combatant", a modder can achieve impressive yet lightweight (on game engine) results. [http://www.youtube.com/watch?v=BTGQTAoU_1E See this YouTube video.]
:*The no-gun behavior "Retreat" works in a rather simple manner: if unarmed, an AI is given a desire to run as far from the enemy as possible. This behavior can look a bit awkward, but is useful for making more life-like civilians. Combined with Melee override at "Short range" or "If punched", and a bit of BSL scripting to deliberately switch between "combatant" and "non-combatant", a modder can achieve impressive results without only a light load on the game engine. [http://www.youtube.com/watch?v=BTGQTAoU_1E See this YouTube video.]


:*Setting short getup times is a good way to make AI driven character formidable opponent in hand to hand combat. However, too short getup times can introduce problems. It is a good idea to experiment with getup parameters till the character feels "natural".
:*Setting short get-up times is a good way to make an AI-driven character a formidable opponent in hand-to-hand combat. However, too-short get-up times can introduce problems. It is a good idea to experiment with get-up parameters till the character feels "natural".


:* Don't overextend "Check body" and "Dead make sure" timers. It looks silly and on top of that it makes AI characters easy targets of a surprise rear throw.
:*Don't over-extend the "Check body" and "Dead make sure" timers. It looks silly, and on top of that it makes AIs easy targets for a rear throw.




Line 416: Line 416:




:AI parameters regarding gunfire dodging are set in [[ONCC]] (xml tags in brackets):
:AI parameters regarding gunfire dodging are set in [[ONCC]] (xml tags in parentheses):
:*Dodge reaction delay (DodgeReactFrames) - a delay in number of frames. This delay makes A.I character wait a bit inside danger zone before this AI character starts its reaction on firingspred/projectile.
:*Dodge reaction delay (DodgeReactFrames) - a delay in number of frames. This delay makes A.I character wait a bit inside danger zone before this AI character starts its reaction on firingspred/projectile.
:*Dodge timescale (DodgeTimeScale) - how long should the AI character's gunfire dodge reaction last.
:*Dodge timescale (DodgeTimeScale) - how long should the AI character's gunfire dodge reaction last.
Line 447: Line 447:




:For each one of these weapons, there are in ONCC defined these parameters (xml tag in brackets):
:For each one of these weapons, there are in ONCC defined these parameters (xml tag in parentheses):
:*Recoil compensation (RecoilCompensation) - How much the AI cahracter compensates the recoil of the weapon. Setting this to 0.0 mean no compensation, setting this to 1.0 means full compensation.
:*Recoil compensation (RecoilCompensation) - How much the AI cahracter compensates the recoil of the weapon. Setting this to 0.0 mean no compensation, setting this to 1.0 means full compensation.
:*Best aiming angle (BestAimingAngle) - In radians, but question is whether it really affects aiming.
:*Best aiming angle (BestAimingAngle) - In radians, but question is whether it really affects aiming.
Line 460: Line 460:


'''Targeting and prediction''' of enemy's movement. Apart from majority of other games, Oni AI does not "cheat" by being 100% accurate and then having some kind of additive error (even tough additive error is present in Oni, see above). It is a bit inverse - there's a bit of a problem making AI being a reasonably precise marksman ^_^. AI character is given input parameters such as distance between characters, present velocity of its enemy (vector) and velocity of held gun's projectile (number, not a vector). From this data, AI logic computes a prediction of enemy's location and ideal aiming direction in order to hit the enemy.
'''Targeting and prediction''' of enemy's movement. Apart from majority of other games, Oni AI does not "cheat" by being 100% accurate and then having some kind of additive error (even tough additive error is present in Oni, see above). It is a bit inverse - there's a bit of a problem making AI being a reasonably precise marksman ^_^. AI character is given input parameters such as distance between characters, present velocity of its enemy (vector) and velocity of held gun's projectile (number, not a vector). From this data, AI logic computes a prediction of enemy's location and ideal aiming direction in order to hit the enemy.
:[[ONCC]] parameters for targeting and prediction (xml tags in brackets):
:[[ONCC]] parameters for targeting and prediction (xml tags in parentheses):
:*Predict amount (PredictAmount)- Some sort of multiplier for prediction mechanics.  
:*Predict amount (PredictAmount)- Some sort of multiplier for prediction mechanics.  
:*Predict position delay (PredictPositionDelay) - In frames, delay before prediction is applied, so AI characters always uses a bit outdated prediction result.
:*Predict position delay (PredictPositionDelay) - In frames, delay before prediction is applied, so AI characters always uses a bit outdated prediction result.
Line 467: Line 467:
:*Predict trend frames (PredictTrendFrames) - Number of frames interval but meaning not 100% sure. Maybe a trend (sort of extrapolation of enemy's movement) is computed with data from this interval? Must be set at least to 2.0.
:*Predict trend frames (PredictTrendFrames) - Number of frames interval but meaning not 100% sure. Maybe a trend (sort of extrapolation of enemy's movement) is computed with data from this interval? Must be set at least to 2.0.


:[[ONWC]] parameters for targeting and prediction (xml tags in brackets):
:[[ONWC]] parameters for targeting and prediction (xml tags in parentheses):
:*Prediction speed (PredictionSpeed) - More precisely "projectile prediction speed". This value is taken by prediction algorithm as a speed of a projectile fired with the corresponding fire mode of the [[ONWC]] weapon. Thus when actual [[PAR3]] projectile's speed is changed, prediction behavior produces misleading values (AI is unable to hit moving targets).
:*Prediction speed (PredictionSpeed) - More precisely "projectile prediction speed". This value is taken by prediction algorithm as a speed of a projectile fired with the corresponding fire mode of the [[ONWC]] weapon. Thus when actual [[PAR3]] projectile's speed is changed, prediction behavior produces misleading values (AI is unable to hit moving targets).
:*Maximal inaccuracy angle (MaxInaccuracyAngle) - Maximal allowed deviation of aim from the enemy's character pelvis in order to keep firing the weapon. If exceeded, AI ceases fire and corrects aiming, the resumes fire. Pelvis is taken as a root point of the character, so without any extra chages done to targeting origin and targeting vector (see [[ONWC]]) AI characters always target pelvis of the enemy.
:*Maximal inaccuracy angle (MaxInaccuracyAngle) - Maximal allowed deviation of aim from the enemy's character pelvis in order to keep firing the weapon. If exceeded, AI ceases fire and corrects aiming, the resumes fire. Pelvis is taken as a root point of the character, so without any extra chages done to targeting origin and targeting vector (see [[ONWC]]) AI characters always target pelvis of the enemy.
Line 483: Line 483:




'''Miscellaneous [[ONWC]] AI setup''' - there are a few more parameters in ONWC which affect AI behavior with the weapon. They are (xml tags in brackets):
'''Miscellaneous [[ONWC]] AI setup''' - there are a few more parameters in ONWC which affect AI behavior with the weapon. They are (xml tags in parentheses):
:*Minimal shooting distance (MinShootingDistance) - defines how close can enemy be to the armed shooting AI character. If enemy comes closer than this distance, AI stops shooting and tends to move back a bit (vector type of movement, see [[#Pathfinding and movement|HERE]]) until the distance is again equal or greater than Minimal shooting distance. Then AI opens fire again. To witness the effect, see some AI operating an SBG when its enemy is close to it.
:*Minimal shooting distance (MinShootingDistance) - defines how close can enemy be to the armed shooting AI character. If enemy comes closer than this distance, AI stops shooting and tends to move back a bit (vector type of movement, see [[#Pathfinding and movement|HERE]]) until the distance is again equal or greater than Minimal shooting distance. Then AI opens fire again. To witness the effect, see some AI operating an SBG when its enemy is close to it.
::'''IMPORTANT''' - for some unknown reason, value from this field is '''divided by 2'''. So when 100 is set, ingame AI starts backing when its enemy is 50 units close to it.
::'''IMPORTANT''' - for some unknown reason, value from this field is '''divided by 2'''. So when 100 is set, ingame AI starts backing when its enemy is 50 units close to it.
Line 490: Line 490:




:*basic parameters of a weapon (pistol or rifle type, type of ammunition etc.) can be set as a various flags in [[ONWC]] flags field (<Flags> in xml). These three flags from them affect AI behavior (xml tags in brackets):
:*basic parameters of a weapon (pistol or rifle type, type of ammunition etc.) can be set as a various flags in [[ONWC]] flags field (<Flags> in xml). These three flags from them affect AI behavior (xml tags in parentheses):
:**NoHolster - apart from holster disabled, this flag also makes AI character ignore this weapon on the ground. One exception is w10_ba1 when AI character has set Superammo flag (InfiniteAmmo in xml) in its [[CHAR]] profile, then this AI character can pick up WMC cannon. If AI character is given the weapon it will fire it, but if the weapon is lying on the ground and AI character does not have superammo flag, this AI character will never pick it up.
:**NoHolster - apart from holster disabled, this flag also makes AI character ignore this weapon on the ground. One exception is w10_ba1 when AI character has set Superammo flag (InfiniteAmmo in xml) in its [[CHAR]] profile, then this AI character can pick up WMC cannon. If AI character is given the weapon it will fire it, but if the weapon is lying on the ground and AI character does not have superammo flag, this AI character will never pick it up.
:**Stun switcher (StunSwitcher) - if the enemy is within armed AI character's shooting distance and was knockdowned, stunned or blownupped, the AI character switches to a melee for a time specified in the weapon's Fight timer (see above). The flag was designed specially for w6_vdg weapon.
:**Stun switcher (StunSwitcher) - if the enemy is within armed AI character's shooting distance and was knockdowned, stunned or blownupped, the AI character switches to a melee for a time specified in the weapon's Fight timer (see above). The flag was designed specially for w6_vdg weapon.
Line 538: Line 538:


Fistfighting AI mode is handled via [[MELE]] profiles. MELE profile is assigned to the spawnable character in its [[CHAR]] profile. When in melee mode, AI character uses vector type of movement. Unless specified otherwise, AI character is made to run towards its enemy.
Fistfighting AI mode is handled via [[MELE]] profiles. MELE profile is assigned to the spawnable character in its [[CHAR]] profile. When in melee mode, AI character uses vector type of movement. Unless specified otherwise, AI character is made to run towards its enemy.
:[[MELE]] profile always contains these parameters (xml tags in brackets):
:[[MELE]] profile always contains these parameters (xml tags in parentheses):
:*Character class (CharacterClass) - Link to an [[ONCC]] class. Level of importance of this parameter not known, but maybe it is neccessary in order to allow for performance of some attack moves (engine checks referenced [[ONCC]] class and its [[TRAC]]).
:*Character class (CharacterClass) - Link to an [[ONCC]] class. Level of importance of this parameter not known, but maybe it is neccessary in order to allow for performance of some attack moves (engine checks referenced [[ONCC]] class and its [[TRAC]]).
:*Notice (Notice) - percentual chance that AI will register incoming attack. In retail profiles it is always set 100.
:*Notice (Notice) - percentual chance that AI will register incoming attack. In retail profiles it is always set 100.