@XML_TOOLS Version "2.0" @CUSTOM_CODE var myBuilder = new JSXMLBuilder(); myBuilder.load($xmlData); var elements = myBuilder.elements[0]; var particles = elements.childElement("Animation").childElement("Particles"); // Check to see if glass_break is already added to Head for (var i = 0; (particles.childElement(i)); i++) { var particle = particles.childElement(i); if (particle.childElement("Bone").text == "Head" && particle.childElement("Name").text == "glass_break") return; } // Exit if we are past Oni's limit on TRAM particles if (particles.length >= 16) return; // Add the glass_break particle to Head for duration of animation var heights = elements.childElement("Animation").childElement("Heights"); var anim_length; for (anim_length = 0; (heights.childElement(anim_length)); anim_length++) {;} myBuilder.addElementAt("Particle", "", "0\ " + (anim_length-1) + "\ Head\ glass_break", particles.index + 1, particles.level + 1); // Update the global variable with the new XML $xmlData = myBuilder.generateXML();