Justine67 1 Posted March 4, 2016 Hello, I want to put an execVM with (r,g,b) as argument in the init of 30-40 wall lights, Wich would add an addaction ON and then OFF. Here's a little part of code, without argument. Also deleting the light doesn't work ON : _object = _this select 0;_r = _g = _b =_h = getPosATL _object;removeallactions _object;_nom = "#lightpoint" createVehicle position _object;_nom setposATL _h;_nom lightAttachObject [_object, [-0,0,0]];_nom setLightColor [_r,_g,_b];_nom setLightAmbient [_r,_g,_b];_nom setLightBrightness 0.12;_rendre = _object addAction ["<t color='#2EFE64'>Eteindre.</t>",{0 = [this] execVM "off.sqf"}]; OFF _object = _this select 0;removeallactions _object;//{deleteVehicle _x} forEach nearestObjects [_object, ["#lightpoint"], 1]; ///DOESN'T WORK AT ALL//{deleteVehicle _x} forEach (position player) nearEntities [["lightpoint"], 0.5];_rendre = _object addAction ["<t color='#2EFE64'>Allumer.</t>",{0 = [this, RGB ARGUMENT ?] execVM "on.sqf"}]; Thx for reading this Share this post Link to post Share on other sites
pedeathtrian 99 Posted March 4, 2016 Check this article: addAction. Parameters array passed to the script upon activation in _this variable is: [target, caller, ID, arguments] on.sqf will look like: params ["_object", "", "_id", ["_args", [], [[]], [1,2]]]; _args params [["_rgb", [1,1,1], [[]], [3]], ["_br", 0.12, [0]]]; // defaults are white light with brightness 0.12 private ["_h", "_nom"] _h = getPosATL _object; _object removeAction _id; _nom = "#lightpoint" createVehicle position _object; _nom setposATL _h; _nom lightAttachObject [_object, [-0,0,0]]; _nom setLightColor _rgb; _nom setLightAmbient _rgb; _nom setLightBrightness _br; _object addAction ["<t color='#2EFE64'>Eteindre.</t>",{0 = _this execVM "off.sqf"}, [_nom, _rgb, _br]]; off.sqf: params ["_object", "", "_id", ["_args", [], [[]], [1,2,3]]]; _args params [["_lightSource", objNull, [objNull]], ["_rgb", [1,1,1], [[]], [3]], ["_br", 0.12, [0]]]; _object removeAction _id; deleteVehicle _lightSource; _object addAction ["<t color='#2EFE64'>Allumer.</t>",{0 = _this execVM "on.sqf"}, [_rgb, _br]]; When you first add "On" action to object (ususally right after acreate), specify light parameters manually: _rendre = _object addAction ["<t color='#2EFE64'>Allumer.</t>",{0 = _this execVM "on.sqf"}, [[1,0.1,0.1], 0.2]]; // for red light Later they will be kept in actions arguments. I also suggest you not use removeAllActions too much as it interferes with other actions being added to objects. 1 Share this post Link to post Share on other sites
Justine67 1 Posted March 4, 2016 Thanks a lot !!! Everything work as I wanted, and the code is really good for my learning. Share this post Link to post Share on other sites
Justine67 1 Posted April 10, 2016 Okay, I have a problem as create lighpoint has only a local effect. Do you know how to make it MP compatible ? :) Share this post Link to post Share on other sites
Guest Posted April 10, 2016 https://community.bistudio.com/wiki/remoteExec and more generally https://forums.bistudio.com/index.php?app=core&module=search&do=search&fromMainBar=1 https://community.bistudio.com/wiki/Category:Scripting_Commands Thank you Share this post Link to post Share on other sites
Justine67 1 Posted April 10, 2016 Already tried , I would not come if I got it to chew ;) Share this post Link to post Share on other sites
dlang 24 Posted April 24, 2016 Anybody ? :unsure: I use the same script, can't remember the author. Effect seems indeed to be only local Share this post Link to post Share on other sites