Norbak 10 Posted April 11, 2016 _pplayer = "#particlesource" createVehicle player; _lplayer = "#lightpoint" createVehicle player; .... ........ Is there any chance to switch this Local code to Global for a Multiplayer Session?. The code started being a local side script. I need to send each client this script but i don't know how to do it. Maybe using "rSpawn" or "rExecVM"?. Any help?. Help appreciated. Share this post Link to post Share on other sites
MrCopyright 107 Posted April 14, 2016 createVehicle is a global command. If one client executes the above code, everyone will see the effect. Do you want the handle to be global? In that case, just use publicVariable. Share this post Link to post Share on other sites
Norbak 10 Posted April 14, 2016 createVehicle is a global command. If one client executes the above code, everyone will see the effect. Do you want the handle to be global? In that case, just use publicVariable. So should it be? _pplayer = "#particlesource" createVehicle player; _lplayer = "#lightpoint" createVehicle player; _Effects = [_pplayer, _lplayer]; PublicVariable "_Effects"; .... ........ ???? Share this post Link to post Share on other sites
MrCopyright 107 Posted April 15, 2016 Change _Effects to a global variable (i.e. lightEffects) Share this post Link to post Share on other sites
Norbak 10 Posted April 15, 2016 Change _Effects to a global variable (i.e. lightEffects) So? _pplayer = "#particlesource" createVehicle player; _lplayer = "#lightpoint" createVehicle player; Effects = [_pplayer, _lplayer]; PublicVariable "Effects"; .... ........ Lol ,so easy?. Damn me. Share this post Link to post Share on other sites
Norbak 10 Posted April 18, 2016 So? _pplayer = "#particlesource" createVehicle player; _lplayer = "#lightpoint" createVehicle player; Effects = [_pplayer, _lplayer]; PublicVariable "Effects"; .... ........ Lol ,so easy?. Damn me. It didn't work. Share this post Link to post Share on other sites
MrCopyright 107 Posted April 18, 2016 What are you trying to achieve? The code you have shown there will do nothing, unless you have more that you have not shown. Share this post Link to post Share on other sites
Norbak 10 Posted April 19, 2016 What are you trying to achieve? The code you have shown there will do nothing, unless you have more that you have not shown. Something like this. Still working: _target = CursorTarget; _TPosition = getPos _target; _lplayer = "#lightpoint" createVehicle _TPosition; _lplayer lightAttachObject [_target,[0,0,1.2]]; _lplayer setLightBrightness 0.06; _lplayer setLightAmbient [0.2,0.4,0.2]; _lplayer setLightColor [2,2,2]; sleep 12; deleteVehicle _lplayer; So making this global should be great, Everybody could see the effect on the CursorTarget. Any ideas? Share this post Link to post Share on other sites
Norbak 10 Posted April 21, 2016 Any idea please?. C'mon guys, you're great programming and giving hints :D ! Share this post Link to post Share on other sites
MrCopyright 107 Posted April 21, 2016 If you want the commands to have a global effect then take a look at the remoteExec command. Share this post Link to post Share on other sites
Norbak 10 Posted April 21, 2016 If you want the commands to have a global effect then take a look at the remoteExec command. That's for Arma 3. Yes and I tried MP Framework using : [nil,nil,"per",rExecvm,"Lights.sqf"] call RE; ....being Lights.sqf the script told before. But it didn't work. I changed these two "nil" to "_this select 0 or 1 (trying the cursorTarget to work) but nothing. :( Share this post Link to post Share on other sites
MrCopyright 107 Posted April 22, 2016 Sorry, I forget that this is in the Arma 2 section Share this post Link to post Share on other sites
Norbak 10 Posted April 23, 2016 Thanks anyway, mate. Anyone else?. I need your help to make a lightpoint global. Share this post Link to post Share on other sites
MrCopyright 107 Posted April 24, 2016 The lightpoint is global because createVehicle is a global command. You only need the effects to be global. You can use a combination of addPublicVariableEventHandler and publicVariable to achieve this. Each client will need to execute the addPublicVariableEventHandler command. The easiest way is to put that in the init.sqf. The client who then creates the lightpoint would use the publicVariable command. Here's a brief demonstration: init.sqf for each client: "lightEffects" addPublicVariableEventHandler { _light = _this select 1 select 0; _brightness = _this select 1 select 1; _ambient = _this select 1 select 2; _color = _this select 1 select 3; _light setLightBrightness _brightness; _light setLightAmbient _ambient; _light setLightColor _color; }; Client who created the lightpoint: _target = cursorTarget; _tposition = getPos _target; _lplayer = "#lightpoint" createVehicle _tposition; _lplayer lightAttachObject [_target,[0,0,1.2]]; _lplayer setLightBrightness 0.06; _lplayer setLightAmbient [0.2,0.4,0.2]; _lplayer setLightColor [2,2,2]; lightEffects = [_lplayer, 0.06, [0.2,0.4,0.2], [2,2,2]]; // <--- The order of lightEffects must be [light, brightness, ambient, color] publicVariable "lightEffects"; sleep 12; deleteVehicle _lplayer; I haven't tested this so if you have any problems feel free to post back. Share this post Link to post Share on other sites
Norbak 10 Posted April 24, 2016 Yes. CreateVehicle is Global. But i don't know if can work. I'll test and i'll let you know if works. Thanks man. Share this post Link to post Share on other sites
Norbak 10 Posted April 24, 2016 It didn't work yet or i failed. Share this post Link to post Share on other sites
MrCopyright 107 Posted April 25, 2016 Make sure that every client runs the public variable event handler and it should be fine. Share this post Link to post Share on other sites
Norbak 10 Posted April 25, 2016 Evry client must run the EH in the init.sqf. I know but Does the script starter need to do aswell?. Does he need this part... _lplayer lightAttachObject [_target,[0,0,1.2]]; _lplayer setLightBrightness 0.06; _lplayer setLightAmbient [0.2,0.4,0.2]; _lplayer setLightColor [2,2,2]; ... if he is running the EH aswell?. Maybe i didn't see the light effect because i skipped that part of the script. if he is running Share this post Link to post Share on other sites
MrCopyright 107 Posted April 26, 2016 The person who starts the script should also have the EH in the event of somebody else also starting the script. Share this post Link to post Share on other sites
Norbak 10 Posted April 26, 2016 The person who starts the script should also have the EH in the event of somebody else also starting the script. I think it's not my question. Putting that EH Variable in the init.sqf makes everybody to have the call for that EH. It's ok. But is this part needed to get the script to work successfully, the caller and the client light effect?: _target = cursorTarget; _tposition = getPos _target; _lplayer = "#lightpoint" createVehicle _tposition; This part: ------------------------------- _lplayer lightAttachObject [_target,[0,0,1.2]]; _lplayer setLightBrightness 0.06; _lplayer setLightAmbient [0.2,0.4,0.2]; _lplayer setLightColor [2,2,2]; ------------------------------- lightEffects = [_lplayer, 0.06, [0.2,0.4,0.2], [2,2,2]]; // <--- The order of lightEffects must be [light, brightness, ambient, color] publicVariable "lightEffects"; sleep 12; deleteVehicle _lplayer; because the Caller also has the EH Variable in his init.sqf and it's called from: lightEffects = [_lplayer, 0.06, [0.2,0.4,0.2], [2,2,2]]; // <--- The order of lightEffects must be [light, brightness, ambient, color] publicVariable "lightEffects"; so is still needed or will he get both effects working at the same time: "caller script light" and "EH light"??. I don't understand that. It's a bit difficult. Share this post Link to post Share on other sites
Norbak 10 Posted April 27, 2016 OK i know now. The PublicVariable calls for the EH only for Clients, not for caller. The caller just begin the process and starts the effect written in the original .sqf using this part to show: This part: ------------------------------- _lplayer lightAttachObject [_target,[0,0,1.2]]; _lplayer setLightBrightness 0.06; _lplayer setLightAmbient [0.2,0.4,0.2]; _lplayer setLightColor [2,2,2]; ------------------------------- So the Caller needs this part to get the effects shown on his computer. Am i right? Share this post Link to post Share on other sites
Norbak 10 Posted April 27, 2016 Thanks mate. Ill test! Share this post Link to post Share on other sites
Norbak 10 Posted April 30, 2016 Great!. It's working. Nice job. Thanks. Share this post Link to post Share on other sites