- Timestamp:
- Mar 2, 2014, 2:50:25 AM (11 years ago)
- Location:
- AE/packages
- Files:
-
- 3 added
- 2 deleted
- 9 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
AE/packages/31000GlassBreakingMoves/Mod_Info.cfg
r959 r965 3 3 ModVersion -> 1.1 4 4 Creator -> Gumby/geyser/s10k/Iritscen 5 Readme -> Makes a ll attacks break glass.5 Readme -> Makes attacks and other colliding animations break glass. Total files patched: 711 (plus any new animations in active mods which conform to the same naming patterns as the vanilla animations). See included file "About this patch" for detailed documentation. -
AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/ONCC-.oni-patch
r950 r965 1 1 @XML_TOOLS Version "2.0" 2 2 3 @ADD_INSIDE_NODES ElementName "Particles" ParentElementName "ONCP" 4 <xml> 5 <ONCPParticle> 6 <Name>glass_break</Name> 7 <Type>glass_break</Type> 8 <BodyPart>None</BodyPart> 9 </ONCPParticle> 10 </xml> 3 @CUSTOM_CODE 4 <code> 5 var myBuilder = new JSXMLBuilder(); 6 myBuilder.load($xmlData); 7 var elements = myBuilder.elements[0]; 8 9 // If there are no attacks in this TRAM, ignore it 10 if (!elements.childElement("ONCP").childElement("Particles")) 11 return; 12 13 // Check if glass_break is already registered for the character 14 var particles = elements.childElement("ONCP").childElement("Particles"); 15 for (var i = 0; (particles.childElement(i)); i++) 16 { 17 var particle = particles.childElement(i); 18 if (particle.childElement("Name").text == "glass_break") 19 return; 20 } 21 22 // If we're still here, register glass_break 23 myBuilder.addElementAt("ONCPParticle", 24 "", 25 "<Name>glass_break</Name>\ 26 <Type>glass_break</Type>\ 27 <BodyPart>None</BodyPart>", 28 particles.index + 1, 29 particles.level + 1); 30 </code> -
AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAM-blownup-.oni-patch
r959 r965 3 3 @CUSTOM_CODE 4 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 5 var myBuilder = new JSXMLBuilder(); 14 6 myBuilder.load($xmlData); 15 7 16 8 var elements = myBuilder.elements[0]; 9 var particles = elements.childElement("Animation").childElement("Particles"); 10 var added_to_head = false, added_to_feet = false; 17 11 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 } 12 // Check if glass_break is assigned to Head and one of the feet; 13 // remove it from any other bones if present 14 for (var i = 0; (particles.childElement(i)); i++) 15 { 16 var particle = particles.childElement(i); 17 var bone = particle.childElement("Bone").text; 18 var name = particle.childElement("Name").text; 19 if (name == "glass_break") 20 { 21 if (bone == "Head") 22 added_to_head = true; 23 else if (bone == "RightFoot") 24 added_to_feet = true; 25 else 26 myBuilder.removeElement(particle.index); 41 27 } 42 28 } 29 30 // Exit if we are past Oni's limit on TRAM particles 31 if (particles.length >= 16) 32 return; 33 34 // Add the glass_break particle to the desired bones if it's not there already 35 var heights = elements.childElement("Animation").childElement("Heights"); 36 var anim_length; 37 for (anim_length = 0; (heights.childElement(anim_length)); anim_length++) {;} 38 if (!added_to_head) 39 myBuilder.addElementAt("Particle", 40 "", 41 "<Start>0</Start>\ 42 <End>" + (anim_length-1) + "</End>\ 43 <Bone>Head</Bone>\ 44 <Name>glass_break</Name>", 45 particles.index + 1, 46 particles.level + 1); 47 48 // Exit if we are past Oni's limit on TRAM particles 49 if (particles.length >= 16) 50 return; 51 52 if (!added_to_feet) 53 myBuilder.addElementAt("Particle", 54 "", 55 "<Start>0</Start>\ 56 <End>" + (anim_length-1) + "</End>\ 57 <Bone>RightFoot</Bone>\ 58 <Name>glass_break</Name>", 59 particles.index + 1, 60 particles.level + 1); 43 61 44 $xmlData=myBuilder.generateXML(); // update the global variable with the new XML 62 // Update the global variable with the new XML 63 $xmlData = myBuilder.generateXML(); 45 64 </code> -
AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAM-comb-.oni-patch
r959 r965 3 3 @CUSTOM_CODE 4 4 <code> 5 function contains(fullStringOrArray, subString){ 6 return fullStringOrArray.indexOf(subString)!=-1; 7 } 5 // |———————————————————————————————————Code best viewed at this width————————————————————————————————————————| 6 7 // Load XML data 8 var myBuilder = new JSXMLBuilder(); 9 myBuilder.load($xmlData); 10 var elements = myBuilder.elements[0]; 8 11 9 function removeFromArray(_array, _value){ 10 _array.splice(_array.indexOf(_value), 1); 12 // If there are no attacks in this TRAM, ignore it 13 if (!elements.childElement("Animation").childElement("Attacks")) 14 return; 15 16 // Gather all the necessary info 17 var particles = elements.childElement("Animation").childElement("Particles"); 18 var attack = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 19 var hit_start = attack.childElement("Start").text; 20 var hit_end = attack.childElement("End").text; 21 var array_bones = attack.childElement("Bones").text.split(" "); 22 23 // Remove glass_break if it is already assigned to any bones, because it's probably not been assigned the 24 // way we want it to be 25 for (var i = 0; (particles.childElement(i)); i++) 26 { 27 var particle = particles.childElement(i); 28 if (particle.childElement("Name").text == "glass_break") 29 myBuilder.removeElement(particle.index); 11 30 } 12 31 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 21 if(!elements.childElement("Animation").childElement("Attacks")){ // if no attacks found ignore file 22 return; 23 } 24 25 var attackElement = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 26 27 var int_start,int_end,array_bones; 28 29 // gather all the necessary info 30 int_start=attackElement.childElement("Start").text; 31 int_end=attackElement.childElement("End").text; 32 array_bones=attackElement.childElement("Bones").text.split(" "); 33 34 // Check if any of the existing particles correspond to the same bone and glass_break 35 for (var i=0; (particles.childElement(i)); i++){ // the condition is to check if the child element exists (!= undefined) 36 var currElement=particles.childElement(i); 37 38 if(contains(array_bones,currElement.childElement("Bone").text) && currElement.childElement("Name").text=="glass_break"){ 39 removeFromArray(array_bones,currElement.childElement("Bone").text); // not necessary to add 32 // Find the outermost bone of each type 33 // The "type" in bone_type[] refers to the extremity of the body to which a bone belongs ("mid" counts as 34 // as an extremity because the head is part of "mid"); this is a "parallel array" with array_bones[] 35 var bone_type = new Array(19); 36 // The "ext" in bone_ext[] refers to the "outermostness" of the bone, that is, how far out on the extremity 37 // this bone is; this is a parallel array with array_bones[] 38 var bone_ext = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 39 // The extremity_ arrays are parallel arrays which store the highest "outermostness" value found for each 40 // extremity, among all the bones in that extremity that are listed in the attack 41 var extremity_name = ["mid", "left_arm", "right_arm", "left_leg", "right_leg"]; 42 var extremity_max = [0, 0, 0, 0, 0]; 43 for (var i = 0; i < array_bones.length; i++) 44 { 45 var bone = array_bones[i]; 46 if (bone == "Head" || bone == "Neck" || bone == "Chest" || bone == "Mid" || bone == "Pelvis") 47 { 48 bone_type[i] = "mid"; 49 if (bone == "Neck") 50 bone_ext[i] = 1; 51 else if (bone == "Head") 52 bone_ext[i] = 2; 53 // The rest of these bones are extremity '0' 54 } 55 else if (bone == "LeftShoulder" || bone == "LeftArm" || bone == "LeftWrist" || bone == "LeftFist") 56 { 57 bone_type[i] = "left_arm"; 58 if (bone == "LeftShoulder") 59 bone_ext[i] = 1; 60 else if (bone == "LeftArm") 61 bone_ext[i] = 2; 62 else if (bone == "LeftWrist") 63 bone_ext[i] = 3; 64 else if (bone == "LeftFist") 65 bone_ext[i] = 4; 66 } 67 else if (bone == "RightShoulder" || bone == "RightArm" || bone == "RightWrist" || bone == "RightFist") 68 { 69 bone_type[i] = "right_arm"; 70 if (bone == "RightShoulder") 71 bone_ext[i] = 1; 72 else if (bone == "RightArm") 73 bone_ext[i] = 2; 74 else if (bone == "RightWrist") 75 bone_ext[i] = 3; 76 else if (bone == "RightFist") 77 bone_ext[i] = 4; 78 } 79 else if (bone == "LeftThigh" || bone == "LeftCalf" || bone == "LeftFoot") 80 { 81 bone_type[i] = "left_leg"; 82 if (bone == "LeftThigh") 83 bone_ext[i] = 1; 84 else if (bone == "LeftCalf") 85 bone_ext[i] = 2; 86 else if (bone == "LeftFoot") 87 bone_ext[i] = 3; 88 } 89 else if (bone == "RightThigh" || bone == "RightCalf" || bone == "RightFoot") 90 { 91 bone_type[i] = "right_leg"; 92 if (bone == "RightThigh") 93 bone_ext[i] = 1; 94 else if (bone == "RightCalf") 95 bone_ext[i] = 2; 96 else if (bone == "RightFoot") 97 bone_ext[i] = 3; 40 98 } 41 99 } 42 43 // Insert the new glass particles 44 for (var i = 0; i < array_bones.length; i++) { 45 if( (contains(array_bones[i],"Foot")) && !contains(array_bones[i],"Calf") && !contains(array_bones[i],"Tight") 46 || (contains(array_bones[i],"Fist")) && !contains(array_bones[i],"Wrist")){ 47 myBuilder.addElementAt("Particle","", 48 "<Start>"+int_start+"</Start>\ 49 <End>"+int_end+"</End>\ 50 <Bone>"+array_bones[i]+"</Bone>\ 51 <Name>glass_break</Name>",particles.index+1,particles.level+1); 100 101 // Find outermost bone for each extremity, among the bones listed in the Attack 102 for (var a = 0; a < array_bones.length; a++) 103 { 104 for (var b = 0; b < extremity_name.length; b++) 105 { 106 if (extremity_name[b] == bone_type[a]) 107 { 108 if (bone_ext[a] > extremity_max[b]) 109 extremity_max[b] = bone_ext[a]; 110 } 52 111 } 53 112 } 113 114 // Add a glass_break particle for every outermost bone in the attack 115 for (var a = 0; a < array_bones.length; a++) 116 { 117 // Move to next bone if this is not the outermost attacking bone on this extremity 118 var add_this_bone = false; 119 for (var b = 0; b < extremity_name.length; b++) 120 { 121 if (bone_type[a] == extremity_name[b]) 122 { 123 if (bone_ext[a] == extremity_max[b]) 124 add_this_bone = true; 125 } 126 } 127 if (!add_this_bone) 128 continue; 129 130 // Exit if we are past Oni's limit on TRAM particles 131 if (particles.length >= 16) 132 { 133 echo("Reached maximum of 16 particles for this TRAM, exiting…"); 134 return; 135 } 136 137 echo("Adding glass_break to " + array_bones[a]); 138 var par_string = "<Start>" + hit_start + "</Start><End>" + hit_end + "</End><Bone>" + array_bones[a] + "</Bone><Name>glass_break</Name>"; 139 140 // Add glass_break to bone for time period that bone has collision status 141 myBuilder.addElementAt("Particle", 142 "", 143 par_string, 144 particles.index + 1, 145 particles.level + 1); 146 } 54 147 55 $xmlData=myBuilder.generateXML(); // update the global variable with the new XML 148 // Update the global variable with the new XML 149 $xmlData = myBuilder.generateXML(); 56 150 </code> -
AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAM-getupfront-.oni-patch
r950 r965 3 3 @CUSTOM_CODE 4 4 <code> 5 function contains(fullStringOrArray, subString){ 6 return fullStringOrArray.indexOf(subString)!=-1; 7 } 5 // |———————————————————————————————————Code best viewed at this width————————————————————————————————————————| 6 7 // Load XML data 8 var myBuilder = new JSXMLBuilder(); 9 myBuilder.load($xmlData); 10 var elements = myBuilder.elements[0]; 8 11 9 function removeFromArray(_array, _value){ 10 _array.splice(_array.indexOf(_value), 1); 12 // If there are no attacks in this TRAM, ignore it 13 if (!elements.childElement("Animation").childElement("Attacks")) 14 return; 15 16 // Gather all the necessary info 17 var particles = elements.childElement("Animation").childElement("Particles"); 18 var attack = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 19 var hit_start = attack.childElement("Start").text; 20 var hit_end = attack.childElement("End").text; 21 var array_bones = attack.childElement("Bones").text.split(" "); 22 23 // Remove glass_break if it is already assigned to any bones, because it's probably not been assigned the 24 // way we want it to be 25 for (var i = 0; (particles.childElement(i)); i++) 26 { 27 var particle = particles.childElement(i); 28 if (particle.childElement("Name").text == "glass_break") 29 myBuilder.removeElement(particle.index); 11 30 } 12 31 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 21 if(!elements.childElement("Animation").childElement("Attacks")){ // if no attacks found ignore file 22 return; 23 } 24 25 var attackElement = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 26 27 var int_start,int_end,array_bones; 28 29 // gather all the necessary info 30 int_start=attackElement.childElement("Start").text; 31 int_end=attackElement.childElement("End").text; 32 array_bones=attackElement.childElement("Bones").text.split(" "); 33 34 // Check if any of the existing particles correspond to the same bone and glass_break 35 for (var i=0; (particles.childElement(i)); i++){ // the condition is to check if the child element exists (!= undefined) 36 var currElement=particles.childElement(i); 37 38 if(contains(array_bones,currElement.childElement("Bone").text) && currElement.childElement("Name").text=="glass_break"){ 39 removeFromArray(array_bones,currElement.childElement("Bone").text); // not necessary to add 32 // Find the outermost bone of each type 33 // The "type" in bone_type[] refers to the extremity of the body to which a bone belongs ("mid" counts as 34 // as an extremity because the head is part of "mid"); this is a "parallel array" with array_bones[] 35 var bone_type = new Array(19); 36 // The "ext" in bone_ext[] refers to the "outermostness" of the bone, that is, how far out on the extremity 37 // this bone is; this is a parallel array with array_bones[] 38 var bone_ext = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 39 // The extremity_ arrays are parallel arrays which store the highest "outermostness" value found for each 40 // extremity, among all the bones in that extremity that are listed in the attack 41 var extremity_name = ["mid", "left_arm", "right_arm", "left_leg", "right_leg"]; 42 var extremity_max = [0, 0, 0, 0, 0]; 43 for (var i = 0; i < array_bones.length; i++) 44 { 45 var bone = array_bones[i]; 46 if (bone == "Head" || bone == "Neck" || bone == "Chest" || bone == "Mid" || bone == "Pelvis") 47 { 48 bone_type[i] = "mid"; 49 if (bone == "Neck") 50 bone_ext[i] = 1; 51 else if (bone == "Head") 52 bone_ext[i] = 2; 53 // The rest of these bones are extremity '0' 54 } 55 else if (bone == "LeftShoulder" || bone == "LeftArm" || bone == "LeftWrist" || bone == "LeftFist") 56 { 57 bone_type[i] = "left_arm"; 58 if (bone == "LeftShoulder") 59 bone_ext[i] = 1; 60 else if (bone == "LeftArm") 61 bone_ext[i] = 2; 62 else if (bone == "LeftWrist") 63 bone_ext[i] = 3; 64 else if (bone == "LeftFist") 65 bone_ext[i] = 4; 66 } 67 else if (bone == "RightShoulder" || bone == "RightArm" || bone == "RightWrist" || bone == "RightFist") 68 { 69 bone_type[i] = "right_arm"; 70 if (bone == "RightShoulder") 71 bone_ext[i] = 1; 72 else if (bone == "RightArm") 73 bone_ext[i] = 2; 74 else if (bone == "RightWrist") 75 bone_ext[i] = 3; 76 else if (bone == "RightFist") 77 bone_ext[i] = 4; 78 } 79 else if (bone == "LeftThigh" || bone == "LeftCalf" || bone == "LeftFoot") 80 { 81 bone_type[i] = "left_leg"; 82 if (bone == "LeftThigh") 83 bone_ext[i] = 1; 84 else if (bone == "LeftCalf") 85 bone_ext[i] = 2; 86 else if (bone == "LeftFoot") 87 bone_ext[i] = 3; 88 } 89 else if (bone == "RightThigh" || bone == "RightCalf" || bone == "RightFoot") 90 { 91 bone_type[i] = "right_leg"; 92 if (bone == "RightThigh") 93 bone_ext[i] = 1; 94 else if (bone == "RightCalf") 95 bone_ext[i] = 2; 96 else if (bone == "RightFoot") 97 bone_ext[i] = 3; 40 98 } 41 99 } 42 43 // Insert the new glass particles 44 for (var i = 0; i < array_bones.length; i++) { 45 if(array_bones[i]=="RightFoot" || array_bones[i]=="LeftFoot" || array_bones[i]=="RightFist" || array_bones[i]=="LeftFist"){ 46 myBuilder.addElementAt("Particle","", 47 "<Start>"+int_start+"</Start>\ 48 <End>"+int_end+"</End>\ 49 <Bone>"+array_bones[i]+"</Bone>\ 50 <Name>glass_break</Name>",particles.index+1,particles.level+1); 100 101 // Find outermost bone for each extremity, among the bones listed in the Attack 102 for (var a = 0; a < array_bones.length; a++) 103 { 104 for (var b = 0; b < extremity_name.length; b++) 105 { 106 if (extremity_name[b] == bone_type[a]) 107 { 108 if (bone_ext[a] > extremity_max[b]) 109 extremity_max[b] = bone_ext[a]; 110 } 51 111 } 52 112 } 113 114 // Add a glass_break particle for every outermost bone in the attack 115 for (var a = 0; a < array_bones.length; a++) 116 { 117 // Move to next bone if this is not the outermost attacking bone on this extremity 118 var add_this_bone = false; 119 for (var b = 0; b < extremity_name.length; b++) 120 { 121 if (bone_type[a] == extremity_name[b]) 122 { 123 if (bone_ext[a] == extremity_max[b]) 124 add_this_bone = true; 125 } 126 } 127 if (!add_this_bone) 128 continue; 129 130 // Exit if we are past Oni's limit on TRAM particles 131 if (particles.length >= 16) 132 { 133 echo("Reached maximum of 16 particles for this TRAM, exiting…"); 134 return; 135 } 136 137 echo("Adding glass_break to " + array_bones[a]); 138 var par_string = "<Start>" + hit_start + "</Start><End>" + hit_end + "</End><Bone>" + array_bones[a] + "</Bone><Name>glass_break</Name>"; 139 140 // Add glass_break to bone for time period that bone has collision status 141 myBuilder.addElementAt("Particle", 142 "", 143 par_string, 144 particles.index + 1, 145 particles.level + 1); 146 } 53 147 54 $xmlData=myBuilder.generateXML(); // update the global variable with the new XML 148 // Update the global variable with the new XML 149 $xmlData = myBuilder.generateXML(); 55 150 </code> -
AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAM-kick-.oni-patch
r950 r965 3 3 @CUSTOM_CODE 4 4 <code> 5 function contains(fullStringOrArray, subString){ 6 return fullStringOrArray.indexOf(subString)!=-1; 7 } 5 // |———————————————————————————————————Code best viewed at this width————————————————————————————————————————| 6 7 // Load XML data 8 var myBuilder = new JSXMLBuilder(); 9 myBuilder.load($xmlData); 10 var elements = myBuilder.elements[0]; 8 11 9 function removeFromArray(_array, _value){ 10 _array.splice(_array.indexOf(_value), 1); 12 // If there are no attacks in this TRAM, ignore it 13 if (!elements.childElement("Animation").childElement("Attacks")) 14 return; 15 16 // Gather all the necessary info 17 var particles = elements.childElement("Animation").childElement("Particles"); 18 var attack = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 19 var hit_start = attack.childElement("Start").text; 20 var hit_end = attack.childElement("End").text; 21 var array_bones = attack.childElement("Bones").text.split(" "); 22 23 // Remove glass_break if it is already assigned to any bones, because it's probably not been assigned the 24 // way we want it to be 25 for (var i = 0; (particles.childElement(i)); i++) 26 { 27 var particle = particles.childElement(i); 28 if (particle.childElement("Name").text == "glass_break") 29 myBuilder.removeElement(particle.index); 11 30 } 12 31 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 21 if(!elements.childElement("Animation").childElement("Attacks")){ // if no attacks found ignore file 22 return; 23 } 24 25 var attackElement = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 26 27 var int_start,int_end,array_bones; 28 29 // gather all the necessary info 30 int_start=attackElement.childElement("Start").text; 31 int_end=attackElement.childElement("End").text; 32 array_bones=attackElement.childElement("Bones").text.split(" "); 33 34 // Check if any of the existing particles correspond to the same bone and glass_break 35 for (var i=0; (particles.childElement(i)); i++){ // the condition is to check if the child element exists (!= undefined) 36 var currElement=particles.childElement(i); 37 38 if(contains(array_bones,currElement.childElement("Bone").text) && currElement.childElement("Name").text=="glass_break"){ 39 removeFromArray(array_bones,currElement.childElement("Bone").text); // not necessary to add 32 // Find the outermost bone of each type 33 // The "type" in bone_type[] refers to the extremity of the body to which a bone belongs ("mid" counts as 34 // as an extremity because the head is part of "mid"); this is a "parallel array" with array_bones[] 35 var bone_type = new Array(19); 36 // The "ext" in bone_ext[] refers to the "outermostness" of the bone, that is, how far out on the extremity 37 // this bone is; this is a parallel array with array_bones[] 38 var bone_ext = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 39 // The extremity_ arrays are parallel arrays which store the highest "outermostness" value found for each 40 // extremity, among all the bones in that extremity that are listed in the attack 41 var extremity_name = ["mid", "left_arm", "right_arm", "left_leg", "right_leg"]; 42 var extremity_max = [0, 0, 0, 0, 0]; 43 for (var i = 0; i < array_bones.length; i++) 44 { 45 var bone = array_bones[i]; 46 if (bone == "Head" || bone == "Neck" || bone == "Chest" || bone == "Mid" || bone == "Pelvis") 47 { 48 bone_type[i] = "mid"; 49 if (bone == "Neck") 50 bone_ext[i] = 1; 51 else if (bone == "Head") 52 bone_ext[i] = 2; 53 // The rest of these bones are extremity '0' 54 } 55 else if (bone == "LeftShoulder" || bone == "LeftArm" || bone == "LeftWrist" || bone == "LeftFist") 56 { 57 bone_type[i] = "left_arm"; 58 if (bone == "LeftShoulder") 59 bone_ext[i] = 1; 60 else if (bone == "LeftArm") 61 bone_ext[i] = 2; 62 else if (bone == "LeftWrist") 63 bone_ext[i] = 3; 64 else if (bone == "LeftFist") 65 bone_ext[i] = 4; 66 } 67 else if (bone == "RightShoulder" || bone == "RightArm" || bone == "RightWrist" || bone == "RightFist") 68 { 69 bone_type[i] = "right_arm"; 70 if (bone == "RightShoulder") 71 bone_ext[i] = 1; 72 else if (bone == "RightArm") 73 bone_ext[i] = 2; 74 else if (bone == "RightWrist") 75 bone_ext[i] = 3; 76 else if (bone == "RightFist") 77 bone_ext[i] = 4; 78 } 79 else if (bone == "LeftThigh" || bone == "LeftCalf" || bone == "LeftFoot") 80 { 81 bone_type[i] = "left_leg"; 82 if (bone == "LeftThigh") 83 bone_ext[i] = 1; 84 else if (bone == "LeftCalf") 85 bone_ext[i] = 2; 86 else if (bone == "LeftFoot") 87 bone_ext[i] = 3; 88 } 89 else if (bone == "RightThigh" || bone == "RightCalf" || bone == "RightFoot") 90 { 91 bone_type[i] = "right_leg"; 92 if (bone == "RightThigh") 93 bone_ext[i] = 1; 94 else if (bone == "RightCalf") 95 bone_ext[i] = 2; 96 else if (bone == "RightFoot") 97 bone_ext[i] = 3; 40 98 } 41 99 } 42 43 // Insert the new glass particles 44 for (var i = 0; i < array_bones.length; i++) { 45 if(array_bones[i]=="RightFoot" || array_bones[i]=="LeftFoot" || array_bones[i]=="RightFist" || array_bones[i]=="LeftFist"){ 46 myBuilder.addElementAt("Particle","", 47 "<Start>"+int_start+"</Start>\ 48 <End>"+int_end+"</End>\ 49 <Bone>"+array_bones[i]+"</Bone>\ 50 <Name>glass_break</Name>",particles.index+1,particles.level+1); 100 101 // Find outermost bone for each extremity, among the bones listed in the Attack 102 for (var a = 0; a < array_bones.length; a++) 103 { 104 for (var b = 0; b < extremity_name.length; b++) 105 { 106 if (extremity_name[b] == bone_type[a]) 107 { 108 if (bone_ext[a] > extremity_max[b]) 109 extremity_max[b] = bone_ext[a]; 110 } 51 111 } 52 112 } 113 114 // Add a glass_break particle for every outermost bone in the attack 115 for (var a = 0; a < array_bones.length; a++) 116 { 117 // Move to next bone if this is not the outermost attacking bone on this extremity 118 var add_this_bone = false; 119 for (var b = 0; b < extremity_name.length; b++) 120 { 121 if (bone_type[a] == extremity_name[b]) 122 { 123 if (bone_ext[a] == extremity_max[b]) 124 add_this_bone = true; 125 } 126 } 127 if (!add_this_bone) 128 continue; 129 130 // Exit if we are past Oni's limit on TRAM particles 131 if (particles.length >= 16) 132 { 133 echo("Reached maximum of 16 particles for this TRAM, exiting…"); 134 return; 135 } 136 137 echo("Adding glass_break to " + array_bones[a]); 138 var par_string = "<Start>" + hit_start + "</Start><End>" + hit_end + "</End><Bone>" + array_bones[a] + "</Bone><Name>glass_break</Name>"; 139 140 // Add glass_break to bone for time period that bone has collision status 141 myBuilder.addElementAt("Particle", 142 "", 143 par_string, 144 particles.index + 1, 145 particles.level + 1); 146 } 53 147 54 $xmlData=myBuilder.generateXML(); // update the global variable with the new XML 148 // Update the global variable with the new XML 149 $xmlData = myBuilder.generateXML(); 55 150 </code> -
AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAM-knockdown-.oni-patch
r959 r965 3 3 @CUSTOM_CODE 4 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 5 var myBuilder = new JSXMLBuilder(); 14 6 myBuilder.load($xmlData); 15 7 16 8 var elements = myBuilder.elements[0]; 17 18 9 var particles = elements.childElement("Animation").childElement("Particles"); 19 10 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); 11 // Check to see if glass_break is already added to Head 12 for (var i = 0; (particles.childElement(i)); i++) 13 { 14 var particle = particles.childElement(i); 15 if (particle.childElement("Bone").text == "Head" && 16 particle.childElement("Name").text == "glass_break") 17 return; 18 } 23 19 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; 20 // Exit if we are past Oni's limit on TRAM particles 21 if (particles.length >= 16) 22 return; 32 23 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 } 24 // Add the glass_break particle to Head for duration of animation 25 var heights = elements.childElement("Animation").childElement("Heights"); 26 var anim_length; 27 for (anim_length = 0; (heights.childElement(anim_length)); anim_length++) {;} 28 myBuilder.addElementAt("Particle", 29 "", 30 "<Start>0</Start>\ 31 <End>" + (anim_length-1) + "</End>\ 32 <Bone>Head</Bone>\ 33 <Name>glass_break</Name>", 34 particles.index + 1, 35 particles.level + 1); 43 36 44 $xmlData=myBuilder.generateXML(); // update the global variable with the new XML 37 // Update the global variable with the new XML 38 $xmlData = myBuilder.generateXML(); 45 39 </code> -
AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAM-punch-.oni-patch
r950 r965 3 3 @CUSTOM_CODE 4 4 <code> 5 function contains(fullStringOrArray, subString){ 6 return fullStringOrArray.indexOf(subString)!=-1; 7 } 5 // |———————————————————————————————————Code best viewed at this width————————————————————————————————————————| 6 7 // Load XML data 8 var myBuilder = new JSXMLBuilder(); 9 myBuilder.load($xmlData); 10 var elements = myBuilder.elements[0]; 8 11 9 function removeFromArray(_array, _value){ 10 _array.splice(_array.indexOf(_value), 1); 12 // If there are no attacks in this TRAM, ignore it 13 if (!elements.childElement("Animation").childElement("Attacks")) 14 return; 15 16 // Gather all the necessary info 17 var particles = elements.childElement("Animation").childElement("Particles"); 18 var attack = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 19 var hit_start = attack.childElement("Start").text; 20 var hit_end = attack.childElement("End").text; 21 var array_bones = attack.childElement("Bones").text.split(" "); 22 23 // Remove glass_break if it is already assigned to any bones, because it's probably not been assigned the 24 // way we want it to be 25 for (var i = 0; (particles.childElement(i)); i++) 26 { 27 var particle = particles.childElement(i); 28 if (particle.childElement("Name").text == "glass_break") 29 myBuilder.removeElement(particle.index); 11 30 } 12 31 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 21 if(!elements.childElement("Animation").childElement("Attacks")){ // if no attacks found ignore file 22 return; 23 } 24 25 var attackElement = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 26 27 var int_start,int_end,array_bones; 28 29 // gather all the necessary info 30 int_start=attackElement.childElement("Start").text; 31 int_end=attackElement.childElement("End").text; 32 array_bones=attackElement.childElement("Bones").text.split(" "); 33 34 // Check if any of the existing particles correspond to the same bone and glass_break 35 for (var i=0; (particles.childElement(i)); i++){ // the condition is to check if the child element exists (!= undefined) 36 var currElement=particles.childElement(i); 37 38 if(contains(array_bones,currElement.childElement("Bone").text) && currElement.childElement("Name").text=="glass_break"){ 39 removeFromArray(array_bones,currElement.childElement("Bone").text); // not necessary to add 32 // Find the outermost bone of each type 33 // The "type" in bone_type[] refers to the extremity of the body to which a bone belongs ("mid" counts as 34 // as an extremity because the head is part of "mid"); this is a "parallel array" with array_bones[] 35 var bone_type = new Array(19); 36 // The "ext" in bone_ext[] refers to the "outermostness" of the bone, that is, how far out on the extremity 37 // this bone is; this is a parallel array with array_bones[] 38 var bone_ext = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 39 // The extremity_ arrays are parallel arrays which store the highest "outermostness" value found for each 40 // extremity, among all the bones in that extremity that are listed in the attack 41 var extremity_name = ["mid", "left_arm", "right_arm", "left_leg", "right_leg"]; 42 var extremity_max = [0, 0, 0, 0, 0]; 43 for (var i = 0; i < array_bones.length; i++) 44 { 45 var bone = array_bones[i]; 46 if (bone == "Head" || bone == "Neck" || bone == "Chest" || bone == "Mid" || bone == "Pelvis") 47 { 48 bone_type[i] = "mid"; 49 if (bone == "Neck") 50 bone_ext[i] = 1; 51 else if (bone == "Head") 52 bone_ext[i] = 2; 53 // The rest of these bones are extremity '0' 54 } 55 else if (bone == "LeftShoulder" || bone == "LeftArm" || bone == "LeftWrist" || bone == "LeftFist") 56 { 57 bone_type[i] = "left_arm"; 58 if (bone == "LeftShoulder") 59 bone_ext[i] = 1; 60 else if (bone == "LeftArm") 61 bone_ext[i] = 2; 62 else if (bone == "LeftWrist") 63 bone_ext[i] = 3; 64 else if (bone == "LeftFist") 65 bone_ext[i] = 4; 66 } 67 else if (bone == "RightShoulder" || bone == "RightArm" || bone == "RightWrist" || bone == "RightFist") 68 { 69 bone_type[i] = "right_arm"; 70 if (bone == "RightShoulder") 71 bone_ext[i] = 1; 72 else if (bone == "RightArm") 73 bone_ext[i] = 2; 74 else if (bone == "RightWrist") 75 bone_ext[i] = 3; 76 else if (bone == "RightFist") 77 bone_ext[i] = 4; 78 } 79 else if (bone == "LeftThigh" || bone == "LeftCalf" || bone == "LeftFoot") 80 { 81 bone_type[i] = "left_leg"; 82 if (bone == "LeftThigh") 83 bone_ext[i] = 1; 84 else if (bone == "LeftCalf") 85 bone_ext[i] = 2; 86 else if (bone == "LeftFoot") 87 bone_ext[i] = 3; 88 } 89 else if (bone == "RightThigh" || bone == "RightCalf" || bone == "RightFoot") 90 { 91 bone_type[i] = "right_leg"; 92 if (bone == "RightThigh") 93 bone_ext[i] = 1; 94 else if (bone == "RightCalf") 95 bone_ext[i] = 2; 96 else if (bone == "RightFoot") 97 bone_ext[i] = 3; 40 98 } 41 99 } 42 43 // Insert the new glass particles 44 for (var i = 0; i < array_bones.length; i++) { 45 if(array_bones[i]=="RightFoot" || array_bones[i]=="LeftFoot" || array_bones[i]=="RightFist" || array_bones[i]=="LeftFist"){ 46 myBuilder.addElementAt("Particle","", 47 "<Start>"+int_start+"</Start>\ 48 <End>"+int_end+"</End>\ 49 <Bone>"+array_bones[i]+"</Bone>\ 50 <Name>glass_break</Name>",particles.index+1,particles.level+1); 100 101 // Find outermost bone for each extremity, among the bones listed in the Attack 102 for (var a = 0; a < array_bones.length; a++) 103 { 104 for (var b = 0; b < extremity_name.length; b++) 105 { 106 if (extremity_name[b] == bone_type[a]) 107 { 108 if (bone_ext[a] > extremity_max[b]) 109 extremity_max[b] = bone_ext[a]; 110 } 51 111 } 52 112 } 113 114 // Add a glass_break particle for every outermost bone in the attack 115 for (var a = 0; a < array_bones.length; a++) 116 { 117 // Move to next bone if this is not the outermost attacking bone on this extremity 118 var add_this_bone = false; 119 for (var b = 0; b < extremity_name.length; b++) 120 { 121 if (bone_type[a] == extremity_name[b]) 122 { 123 if (bone_ext[a] == extremity_max[b]) 124 add_this_bone = true; 125 } 126 } 127 if (!add_this_bone) 128 continue; 129 130 // Exit if we are past Oni's limit on TRAM particles 131 if (particles.length >= 16) 132 { 133 echo("Reached maximum of 16 particles for this TRAM, exiting…"); 134 return; 135 } 136 137 echo("Adding glass_break to " + array_bones[a]); 138 var par_string = "<Start>" + hit_start + "</Start><End>" + hit_end + "</End><Bone>" + array_bones[a] + "</Bone><Name>glass_break</Name>"; 139 140 // Add glass_break to bone for time period that bone has collision status 141 myBuilder.addElementAt("Particle", 142 "", 143 par_string, 144 particles.index + 1, 145 particles.level + 1); 146 } 53 147 54 $xmlData=myBuilder.generateXML(); // update the global variable with the new XML 148 // Update the global variable with the new XML 149 $xmlData = myBuilder.generateXML(); 55 150 </code> -
AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAM-slide-.oni-patch
r950 r965 3 3 @CUSTOM_CODE 4 4 <code> 5 function contains(fullStringOrArray, subString){ 6 return fullStringOrArray.indexOf(subString)!=-1; 7 } 5 // |———————————————————————————————————Code best viewed at this width————————————————————————————————————————| 6 7 // Load XML data 8 var myBuilder = new JSXMLBuilder(); 9 myBuilder.load($xmlData); 10 var elements = myBuilder.elements[0]; 8 11 9 function removeFromArray(_array, _value){ 10 _array.splice(_array.indexOf(_value), 1); 12 // If there are no attacks in this TRAM, ignore it 13 if (!elements.childElement("Animation").childElement("Attacks")) 14 return; 15 16 // Gather all the necessary info 17 var particles = elements.childElement("Animation").childElement("Particles"); 18 var attack = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 19 var hit_start = attack.childElement("Start").text; 20 var hit_end = attack.childElement("End").text; 21 var array_bones = attack.childElement("Bones").text.split(" "); 22 23 // Remove glass_break if it is already assigned to any bones, because it's probably not been assigned the 24 // way we want it to be 25 for (var i = 0; (particles.childElement(i)); i++) 26 { 27 var particle = particles.childElement(i); 28 if (particle.childElement("Name").text == "glass_break") 29 myBuilder.removeElement(particle.index); 11 30 } 12 31 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 21 if(!elements.childElement("Animation").childElement("Attacks")){ // if no attacks found ignore file 22 return; 23 } 24 25 var attackElement = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 26 27 var int_start,int_end,array_bones; 28 29 // gather all the necessary info 30 int_start=attackElement.childElement("Start").text; 31 int_end=attackElement.childElement("End").text; 32 array_bones=attackElement.childElement("Bones").text.split(" "); 33 34 // Check if any of the existing particles correspond to the same bone and glass_break 35 for (var i=0; (particles.childElement(i)); i++){ // the condition is to check if the child element exists (!= undefined) 36 var currElement=particles.childElement(i); 37 38 if(contains(array_bones,currElement.childElement("Bone").text) && currElement.childElement("Name").text=="glass_break"){ 39 removeFromArray(array_bones,currElement.childElement("Bone").text); // not necessary to add 32 // Find the outermost bone of each type 33 // The "type" in bone_type[] refers to the extremity of the body to which a bone belongs ("mid" counts as 34 // as an extremity because the head is part of "mid"); this is a "parallel array" with array_bones[] 35 var bone_type = new Array(19); 36 // The "ext" in bone_ext[] refers to the "outermostness" of the bone, that is, how far out on the extremity 37 // this bone is; this is a parallel array with array_bones[] 38 var bone_ext = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 39 // The extremity_ arrays are parallel arrays which store the highest "outermostness" value found for each 40 // extremity, among all the bones in that extremity that are listed in the attack 41 var extremity_name = ["mid", "left_arm", "right_arm", "left_leg", "right_leg"]; 42 var extremity_max = [0, 0, 0, 0, 0]; 43 for (var i = 0; i < array_bones.length; i++) 44 { 45 var bone = array_bones[i]; 46 if (bone == "Head" || bone == "Neck" || bone == "Chest" || bone == "Mid" || bone == "Pelvis") 47 { 48 bone_type[i] = "mid"; 49 if (bone == "Neck") 50 bone_ext[i] = 1; 51 else if (bone == "Head") 52 bone_ext[i] = 2; 53 // The rest of these bones are extremity '0' 54 } 55 else if (bone == "LeftShoulder" || bone == "LeftArm" || bone == "LeftWrist" || bone == "LeftFist") 56 { 57 bone_type[i] = "left_arm"; 58 if (bone == "LeftShoulder") 59 bone_ext[i] = 1; 60 else if (bone == "LeftArm") 61 bone_ext[i] = 2; 62 else if (bone == "LeftWrist") 63 bone_ext[i] = 3; 64 else if (bone == "LeftFist") 65 bone_ext[i] = 4; 66 } 67 else if (bone == "RightShoulder" || bone == "RightArm" || bone == "RightWrist" || bone == "RightFist") 68 { 69 bone_type[i] = "right_arm"; 70 if (bone == "RightShoulder") 71 bone_ext[i] = 1; 72 else if (bone == "RightArm") 73 bone_ext[i] = 2; 74 else if (bone == "RightWrist") 75 bone_ext[i] = 3; 76 else if (bone == "RightFist") 77 bone_ext[i] = 4; 78 } 79 else if (bone == "LeftThigh" || bone == "LeftCalf" || bone == "LeftFoot") 80 { 81 bone_type[i] = "left_leg"; 82 if (bone == "LeftThigh") 83 bone_ext[i] = 1; 84 else if (bone == "LeftCalf") 85 bone_ext[i] = 2; 86 else if (bone == "LeftFoot") 87 bone_ext[i] = 3; 88 } 89 else if (bone == "RightThigh" || bone == "RightCalf" || bone == "RightFoot") 90 { 91 bone_type[i] = "right_leg"; 92 if (bone == "RightThigh") 93 bone_ext[i] = 1; 94 else if (bone == "RightCalf") 95 bone_ext[i] = 2; 96 else if (bone == "RightFoot") 97 bone_ext[i] = 3; 40 98 } 41 99 } 42 43 // Insert the new glass particles 44 for (var i = 0; i < array_bones.length; i++) { 45 if(array_bones[i]=="RightFoot" || array_bones[i]=="LeftFoot" || array_bones[i]=="RightFist" || array_bones[i]=="LeftFist"){ 46 myBuilder.addElementAt("Particle","", 47 "<Start>"+int_start+"</Start>\ 48 <End>"+int_end+"</End>\ 49 <Bone>"+array_bones[i]+"</Bone>\ 50 <Name>glass_break</Name>",particles.index+1,particles.level+1); 100 101 // Find outermost bone for each extremity, among the bones listed in the Attack 102 for (var a = 0; a < array_bones.length; a++) 103 { 104 for (var b = 0; b < extremity_name.length; b++) 105 { 106 if (extremity_name[b] == bone_type[a]) 107 { 108 if (bone_ext[a] > extremity_max[b]) 109 extremity_max[b] = bone_ext[a]; 110 } 51 111 } 52 112 } 113 114 // Add a glass_break particle for every outermost bone in the attack 115 for (var a = 0; a < array_bones.length; a++) 116 { 117 // Move to next bone if this is not the outermost attacking bone on this extremity 118 var add_this_bone = false; 119 for (var b = 0; b < extremity_name.length; b++) 120 { 121 if (bone_type[a] == extremity_name[b]) 122 { 123 if (bone_ext[a] == extremity_max[b]) 124 add_this_bone = true; 125 } 126 } 127 if (!add_this_bone) 128 continue; 129 130 // Exit if we are past Oni's limit on TRAM particles 131 if (particles.length >= 16) 132 { 133 echo("Reached maximum of 16 particles for this TRAM, exiting…"); 134 return; 135 } 136 137 echo("Adding glass_break to " + array_bones[a]); 138 var par_string = "<Start>" + hit_start + "</Start><End>" + hit_end + "</End><Bone>" + array_bones[a] + "</Bone><Name>glass_break</Name>"; 139 140 // Add glass_break to bone for time period that bone has collision status 141 myBuilder.addElementAt("Particle", 142 "", 143 par_string, 144 particles.index + 1, 145 particles.level + 1); 146 } 53 147 54 $xmlData=myBuilder.generateXML(); // update the global variable with the new XML 148 // Update the global variable with the new XML 149 $xmlData = myBuilder.generateXML(); 55 150 </code> -
AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAMKONCOMrun_throw_fw.oni-patch
r959 r965 1 1 @XML_TOOLS Version "2.0" 2 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 21 if(!elements.childElement("Animation").childElement("Attacks")){ // if no attacks found ignore file 22 return; 23 } 24 25 var attackElement = elements.childElement("Animation").childElement("Attacks").childElement("Attack"); 26 27 var int_start,int_end,array_bones; 28 29 // gather all the necessary info 30 int_start=attackElement.childElement("Start").text; 31 int_end=attackElement.childElement("End").text; 32 array_bones=attackElement.childElement("Bones").text.split(" "); 33 34 // Check if any of the existing particles correspond to the same bone and glass_break 35 for (var i=0; (particles.childElement(i)); i++){ // the condition is to check if the child element exists (!= undefined) 36 var currElement=particles.childElement(i); 37 38 if(contains(array_bones,currElement.childElement("Bone").text) && currElement.childElement("Name").text=="glass_break"){ 39 removeFromArray(array_bones,currElement.childElement("Bone").text); // not necessary to add 40 } 41 } 42 43 // Insert the new glass particles 44 for (var i = 0; i < array_bones.length; i++) { 45 if(array_bones[i]=="RightFoot" || array_bones[i]=="LeftFoot" || array_bones[i]=="RightFist" || array_bones[i]=="LeftFist"){ 46 myBuilder.addElementAt("Particle","", 47 "<Start>"+int_start+"</Start>\ 48 <End>"+int_end+"</End>\ 49 <Bone>"+array_bones[i]+"</Bone>\ 50 <Name>glass_break</Name>",particles.index+1,particles.level+1); 51 } 52 } 53 54 $xmlData=myBuilder.generateXML(); // update the global variable with the new XML 55 </code> 3 @ADD_INSIDE_NODES ElementName "Particles" 4 <xml> 5 <Particle> 6 <Start>29</Start> 7 <End>39</End> 8 <Bone>LeftFoot</Bone> 9 <Name>glass_break</Name> 10 </Particle> 11 </xml>
Note:
See TracChangeset
for help on using the changeset viewer.