source: AE/packages/patches/common/level0_Final/knockdowns/TRAM-blownup-.oni-patch@ 949

Last change on this file since 949 was 949, checked in by s10k, 11 years ago

Package to Iritscen

File size: 1.4 KB
RevLine 
[949]1@XML_TOOLS Version "2.0"
2
3@CUSTOM_CODE
4<code>
5 function contains(fullStringOrArray, subString){
6 return fullStringOrArray.indexOf(subString)!=-1;
7 }
8
9 function removeFromArray(_array, _value){
10 _array.splice(_array.indexOf(_value), 1);
11 }
12
13 var myBuilder = new JSXMLBuilder();
14 myBuilder.load($xmlData);
15
16 var elements = myBuilder.elements[0];
17
18 var particles = elements.childElement("Animation").childElement("Particles");
19
20 // Check if any of the existing particles contains a head bone
21 for (var i=0; (particles.childElement(i)); i++){ // the condition is to check if the child element exists (!= undefined)
22 var currElement=particles.childElement(i);
23
24 if(currElement.childElement("Bone").text=="Head"){
25 if(currElement.childElement("Name").text=="glass_break"){
26 return; // not necessary to add
27 }
28 else{
29 // gather all the necessary info
30 var int_start=currElement.childElement("Start").text;
31 var int_end=currElement.childElement("End").text;
32
33 // Insert the new glass particle (for when he touches glass with head
34 myBuilder.addElementAt("Particle","",
35 "<Start>"+int_start+"</Start>\
36 <End>"+int_end+"</End>\
37 <Bone>Head</Bone>\
38 <Name>glass_break</Name>",particles.index+1,particles.level+1);
39 break;
40 }
41 }
42 }
43
44 $xmlData=myBuilder.generateXML(); // update the global variable with the new XML
45</code>
Note: See TracBrowser for help on using the repository browser.