AI Attachment Ingame Editing: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
originally written by Ishtvan (original Forum Post: http://modetwo.net/darkmod/index.php?showtopic=4374)
{{Original_Reference|Ishtvan|4374}}
 
'''This page needs updating as we are using a slightly different attachment system now. See [[Attachment Positions]]'''


= New Attachment-Related Console Commands =
= New Attachment-Related Console Commands =
Line 9: Line 11:
NOTE: In all of these cases, <attachment index> is an integer number. It is the order of the attachment in the AI's def file (or the order it was added in if it was somehow added ingame). For example, if it's the first def_attach in teh def, the index would be 1. If it's the second (def_attach_2 or something), it would be 2, etc.
NOTE: In all of these cases, <attachment index> is an integer number. It is the order of the attachment in the AI's def file (or the order it was added in if it was somehow added ingame). For example, if it's the first def_attach in teh def, the index would be 1. If it's the second (def_attach_2 or something), it would be 2, etc.


=== tdm_attach_print ===
Print the attachment info for the given attachment on the AI you are looking at.
Usage: '''tdm_attach_print ''<attachment index>''
'''
=== tdm_attach_offset ===
=== tdm_attach_offset ===
Set the vector offset (x y z) for an attachment on an AI you are looking at.
Set the vector offset (x y z) for an attachment on an AI you are looking at.


Usage: '''tdm_attach_offset ''<attachment index> <x> <y> <z>'''''
Usage: '''tdm_attach_offset ''<attachment name> <attachment position> <x> <y> <z>'''''


=== tdm_attach_rot ===
=== tdm_attach_rot ===
Set the rotation (pitch yaw roll) for an attachment on an AI you are looking at.
Set the rotation (pitch yaw roll) for an attachment on an AI you are looking at.


Usage: '''tdm_attach_rot ''<attachment index> <pitch> <yaw> <roll>'''''  
Usage: '''tdm_attach_rot ''<attachment name> <attachment position> <pitch> <yaw> <roll>'''''  


(NOTE: Rotation is applied before translation, angles are relative to the joint orientation)
(NOTE: Rotation is applied before translation, angles are relative to the joint orientation)
=== tdm_attach_joint ===
Set the attachment joint name for an attachment on an AI you are looking at.
Usage: '''tdm_attach_joint ''<attachment index> <string name of joint>'''''


= List of new attachment-related script functions =
= List of new attachment-related script functions =
Line 38: Line 31:
  **/
  **/
  scriptEvent void attach( entity ent);
  scriptEvent void attach( entity ent);
 
  /**
  /**
  * Reattach an existing attachment
  * Reattach an existing attachment
Line 49: Line 42:
  **/
  **/
  scriptEvent void reAttach( float ind, string joint, vector offset, vector angles );
  scriptEvent void reAttach( float ind, string joint, vector offset, vector angles );
 
  /**
  /**
  * Show or hide an attachment. Index works the same as in ReAttach described above.
  * Show or hide an attachment. Index works the same as in ReAttach described above.
Line 55: Line 48:
  **/
  **/
  scriptEvent void showAttachment( float ind, float bShow );   
  scriptEvent void showAttachment( float ind, float bShow );   
 
  /**
  /**
  * Drop the attachment for the given index
  * Drop the attachment for the given index
  **/
  **/
  scriptEvent void dropAttachment( float ind );  
  scriptEvent void dropAttachment( float ind );  
 
  /**
  /**
  * Get the attached entity at the given index
  * Get the attached entity at the given index
Line 66: Line 59:
  **/
  **/
  scriptEvent entity getAttachment( float ind );
  scriptEvent entity getAttachment( float ind );
/**
* Return the number of attachments on an AI.
* Used to iterate through the attachments if desired.
**/
scriptEvent float getNumAttachments( );


[[Category:Scripting]]
[[Category:Scripting]]
[[Category:AI]]

Latest revision as of 10:49, 13 August 2009

Originally written by Ishtvan on http://forums.thedarkmod.com/topic/4374

This page needs updating as we are using a slightly different attachment system now. See Attachment Positions

New Attachment-Related Console Commands

This pertains to attaching any entity to an AI. This may be done to facilitate pickpocketing items off of AI, or simply attaching the AI's weapon to their hand or frog sheath. The only attachment this does not apply to is attaching the head of the AI, which is handled differently by D3.

The following attachment commands must be run while looking at the AI you want to modify, with nothing obstructing your view. I could have made people type in the full name of the AI, but I'd figure we'd see how it works when looking at them. Also, these are meant to be run after you have initially placed the attachments in the def file / spawnArgs of the AI. This step is still done the same as before.

NOTE: In all of these cases, <attachment index> is an integer number. It is the order of the attachment in the AI's def file (or the order it was added in if it was somehow added ingame). For example, if it's the first def_attach in teh def, the index would be 1. If it's the second (def_attach_2 or something), it would be 2, etc.

tdm_attach_offset

Set the vector offset (x y z) for an attachment on an AI you are looking at.

Usage: tdm_attach_offset <attachment name> <attachment position> <x> <y> <z>

tdm_attach_rot

Set the rotation (pitch yaw roll) for an attachment on an AI you are looking at.

Usage: tdm_attach_rot <attachment name> <attachment position> <pitch> <yaw> <roll>

(NOTE: Rotation is applied before translation, angles are relative to the joint orientation)

List of new attachment-related script functions

/**
* Attach an entity to the AI.
* Entity spawnArgs checked for attachments are:
* "origin", "angles", and "joint".
* These must be set prior to calling attach.
**/
scriptEvent void attach( entity ent);
/**
* Reattach an existing attachment
* Effects the attachment at index ind (where the first attachment starts at 1)
* For example to effect the first item that was attached, ind should be = 1
*
* The next arguments are the name of the joint to attach to, the translation
* offset from that joint, and a (pitch, yaw, roll) angle vector that defines the
* rotation of the attachment relative to the joint's orientation.
**/
scriptEvent void reAttach( float ind, string joint, vector offset, vector angles );
/**
* Show or hide an attachment. Index works the same as in ReAttach described above.
* Second argument set to true shows attachment, false hides it.
**/
scriptEvent void showAttachment( float ind, float bShow );  
/**
* Drop the attachment for the given index
**/
scriptEvent void dropAttachment( float ind ); 
/**
* Get the attached entity at the given index
* Will be NULL if the index is invalid or the entity no longer exists
**/
scriptEvent entity getAttachment( float ind );
/**
* Return the number of attachments on an AI.
* Used to iterate through the attachments if desired.
**/
scriptEvent float getNumAttachments( );