Jump to content

NPC Portrait Animation XMLs


Thunderbro
 Share

Recommended Posts

In this post we will learn all the different parts of how an NPC's XML file is constructed in order to help create custom XMLs for NPCs.

<portraitAnimation image="NPCportrait_Makenna.dds">

This line is the most obvious, it needs to match the file name. On that same note because of how these files are loaded, it is based on the filename. For the custom Makenna NPC portrait to appear in game, you'll need to name the file NPCportrait_Makenna.dds. This name will be dependent on the NPC's name. For example, internally Nora is _nora, this is set in NPCInfo.XML, without the underscore in the name, that file is fairly self-explanatory. For this example, the NPC's name in that file is _makenna.

<clipInformations number='15'>
    <clipInformation x1="  0" y1="  0" x2=" 384" y2=" 512" originX="   0" originY="  0" />
    <clipInformation x1=" 134" y1=" 123" x2=" 123" y2=" 260" originX="  134" originY=" 123" />
    <clipInformation x1=" 386" y1="   0" x2=" 511" y2="  62" originX="  134" originY=" 123" />
    <clipInformation x1=" 386" y1="  64" x2=" 511" y2=" 126" originX="  134" originY=" 123" />
    <clipInformation x1=" 386" y1=" 255" x2=" 511" y2=" 318" originX="  134" originY=" 123" />
    <clipInformation x1=" 386" y1=" 128" x2=" 511" y2=" 189" originX="  134" originY=" 123" />
    <clipInformation x1=" 386" y1=" 191" x2=" 511" y2=" 253" originX="  134" originY=" 123" />
    <clipInformation x1=" 185" y1=" 210" x2=" 225" y2=" 227" originX="  185" originY=" 210" />
    <clipInformation x1=" 407" y1=" 448" x2=" 447" y2=" 465" originX="  185" originY=" 210" />
    <clipInformation x1=" 407" y1=" 469" x2=" 447" y2=" 486" originX="  185" originY=" 210" />
    <clipInformation x1=" 407" y1=" 491" x2=" 447" y2=" 508" originX="  185" originY=" 210" />
    <clipInformation x1=" 464" y1=" 425" x2=" 504" y2=" 442" originX="  185" originY=" 210" />
    <clipInformation x1=" 464" y1=" 450" x2=" 504" y2=" 467" originX="  185" originY=" 210" />
    <clipInformation x1=" 464" y1=" 471" x2=" 504" y2=" 488" originX="  185" originY=" 210" />
    <clipInformation x1=" 464" y1=" 493" x2=" 504" y2=" 510" originX="  185" originY=" 210" />
</clipInformations>

This represents the different animation frames, the very first one should be for the main body itself.

<clipInformations number='15'>

This value should equal the number of entries below.

x1 is left most X coordinate of the chunk
y1 is the top Y coordinate of the chunk
x2 is the right most X coordinate of the chunk
y2 is the bottom Y coordinate of the chunk
originX is where on the initial left-most X coordinate of the frame the part should be layered on top of. This will be 0 for the main body.
originY is where on the initial top Y coordinate of the frame the part should be layered on top of. This will be 0 for the main body.

the values range from 0 to 511 (512 pixels in each direction in total). the 0 coordinates start from the top left corner of the image.

<animations number='21'>
    <animation index='0' name='base'>
        <background>
            <clips number='1'>
                <clip value=" 0 " />
            </clips>
        </background>
    </animation>
    <animation index='1' name='normal'>
        <background>
            <clips number='2'>
                <clip value=" 7 " />
                <clip value=" 1 " />
            </clips>
        </background>
        <frame index='0' duration='0.06'>
            <clips number='1'>
                <clip value=" 2 " />
            </clips>
        </frame>
        <frame index='1' duration='0.15'>
            <clips number='1'>
                <clip value=" 3 " />
            </clips>
        </frame>
        <frame index='2' duration='0.06'>
            <clips number='1'>
                <clip value=" 2 " />
            </clips>
        </frame>
    </animation>

This portion defines the chunks used for each emotion.
 

<animations number='21'>

This indicates the number of different emotions or animation values there are.
 

<animation index='0' name='base'>

This indicates the index of the animation, you will increment this by 1 for each animation you add, and this will always start from an index of 0. The name indicates the name that the client calls in scripts for the animation.

The first index should always be named base, this is used for the base portrait.
normal indicates the neutral expression that all NPCs have
good, love, bad, and hate indicate the favor based expressions that NPCs can use automatically based on favor level. If an NPC doesn't have these, it will default to normal.

Any other emotions added can have any name but the NPC script's dialogue must call it manually.
 

<clips number='2'>

This indicates the number of chunks to use for this animation (usually eyes and mouth).

<clip value=" 7 " />

This indicates which clip to use from above, it starts from an index of 0, so setting this to 0 would be the main body typically.

<frame index='0' duration='0.06'>
    <clips number='1'>
        <clip value=" 2 " />
    </clips>
</frame>
<frame index='1' duration='0.15'>
    <clips number='1'>
        <clip value=" 3 " />
    </clips>
</frame>
<frame index='2' duration='0.06'>
    <clips number='1'>
        <clip value=" 2 " />
    </clips>
</frame>

This is used for animating chunks, usually the eyes.

<frame index='0' duration='0.06'>

index selects which part should be animated from the above list of indexes in `clip`. 
duration is how long this specific frame of animation plays

You will iterate index by 1 for each additional frame of animation you use. I recommend keeping the duration and number of frames the same for animating eyes since this is how official NPCs are animated and will give the desired blink effect.
 

<clips number='1'>

the number of clips to use for the frame. I've never seen this set to more than 1, but technically you should be able to animate multiple parts at once.

 

 <clip value=" 2 " />

Indicates the chunk used for this frame of animation, 2 should be her eyes half closed chunk and 3 should be fully closed. 1 would also be her normal eyes fully opened, which we set above, when it isn't animating, it will use that chunk instead.


And that's about all there is to this file, aside from the usual XML syntax. If there are any further questions about how these files work, please feel free to ask questions here.

Edited by Thunderbro
  • Like 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...