Jump to content
SchwEde

Schwede's improved Flashlighst

Recommended Posts

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Schwede's improved Flashlighst <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

 
What it does?
 
It simply add a bit more light to your surrounding so flashlights are more effective then they are by default.
 
Screenshot:
 
qxqxhezq.jpg
 
How it works:
 
This Scripts is completly local and is not visible by other players, since the light of the flashlight should be enough attraction for them.
 
How to install
 
You need to make changes in:
 
init.sqf
variables.sqf
compiles.sqf
dayz_spaceInterrupt.sqf
 
first we make our new file called: flashlight.sqf
 
and paste this in there and place it somewhere you like:

/**
Schwedes Flashlight improvement
**/

Private ["_num","_light","_type"];
_type = _this select 0;


switch (_type) do {
		case 0: {
			_light = "#lightpoint" createVehicleLocal (getPosATL player);
			_light setLightBrightness 0.01;
			systemChat format['currentWeapon player: %1',(currentWeapon player)];
			if ((currentWeapon player) == "MeleeFlashlightRed") then {
			_light setLightColor [0.5,0,0];
			_light setLightAmbient [0.2,0.01,0.01];
			} else {
			_light setLightAmbient[.9, .9, .6];
			_light setLightColor[.9, .9, .6];
			};
			_light lightAttachObject [player, [0.1,2,0.5]];
		};
		case 1: {
					player action ["GunLightOff", player];
					_light = nearestObject [player, "#lightpoint"];
					deleteVehicle _light;
					Schwede_flashlicht = false;
		};
	};

Next we create another file called and place it somewhere you like: lightcheck.sqf
 
and paste this in there:

/**
Schwedes Flashlight improvement
Light Check
**/
Private ["_light"];

	waitUntil {!isNull (findDisplay 46)}; //making sure player is spawned
		while {true} do {
			
			waitUntil {Schwede_flashlicht};
			if !((currentWeapon player) in Schwede_FlashlightWeapons) then {
			
					player action ["GunLightOff", player];
					_light = nearestObject [player, "#lightpoint"];
					deleteVehicle _light;
					Schwede_flashlicht = false;

			};
			sleep 0.1;
		};

Time to make this thing to work:
 
variables.sqf:

 

search for

// DayZ Epoch Client only variables

and add right after:
 

	if(isNil "Schwedes_flashlicht") then {
		Schwedes_flashlicht = false;
	};

search for 

