"Commander Under Attack" Replacement

Everything about mods can be found here.

Moderator: Morax

"Commander Under Attack" Replacement

Postby Deribus » 28 Jan 2018, 17:56

Hello, I'm trying to get into modding, and I've read the guides on the FAF Website, but I'm encountering some issues.

For my first mod I'm trying something that should be quite simple: replacing the "commander under attack" sound effect. However, I can't find the proper file to hook onto, and even if I did I cannot figure out the way sound works. For example, in the aeonweapons.lua and UserMusic.lua files I cannot find where they request the sound file, so I cannot see a way to change it.

Any advice?
Last edited by Deribus on 11 Feb 2018, 21:47, edited 1 time in total.
Deribus
Avatar-of-War
 
Posts: 84
Joined: 11 Apr 2017, 20:46
Has liked: 19 times
Been liked: 8 times
FAF User Name: Deribus

Re: Help - New To Modding

Postby Franck83 » 29 Jan 2018, 12:58

Hi Deribus,

First welcome in the modding part of FA ! You can achieve impressive results in modding supcom.

For sound modding, refer to previous posts on the forum :

viewtopic.php?f=41&t=6169
viewtopic.php?f=41&t=13038

Mission scripting contains an audio part :
https://wiki.faforever.com/index.php?ti ... ting#Audio

Have fun modding !
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83

Re: Help - New To Modding

Postby speed2 » 29 Jan 2018, 13:01

Voices for acu under attack etc... happen here https://github.com/FAForever/fa/blob/de ... n.lua#L820
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: Help - New To Modding

Postby Deribus » 30 Jan 2018, 20:10

Thanks for the help. I attempted to get the sound to work, but I only made it so that no sound would play. I assume that this is because I used XACT 4.0 instead of 2.0 as was stated in the guide, but I can only find a version 2.0 for MacOS. Anyone know where I could get XACT 2.0 for Windows? Or is that not the real problem and I messed up somewhere else?
Deribus
Avatar-of-War
 
Posts: 84
Joined: 11 Apr 2017, 20:46
Has liked: 19 times
Been liked: 8 times
FAF User Name: Deribus

Re: Help - New To Modding

Postby Farmsletje » 30 Jan 2018, 20:15

Replace it with the empire earth "We're under attack" sound Kreygasm
FtXCommando wrote:
need to give him some time to blossom into an aids flower
Farmsletje
Contributor
 
Posts: 1116
Joined: 14 Sep 2016, 18:38
Has liked: 383 times
Been liked: 452 times
FAF User Name: Farmsletje

Re: Help - New To Modding

Postby speed2 » 30 Jan 2018, 20:24

Deribus wrote:Thanks for the help. I attempted to get the sound to work, but I only made it so that no sound would play. I assume that this is because I used XACT 4.0 instead of 2.0 as was stated in the guide, but I can only find a version 2.0 for MacOS. Anyone know where I could get XACT 2.0 for Windows? Or is that not the real problem and I messed up somewhere else?

the link is in the wiki guide
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: Help - New To Modding

Postby Deribus » 30 Jan 2018, 23:16

speed2 wrote:the link is in the wiki guide

That is the one I used, but that is version 4.0, not 2.0. Will it still work?
Deribus
Avatar-of-War
 
Posts: 84
Joined: 11 Apr 2017, 20:46
Has liked: 19 times
Been liked: 8 times
FAF User Name: Deribus

Re: "Commander Under Attack" Replacement

Postby Deribus » 11 Feb 2018, 21:54

I've been able to get some work done on the mod, and it seems like the only thing I have left is to get it to use the new sound file. In bug fixing I've been able to write to mod to use a different sound effect, such as telling me that there are no air staging facilities when my commander takes damage, but not the new file. The relevant snippet of code is here:
OnPlayCommanderUnderAttackVO = {timeout = 15, bank = 'Test1234'},

But this results in no sound effect being played at all. I attached a zip copy of the mod if someone would like to take a look over it and see where I messed up.

