Jump to content

Recommended Posts

Let me firstly say this work has been heavily inspired and predicated on the post "Simple Call to Prayer" and "Takistan Insurgency""".

 

So, I have a mission (rather a few mission templates) set in the "middle eastern" region maps from CUP etc... My objective is to have non mod dependent CTP experience that is also simple and lightweight. I have been mildly successful in following the Simple Call to Prayer post mentioned above. In my mission I have a trigger that runs at certain times similar to the afore mentioned post.

 

Trigger Onact
 

Spoiler

execVM "CTP.sqf"

 

description.ext

Spoiler

overviewPicture = "56RDFlag.jpg";
respawnOnStart = -1;
respawn = "BASE";
respawnDelay = 3;
respawnDialog = 0;
overviewText = "DUO BLUFOR TAKISTAN";
author = "COCKHEAVEN";
onLoadName = "DUO BLUFOR TAKISTAN";
loadScreen = "56RDFlag.jpg";
onLoadMission = "DUO BLUFOR TAKISTAN";

class CfgSounds 
{
	Sounds[] = {CK_Call1,CK_Call2,CK_Call3}; 

		class CK_Call1
	{

	name     = "CK_Call1"; 
	sound[]  = {"Sounds\CK_Call1.ogg", 15, 1, 100};
	titles[] = {0,""};
	soundLength = 186; 

	};
		class CK_Call2 
	{

	name     = "CK_Call2"; 
	sound[]  = {"Sounds\CK_Call2.ogg", 15, 1, 100};
	titles[] = {0,""};
	soundLength = 196; 

	};
		class CK_Call3 
	{

	name     = "CK_Call3"; 
	sound[]  = {"Sounds\CK_Call3.ogg", 15, 1, 100};
	titles[] = {0,""};
	soundLength = 227; 

	};
};

 


CTP.sqf

Spoiler

_Speakers = [Speaker1_1,Speaker1_2,Speaker1_3,Speaker1_4,Speaker1_5,Speaker1_6,Speaker1_7,Speaker1_8,Speaker1_9,Speaker1_10,Speaker1_11,Speaker1_12,Speaker1_13,Speaker1_14,Speaker1_15,Speaker1_16,Speaker1_17,Speaker1_18,Speaker1_19];//array of your speakers
{
_x say3d ["CK_Call2", 800, 1];
} foreach _Speakers;// make all of your speakers play sound listed dont need 19 speakers but speakers must start at 1_1 and incriment by 1 for each speaker on the map



if (isServer) then {
  CK_Civs = [];// empty for civs
  CK_rugs = [];// empty for CK_rugs
{
	if ((side _x) == civilian) then {
		CK_Civs pushBack _x
	}// find all civs put them in array
} forEach allUnits;// search in allunits
{
	_rug = createVehicle[(selectRandom ["Land_Carpet_EP1","Land_Rug_01_Traditional_F","Land_Rug_01_F"]), (getpos _x), [], 0, "CAN_COLLIDE"];// create rug for each civ
	_x setDir 90; // set civ facing east
	_x setFormDir 90; // because in arma you need mutlitple stupid f****** commands for the same thing!
	_rug setDir 90; // set rug facing east
	CK_rugs pushBack _rug;
	_x disableAI "PATH"; // stop
	_x disableAI "MOVE"; // stop
} forEach CK_Civs;// run for all civs
};
_limit = 5; // define loop limit
_num = 0; // define loop init
while {(_num) < (_limit)} do {
	{
	_x setUnitPos "DOWN";
	} forEach CK_Civs; // up downs for civs
	uisleep 2;
	{
	_x setUnitPos "UP";
	} forEach CK_Civs; // up downs for civs
	uisleep 2;
	_num = _num + 1; // counting is fun
	};
{
	_x enableAI "PATH"; // start
	_x enableAI "MOVE"; // start
	_x setUnitPos "AUTO";
} forEach CK_Civs;// run for all civs

{
	deleteVehicle _x;
} forEach CK_rugs;

 


Only two minor problems I'm having. Firstly only the sound defined as CK_Call2 will play for its entire duration, I have tried playing CK_Call1 and CK_Call3 but they each stop playing after about 3 seconds. Secondly on the server the civs rotate 90 degrees but then rotate freely, the rugs create and orient perfectly but the civies do not do up-downs and the rugs all delete after the loop finishes.... So basically I'm stuck with 1 sound file that plays and civies that just stand there on top of their carpets facing random directions, I guess its a locality thing but I don't really understand that stuff yet......

 

 

Share this post


Link to post
Share on other sites

My workaround for the sound is to say3D it from an invisible helipad (or whatever) created on the minaret pos, then delete the sound when the sound ends (I sleep for the duration of the sound, but recommend adding an extra couple seconds just to be safe).

 

Deleting the helipad playing the CTP will abruptly end the sound as well. The civs may be rotating because they want to move somewhere else, try adding disableAI"move" to each AI.

  • Thanks 1

Share this post


Link to post
Share on other sites

@phronk Thanks for the input. As it stands all of the Say3d is played from minarets placed via editor. Also I have _x disableAI "PATH" and _x disableAI "MOVE" in my foreach refrencing CK_Civs which is the array of my civies….. so it should already be disableAI to each AI...

Share this post


Link to post
Share on other sites

What I've discovered when doing my own version is that the sound actually only begins when the player enters about 500m radius of the sound. Even if it the code played the sound 20 minutes ago, if the player only reaches it then, it will begin (For him, locally) when he gets around that distance of the sound source. This is why I use temporary invisible helipads and delete them; if you kill/delete the object playing the sound, it ends globally.

 

Also, your setDir issue may be a locality issue. If the code runs on all clients, then the setDir will multiply. If it runs only server side, it should fix it, you'll just have to remoteExec the animations and sound(s).

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×