if(!isDedicated) then {

and place this somewhere in this area:
 

Schwede_FlashlightWeapons = ["M4A3_CCO_EP1","SCAR_L_CQC_Holo","SCAR_H_CQC_CCO","MeleeFlashlight","MeleeFlashlightRed"]; //This array wants to be filled with weapons with flashlights

compiles.sqf
 
 
 
add this



Schwedes_flashlight = compile preprocessFileLineNumbers "PathTo\flashlight.sqf";

to the if(!isDedicated) then { area
 
dayz_spaceInterrupt.sqf
 
place this somewhere in it:

//flashlight
if (_dikCode in actionKeys "Headlights" && ((currentWeapon player) in Schwede_FlashlightWeapons) && ((vehicle player) == player)) then {
	if (Schwedes_flashlicht) then {
			Schwedes_flashlicht= false;
			_id = [1] spawn Schwedes_flashlight;
		} else {
			Schwedes_flashlicht= true;
			_id = [0] spawn Schwedes_flashlight;
		};
};

init.sqf
 
add this
 




[] execVM "PathTo\lightcheck.sqf";

to the if(!isDedicated) then { area
 
Save everything and load up everything.
 
 
Suggestions? Post them here
 
Like my work? why not spend me a beer then ;D Link in my Sig :)

Share this post


Link to post
Share on other sites
Guest   
Guest

I don't get this:

//flashlight
if (_dikCode in actionKeys "Headlights" && ((currentWeapon player) in Schwede_FlashlightWeapons) && ((vehicle player) == player)) then {
	if (Schwedes_flashlicht) then {
			Schwedes_flashlicht= false;
			_id = [1] spawn Schwedes_flashlight;
		} else {
			Schwedes_flashlicht= true;
			_id = [0] spawn Schwedes_flashlight;
		};
};

If schwedes licht is true, then... Where do you define Schwedes Licht, so that script knows if that's true or not?

Share this post


Link to post
Share on other sites

oh you are right i forgot the step with the isNil part to the variables.sqf ^^"
whopsie
 
Post #1 updated
 
search for:
variables.sqf

// DayZ Epoch Client only variables

and add right after:
 

	if(isNil "Schwedes_flashlicht") then {
		Schwedes_flashlicht = false;
	};

Share this post


Link to post
Share on other sites
Guest   
Guest

Noch was (sorry, will deine Arbeit nicht schlecht machen):

_id = [0] spawn Schwedes_flashlight;

 

Schwede_flashlight = compile preprocessFileLineNumbers "PathTo\flashlight.sqf";

 

 

Die Function die du aufrufen willst existiert nicht, weil du ein "S" vergessen hast :)

Share this post


Link to post
Share on other sites

Client RPT Errors:

File mpmissions\__CUR_MP.Napf\custom\flashlight\lightcheck.sqf, line 6
Error in expression <ay 46)}; 
while {true} do {

waitUntil {Schwede_flashlicht};
if !((currentWeapon>
  Error position: <Schwede_flashlicht};
if !((currentWeapon>
  Error Undefined variable in expression: schwede_flashlicht
File mpmissions\__CUR_MP.Napf\custom\flashlight\lightcheck.sqf, line 6

To fix this error add second variable (near first) in variables.sqf.It looks like this:

if(isNil "Schwedes_flashlicht") then {
        Schwedes_flashlicht = false;
    };
    if(isNil "schwede_flashlicht") then {
        schwede_flashlicht = false;
    };

Share this post


Link to post
Share on other sites

Should this work fine with Overpoch? Seems like I had it working on Epoch then changed my client server to overpoch and it doesn't work anymore.

 

There's no reason this shouldn't work on Overpoch. Double check to be sure that you didn't replace any of the files required for this script with the same files when installing Overpoch.

Share this post


Link to post
Share on other sites

Just installed this script and I found a bug. If you have your flashlight on and you switch weapons, there's still an ambient glow, which is basically the effect that this script adds to the flashlight to make it brighter. See these screenshots for a better explanation.

 

 

Flashlight turned on. You see the ambient light effect here.
 
zIDJb8.jpg
 
Flashlight left on, switched weapons. You still see the ambient light.
 
lKs0Le.jpg
 
Flashlight turned off, no ambient light.
 
b5NdAt.jpg
 
Switched to weapon, after flashlight was turned off, still no ambient light.
 
vLzNOg.jpg

Share this post


Link to post
Share on other sites

 

Just installed this script and I found a bug. If you have your flashlight on and you switch weapons, there's still an ambient glow, which is basically the effect that this script adds to the flashlight to make it brighter. See these screenshots for a better explanation.

 

 

Flashlight turned on. You see the ambient light effect here.
 
zIDJb8.jpg
 
Flashlight left on, switched weapons. You still see the ambient light.
 
lKs0Le.jpg
 
Flashlight turned off, no ambient light.
 
b5NdAt.jpg
 
Switched to weapon, after flashlight was turned off, still no ambient light.
 
vLzNOg.jpg

 

I saw this last night as well.

Share this post


Link to post
Share on other sites

Ok, figured out what was causing the problem with the flashlight not working. I installed Advanced Alchemical Crafting v3.3 and the Crafting_Compiles was conflicting with the dayz_spaceinterrupt. i used diffmerge to merge the two and now it works fine.

 

I need to find out how to make the "F" key make the object stay still though for Advanced Alchemical Crafting v3.3. Haven't checked the forums yet, but if anyone can save me some time I would appreciate it. ;-)

 

Thanks for making me take another look BetterDeadThanZed. Appreciate it!!

Share this post


Link to post
Share on other sites

 

Just installed this script and I found a bug. If you have your flashlight on and you switch weapons, there's still an ambient glow, which is basically the effect that this script adds to the flashlight to make it brighter. See these screenshots for a better explanation.

 

 

Flashlight turned on. You see the ambient light effect here.
 
zIDJb8.jpg
 
Flashlight left on, switched weapons. You still see the ambient light.
 
lKs0Le.jpg
 
Flashlight turned off, no ambient light.
 
b5NdAt.jpg
 
Switched to weapon, after flashlight was turned off, still no ambient light.
 
vLzNOg.jpg

 

 

Anyone have a solution for this yet?

Share this post


Link to post
Share on other sites

It would be great to also see the other players' light, so when you're in a group and only one haves a flashlight, you get to use it properly... maybe the other ones struggling to meele the zedz...

Share this post


Link to post
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


  • Advertisement
  • Donation Box

    Please donate to support the community.
    We appreciate all donations!
  • Advertisement
  • Supporters
  • Latest Donations

  • Advertisement
  • Discord

×