I am also using XACT 2.0 and the sound is playing in auditioning, so it doesn't seem like it's an issue with the sound file.
Attachments
Oof.zip
(38.83 KiB) Downloaded 84 times
Deribus
Avatar-of-War
 
Posts: 84
Joined: 11 Apr 2017, 20:46
Has liked: 19 times
Been liked: 8 times
FAF User Name: Deribus

Re: "Commander Under Attack" Replacement

Postby Uveso » 11 Feb 2018, 22:38

hello Deribus,

i got this error from the mod:
Code: Select all
WARNING: Error resolving cue 'Test1234' in bank 'XGG'


This means, the game can't find the sound "Test1234" inside the files "XGG.xwb" and "XGG.xsb"

You also used a destructive hook inside aibrain.lua. (It will not run on every SupCom version)

Please delete everything inside your aibrain.lua and replace it with the following code:

Code: Select all
OLDAIBrain = AIBrain

AIBrain = Class(OLDAIBrain) {
    -- System for playing VOs to the Player
    VOSounds = {
        -- {timeout delay, default cue, observers}
        NuclearLaunchDetected =        {timeout = 1, bank = nil, obs = true},
        OnTransportFull =              {timeout = 1, bank = nil},
        OnFailedUnitTransfer =         {timeout = 10, bank = 'Computer_Computer_CommandCap_01298'},
        OnPlayNoStagingPlatformsVO =   {timeout = 5, bank = 'XGG_Computer_CV01_04756'},
        OnPlayBusyStagingPlatformsVO = {timeout = 5, bank = 'XGG_Computer_CV01_04755'},
        OnPlayCommanderUnderAttackVO = {timeout = 15, bank = 'Test1234'}, --Computer_Computer_Commanders_01314'},
    },

    PlayVOSound = function(self, string, sound)
        if not self.VOTable then self.VOTable = {} end

        local VO = self.VOSounds[string]
        if not VO then
            WARN('PlayVOSound: ' .. string .. " not found")
            return
        end

        if not self.VOTable[string] and VO['obs'] and GetFocusArmy() == -1 and self:GetArmyIndex() == 1 then
            -- Don't stop sound IF not repeated AND sound is flagged as 'obs' AND i'm observer AND only from PlayerIndex = 1
        elseif self.VOTable[string] or GetFocusArmy() ~= self:GetArmyIndex() then
            return
        end

        local cue, bank
        if sound then
            cue, bank = GetCueBank(sound)
        else
            cue, bank = VO['bank'], 'XGG'
        end

        if not (bank and cue) then
            WARN('PlayVOSound: No valid bank/cue for ' .. string)
            return
        end

        self.VOTable[string] = true
        table.insert(Sync.Voice, {Cue = cue, Bank = bank})

        local timeout = VO['timeout']
        ForkThread(function()
            WaitSeconds(timeout)
            self.VOTable[string] = nil
        end)
    end,

}


I guess you need also to change the PlayVOSound function, because it needs the commander sound inside the file XGG.xwb. You may want to change this.
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: "Commander Under Attack" Replacement

Postby Deribus » 11 Feb 2018, 22:48

Uveso wrote:hello Deribus,

i got this error from the mod:

This means, the game can't find the sound "Test1234" inside the files "XGG.xwb" and "XGG.xsb"

You also used a destructive hook inside aibrain.lua. (It will not run on every SupCom version)

Please delete everything inside your aibrain.lua and replace it with the following code:

I guess you need also to change the PlayVOSound function, because it needs the commander sound inside the file XGG.xwb. You may want to change this.


Thanks! That really helps a lot. I'll change aibrain and look into the PlayVOSound function in order for it to not require XGG, as I don't believe you can open and add to an existing bank. Also, where did you get that error message from?
Deribus
Avatar-of-War
 
Posts: 84
Joined: 11 Apr 2017, 20:46
Has liked: 19 times
Been liked: 8 times
FAF User Name: Deribus

Next

Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest