@XML_TOOLS Version "2.0" @CUSTOM_CODE var myBuilder = new JSXMLBuilder(); myBuilder.load($xmlData); var elements = myBuilder.elements[0]; // If ONCP doesn't exist, ignore it if (!elements.childElement("ONCP")) return; // If there are no attacks in this TRAM, ignore it if (!elements.childElement("ONCP").childElement("Particles")) return; // Check if glass_break is already registered for the character var particles = elements.childElement("ONCP").childElement("Particles"); for (var i = 0; (particles.childElement(i)); i++) { var particle = particles.childElement(i); if (particle.childElement("Name").text == "glass_break") return; } // If we're still here, register glass_break myBuilder.addElementAt("ONCPParticle", "", "glass_break\ glass_break\ None", particles.index + 1, particles.level + 1); // Update the global variable with the new XML $xmlData = myBuilder.generateXML();