Jump to content

Scare your players


Recommended Posts

Don´t Work Go To post #8 

 

Scare your players with this little script

 

 

 

1.

Make a file and call it monster.sqf

private["_rand_player","_chance","_spawnroll"];

///////////////////Config////////////////////////////
_chance	= 33; // Percent chance 0 - 100 ////////////
/////////////////////////////////////////////////////

_rand_player    = playableUnits call BIS_fnc_selectRandom;
_spawnRoll		= round(random 100);

if (_spawnRoll <= _chance) then{

	if((isPlayer _rand_player) && (alive _rand_player)) then {

		playSound "monster";
                sleep 5;
        };
};
 

and place it in the modules folder in your dayz_server.pbo

 

 

 

2.

In your Init.sqf in your mission folder (DayZ_Epoch_XX.XXXXX)

 

find EpochEvents

 

and add 

               ["any","any","any","any",33,"monster"]

EpochEvents = [["any","any","any","any",10,"Military"], ["any","any","any","any",34,"monster"],["any","any","any","any",25,"Treasure"], ["any","any","any","any",15,"Supplyitems"]];

3.

 

Add this to the description.ext file

class CfgSounds
{
    sounds[] = 
	{
          monster
        };
class monster
	{
	name="monster";
	sound[]={monster.ogg,0.3,1};
	titles[] = {};
	};
};

just before

         class RscLoadingText : RscText

 

4.

unzip the attach file and put it in your mission folder (DayZ_Epoch_XX.XXXXX)

 

All Done

 

Come and vissit my Chuck Norris approved server

ip: 5.103.68.98

Port 2302

monster.zip

Link to comment
Share on other sites

i dont think that will work when he is running this serverside, he would need to use a publicvariable then ...

 

oh yes, I forgot about that. But with public variable, how do you make it local? 

 

I would just suggest using a client side script.

Link to comment
Share on other sites

Why not leverage object_speak.sqf already used for playing sounds in A2 Epoch.

 

It will accept

_unit
_type
_chance
_dis (distance) 

 

and is called with (for example)

[player,"tentpack",0,false] call dayz_zombieSpeak;

If you have a process running on the server which 'selects' a player then it can calls it with a 100% chance.  If any units in range are non local (to the server) it will fire a RE: to play the sound on the other players clients so everyone in the area gets the sound.

 

Now, _unit need not be an actual player but could be some coords [x,y,z] so the sound could be played to anyone in range of a specific place.

 

Wolf howl in the center of a dark forest, for example, for anyone close to hear.

 

Detail on the RE (Remote Execution) framework can also be found here if you are interested.

 

If the mechanisum is already there, why not use it.

Link to comment
Share on other sites

1.

Make a file and call it monster.sqf

private["_rand_player","_chance","_spawnroll"];

///////////////////Config////////////////////////////
_chance	= 33; // Percent chance 0 - 100 ////////////
/////////////////////////////////////////////////////

_rand_player    = playableUnits call BIS_fnc_selectRandom;
_spawnRoll		= round(random 100);

if (_spawnRoll <= _chance) then{

	if((isPlayer _rand_player) && (alive _rand_player)) then {

		playSound "monster";
                sleep 5;
        };
};

and place it in your custom folder.

 

2.

 

copy your

 

                local_lockUnlock.sqf

 

from your Dayz_code.pbo to your costum folder in your mission folder (DayZ_Epoch_XX.XXXXX)

 

3.

add

     

        [] execVM "custom\monster.sqf"

 

to the local_lockUnlock.sqf

 

so it looks like this

private ["_vehicle","_status"];
_vehicle = _this select 0;
_status = _this select 1;

if (local _vehicle) then {
	if(_status) then {
		_vehicle setVehicleLock "LOCKED";
                [] execVM "custom\monster.sqf"

} else {
		_vehicle setVehicleLock "UNLOCKED";
	};
};

4.

 

in your compiles.sqf find

 

          local_lockUnlock = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lockUnlock.sqf";

 

and change the hole line to

 

         local_lockUnlock = compile preprocessFileLineNumbers "custom\local_lockUnlock.sqf";

 

5.

 

Add this to the description.ext file

class CfgSounds
{
    sounds[] = 
	{
          monster
        };
class monster
	{
	name="monster";
	sound[]={monster.ogg,0.3,1};
	titles[] = {};
	};
};

just before

         class RscLoadingText : RscText

 

4.

unzip the attach file (from my first post) and put it in your mission folder (DayZ_Epoch_XX.XXXXX)

 

Dont know if this is the perfect way but it works  :)

Link to comment
Share on other sites

 

Dont know if this is the perfect way but it works  :)

 

better than having the server do it imho ...

 

else it will just generate a bunch of unneeded and unwanted network traffic slowing down the overall performance of connection and server ... it was like going around the moon to reach the bakery down the street.

Link to comment
Share on other sites

When or where is this suppose to work in game??
 
what do i do with sounds[]={monster}; what i mean is what about all the other sounds i have. they have been working with just sounds[]={}; with nothing in the {};
Should i put each class behind monster like monster, DoorCreak, and so on? 
My question may be clear as mud, so if you need more information, let me know.
The following are my sounds
 
class CfgSounds
{
    sounds[] = 
{
          
        };
 
 
class DoorCreak
    {
name="DoorCreak";
sound[]={sounds\doorCreak.ogg, 0.1, 1};
titles[] = {};
    };
class metalGates
    {
name="metalGates";
sound[]={sounds\metalGates.ogg, 0.1, 1};
titles[] = {};
    };
class stronghold
{
name = "stronghold";
sound[] = {sounds\vrata_sound.ogg,0.1,1};
titles[] = {};
    };
class vendingmachine
    {
    name="vendingmachine";
    sound[]={Vending\vendingmachine.ogg,0.9,1};
    titles[] = {};
};
 
};
Link to comment
Share on other sites

  • 2 months later...

Can anyone please tell how to make it so the monster sound is heard by other players as well?

 

You would need to send the event to all players which then play the sound localy. 

 

Unnecessary trafic in my opinion though.

Link to comment
Share on other sites

Damn .... I know the carlock sound script plays the sound so that everyone can hear it. I thought it might be an easy fix :(

 

It's not hard. And don't call it a 'fix'. Extra 'feature' is more the word for this. 

 

Fixes sound like the scripter broke the script. Which is 80% of the cases just installation mistakes if the installer says it in a forum post :p

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...