Def attach: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
m (add link)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''def_attach''' is used to attach an entity to another entity at spawning the first entity. This technique is for instance by the [[combined light entities]].
'''def_attach''' is used to attach an entity to another entity at spawning the first entity. This technique is for instance by the [[combined light entities]].
See [[Attaching Props to AI]] for using def_attach on characters.


== Example ==
== Example ==
"def_attach"                    "light_candleflame"    // The entity class we want to spawn and attach
"pos_attach"                    "flame"                // At the attach point called "flame"...
"attach_pos_name_1"            "flame"                // ... which is defined here.
"attach_pos_origin_1"          "0 0 15"                // Offset the flame X units in the Z direction


        "def_attach"                    "light_candleflame"    // The entity class we want to spawn and attach
Optionally, you can set the rotation of the attached entity with:
        "pos_attach"                    "flame"                // At the attach point called "flame"...
        "attach_pos_1_name"            "flame"                // ... which is defined here.
        "attach_pos_1_origin"          "0 0 15"                // Offset the flame X units in the Z direction


Optionally, you can set the rotation of the attached entity with:
"attach_pos_angles_1"          "0 0 90"                // rotated 90° around the z-axis
 
You can have multiple def_attach items on an entity, just add a number suffix to the spawnargs like this:
 
"def_attach1"      "light_candleflame"
"pos_attach1"      "flame"
"def_attach2"      "candleflame_particle"
"pos_attach2"      "flame"


        "attach_pos_1_angles"           "0 0 90"               // rotated 90° around the z-axis
Some entities come with items already being <tt>def_attach</tt>ed. To "disable" an attachment, just enter a dash "-" character as spawnarg value, like this:
"def_attach1" "-"
The code will then ignore the def_attach item 1.


{{spawnargs}}
{{spawnargs}}

Latest revision as of 21:04, 26 January 2017

def_attach is used to attach an entity to another entity at spawning the first entity. This technique is for instance by the combined light entities.

See Attaching Props to AI for using def_attach on characters.

Example

"def_attach"                    "light_candleflame"     // The entity class we want to spawn and attach
"pos_attach"                    "flame"                 // At the attach point called "flame"...
"attach_pos_name_1"             "flame"                 // ... which is defined here.
"attach_pos_origin_1"           "0 0 15"                // Offset the flame X units in the Z direction

Optionally, you can set the rotation of the attached entity with:

"attach_pos_angles_1"           "0 0 90"                // rotated 90° around the z-axis

You can have multiple def_attach items on an entity, just add a number suffix to the spawnargs like this:

"def_attach1"       "light_candleflame"
"pos_attach1"       "flame"
"def_attach2"       "candleflame_particle"
"pos_attach2"       "flame"

Some entities come with items already being def_attached. To "disable" an attachment, just enter a dash "-" character as spawnarg value, like this:

"def_attach1" "-"

The code will then ignore the def_attach item 1.