Community Forum

Cant loadSample from modfolder

Forum Overview >> Scripting

Created15.02.2019 01:41

Auke Tembrink (Unknown) 15.02.2019 01:41
i am trying to load a mono .ogg sound file within the loadmap event. The soundfile is located in the root of my mod folder. But everytime i load a game i get the following errors:

notifySample = createSample('notifySample');
loadSample(notifySample, 'notify2.ogg', false);
can´t load resource notify2.ogg
can´t load sample notify2.ogg```

Bilbo Beutlin (BBeutlin) 15.02.2019 10:09
Within a script the current directory cannot be determined exactly.
So use just at beginning of the script:
myMod = {}
myMod.homeDir = g_currentModDirectory
Then you can access your files later with
fName = myMod.homeDir .. "myFile"

Note: Log in to post. Create a new account here.