ADuke 1 Posted January 18, 2009 Hello, In my mission I have a control panel (just a radio made to look like a control panel) placed near a SCUD launcher. I have added an action to the control panel called "Disable SCUD". The init field of the control panel looks like this... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> this setpos [2028.88,2565.19,1.28146]; myaction = this addAction ["Disable SCUD", "disabled1.sqf"] "disabled1.sqf" looks like this <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> player switchmove "OTKSTANDA2"; playsound "disabled"; sleep 4; deletevehicle blinky1; scudonedriver setbehaviour "stealth"; scudone setfuel 0; player switchmove "AidlPercMstpSnonWnonDnon06"; sleep 2; "2" objStatus "done"; TitleText["Objective Complete!! SCUD ONE is disabled","PLAIN"]; "scud1" setMarkerType "marker"; "scud1" setMarkerColor "Colorred"; sleep 3; scudonedriver leavevehicle scudone; scudonedriver setbehaviour "combat"; player removeaction myaction; This is what works... 1.) The action appears as intended when the player stands next to the control panel. 2.) The script executes successfully and the action is removed when the script completes. This is what does NOT work... 1.) When the action appears in the action menu, and the player walks away, the action remains in the action menu 2.) I would also like to make this multiplayer compatible and have the action only appear on the unit who is near the control panel. Any help is appreciated. Share this post Link to post Share on other sites
Bandicoot 0 Posted January 18, 2009 Try adding <name of scud> removeaction myaction; at the bottom of the script("disabled1.sqf") also as the scud won't need the action if its disabled. Bandicoot Share this post Link to post Share on other sites
poweruser 10 Posted January 18, 2009 1.) When the action appears in the action menu, and the player walks away, the action remains in the action menu Because of this behaviour and the code <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player removeaction myaction; having some effect (it really removes the action), I'm sure the action was added to the player instead of to the radio. Multiplayer   (Assuming the action was added to the radio and works as expected): In the mission editor, create a trigger. Condition: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">ADuke_scuddisabled On Activation: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] execVM "disabled1_mp.sqf" Now your script "disabled1.sqf" needs to be split up into 2 scripts. "disabled1.sqf" holds all commands with global effect. "disabled1_mp.sqf" holds all commands with local effect. "disabled1.sqf"   is run on the client who disables the scud <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">ADuke_scuddisabled = true; publicVariable "ADuke_scuddisabled"; player switchmove "OTKSTANDA2"; sleep 4; deletevehicle blinky1; scudonedriver setbehaviour "stealth"; scudone setfuel 0; player switchmove "AidlPercMstpSnonWnonDnon06"; sleep 5; scudonedriver leavevehicle scudone; scudonedriver setbehaviour "combat"; "disabled1_mp.sqf"    is run on all machines when someone disables the scud <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"><nameOfRadio> removeaction myaction;  // TODO: insert name of radio/control panel, to which the action was added if(player distance scudone < 20) then { playsound "disabled"; }; sleep 6; "2" objStatus "done"; TitleText["Objective Complete!! SCUD ONE is disabled","PLAIN"]; "scud1" setMarkerType "marker"; "scud1" setMarkerColor "Colorred"; Share this post Link to post Share on other sites
ADuke 1 Posted January 19, 2009 Thank you all for your replies, Turns out that the problem I was having with the remaining action after walking away from the control panel was caused by a trigger that was left over when I made the switch from adding the action via trigger to adding the action on the object, deleted the trigger and fixed the problem. The issue with making it mp compatible still exists so I will try out those suggestions when I get ready to test. Thanks again Share this post Link to post Share on other sites