Okay, I'm spawning louspeakers but there's no sounds. Do you mind having a look and making sure everything looks good to you? I'll update this post once it is working with the final instruction set.
So init.sqf in mission root:
INS_CTPMARKERS = ["CTP1","CTP2","CTP3"];
call compile preprocessFile "CallToPrayer\init.sqf";
description.ext:
//----------------------CalltoPrayer----------------------------
class CfgSounds {
sounds[] = {prayer};
class prayer {
name = "prayer";
sound[] = {"CalltoPrayer\sounds\prayer.ogg", db+1, 1};
titles[] = {};
};
};
Inside folder CalltoPrayer, functions.sqf:
/*
Author: Sacha
______________________________________________________*/
CalltoPrayer_fnc_getCities = {
private ["_locations","_cityTypes","_randomLoc","_x","_cities"];
_cities = [];
_locations = configfile >> "CfgWorlds" >> worldName >> "Names";
_cityTypes = ["NameVillage","NameCity","NameCityCapital","NameLocal"];
for "_x" from 0 to (count _locations - 1) do {
_randomLoc = _locations select _x;
private["_cityPos","_cityType"];
_cityPos = getArray(_randomLoc >> "position");
_cityType = getText(_randomLoc >> "type");
if (_cityType in _cityTypes) then {
_cities pushback [_cityPos];
};
};
{_cities pushback (getmarkerpos _x)} foreach INS_CTPMARKERS;
_cities;
};
/////////////////////////////////////////////////////////////////////
/*
Author:
Hazey - Main loop for the prayer.
______________________________________________________*/
CalltoPrayer_fnc_prayerLoop = {
[] spawn {
private ["_fnc_between","_fnc_prayer"];
_fnc_between = {
private ["_a","_b"];
_a = _this select 0;
_b = _this select 1;
(daytime >= _a AND daytime < _b)
};
_fnc_prayer = {
{
[_x, "prayer"] call CBA_fnc_globalSay3d;
} foreach CalltoPrayerLoudspeakers;
};
waitUntil {
{
if (_x call _fnc_between) exitwith {
_x call _fnc_prayer;
};
} foreach [[3.30,3.40],[5.00,5.05],[11.51,11.58],[15.35,15.42],[18.40,18.48],[20.10,20.28]]; ////updated for adhan times relevant to mission date
sleep 160;
false;
};
};
};
Aaaand the init.sqf inside the CalltoPrayer folder:
if (!isServer) exitWith {};
_CalltoPrayerDebug = false;
_functions = execVM "CallToPrayer\functions.sqf";
waitUntil {scriptDone _functions};
//-- Get cities
_cities = [] call CalltoPrayer_fnc_getCities;
CalltoPrayerLoudspeakers = [];
{
_spawnPos = [_x select 0, 20,50,3,0,0,0] call BIS_fnc_findSafePos;
_pole = "Land_Loudspeakers_F" createVehicle _spawnPos;
CalltoPrayerLoudspeakers pushBack _pole;
if (_CalltoPrayerDebug) then {
_n = format["%1", floor (random 1000)];
_marker = createMarker [_n, _spawnPos];
_marker setMarkerShape "ICON";
_marker setMarkerType "mil_dot";
_marker setMarkerText "Spawn Pos";
};
} forEach _cities;
[] call CalltoPrayer_fnc_prayerLoop;
Finally, I added a few markers to the mission with the relevant names.
To me, this all looks good and it does spawn loudspeakers but the lack of sounds is puzzling. Any thoughts?