JohnKalo 657 Posted March 13, 2020 Hey guys in the editor there is an object named Transfer Switch. I am trying to make an action where the player can move the lever of that switch. When they do so something will happen and the mission will continue. It is about a WIP MP mission. So how can that be done please? Share this post Link to post Share on other sites
JohnKalo 657 Posted March 13, 2020 Update: I found the code that I had discovered some time ago on steam forums!!!!!! Here it is: DistanceToReach = 300; this addAction [ "Turn Off", { params ["_target", "_caller", "_actionId", "_arguments"]; { [_x, "OFF"] remoteExec ["switchLight",0,true]; } forEach (nearestObjects [_caller, [], DistanceToReach]); _target animateSource ["switchposition",1]; _target animateSource ["light",0]; _target setDamage 1; }, [], 1.5, true, true, "", "alive _target", 3, false, "", "" ]; this addAction [ "Turn On", { params ["_target", "_caller", "_actionId", "_arguments"]; { [_x, "ON"] remoteExec ["switchLight",0,true]; } forEach (nearestObjects [_caller, [], DistanceToReach]); _target animateSource ["switchposition",-1]; _target animateSource ["light",1]; _target setDamage 0; }, [], 1.5, true, true, "", "!alive _target", 3, false, "", "" ]; So now I have the a lever going up and down without really doing anything. Somewhere in there I can call a script. This must be simple but I cannot find it 3 Share this post Link to post Share on other sites
JohnKalo 657 Posted March 13, 2020 Update again: Now I saw the code with the colors more clearly I found a solution. Placing the code here seemed to work: { [_x, "ON"] remoteExec ["switchLight",0,true]; man setDamage 1; } forEach (nearestObjects [_caller, [], DistanceToReach]); Posting it for anybody else wanting to use the switch although that might not be the right position. ForEach does not make much sense. Now tired will do more tests tomorrow ^^^ 2 1 Share this post Link to post Share on other sites
JohnKalo 657 Posted March 14, 2020 Final Update: Yep it was simple after all. The code should be placed here: {[_x, "ON"] remoteExec ["switchLight",0,true];} forEach (nearestObjects [_caller, [], DistanceToReach]); // Codes can be placed here ; _target animateSource ["switchposition",1]; _target animateSource ["light",0]; _target setDamage 1; 2 1 Share this post Link to post Share on other sites
BenFromTTG 0 Posted July 2, 2020 Hey, so only wanting to just have it switch on, but it won't add the action if I only have 1, any solutions? Also, the switch light won't come on either Share this post Link to post Share on other sites
JohnKalo 657 Posted July 4, 2020 @BenFromTTG Hello, sorry for the late reply. Had to open the editor and I am in an exam period. I encountered a similar issue. Here is how I solved it: DistanceToReach = 50; this addAction [ "Turn On", { params ["_target", "_caller", "_actionId", "_arguments"]; { [_x, "ON"] remoteExec ["switchLight",0,true]; } forEach (nearestObjects [_caller, [], DistanceToReach]); _target animateSource ["switchposition",-1]; _target animateSource ["light",1]; _target setDamage 0; }, [], 1.5, true, true, "", "alive _target", 3, false, "", "" ]; About the light I have not noticed. All seemed to work as intended. 2 Share this post Link to post Share on other sites