Criterion

From Valve Developer Community
(Redirected from Criteria)
Jump to: navigation, search

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

See Also