XML code that only plays an mp3 file
-
I am trying to make is so, that a sound is played for all players if a special unit (belonging to whatever player) called “loot” appears on the map. If unit loot appears --> play sound.
I have many times made notifications that had a sound being played alongside the windows popup, but now I would like to make a notification consisting only of a sound being played. Is this possible?I have tried experimenting with the following, but I don’t hear the sound/loot.mp3 being played:
<!-- Start Loot drop sound --> <attachment name="conditionAttachment_Loot" attachTo="Nature" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="map" count="1"/> <option name="unitPresence" value="Loot" count="1"/> <option name="players" value="$AllPlayers$"/> </attachment> <attachment name="triggerAttachment_Loot_is_dropped_on_the_map" attachTo="Nature" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Loot"/> <option name="notification" value="loot"/> <option name="players" value="$AllPlayers$"/> </attachment> <!-- End Loot drop sound -->
In my sounds.properties:
notification_loot=loot.mp3
In my notification.properties
loot_sounds=loot
-
@Frostion If you add a windows popup to it then does it play? And are you sure the trigger is activating?
-
@redrum Right the first thing to know is if the trigger is firing (not really activating, that is another thing) at all. I'm not sure if having multiple players for a same direct presence means that each one of those players must verify it.
-
Well, I got the sound to work. This is the code I used:
<!-- Start Loot drop sound --> <attachment name="conditionAttachment_Loot" attachTo="Nature" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="directPresenceTerritories" value="map" count="1"/> <option name="unitPresence" value="Loot" count="1"/> <option name="players" value="$AllPlayers$"/> </attachment> <attachment name="triggerAttachment_Loot_is_dropped_on_the_map" attachTo="Nature" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Loot"/> <option name="notification" value="loot"/> <option name="players" value="$AllPlayers$"/> <option name="when" value="after:HumansBattle"/> <option name="when" value="after:DwarvesBattle"/> <option name="when" value="after:GnomesBattle"/> <option name="when" value="after:Night-ElvesBattle"/> <option name="when" value="after:OrcsBattle"/> <option name="when" value="after:TaurenBattle"/> <option name="when" value="after:UndeadBattle"/> <option name="when" value="after:TrollsBattle"/> </attachment> <!-- End Loot drop sound -->
Seems that I am required to give “whens” in this case, even though I do not seem to need it when triggering notifications that are accompanied with window popups. This is a bit annoying, but I can live with it If I do not give when, then the sound does not play.
New problem: Now I get an error related to the images of units. The “Outlaws” unit is changing into a “Loot" unit when dying. Loot is a 1 round unit that is trigger removed from the map after endTurn.
<attachment name="unitAttachment" attachTo="Outlaws" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="defense" value="3"/> <option name="whenHitPointsDamagedChangesInto" value="1:false:Loot"/> </attachment>
<attachment name="unitAttachment" attachTo="Loot" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="isInfrastructure" value="true"/> <option name="createsResourcesList" value="10:XP"/> <option name="createsResourcesList" value="1:Gold"/> </attachment>
But I guess this is a topic for another discussion. Generally I see a lot of image + territory ownership related errors on my map or in the pre-release, that I cannot explain. I cant wait to go into beta and hopefully get som help to fix the errors.
-
just updated post. Gave wrong code info
-
@Frostion Umm, the error seems to indicate that you are missing a unit image for the Outlaws unit owned by Bandits?
PS. My general advice is to always specify the "when" as otherwise you are relying on some engine defaults that vary per type of trigger and make it very unclear when it can/will fire.
-
@redrum said in XML code that only plays an mp3 file:
@Frostion Umm, the error seems to indicate that you are missing a unit image for the Outlaws unit owned by Bandits?
But that does not make sense since the Outlaws unit is a Bandit owned unit and just fought a battle defending their territory. This situation is what my posted picture was a screenshot of.
Maybe it will all be easier to investigate when my map goes into beta mode
-
@Frostion Ah I see. I'd need to see the error details to see why that's happening. Not sure if you have those but if so please post them.