How to make a certain playlist or song play whenever a certain faction is chosen in multiplayer
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- Bilbo_Sacket
- Posts: 37
- Joined: February 28th, 2021, 4:27 am
How to make a certain playlist or song play whenever a certain faction is chosen in multiplayer
I am making an era, and I want any faction participating in a multiplayer's theme song to be added to the playlist for that scenario. But I don't want any default, or core songs to be butting in. Meaning a scenario that has only my songs in it, and only the ones belonging to the factions, chosen for the scenario. However, I don't want to change core data permanently to do it, just while someone is playing my mod on it.
I would appreciate some help, on this somewhat formidable problem thank you.
I would appreciate some help, on this somewhat formidable problem thank you.
- Lord-Knightmare
- Discord Moderator
- Posts: 2364
- Joined: May 24th, 2010, 5:26 pm
- Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
- Contact:
Re: How to make a certain playlist or song play whenever a certain faction is chosen in multiplayer
Here's what I would do:
- Give all leaders of your factions a faction-specific dummy ability. This is not needed if the leaders are all of the same race.
- Code a Start event.
- Filter by race/dummy-ability
- use your
{REPLACE_SCENARIO_MUSIC music.ogg}
and then multiple{APPEND_MUSIC music.ogg}
, to set up your playlist - Enjoy.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
- Bilbo_Sacket
- Posts: 37
- Joined: February 28th, 2021, 4:27 am
Re: How to make a certain playlist or song play whenever a certain faction is chosen in multiplayer
Thank you very much I will try that.
- Bilbo_Sacket
- Posts: 37
- Joined: February 28th, 2021, 4:27 am
Re: How to make a certain playlist or song play whenever a certain faction is chosen in multiplayer
Okay so I did or tried what you told me. But there is a problem, and I don't totally understand it. anyway would you please check my code to see if I got anything wrong, because so far what I tried hasn't worked.
I could not think of any other ways to do it from what you told me.
Code: Select all
#textdomain wesnoth- MUSIC
#define ABILITY_MUSIC
[dummy]
id=music
name=_ "music"
description=_ "This ability adds faction specific music to gameplay"
[/dummy]
[event]
name=start
[filter]
race=human
[/filter]
{REPLACE_SCENARIO_MUSIC loyalists.ogg}
{APPEND_MUSIC loyalists.ogg}
[filter]
race=orc
[/filter]
{REPLACE_SCENARIO_MUSIC northerners.ogg}
{APPEND_MUSIC loyalists.ogg}
[/event]
#enddef
- MoonyDragon
- Posts: 149
- Joined: November 29th, 2017, 5:46 pm
Re: How to make a certain playlist or song play whenever a certain faction is chosen in multiplayer
A
[store_side]
check for the individual factions is more elegant than anything with dummy abilities. Throw in a [switch]
to assign music to each faction, and the code below is ready to be put inside your [era]
tag. Enjoy!Code: Select all
[event]
name=start
{REPLACE_SCENARIO_MUSIC silence.ogg}
[store_side]
variable=sides
[/store_side]
[for]
array=sides
[do]
[switch]
variable=sides[$i].faction
[case]
value="Northerners"
{APPEND_MUSIC northerners.ogg}
[/case]
[case]
value="Loyalists"
{APPEND_MUSIC loyalists.ogg}
[/case]
[case]
value="Rebels"
{APPEND_MUSIC elvish-theme.ogg}
[/case]
[case]
value="Knalgan Alliance"
{APPEND_MUSIC knalgan_theme.ogg}
[/case]
[case]
value="Undead"
{APPEND_MUSIC the_dangerous_symphony.ogg}
[/case]
[case]
value="Drakes"
{APPEND_MUSIC frantic.ogg}
[/case]
[else]
{APPEND_MUSIC defeat.ogg}
[/else]
[/switch]
[/do]
[/for]
[clear_variable]
name=sides
[/clear_variable]
[/event]
Default L0 Era - Level 1 leaders with level 0 recruits!
- Bilbo_Sacket
- Posts: 37
- Joined: February 28th, 2021, 4:27 am
Re: How to make a certain playlist or song play whenever a certain faction is chosen in multiplayer
Thank you so much. I have been working on this for months and now something finally works you have my deepest gratitude for your help.