Criterion: Difference between revisions
Jump to navigation
Jump to search
m (recategorize) |
Thunder4ik (talk | contribs) m (→See also: Unicodifying, replaced: See Also → See also) |
||
(8 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
[[Category:AI Programming]] | [[Category:AI Programming]] | ||
A '''criterion''' is a match condition. If it doesn't match, it scores 0. If it does match, the score is its weight value. | |||
The Response system checks each [[Rules|rule]] against the set, give it a numeric score based on the rule's set of criteria. Then the system picks one rule with the highest score, dispatch a response that the rule points. | The Response system checks each [[Rules|rule]] against the set, give it a numeric score based on the rule's set of criteria. Then the system picks one rule with the highest score, dispatch a response that the rule points. | ||
Line 11: | Line 11: | ||
==matchkey== | ==matchkey== | ||
Many keyvalue pairs are updated in <code> | Many keyvalue pairs are updated in <code>ModifyOrAppendCriteria( AI_CriteriaSet& set )</code> & <code>CAI_ExpresserHost_DoModifyOrAppendCriteria( CAI_BaseNPC *pSpeaker, AI_CriteriaSet& set )</code> and player and NPC codes. | ||
Also mappers can set keyvalue pairs via [[ | Also mappers can set keyvalue pairs via the [[Context]] system. | ||
*[[ | *[[concept]] | ||
* | *map | ||
* | *classname | ||
* | *name | ||
* | *health | ||
* | *healthFrac | ||
* | *playerHealth | ||
* | *player | ||
* | *playerWeapon | ||
* | *playerActivity | ||
* | *playerSpeed | ||
* | *npcstate | ||
*distancetoplayer | *distancetoplayer | ||
*seeplayer | *seeplayer | ||
Line 54: | Line 54: | ||
==other options== | ==other options== | ||
*weight | *weight nnn: floating point weighting for score assuming criteria match (default value 1.0) | ||
*required: if a rule has one or more criteria with the required flag set, then if any such criteria fail, the entire rule receives a score of zero | *required: if a rule has one or more criteria with the required flag set, then if any such criteria fail, the entire rule receives a score of zero | ||
== | ==See also== | ||
*[[List of HL2 criteria]] | |||
== | |||
Latest revision as of 08:43, 8 January 2024
A criterion is a match condition. If it doesn't match, it scores 0. If it does match, the score is its weight value.
The Response system checks each rule against the set, give it a numeric score based on the rule's set of criteria. Then the system picks one rule with the highest score, dispatch a response that the rule points.
criterion <criterionname> <matchkey> <matchvalue> weight nnn required
matchkey
Many keyvalue pairs are updated in ModifyOrAppendCriteria( AI_CriteriaSet& set )
& CAI_ExpresserHost_DoModifyOrAppendCriteria( CAI_BaseNPC *pSpeaker, AI_CriteriaSet& set )
and player and NPC codes.
Also mappers can set keyvalue pairs via the Context system.
- concept
- map
- classname
- name
- health
- healthFrac
- playerHealth
- player
- playerWeapon
- playerActivity
- playerSpeed
- npcstate
- distancetoplayer
- seeplayer
- seenbyplayer
- timesincecombat
- shotloc
- enemy
- gordon_precriminal
- attacking_with_weapon
- hurt_by_fire
- numselected
- useradio
- commandpoint_dist_to_npc
- commandpoint_dist_to_player
- numjoining
- reinforcement
matchvalue
- "0"; numeric match to value 0
- "1"; numeric match to value 1
- "weapon_smg1"; string match to weapon_smg1 string
- "[npcstate::idle]"; match enumeration by looking up numeric value
- ">0"; match if greater than zero
- ">10,<=50"; match if greater than ten and less than or equal to 50
- ">0,<[npcstate::alert]"; match if greater than zer and les then value of enumeration for alert
- "!=0"; match if not equal to zero
other options
- weight nnn: floating point weighting for score assuming criteria match (default value 1.0)
- required: if a rule has one or more criteria with the required flag set, then if any such criteria fail, the entire rule receives a score of zero