Dynamic interactions: Difference between revisions
|  (fixed some formatting + corrected/added information) |  (Added debug command and picture) | ||
| Line 1: | Line 1: | ||
| [[Image:Dynamic_interaction_modded_citizen_v_zombie0.jpg|thumb|512|Example of an dynamic interaction. This one is copied from Alyx and allows citizens to kick zombies.]] | |||
| The '''dynamic_interactions''' [[KeyValues]] block defines when and how to perform a dynamic interaction. For example; when [[Alyx]] kicks a zombie. It is embedded in a model with the [[$keyvalues]] QC command.   | The '''dynamic_interactions''' [[KeyValues]] block defines when and how to perform a dynamic interaction. For example; when [[Alyx]] kicks a zombie. It is embedded in a model with the [[$keyvalues]] QC command.   | ||
| Line 110: | Line 109: | ||
| : ''Classname of the weapon my interaction partner is holding, if any'' | : ''Classname of the weapon my interaction partner is holding, if any'' | ||
| == Related or Useful Animation Events == | == Related or Useful Stuff == | ||
| === Animation Events === | |||
| These are useful animation events for those wanted to create an activity for a dynamic interaction. | These are useful animation events for those wanted to create an activity for a dynamic interaction. | ||
| READ: [[Animation_Events]] | READ: [[Animation_Events]] | ||
| Line 116: | Line 117: | ||
| Example: | |||
|   { event AE_NPC_HURT_INTERACTION_PARTNER 28 "THEM 100" } |   { event AE_NPC_HURT_INTERACTION_PARTNER 28 "THEM 100" } | ||
| ;<code>AE_NPC_HURT_INTERACTION_PARTNER "<choices> <[[int]]>" </code> | ;<code>AE_NPC_HURT_INTERACTION_PARTNER "<choices> <[[int]]>" </code> | ||
| : ''Hurt either this character or his partner... and how much(the int).'' | : ''Hurt either this character or his partner... and how much(the int).'' | ||
| Line 134: | Line 134: | ||
| : ''Fire this character's weapon. The bool is whether or not you want him to use the weapon's secondary fire.'' | : ''Fire this character's weapon. The bool is whether or not you want him to use the weapon's secondary fire.'' | ||
| === Console Variable === | |||
| [[Image:Ai_debug_dyninteractions.jpg|thumb|128|Example of <code>ai_debug_dyninteractions</code> debugging information during a dynamic interaction.]] | |||
| [[Image:Ai_debug_dyninteractions2.jpg|thumb|128|Example of <code>ai_debug_dyninteractions</code> debugging information when a NPC is checking for the proper conditions to perform a dynamic interaction]] | |||
| ;<code>ai_debug_dyninteractions "<[[bool]]>" </code> | |||
| : ''Debug the NPC dynamic interaction system.'' | |||
| Example(information printed in the console when looking): | |||
| <pre> | |||
| DYNINT: (al) testing interaction "alyx_v_zombie_180deg_64" | |||
|    al is at: 404.55 -67.75 -115.91 | |||
|    al distsqr: 0.37 (468.17 -60.77 -115.91), desired: (468.24 -61.37 -115.91) | |||
|    Idle_Relaxed_Shotgun_2 Speed: 0.00 | |||
|    al angle matched: (0.00 186.25 0.00), desired (0.00, 185.72, 0.00) | |||
| </pre> | |||
| Example(information printed in the console when starting an interaction): | |||
| <pre> | |||
| npc_alyx(al) starting dynamic interaction "alyx_v_zombie_180deg_64" with npc_citizen(dude2). | |||
|  - Core sequence: alyx_zombie_fight2 | |||
| </pre> | |||
| == See Also == | == See Also == | ||
Revision as of 18:23, 26 February 2012
The dynamic_interactions KeyValues block defines when and how to perform a dynamic interaction. For example; when Alyx kicks a zombie. It is embedded in a model with the $keyvalues QC command.
Once a dynamic interaction is defined in a model, the character(s) with this model can have the interaction with any other character that has the same sequence names or activity names. This only has to be defined in one of the two characters(NPCs)'s model participating in the interaction. For example; Alyx has the dynamic interactions defined in her model using this keyvalue, but the zombie model just has matching activity names.
 Warning: Most of the "confirms" are there because I just assumed a lot of those descriptions. My assumptions were based on the names, Valve use in models, and the code that they use.
Warning: Most of the "confirms" are there because I just assumed a lot of those descriptions. My assumptions were based on the names, Valve use in models, and the code that they use.
Example
Found in models/Alyx_animations.mdl
 Note: This is only one of the interactions and it has been restructured for easier reading!
