Scripts with path sounds not working with save game as runtime?

hi there I,m using a blender 2.74 version and try external data to pack all in to .blend file and work in same computer where i Have blender

installed but not in other computer.Example i use Windows7. If i try run game in other computer with windows 7 dont run sounds but textures

all fine

Script example with path data sound:

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") 


i made all external data to pack all in to .blend, then export save game as runtime the game run with all sounds scripts only in

my computer.Ohter computer with same OS not work then scripts fail

Can anyone help me with solution?

sound = aud.Factory.file(“C:/MakeHumanZip/project_last_back/sounds/glockshoot.ogg”)

In here is your error, it cannot get the relative path.

with other words normally //folder/ should work


            device = aud.device()
            sound = aud.Factory.file(logic.expandPath("//sounds/" + "glockshoot.ogg")


            device.play(sound)

so ‘sounds’ is a folder in the same directory as the .blend

i made all external data to pack all in to .blend, then export save game as runtime the game run with all sounds scripts only in

Sounds are not getting packed into .blend, atleast did not work for me. so manually place the sounds folder in the folder of the .blend/.exe.

Best option for distribution is to make a tree structure like this:


put every thing in there what the game needs, be sure to reload all textures and sound from logic bricks.
then save it and it will work.

i have around 10 scripts with sounds in is very complicate change that to logic bricks

i will try then change code with expandPath an will see if work.Textures normal will apply all data pack in to .blend file

go copy folder sounds to same local of blend file and go test in another computer

thanks for now

Its worked with expandPath now working in any local of any computer with window system.

thanks a lot