openclonk/docs/sdk/script/fn/CreateParticleAtBone.xml

82 lines
3.5 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>CreateParticleAtBone</title>
<category>Particle</category>
<version>5.4 OC</version>
<syntax>
<rtype>bool</rtype>
<params>
<param>
<type>string</type>
<name>szName</name>
<desc>Name of the particle</desc>
</param>
<param>
<type>string</type>
<name>szBoneName</name>
<desc>Name of the bone at which to create the particle</desc>
</param>
<param>
<type>array</type>
<name>pos</name>
<desc>Vector of three elements with the X,Y and Z coordinates of the particle relative to the bone position and orientation.</desc>
</param>
<param>
<type>array</type>
<name>dir</name>
<desc>Vector of three elements with the X,Y and Z components of the velocity of theparticle relative to the bone orientation.</desc>
</param>
<param>
<type>int</type>
<name>a</name>
<desc>Extra parameter. This is usually the size of the particle in 1/5 pixels.</desc>
</param>
<param>
<type>int</type>
<name>b</name>
<desc>Extra parameter. This is usually the color modulation of the particle.</desc>
</param>
<param>
<type>object</type>
<name>target</name>
<desc>Target object for object local particles. Object local particles are drawn directly on top of the object and are removed when the object is deleted.</desc>
<optional />
</param>
<param>
<type>bool</type>
<name>behind_target</name>
<desc>If specified and not <code>false</code>, the particle is drawn directly behind the target object.</desc>
<optional />
</param>
</params>
</syntax>
<desc>Creates a particle relative to a bone of the calling object's skeleton. The named particle definition must be loaded. For more information see the particle documentation.</desc>
<remark>This function returns <code>false</code> if the particle definition was not found, or the function is called for an object which does not have a mesh graphics, or the skeleton of the mesh does not have a bone called <code>szBoneName</code>. Otherwise, <code>true</code> is returned. There is no return value indicating whether the particle has actually been created. This must be so to prevent synchronization problems in network games, as particles may be handled differently on each computer in the network.</remark>
<examples>
<example>
<code>func InitializePlayer(int plr)
{
AddEffect("IntColorize", 0, 1, 1);
}
global func FxIntColorizeTimer()
{
FindObject(Find_ID(Clonk))->CreateParticleAtBone("PSpark", "skeleton_body", [0, 0, 0], [0, 0, 0], 8, RGB(255,0,0));
FindObject(Find_ID(Clonk))->CreateParticleAtBone("PSpark", "pos_hand1", [0, 0, 0], [0, 0, 0], 8, RGB(0,255,0));
FindObject(Find_ID(Clonk))->CreateParticleAtBone("PSpark", "pos_hand2", [0, 0, 0], [0, 0, 0], 8, RGB(0,0,255));
return(0);
}</code>
<text>Scenario script. Creates an effect which traces a Clonk's body, left hand and right hand with differently colored sparks.</text>
</example>
</examples>
<related>
<funclink>CreateParticle</funclink>
</related>
</func>
<author>Clonk-Karl</author><date>2012-12</date>
</funcs>