Mods with random sounds

4 replies [Last post]
Joined: 09/27/2014

You know there's mods that change the appearance of a Goo Ball into random different images, right?

Well, I was wondering if you could do the same but with sound files instead of image files. Yep, XSL trouble again!

Joined: 08/06/2010

You can, same way you'd do random images. Just separate your sound names with commas.

Another Planet finally has an official release! Download chapters 1 through 3 here! Thank you for waiting so long while I kept starting over.

Joined: 09/27/2014

Well, I can only get the default sound to play. These are my XSL files. As you can see, I'm trying to make a mod with random explosion sound effects.

balls.xml.xsl

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
  <!-- Copy everything not matched by another rule -->
  <xsl:template match="* | comment()">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
 
 
<xsl:template match="/ball/sound[@layer = 0]">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:attribute name="sounds">SOUND_BALL_BOMBSTICKY_DETONATE0,SOUND_BALL_BOMBSTICKY_DETONATE2,SOUND_BALL_BOMBSTICKY_DETONATE3,SOUND_BALL_BOMBSTICKY_DETONATE4,SOUND_BALL_BOMBSTICKY_DETONATE5,SOUND_BALL_BOMBSTICKY_DETONATE6,SOUND_BALL_BOMBSTICKY_DETONATE7,SOUND_BALL_BOMBSTICKY_DETONATE8,SOUND_BALL_BOMBSTICKY_DETONATE9,SOUND_BALL_BOMBSTICKY_DETONATE10</xsl:attribute>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>  
 
 
</xsl:transform>

resources.xml.xsl

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
  <!-- Copy everything not matched by another rule -->
  <xsl:template match="* | comment()">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>
 
 
  <xsl:template match="/ResourceManifest/Resources">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
 
 <SetDefaults path="res/balls/BombSticky/" idprefix="SOUND_BALL_BOMBSTICKY_" />
      <Sound id="DETONATE0"	          path="detonate0"/>
      <Sound id="DETONATE2"	          path="detonate2"/>
      <Sound id="DETONATE3"	          path="detonate3"/>
      <Sound id="DETONATE4"	          path="detonate4"/>
      <Sound id="DETONATE5"	          path="detonate5"/>
      <Sound id="DETONATE6"	          path="detonate6"/>
      <Sound id="DETONATE7"	          path="detonate7"/>
      <Sound id="DETONATE8"	          path="detonate8"/>
      <Sound id="DETONATE9"	          path="detonate9"/>
      <Sound id="DETONATE10"	          path="detonate10"/>
 
    </xsl:copy>
  </xsl:template>
</xsl:transform>

Joined: 04/29/2009

Hm, I'm a little out of practise with xsl. It looks like you are adding the sounds in the wrong place.
There is no attribute called "sounds" in the ball.XML.
Try to decrypt the ball.XML after installing the goomod with your xsl files.
Check if it has changed and if so what has changed.

Joined: 09/27/2014

After lots of attempts I found out that you aren't supposed to use XSL files! So instead of a "merge" folder, I had to use a "compile" folder, and it makes things a lot easier! Why didn't I think of that before?!

Well, my problem is solved. Now I can publish my mod...