Jump to content
Korean Random

CDC

User
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

1 Noob
  1. Thank you! Turns out I did it correctly. For some reason when I change the file it gives an error (7 = invalid file or 2 = fail) at the first attempt of starting and loading it and then, after closing and restarting the game, it loads the completely unchanged file correctly. Well, easy to work around, but maybe this is giving someone some info. Either way, the threads you linked to are great help for the future. Thanks alot.
  2. Turns out restarting the game works, too, at least occasionally. Sometimes there is a loading error, sometimes there is not. With the same file, of course.
  3. Hey, my soundbank (used for various sixth sense sounds) usually doesn't work after including another sound. When rebuilding the whole thing from scratch however it usually does. Here is what I do: - Start a project in WWise (nothing checked etc.) - include license - set Default Conversion Settings to Vorbis with quality 6 - create one random container per sound - import sound file to container - set conversion setting for that file to "override parent" - create play event for container - create soundbank - include all the containers in the soundbank Thing is, like I said, occasionally this works, at other times I get alternatively (based on whether I "override parent" with "default" or "Vorbis High Quality") either this: Cannot load sound bank. Audiokinetic error code: 2 Or the same with error code 7. Anyone got an idea/manual for how to reliably do this without having to redo it every time you want to add a new sound?
  4. With that code the problem remains. This: import BigWorld import SoundGroups from gui.Scaleform.daapi.view.battle.shared.indicators import SixthSenseIndicator from xfw import * from Avatar import PlayerAvatar from xvm_main.python.logger import * cds = load_config('sound.json') @registerEvent(SixthSenseIndicator, 'as_showS') def SixthSenseIndicator_as_showS(self): global cds vehicle_name = BigWorld.player().vehicleTypeDescriptor.type.name if not cds: soundID = 'xvm_sixthSense' else: soundID = cds.get(vehicle_name, 'xvm_sixthSense') log('vehicle_name: ' + vehicle_name) log('soundID: ' + soundID) SoundGroups.g_instance.playSound2D(soundID) Doesn't play the sound. The log shows that the sound is correctly identified from the file (e.g. 'Default'). But while that plays when defined in the config it does not play this way. It doesn't play 'xvm_sixthSense' either if I set 'soundID' to that. There too the python.log shows: [SOUND_ERROR] Sound fail: 2166136261 - ErrorCode: 15 EDIT: Ah, got it. A simple str(soundID) solves the problem. Thank you sirmax for your help!
  5. Hey, as I was getting back to this I have a question about the following: I got the idea to work to the point where that is all that is needed. I have a .json file with the sound mappings, a .bnk file containing the sounds and a py_macro that should load it. In particular this works (for a sound file/event called "Default" in my sound bank): "xvm_sixthSense": "Default", The sound is played, so the bank will have been loaded correctly. All I need now is to make that vehicle-dependent. For that purpose I wrote the following short py_macro (the BigWorld import should be redundant, but anyway): import BigWorld import os.path import json def sounds(vehicle): with open('res_mods/CDC/sound/sound.json') as sound_file: sound_json = json.load(sound_file) if (vehicle in sound_json): return sound_json[vehicle] return 'Default' @xvm.export('CDC_sounds', deterministic=True) def CDC_sounds(vehicle): return sounds(vehicle) Problem is, it doesn't even seem to get there. When I put in logs to see what is done the macro doesn't even seem to be accessed. I try to access the macro this way: "xvm_sixthSense": "{{py:CDC_sounds('{{my-vehiclename}}')}}", Tried the same with the regular sixth sense in sounds.xc. Python.log says "sound error". Is it not possible to use macros in that file? Or at least not vehicle dependent ones? Or am I just using the wrong one? This doesn't work either: "xvm_sixthSense": "{{py:CDC_sounds()}}", With the macro simplified to: @xvm.export('CDC_sounds', deterministic=True) def CDC_sounds(): return 'Default' Again the result is (from python.log): [SOUND_ERROR] Sound fail: 1824773650 - ErrorCode: 15
  6. Hmm, I tried to implement it test wise, but without success. I created a source file cdc.json: { "xtest": "Sound_CDC1" } That sound is, under that name, part of my soundbank. If I use that in sounds.xc for the regular xvm_sixthsense (i.e: "xvm_sixthSense": "Sound_CDC1"), it works, so I can exclude a soundbank problem (xvm.log also says the soundbank is loaded). Do I have to reference it differently? I tried to load it with the code you provided: import BigWorld import SoundGroups from gui.Scaleform.daapi.view.battle.shared.indicators import SixthSenseIndicator from xfw import * # main @registerEvent(SixthSenseIndicator, 'as_showS') def SixthSenseIndicator_as_showS(self): vehicle_name = BigWorld.player().vehicleTypeDescriptor.type.name if not cds: soundID = 'xvm_sixthSense' else: soundID = cds.get('xtest', 'xvm_sixthSense') SoundGroups.g_instance.playSound2D(soundId) But without success. The "cds" file is loaded with the code you provide (plus imports, of course): from Avatar import PlayerAvatar @registerEvent(PlayerAvatar, 'onBecomePlayer') def onBecomePlayer(self): global cds cds = load_config('cdc.json') I tried removing the if-clause in the first script in case that was the problem but also no success. If a sound is defined in sounds.xc it plays that, but only then and that.
  7. Thanks, very useful information. Particularly: cds = load_config('cdc.json') # path is relative to WoT root dir, loaded once per session So there is no way to reload the file based on some event, like returning to garage?
  8. I didn't remove the imports of course, I just omitted them in the quote.
  9. Thanks again. I don't think - or I don't get enough - that this will do it, though. The idea is to change the sound map after each round. I would assume the .py File to be loaded into memory. I tried to refer to a file this way: # main @registerEvent(SixthSenseIndicator, 'as_showS') def SixthSenseIndicator_as_showS(self): vehicle_name = BigWorld.player().vehicleTypeDescriptor.type.name with open('cdc.json', 'r') as myfile: soundID=myfile.get(vehicleName, 'xvm_sixthSense') SoundGroups.g_instance.playSound2D(soundId) This does not work, also not with a static link (say "test": "soundInSoundBank") instead of "vehicleName". As I know very little about python there might be a rather obvious problem I don't see. Also does XVM load all .py scripts in the py_macro folder automatically or do I have to add it somewhere?
  10. Hey, thanks for the reply! I am new to the whole py_macro part of XVM, which seems to be quite powerful indeed. The first problem I ran into was how to use the {{my-vehiclename}} macro in connection with the sixth sense sound, as that is not supported in there apparently. How would I change that with py_macro? What I am trying to do is to use a soundMappings.xc file like this: { "china-Ch01_Type59": "SixthSenseSound1", // in MySoundBank.bnk "china-Ch02_Type62": "SixthSenseSound2", "china-Ch03_WZ-111": "SixthSenseSound3", "china-Ch04_T34_1": "SixthSenseSound1" ... } With a line in sounds.xc: "xvm_sixthSense": ${"soundMappings.xc":"{{my-vehiclename}}"}, Here the problem is the aforementioned lack of being able to use {{my-vehiclename}}. However, if it were to be static I could perhaps work around that, but as I want those sounds to (potentially) be shuffled around every single game I don't exactly know how to achieve that. And then the second issue is how to reload that file, i.e. remap the sounds, every time. Could you give any hints on how to do that?
  11. Hello! As said in the thread title I have the following problem: I need to reload the contents a certain file (say "script.cs") that is part of my xvm config before every new round. That file is supposed to map specific sound event names to each vehicle (different ones every time), the change of the file is achieved with an external program. Of course it is possible to reload the whole xvm config (via "autoReloadConfig") but that is excessive and very demanding for the computer. So I wonder if it is possible to reload parts of it at that specific moment.
×
×
  • Create New...