Call to prayer script for mission makers (marker version)

  1. 9 years ago
    Edited 9 years ago by incontinenetia

    UPDATE: Here is the script.

    Call to Prayer - Marker version
    -------------------

    This script will add loudspeakers near user-placed markers which will play an Islamic Call to Prayer (adhan) at certain times of day (defined in the call to prayer loop in functions.sqf - by default these are based on May 2016 in Kabul). It will work on any map and allows the mission maker to define certain locations on a map to play the adhan, as opposed to the automatic script that detects towns and places louspeakers near the centre. The mission.sqm has markers placed at appropriate (ish) locations on FATA and these are defined in the init.sqf in the mission root, but these can be adapted to your needs.

    INSTRUCTIONS

    Step 1: Place the CalltoPrayer folder in the root of your mission folder. Place empty icon markers (not shape / area markers) on the map in the areas you want Call to Prayer loudspeakers to spawn. The loudspeakers will spawn fairly close to the markers so if you want them to sound like they are coming from a particular building, this is possible by placing the marker over that building. A loudspeaker will be spawned nearby. Name those markers something simple like CTP1, CTP2, CTP3 etc.

    Step 2: Then add these lines to the init.sqf file in the mission root folder (IMPORTANT: they must go at the very top or the script may not work):

    //--------------call to prayer------------------------------------------

    INS_CTPMARKERS = ["CTP1","CTP2","CTP3","CTP4","CTP5","CTP6","CTP7","CTP8","CTP9","CTP10","CTP11","CTP12"];  // marker names in this array will be picked up by the call to prayer script adn can be changed according to preference (eg INS_CTPMARKERS = ["MyMarker1","MyMarker2","MyMarker3"])
    
    call compile preprocessFile "CallToPrayer\init.sqf"; //this executes the Call to Prayer script

    Step 3: Finally, add this to your description.ext:

    //----------------------Call to Prayer------------------------
    //This adds the sound config entries for the call to prayer script
    
    class CfgSounds {
    	sounds[] = {prayer};
    	class prayer {
    		name = "prayer";
    		sound[] = {"CalltoPrayer\sounds\prayer.ogg", db+10, 1};
    		titles[] = {};
    	};
    };

    Credits
    -----------
    Hazey and Sacha for writing the initial functions, SpyderBlack723 for adapting the scripts for use on FATA.

  2. I've got one. I've also created an entire Middle East ambient sound suite that I'm debating posting here and on the BI forums for community use.

    I've also got an African sounds suite as well.

  3. That sounds brilliant! Any chance I could ask you for a copy? It's for private missions that will likely never be released publicly (certainly not without prior consent) and I'm more than happy to adhere to any terms you have!

  4. I'll more than likely post my templates today or tomorrow

  5. Awesome, good to hear. Thanks.

  6. You can grab the one I'm using from the mission I just posted in the Missions Template section if you want.

    It works on every single map I've ever tested it on, and it works brilliantly. Except for FATA. I have no idea why FATA is immune to it.

  7. @AUTigerGrad I'll more than likely post my templates today or tomorrow

    Yes! :)

  8. @HeroesandvillainsOS  You can grab the one I'm using from the mission I just posted in the Missions Template section if you want.

    It works on every single map I've ever tested it on, and it works brilliantly. Except for FATA. I have no idea why FATA is immune to it.

    Aaaaah!! My mission is using FATA! Cheers though Heroes.

  9. Tupolov

    9 Feb 2016 Administrator

    We could easily add them to the ambient civilian module :D

  10. @Tupolov We could easily add them to the ambient civilian module :D

    Yes please. :)

    A lot of cool things ALiVE related are being posted or proposed today. It's a good day.

  11. Edited 9 years ago by HeroesandvillainsOS

    @incontinenetia Aaaaah!! My mission is using FATA! Cheers though Heroes.

    I've got 5 mission templates right now and it just doesn't seem to work only on FATA. Don't discount the possibility that I could have messed it up on FATA though! Try it. An 80% success rate even when I know I'm doing something correctly sounds about right for me. :(

  12. added as a feature request!

    https://github.com/ALiVEmod/alive/issues/183

  13. @Tupolov We could easily add them to the ambient civilian module :D

    Sure thing Tupolov. I'm working on an Eastern Europen suite as well. When I post them I'll make sure to post a YouTube vid of them in action. Using them in conjunction with Alive and Spyder's ambient traffic really adds a great deal of immersion to the environment.

  14. ALiVE has blown me away in recent months. Granted I always thought it was cool but this community has absolutely nailed it down. By far one of the most helpful and productive communities I've come across online. And now with the 1.0 release, things can only get better. Cheers everyone! You're all legends.

    @HeroesandvillainsOS , you are right about FATA, it doesn't work for some reason!

  15. @incontinenetia ALiVE has blown me away in recent months. Granted I always thought it was cool but this community has absolutely nailed it down. By far one of the most helpful and productive communities I've come across online. And now with the 1.0 release, things can only get better. Cheers everyone! You're all legends.

    @HeroesandvillainsOS , you are right about FATA, it doesn't work for some reason!

    100% success rate on something baby! I'm back! :)

  16. Edited 9 years ago by SpyderBlack723

    It doesn't work on FATA because the map author did not include map locations, which it uses to determine where to place the CTP loudspeakers. If you guys really want to use it on FATA I can look to try and update it to work somehow in the future.

    A lot of cool things ALiVE related are being posted or proposed today. It's a good day.

    You could say, the community is ALiVE today .. no? .. anyone? alright

  17. Edited 9 years ago by AUTigerGrad

    Here's a demo of my ambient sounds pack in action on a typical patrol through an Afghan city.

    I'll try and get these up along with my African pack in the next couple of days.

  18. Here's a demo of my ambient sounds pack in action on a typical patrol through an Afghan city.

    I'll try and get these up along with my African pack in the next couple of days.

    This is really impressive. Is it dynamic or set up by the mission editor?

    @SpyderBlack723 You could say, the community is ALiVE today .. no? .. anyone? alright

    Keep at it Spyder! Don't let them bring you down!

  19. Set up in the editor....I have templates built that populate heavy civilian areas with the sounds. I also have news/radio in remote villages as well.

  20. Dynamic is the next step ;)

  21. 9 years ago
    Deleted 9 years ago by incontinenetia
  22. So. I am using the Call to Prayer file and scripting from @HeroesandvillainsOS mission. I have it working in one mission that I have moved from because of of other issues.
    I have found a mission that I am attempting to modify for my unit's private play and would like to use the Call there also.

    I am attempting to put the scripting code into my description.ext file, but there is already a ClassCfg Sounds entry.
    When I put the code for the Call to Prayer script in, I get an error.

    Can someone show me what I need to do or remove to get this working?
    Here is what I need to insert

    class CfgSounds {
    	sounds[] = {prayer};
    	class prayer {
    		name = "prayer";
    		sound[] = {"CalltoPrayer\sounds\prayer.ogg", db+1, 1};
    		titles[] = {};
    	};
    };

    after

    class CfgSounds {
    	sounds[] = {Vent,Vent2,Para};	
    	// ATM AirDrop
    	class Vent {name="Vent";sound[]={"ATM_airdrop\data\Vent.ogg",db-11,1.0};titles[] = {};};
    	class Vent2 {name="Vent2";sound[]={"ATM_airdrop\data\Vent2.ogg",db-11,1.0};titles[] = {};};
    	class Para {name ="Para";sound[]={"ATM_airdrop\data\parachute.ogg",db-11,1.0};titles[] = {};};	
    };

    Thanks for any help!

  23. What does the error say?

  24. error is as follows [directory]\description.ext, line 53: .CfgSounds: Member already defined.

  25. I wonder if you combined the scripts if it would work? What's line 53 in your description.ext? If you have notepad++ it will tell you your lines.

  26. Edited 9 years ago by HeroesandvillainsOS
    class CfgSounds {
    	sounds[] = {prayer};
    	class prayer {
    		name = "prayer";
    		sound[] = {"CalltoPrayer\sounds\prayer.ogg", db+1, 1};
    		titles[] = {};
    	};
    	sounds[] = {Vent,Vent2,Para};	
    	// ATM AirDrop
    	class Vent {name="Vent";sound[]={"ATM_airdrop\data\Vent.ogg",db-11,1.0};titles[] = {};};
    	class Vent2 {name="Vent2";sound[]={"ATM_airdrop\data\Vent2.ogg",db-11,1.0};titles[] = {};};
    	class Para {name ="Para";sound[]={"ATM_airdrop\data\parachute.ogg",db-11,1.0};titles[] = {};};	
    };

    Or something like that? Long shot but I'd do a backup and try it until a scripter gets in here. :)

  27. Deleted 9 years ago by incontinenetia
  28. @HeroesandvillainsOS  class CfgSounds { sounds[] = {prayer}; class prayer { name = "prayer"; sound[] = {"CalltoPrayer\sounds\prayer.ogg", db+1, 1}; titles[] = {}; }; sounds[] = {Vent,Vent2,Para}; // ATM AirDrop class Vent {name="Vent";sound[]={"ATM_airdrop\data\Vent.ogg",db-11,1.0};titles[] = {};}; class Vent2 {name="Vent2";sound[]={"ATM_airdrop\data\Vent2.ogg",db-11,1.0};titles[] = {};}; class Para {name ="Para";sound[]={"ATM_airdrop\data\parachute.ogg",db-11,1.0};titles[] = {};}; };

    Or something like that? Long shot but I'd do a backup and try it until a scripter gets in here. :)

    That should work I think, all you're doing is defining the sounds so this combination should be fine..

  29. Yeah, for missions, you cannot double-define config entries such as CfgSounds and CfgFunctions. You will have to combine the entries.

    class CfgSounds {
    	sounds[] = {prayer,Vent,Vent2,Para};
    
    	//-- Call to prayer
    	class prayer {
    		name = "prayer";
    		sound[] = {"CalltoPrayer\sounds\prayer.ogg", db+1, 1};
    		titles[] = {};
    	};
    
    	// ATM AirDrop
    	class Vent {name="Vent";sound[]={"ATM_airdrop\data\Vent.ogg",db-11,1.0};titles[] = {};};
    	class Vent2 {name="Vent2";sound[]={"ATM_airdrop\data\Vent2.ogg",db-11,1.0};titles[] = {};};
    	class Para {name ="Para";sound[]={"ATM_airdrop\data\parachute.ogg",db-11,1.0};titles[] = {};};	
    };
  30. Edited 9 years ago by HeroesandvillainsOS

    Ah! Cool. So not just sort of combined but REALLY combined, I see. This doesn't bode well for me to getting Autigergrad's sound pack working with the Call to Prayer script. :(

    I'll have to ask AA to share his description.ext. :)

  31. Thanks for the help guys! Great community here.

  32. @HeroesandvillainsOS  Ah! Cool. So not just sort of combined but REALLY combined, I see. This doesn't bode well for me to getting Autigergrad's sound pack working with the Call to Prayer script. :(

    I'll have to ask AA to share his description.ext. :)

    It works fine.

    My sounds are defined as sfx sounds, Call to prayer is defined as actual "sound", two completely different categories.

    Look at the Description.ext I provided in my ambient sounds pack. all you have to do is copy and paste the description.ext with the call to Prayer add on into that same description.ext so you'll have both the cfg SFX and cfg Sounds in one description.ext. That's it. You'll also want to make sure the actual sounds are in the mission as well of course.

  33. @AUTigerGrad It works fine.

    My sounds are defined as sfx sounds, Call to prayer is defined as actual "sound", two completely different categories.

    Look at the Description.ext I provided in my ambient sounds pack. all you have to do is copy and paste the description.ext with the call to Prayer add on into that same description.ext so you'll have both the cfg SFX and cfg Sounds in one description.ext. That's it. You'll also want to make sure the actual sounds are in the mission as well of course.

    Oh ok. So in this instance I can have their respective entries written individually in the description.ext I take it then? That's good. The easier the better. :)

  34. Edited 9 years ago by AUTigerGrad

    My sounds are 3D sounds...they are not Cfg Sounds. I'm not staring at my description.ext right now but I think it's CFG sfx or something like that.

    You're just pasting on the Cfg sounds portion for the call to prayer to the Cfg SFX. Should work fine.

  35. If it looks different than this:

    class CfgSounds {
    	sounds[] = {prayer};
    	class prayer {
    		name = "prayer";
    		sound[] = {"CalltoPrayer\sounds\prayer.ogg", db+1, 1};
    		titles[] = {};
    	};
    
    *Your sounds pack stuff here

    So like literally just placing them back to back like any other description.ext entry, could you post your description.ext back here?

  36. Correct. Back to back

  37. Anybody know how to alter the following script to only pick up designated markers or gamelogics?
    (This is the modified function originally written by Sacha, extracted from ALiVE Insurgency redux).

    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;
    };

    Hoping to get the call to prayer working on FATA by getting this script to return marker positions set on minarets (which I will make a template for). Or alternatively, is there an easy way to make this return minaret locations (configfile >> "CfgVehicles" >> "CUP_A2_minaret_ep1")?

  38. Edited 9 years ago by SpyderBlack723

    Replace your CallToPrayer\init.sqf file with this code

    if !(isServer) exitWith {};
    
    _CalltoPrayerDebug = false;
    _functions = execVM "CallToPrayer\functions.sqf";
    waitUntil {scriptDone _functions};
    
    //-- Get cities
    _cities = [] call CalltoPrayer_fnc_getCities;
    
    CalltoPrayerLoudspeakers = [];
    {
    	_cityPos = _x select 0;
    
    	{
    		_pole = "Land_Loudspeakers_F" createVehicle (getPosATL _x);
    		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 "CTP loudspeaker";
    		};
    	} foreach (nearestobjects [_cityPos, INS_CTPLOCATIONS, 600]);
    } forEach _cities;
    
    [] call CalltoPrayer_fnc_prayerLoop;

    And then in your standard init.sqf (one that is executed automatically in each mission), simply define
    INS_CTPLOCATIONS = ["CUP_A2_minaret_ep1"];

  39. Damn, just forgot FATA has no cities defined.. I'll make another modification real quick

  40. Edited 9 years ago by SpyderBlack723

    Ok, then just replace the function you posted with this

    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;
    };

    Then place markers (icons, not rectangles/ellipses) on each of the cities that you want CTP to look for nearby INS_CTPLOCATIONS. After that, go back to your init.sqf where you defined INS_CTPLOCATIONS and define

    INS_CTPMARKERS = ["markername1","markername2","markername3"];

    Remember to put quotes around each marker name and separate them with a comma.

    Another quick thing to keep in mind, define these INS_x variables BEFORE you call the initialization function.

    So, to be safe, define these variables at the very top of your init.sqf

  41. Newer ›
 

or Sign Up to reply!