Jump to content
Sign in to follow this  
Icaruk

There is any way to emulate a flashlight without using a flashlight?

Recommended Posts

Example, using this light:

asd = "#lightpoint" createVehicle position player;
asd setLightBrightness 0.3;
asd setLightAmbient[ 1.0, 1.0, 1.0];
asd setLightColor [1.0, 1.0, 1.0];
asd lightAttachObject [player, [0, 0, 0]];

How I can make this light to iluminate the way I'm facing instead sticking to me?

Share this post


Link to post
Share on other sites

I am trying to include a handheld flashlight feature in my missions and I am wondering about the same question here.

Share this post


Link to post
Share on other sites

That [0, 0, 0] part after lightAttachObject is the relative position to the player. I think if you set it to something like [0, 5, 0], the light spot should always be 5m in front of the player. (Or perhaps -5 instead of 5, I can't test right now.)

The problem is it won't raise or lower if you look up or down, and it won't be blocked by walls, similar to normal lights.

Share this post


Link to post
Share on other sites

I had this in my arma2 Stuff, I have no evidence of who scripts these were. I haven't tried this in A3, it's more for showing how to turn on and off a flashlight, not for creating the light source, that has changed quite abit from A2 in my limited experience.

init.sqf

player setVariable ["lightIsOn", false];

fnc_turnLightOn = {
light1 = "#lightpoint" createVehicleLocal [0,0,0];
light1 setLightBrightness 0.02;
light1 setLightAmbient [0.2,0.2,0.2];
light1 setLightColor [2,2,2.2];
light1 lightAttachObject [m1,[0,+4.7,+1]];
};

fnc_turnLightOff = {
deleteVehicle light1;
};

onKeyPress = compile preprocessFile "keypressed.sqf";
waituntil {!(IsNull (findDisplay 46))};
(findDisplay 46) displaySetEventHandler ["KeyDown", "_this call onKeyPress"];

flashlight.sqf

if (player getVariable "lightIsOn") then { 
[] call fnc_turnLightOff; player setVariable ["lightIsOn", false];
} else { 
[] call fnc_turnLightOn; player setVariable ["lightIsOn", true];
};

keypressed.sqf

private "_handled";

_key = _this select 0;
_shift = _this select 1;
_handled = false;

switch _shift do
{
case 21 : // pressed Y
{
      	nul = [] execVM "flashlight.sqf";
	_handled = true;
};
};

_handled;

EDIT* @Tajin, that's a nice ticketS, I'm drooling at the possibilities of those being implemented. voted that up

Edited by PlacidPaul

Share this post


Link to post
Share on other sites

it's not too difficult to make a handheld flashlight, if you decide that's what you want.

sav-1_zpsb831f23e.jpg

Share this post


Link to post
Share on other sites

basically make a flashlight model in o2, config it as a pistol, then add a class flashlight to it in the weapon config (that would be slightly different in A3, as you'd need an attachment i guess), and bingo - a working flashlight...

we even made a pistol/flashlight combo using the same idea...

wreck1_zpsae8203c4.jpg

not the same as just adding a lightsource but it looks better.

i've been thinking for ages that making a "weapon" with a custom muzzleflash could be cool - you could make it fire a damage 0 bullet, but have an incredibly bright muzzle flash, that drifts off overtime, to create a blinding light-source (like gandalfs staff lol), or you could make it work like a fiery torch or a zippo lighter or whatnot... i nearly blinded myself when editing the weapon illumination intensity settings etc to take off the muzzleflash on a suppressed pistol we made. i guess the flares in dayZ and the chem lights work on a similar basis.

Share this post


Link to post
Share on other sites
basically make a flashlight model in o2, config it as a pistol, then add a class flashlight to it in the weapon config (that would be slightly different in A3, as you'd need an attachment i guess), and bingo - a working flashlight...

we even made a pistol/flashlight combo using the same idea...

http://i162.photobucket.com/albums/t247/eggbeast/wreck1_zpsae8203c4.jpg

not the same as just adding a lightsource but it looks better.

i've been thinking for ages that making a "weapon" with a custom muzzleflash could be cool - you could make it fire a damage 0 bullet, but have an incredibly bright muzzle flash, that drifts off overtime, to create a blinding light-source (like gandalfs staff lol), or you could make it work like a fiery torch or a zippo lighter or whatnot... i nearly blinded myself when editing the weapon illumination intensity settings etc to take off the muzzleflash on a suppressed pistol we made. i guess the flares in dayZ and the chem lights work on a similar basis.

I don't want to use mods :/ that's the problem. Thanks anyways :D

Share this post


Link to post
Share on other sites

yeah np, i just thought i'd offer to show you how to do it in case you decided you couldn't do it any other way that satisfies your design idea. let mme knowif you getto that point, and i'll walk you through the process, and send you some configs etc. gl

Share this post


Link to post
Share on other sites
yeah np, i just thought i'd offer to show you how to do it in case you decided you couldn't do it any other way that satisfies your design idea. let mme knowif you getto that point, and i'll walk you through the process, and send you some configs etc. gl

I'll let you know, thank you ^^

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
Sign in to follow this  

×