ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/ONCC-.oni-patch
Revision: 966
Committed: Sun Mar 2 15:35:02 2014 UTC (11 years, 9 months ago) by s10k
File size: 1079 byte(s)
Log Message:
fixed ONCC particle adding

File Contents

# Content
1 @XML_TOOLS Version "2.0"
2
3 @CUSTOM_CODE
4 <code>
5 var myBuilder = new JSXMLBuilder();
6 myBuilder.load($xmlData);
7 var elements = myBuilder.elements[0];
8
9 // If ONCP doesn't exist, ignore it
10 if (!elements.childElement("ONCP"))
11 return;
12
13 // If there are no attacks in this TRAM, ignore it
14 if (!elements.childElement("ONCP").childElement("Particles"))
15 return;
16
17 // Check if glass_break is already registered for the character
18 var particles = elements.childElement("ONCP").childElement("Particles");
19 for (var i = 0; (particles.childElement(i)); i++)
20 {
21 var particle = particles.childElement(i);
22 if (particle.childElement("Name").text == "glass_break")
23 return;
24 }
25
26 // If we're still here, register glass_break
27 myBuilder.addElementAt("ONCPParticle",
28 "",
29 "<Name>glass_break</Name>\
30 <Type>glass_break</Type>\
31 <BodyPart>None</BodyPart>",
32 particles.index + 1,
33 particles.level + 1);
34
35 // Update the global variable with the new XML
36 $xmlData = myBuilder.generateXML();
37 </code>