Filipsons 10 Posted November 28, 2016 Hello guys, Im newbie in scripting. I create this script light01 = "#lightpoint" createvehicle position LAMP01; light01 attachTo [LAMP01,[0,0,0.1]]; light01 setlightbrightness 0.5; light01 setlightcolor [1,0.6,0.4]; this addaction ["LIGHT ON",{(light01), light01 setlightcolor [1,0.6,0.4]}]; this addaction ["LIGHT OFF",{(light01), light01 setlightcolor [0,0,0]}]; this addaction ["Intenzita 1",{(light01), light01 setlightbrightness 0.2}]; this addaction ["Intenzita 2",{(light01), light01 setlightbrightness 0.6}]; this addaction ["Intenzita 3",{(light01), light01 sesetLightBrightness 1}]; Everything works fine, but in multiplayer nobody see my changes.some solution please? Share this post Link to post Share on other sites
davidoss 552 Posted November 28, 2016 if (isServer) then { light01 = "#lightpoint" createvehicle (position LAMP01); light01 attachTo [LAMP01, [0,0,0.1]]; publicVariable "light01"; }; light01 setlightbrightness 0.5; light01 setlightcolor [1,0.6,0.4]; this addaction ["LIGHT ON",{[light01, [1,0.6,0.4]] remoteExec ["setlightcolor", [0, -2] select isDedicated, light01]}]; this addaction ["LIGHT OFF",{ [light01, [0,0,0]] remoteExec ["setlightcolor", [0, -2] select isDedicated, light01]}]; this addaction ["Intenzita 1",{[light01, 0.2] remoteExec ["setlightbrightness", [0, -2] select isDedicated, light01]}]; this addaction ["Intenzita 2",{[light01, 0.6] remoteExec ["setlightbrightness", [0, -2] select isDedicated, light01]}]; this addaction ["Intenzita 3",{[light01, 1] remoteExec ["setlightbrightness", [0, -2] select isDedicated, light01]}]; Share this post Link to post Share on other sites
Filipsons 10 Posted November 28, 2016 if (isServer) then { light01 = "#lightpoint" createvehicle (position LAMP01); light01 attachTo [LAMP01, [0,0,0.1]]; publicVariable "light01"; }; light01 setlightbrightness 0.5; light01 setlightcolor [1,0.6,0.4]; this addaction ["LIGHT ON",{[light01, [1,0.6,0.4]] remoteExec ["setlightcolor", [0, -2] select isDedicated, light01]}]; this addaction ["LIGHT OFF",{ [light01, [0,0,0]] remoteExec ["setlightcolor", [0, -2] select isDedicated, light01]}]; this addaction ["Intenzita 1",{[light01, 0.2] remoteExec ["setlightbrightness", [0, -2] select isDedicated, light01]}]; this addaction ["Intenzita 2",{[light01, 0.6] remoteExec ["setlightbrightness", [0, -2] select isDedicated, light01]}]; this addaction ["Intenzita 3",{[light01, 1] remoteExec ["setlightbrightness", [0, -2] select isDedicated, light01]}]; It does not work :( Share this post Link to post Share on other sites
killzone_kid 1332 Posted November 28, 2016 It does not work :( while light01 will be global object, all the properties you set on it regarding light are local, so not only you need to set them on every computer at the same time, you need to make sure they are synched for JIP players and user actions of players also synced. This is not a simple task I can tell you this. Share this post Link to post Share on other sites
Devastator_cm 434 Posted November 29, 2016 @KK, for the light (or flare in my case) is it like this 1- Create the flare in server ( _flare) 2- Call remote exec to set the properties, i.e. [_flare, 2000] remoteExec ["setLightFlareMaxDistance", 0,true]; I think it will not work so as argument needs to be local right? so createVehicleLocal needs to be used instead of createVehicle and all the rest of the script needs to run at client (create, adjust properties etc.) for such flare situation? Share this post Link to post Share on other sites
killzone_kid 1332 Posted November 29, 2016 @KK, for the light (or flare in my case) is it like this 1- Create the flare in server ( _flare) 2- Call remote exec to set the properties, i.e. [_flare, 2000] remoteExec ["setLightFlareMaxDistance", 0,true]; I think it will not work so as argument needs to be local right? so createVehicleLocal needs to be used instead of createVehicle and all the rest of the script needs to run at client (create, adjust properties etc.) for such flare situation? no 1, 2 should work fine, the problem is when you want to reset properties based on user actions Share this post Link to post Share on other sites
Guest Posted November 29, 2016 no 1, 2 should work fine, the problem is when you want to reset properties based on user actions Why ? Let the server handle this. Creating light => Server Sends clients info === remoteExec target clients ===> Clients receive infos on lights Client actions === remoteExec target server ===> Server handle actions => Server broadcast light params === remoteExec target clients ===> Client receive params Share this post Link to post Share on other sites
bad benson 1733 Posted November 29, 2016 while light01 will be global object, all the properties you set on it regarding light are local, really? i always thought those classes with the # infront like particle sources too are local effects like cameras. did that change or am i suffering from faulty info? Share this post Link to post Share on other sites
killzone_kid 1332 Posted November 29, 2016 really? i always thought those classes with the # infront like particle sources too are local effects like cameras. did that change or am i suffering from faulty info? same with smokes, you can create it as global object, sort of like createTrigger with global flag works, but all the properties are local. Sometimes it is better to have global object, sometimes it is undesirable. I honestly do not know if this changed, but I'm glad there is an option to be able to do it either way. 1 Share this post Link to post Share on other sites