Note: This is only one of the interactions and it has been restructured for easier reading!  $keyvalues 
 { 
 
	dynamic_interactions 
	{
		"alyx_v_zombie_180deg_64" 
		{ 
		"trigger" "auto_in_combat" 
		"origin_relative" "64 0 0" 
		"angles_relative" "0 180 0" 
		"activity" "ACT_DI_ALYX_ZOMBIE_MELEE"
		"delay" "10.0" 
		"needs_weapon" "ME" 
		"weapon_mine" "weapon_alyxgun" 
		}   
 
	}
 }
Options
 Note: The "partner" is the character that this character is interacting with.
Note: The "partner" is the character that this character is interacting with.- trigger <choices>
- What triggers this interaction... If this isn't defined, the interaction can be trigged via input forceinteractionwithnpc "<targetname> <interaction name>"- auto_in_combat
- Automatically in combat.
 
- loop_break_trigger <choices>
- Stop looping the action animation if loop_in_actionwas set. [confirm]- on_damage
- Break loop on damage.
- on_flashlight_illum
- Break loop once illuminated by player's flashlight. [confirm]
 
- origin_relative <vector>
- Desired relative origin of the other NPC
- angles_relative <angles>
- Desired relative angles of the other NPC
- velocity_relative <vector>
- Desired relative velocity of the other NPC
- entry_sequence <sequence>
- What sequence to play for this interaction before the main sequence/activity. [confirm]
- entry_activity <activity>
- What activity to play for this interaction before the main sequence/activity. [confirm]
- sequence <sequence>
- What sequence to play for this interaction.(The "action")
- activity <activity>
- What activity to play for this interaction.(The "action")
- exit_sequence <sequence>
- What sequence to play for this interaction after the main sequence/activity. [confirm]
- exit_activity <activity>
- What activity to play for this interaction after the main sequence/activity. [confirm]
- delay <float>
- Delay before interaction can be used again
- origin_max_delta <float>
- Max distance sqr from the relative origin the NPC is allowed to be to trigger
- loop_in_action <float> Note: While the value is a float, it's used as a bool in code. Note: While the value is a float, it's used as a bool in code.
- Loop in the "action" animation(the "activity" or "sequence" options.). [confirm]
- dont_teleport_at_end <choices>
- Don't teleport/fix up positions at the end 
- me
- Don't teleport/fix up this character's position
- them
- Don't teleport/fix up this character's partner's position
- both
- Don't teleport/fix up this character's or his partner's position
 
- needs_weapon <choices>
- Needs a weapon to perform this interaction?
- ME
- Does this character need a weapon?
- THEM
- Does this character's partner need a weapon?
- BOTH
- Does both this character and his partner need a weapon?
 
- weapon_mine <classname>
- Classname of the weapon I'm holding, if any
- weapon_theirs <classname>
- Classname of the weapon my interaction partner is holding, if any
Related or Useful Stuff
Animation Events
These are useful animation events for those wanted to create an activity for a dynamic interaction. READ: Animation_Events
Example:
{ event AE_NPC_HURT_INTERACTION_PARTNER 28 "THEM 100" }
- AE_NPC_HURT_INTERACTION_PARTNER "<choices> <int>"
- Hurt either this character or his partner... and how much(the int).
- ME
- Hurt this character
- THEM
- Hurt the partner
 
- AE_NPC_SET_INTERACTION_CANTDIE "<bool>"
- Set those participating in the interaction to become invincible Todo: Which NPC? The partner or this character
- AE_NPC_WEAPON_FIRE "<bool>"
- Fire this character's weapon. The bool is whether or not you want him to use the weapon's secondary fire.
Console Variable
- ai_debug_dyninteractions "<bool>"
- Debug the NPC dynamic interaction system.
Example(information printed in the console when looking):
DYNINT: (al) testing interaction "alyx_v_zombie_180deg_64" al is at: 404.55 -67.75 -115.91 al distsqr: 0.37 (468.17 -60.77 -115.91), desired: (468.24 -61.37 -115.91) Idle_Relaxed_Shotgun_2 Speed: 0.00 al angle matched: (0.00 186.25 0.00), desired (0.00, 185.72, 0.00)
Example(information printed in the console when starting an interaction):
npc_alyx(al) starting dynamic interaction "alyx_v_zombie_180deg_64" with npc_citizen(dude2). - Core sequence: alyx_zombie_fight2


