MP Tutorial Module System Faction Specific Victory/Defeat Music in Multiplayer

正在查看此主题的用户

Jarvisimo

Grandmaster Knight
Figured I'd share this as it does add something to the multiplayer experience and is really simple to get set up.

How to implement

1. At the END of module_sounds.py, add the following lines.

插入代码块:
("fac1_win_music", sf_2d|sf_priority_10|sf_vol_10, ["fac1_win_music.wav"]),
("fac2_lose_music", sf_2d|sf_priority_10|sf_vol_10, ["fac2_win_music.wav"]),
("lose_music", sf_2d|sf_priority_10|sf_vol_10, ["lose_music"]),

2. Go to module_presentations.py.

Search for the following code:

(eq, "$my_team_at_start_of_round", ":winner_agent_team"),

Replace this code:

插入代码块:
(assign, ":text_font_color", 0xFF33DD11),
(else_try),
(assign, ":text_font_color", 0xFFFF4422),
(try_end),

With the following:

插入代码块:
(assign, ":text_font_color", 0xFF33DD11), #green text
(team_get_faction, ":faction_of_winner_team", ":winner_agent_team"),
(try_begin),
(eq, ":faction_of_winner_team", "fac_kingdom_1"),                # if player won as Swadians (fac_kingdom_1)
(play_sound, "snd_fac1_win_music"), #play fac1 win sound
(else_try),                                                                              # OR if player won as Vaegirs (fac_kingdom_2)
(play_sound, "snd_fac2_win_music"), # play fac2 win sound
(try_end),
(else_try),                                                                               #if player lost :(
(assign, ":text_font_color", 0xFFFF4422), #red text
(play_sound, "snd_lose_music"), # play lose sound
(try_end),

I'll need to add to this in the morning but you get the gist for now. That's it.

Enjoy,

Jarvy
 
that looks kinda nice, simple and well tought. just a little thing, you used snd_fac2_win_music in the presentation and added fac2_lose_music in module_sounds  :wink:
 
后退
顶部 底部