Jump to content
pellelil

Create light (#lightpoint) in COOP/MP

Recommended Posts

I am fairly new to scripting in Arma and I am trying to get up to speed scripting for COOP/MP, and in this aspect I am working on a flare-script. My current script is working fine, however I would like to have more control over the brightness/intensity of my flare (as the flare fired in vanilla Arma don't illuminate very much, whereas with Blastcore it does).

 

I am therefore looking into using a light ("#lightpoint" createVehicle getPos _flare;), that I will either attach to my current flare or in whole replace my flare. However I have read that all of the "setLight" methods only affect the "local" light (not for each client in COOP/MP). E.g created this way:

// ... some code that creates/setup my _flare ...

_light = "#lightpoint" createVehicle getPos _flare; 
_light setLightFlareSize _flareSize;
_light setLightBrightness _flareBrightness; 
_light setLightIntensity _flareIntensity; 
_light setLightColor _flareColor; 
_light setLightAmbient _flareColor; 
_light attachTo [_flare, [0, 0, 0]]; 

// ... some code that controls/animates my _flare ...

Is it possible to have the light being created/controlled on each "connected client"?, and if so how?

Share this post


Link to post
Share on other sites

Local means visible only there where code executed.

Obviously you need to execute the code on each client.

Use remoteExec for that.

Share this post


Link to post
Share on other sites

Local means visible only there where code executed.

Obviously you need to execute the code on each client.

Use remoteExec for that.

 

So I guess something in the line of this:

_scriptCreatingSettingLight = {
  _flare = _this select 0;
  _flareBrightness = _this select 1;
  // ... "read" more params ...
  _light = "#lightpoint" createVehicle getPos _flare; 
  _light setLightBrightness _flareBrightness; 
  // ... "set" more params ...
};
[_flare, 4] remoteExec ["_scriptCreatingSettingLight"]; 

Not calling remoteExec with a specific client it should run on all clients, so for optimization it might be a good idea to find all client within a cirtain range from where the flare is fired, and then only use remoteExec on those !?

 

You know if it will work with a local function, or does it have to be a global?

Share this post


Link to post
Share on other sites

Isn't there an event script for flares?

 

onFlare.sqs executes globally when a flare is fired, IIRC

Share this post


Link to post
Share on other sites

[_flare, 4] remoteExec ["_scriptCreatingSettingLight"];
Remote calling a function that is stored in a private variable is not going to work.

 

Isn't there an event script for flares?

That script is meant for illumination flares. I highly doubt it will trigger for countermeasure flares.

It should be possible to use a "fired" Eventhandler though.

Share this post


Link to post
Share on other sites
[_flare, 4] remoteExec ["_scriptCreatingSettingLight"];
Remote calling a function that is stored in a private variable is not going to work.

 

That script is meant for illumination flares. I highly doubt it will trigger for countermeasure flares.

It should be possible to use a "fired" Eventhandler though.

 

 

I might have misunderstood OP, thought he was referring to illumination flares

Share this post


Link to post
Share on other sites

Define global function:

fn_setLight = {

    params ["_light", "_flareSize", "_flareBrightness", "_flareIntensity", "_flareColor"];

    _light setLightFlareSize _flareSize;
    _light setLightBrightness _flareBrightness;
    _light setLightIntensity _flareIntensity;
    _light setLightColor _flareColor;
    _light setLightAmbient _flareColor;


};

than execute it on each client:

if (isServer) then {

// createVehicle is global, every client knows about 
// _flare whatever that is needs to be global too

    _light = "#lightpoint" createVehicle getPos _flare; 

// attachTo is global

    _light attachTo [_flare, [0, 0, 0]];

//passed params in order >object,flare Size, flare Brightness, flare Intensity, [flare RBG Color]< 

    [_light, 5, 2, 4, [0.5,0,0]] remoteExec ["fn_setLight", 0, true];


};

selected color is red

setLightAmbient value are not passed obviously is the same color as source.

Remove comments when understand.

 

Edit: Check this;

Share this post


Link to post
Share on other sites

Could we use this to augment the searchlights on the aircraft and headlights on the vehicles?

Share this post


Link to post
Share on other sites

...

 

How did you mange to make it directionally? Something you did, or is it simply blocked by the 3D model?

Share this post


Link to post
Share on other sites

He's using one of those construction lamps. (Land_PortableLight_single_F) which have a spotlight effect included.

Thats not what we're looking for here.

Share this post


Link to post
Share on other sites

He's using one of those construction lamps. (Land_PortableLight_single_F) which have a spotlight effect included.

Thats not what we're looking for here.

this. video is mine actually :D 

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

×