major woody 11 Posted December 17, 2006 I would like to give an addon the ability to hide under a custommade cammonet by the action menu. My UserAction looks like this: Quote[/b] ]class useractions       { class Cammonet         {          displayName="Put Up Cammonet";          position="pos commander";          radius=2;         condition="true";          statement="Net = [this] exec {\Rapira\Scripts\cammonet.sqs}";         };  And this is my script Quote[/b] ];Cammonet.sqs_p = _this select 0 _p removeaction Net _d = getdir _p _cammo = "CammoNet" createvehicle [(getpos _p select 0)+(0*sin _d),(getpos _p select 1)+(0*cos _d),0] _cammo setdir (_d - 0) _cammo addaction ["Pack cammonet","\Rapira\Scripts\delete.sqs"] exit Quote[/b] ];delete.sqsdeletevehicle (_this select 0) (_this select 1) addaction ["Put up cammonet","\Rapira\Scripts\cammonet.sqs"] exit And now my problems 1. After I've activaded cammonet.sqs I would like to remove it from the action menu - How do I do that in UserActions? 2. I would like the cammonet to appear EXACTLY over the addon, at the same spot every time - it's a towed addon so it appears different palces every time... Hope some one can help me... Share this post Link to post Share on other sites
ProfTournesol 956 Posted December 18, 2006 Well, the simpliest answer would be to make the cammonet an hidden selection of your model, and use a setobjecttexture command to hide or display it (the cammonet must be a single texture file then). Name the cammonet "cammonet", and then add this selection to the CfgModel of your addon, such as : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgModels { class Default { sections[]={}; sectionsInherit=""; }; class Vehicle: Default {}; class My_addon: Vehicle { sectionsInherit="Vehicle"; sections[]={"cammonet"}; }; }; Then, "hide the selection" in the CfgVehicles, such as : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgVehicles { class All{}; class AllVehicles:All{}; Â Â class Tank: AllVehicles {}; class APC: Tank {}; class M113: APC {}; class My_addon: M113 Â { hiddenSelections[] = {"cammonet"}; etc... Then, create a "fake anim" to be able to check if the cammonet is on or off : create a single vertice in your model, named "fakeanimpoint". Then create a fake axis in the memory lod : "fakeaxis". Then, write this in your config : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> animated=1; class Animations { class fakeanim { type="rotation"; animPeriod=0.5; selection="fakeanimpoint"; axis="fakeaxis"; angle0=0; angle1=0.75; }; }; class UserActions { class CammoNetOn { displayName="Put up cammonet"; position="pos commander"; radius=2; condition="this animationPhase ""fakeanim"" < 0.5"; statement="this animate [""fakeanim"", 1];this setobjectexture [0,""\NameofPbo\mycammonettexture.paa""]"; }; class CammoNetOff { displayName="Pack cammonet"; position="pos commander"; radius=2; condition="this animationPhase ""fakeanim"" >= 0.5"; statement="this animate [""fakeanim"", 0];this setobjectexture [0,""""]"; }; }; The only problem with the setobjectexture command is that the cammonet texture must be loaded at the beginning to be correctly displayed (it is not loaded at the beginning because the selection is "hidden"). A turnaround is to apply it to a "non visible part of the model", so that Ofp loads the texture in its memory at the beginning. About your problem with createvehicle that never creates the model at the same place, you can solve it : 1. By using "camcreate" command instead of "createvehicle" 2. Or by createvehicle the cammonet THEN setpos it, such as : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ;Cammonet.sqs _p = _this select 0 _p removeaction Net _d = getdir _p _cammo = "CammoNet" createvehicle [0,0,0] _cammo setpos [(getpos _p select 0)+(0*sin _d),(getpos _p select 1)+(0*cos _d),0] _cammo setdir (_d - 0) _cammo addaction ["Pack cammonet","\Rapira\Scripts\delete.sqs"] exit Share this post Link to post Share on other sites
major woody 11 Posted December 21, 2006 The script works as planned - only problem left is how to get rid of the CammoOption in the Action Menu Share this post Link to post Share on other sites
TeRp 1 Posted December 24, 2006 use the condition setting (which is currently set to "true" and thus will always display the user action) to get rid of the action after using, as ProfTournesol suggested. Share this post Link to post Share on other sites