Scripts with sound path - Imported audio not working with Save Game as Runtime I'm using a Blender 2.74 and am trying to pack external audio data into a .blend file. I am using Windows 7. If I try run my game on other another computer, everything but the audio seems okay.

Here is the audio script:

import aud

def main():

    cont = bge.logic.getCurrentController()
    own = cont.owner
    scene = bge.logic.getCurrentScene()
    gunspawn = scene.objects[own.name]

    # sensors
    Message = cont.sensors['Message']


    #sound of glock shoot
    sound = aud.Factory.file("C:/MakeHumanZip/project_last_back/sounds/glockshoot.ogg")


When I pack the external data into the .blend the audio only works on my machine. The audio doesn't work on other Windows 7 machines and the scripts eventually crash.

Can anyone help me with solution?
Referring to a file in a python script doesn't tell blender that it is using an external file, so it isn't included when packing external files.

You can add a sound strip to the Video Sequence Editor or you could add a speaker in the 3D scene and open the sound file with that. Both of these methods allow blender to pack the audio file into the blend and I expect that both will be included when exporting to the game engine runtime.

An even better approach would be to use a sound actuator and open the sound file with that, which allows it to be packed. You can then use the actuator to play the sound or access other properties with a python script, you can also use sensors to play the sound without the script.

cont = bge.logic.getCurrentController()
actu = cont.actuators['Sound']
cont.activate(actu)