Obmar 0 Posted December 14, 2007 I have been modeling our custom pilot addon for our mod. To make the addon interesting I tried to add a custom Visor and Holstering animation. Once I started the config process and tried to add the custom animations and placing the bones in the Cfgskeleton and adding the class UserActions, all sorts of problems occured in the game. Anybody that has tried to add a custom animation to a soldier model will know what I am talking about. The major problem was that the model was streched out of preportion and the second problem is that the animations did not work in game at all. Due to the amount of work I put into this model I tried a work around using the class EventHandlers via the init= field Quote[/b] ]class EventHandlers  { init = "[_this select 0] exec ""\bwc_pilots\data\scr\pilot_init.sqs""";  }; I then created some scripts using the SetObjectTexture for the "visor" and AddWeapon/RemoveWeapon for the "bwc_star" pistol. Here are the samples of the scripts PILOT_INIT.SQS Quote[/b] ]_player = _this select 0_player setObjectTexture [0, ""]; holster = player addAction ["Holster","\bwc_pilots\data\scr\holster.sqs"]; _player removeaction holster; _player setObjectTexture [1, "\bwc_pilots\data\visor_ca.paa"]; raisevisor = player addAction ["RaiseVisor","\bwc_pilots\data\scr\raisevisor.sqs"]; _player removeaction raisevisor; exit RAISEVISOR.SQS Quote[/b] ]_player = _this select 0?(not alive _player): goto "Exit" _player setObjectTexture [1, ""]; lowervisor = player addAction ["LowerVisor","\bwc_pilots\data\scr\lowervisor.sqs"]; _player removeaction raisevisor; #Exit exit LOWERVISOR.SQS Quote[/b] ]_player = _this select 0?(not alive _player): goto "Exit" _player setObjectTexture [1, "\bwc_pilots\data\visor_ca.paa"]; raisevisor = player addAction ["RaiseVisor","\bwc_pilots\data\scr\raisevisor.sqs"]; _player removeaction lowervisor; #Exit exit And the 2 weapon scripts HOLSTER.SQS Quote[/b] ]_player = _this select 0_gun = "bwc_star"; ?(not alive _player): goto "Exit" _player removeWeapon _gun; _player setObjectTexture [0, "\bwc_pilots\data\star\star_co.paa"]; unholster = player addAction ["Unholster","\bwc_pilots\data\scr\unholster.sqs"]; _player removeaction holster; #Exit exit UNHOLSTER.SQS Quote[/b] ]_player = _this select 0_gun = "bwc_star"; ?(not alive _player): goto "Exit" _player addWeapon _gun; _player selectWeapon _gun; ~2 _player setObjectTexture [0, ""]; holster = player addAction ["Holster","\bwc_pilots\data\scr\holster.sqs"]; _player removeaction unholster; #Exit exit Very simple and basic scripting and I now have the animations working properly including a little scripting trick which holsters/unholsters the pistol ...... HOWEVER the animations only work if the pilot is initiated directly in the game and not in a vehicle. If the pilot is initiated in the helicopter once he gets out the animations are not available to the player and AI. The other problem is if you order an AI to lets say "RaiseVisor" he moves towards the player and raises the players visor and not his own. The only way to fix this is to run the animations using the "class UserActions" in the config. I have tried everything but have had no success. What I would like to know from the scripting community is, how does one configure these animations in the class UserActions without having to include custom anims or bones to the model as this seems to create all sorts of problems. I know it is possible to do this I just don't know how to script the arguments with out having to add a custom --- class Animations ---- in the cfgModels or bones in the cfgSkeletons. Quote[/b] ]class UserActions  {  class holster  {   displayName="Holster";   position="pilot";   radius=1   onlyForplayer = false;   condition= "WHAT CONDITION DO I USE HERE";   statement= "WHAT STATEMENT DO I USE HERE";  };  class unholster  {   displayName="Unholster";   position="pilot";   radius=1   onlyForplayer = false;   condition= "WHAT CONDITION DO I USE HERE";   statement= "WHAT STATEMENT DO I USE HERE";  }; Please if anyone has been sucessful in including a custom animation with their soldier models could they post sample of scripts or explain how they did it, here........I would really appreciate the help as I would like to release the pilots with our Puma 330L helicopters before Christmas. Share this post Link to post Share on other sites
UNN 0 Posted December 16, 2007 Quote[/b] ]What I would like to know from the scripting community is, how does one configure these animations in the class UserActions without having to include custom anims or bones to the model as this seems to create all sorts of problems. Never tried animating a soldier object, but the fact that isDiscreet is always false, will probably cause you problems? But why not use the hide animation instead of setobjecttexture. The hide animation only needs a selection, so the bones don't have to be attached to other bones. Then you can use the animationphase as part of your user action condition. The user action statment would just be a call to the holster and unholster scripts you posted before. Although I noticed your using a mixture of the old sqs and the new sqf format. Use the new sqf format and change your scripts to look like this: HOLSTER.SQF <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_player = _this select 0; If (Alive _Player) Then     {     _player removeWeapon "bwc_star";     _player setObjectTexture [0, "\bwc_pilots\data\star\star_co.paa"];     }; You can still use setobjecttexture if you want, but you might hit some problems in MP. If you stick with setobjecttexture then you will have to use another method to detect when the pistol is present. Something like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class holster  {  displayName="Holster";  position="pilot";  radius=1  onlyForplayer = false;  condition= """bwc_star"" in (Weapons This);  statement= "[This] ExecVM ""HOLSTER.SQF""";  }; Share this post Link to post Share on other sites
Obmar 0 Posted December 17, 2007 The script does work so it is a start but does not give me the option in user actions of unholstering the weapon. What argument would I use for unholstering the weapon. It only removes the weapon from the pilot but I can't use the weapon again as it has been removed. To hide a selection I know how but how do you show (make visible) the selection again. That is what I am looking for, a sample of a script with the True and False argument to be able to do that with user actions. Share this post Link to post Share on other sites
UNN 0 Posted December 17, 2007 Quote[/b] ]The script does work so it is a start but does not give me the option in user actions of unholstering the weapon. Just modify your other scripts and config conditions the same way. Only this time test to see if the weapon is not in the soldier inventory. Quote[/b] ]To hide a selection I know how but how do you show (make visible) the selection again. That is what I am looking for, a sample of a script with the True and False argument to be able to do that with user actions. Well if you can send me your pilot addon I will have a go at setting up the visor with either hide anims or setobjecttexture, seen as that has to be handled differently from the pistol. Share this post Link to post Share on other sites
Obmar 0 Posted December 19, 2007 @UNN please check your PM as I have sent you a link to the MLOD file of the pilot. I hope you can solve this enigma as I have tried everything I know and have not been successful in implementing the animations via the User Actions. If you do resolve this problem, please could you post the solution here for others to see as well. Share this post Link to post Share on other sites
UNN 0 Posted January 2, 2008 Quote[/b] ]The other problem is if you order an AI to lets say "RaiseVisor" he moves towards the player and raises the players visor and not his own. This bit was solved using two lots of user actions, one lot for the Player only, the other for both the AI and Player: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class aiholster_star     {     displayName="Holster";     position="camera";     onlyforplayer=0;     radius=0.75;     condition="Call {_Result=False; If (This!=Player) Then {BWC_PLAYER=This; _Result=(Alive BWC_PLAYER) And (""bwc_star"" In (Weapons BWC_PLAYER))}; _Result}";     statement="[BWC_PLAYER] Execvm ""\bwc_pilots\data\scr\holster.sqf""";     }; class aiunholster_star     {     displayName="Unholster";     position="camera";     onlyforplayer=0;     radius=0.75;     condition="Call {_Result=False; If (This!=Player) Then {BWC_PLAYER=This; _Result=(Alive BWC_PLAYER) And !(""bwc_star"" In (Weapons BWC_PLAYER))}; _Result}";     statement="[BWC_PLAYER] Execvm ""\bwc_pilots\data\scr\unholster.sqf""";     }; class airaise_visor     {     displayName="RaiseVisor";     position="camera";     onlyforplayer=0;     radius=0.75;     condition="Call {_Result=False; If (This!=Player) Then {BWC_PLAYER=This; _Result=(Alive BWC_PLAYER) And !(BWC_PLAYER GetVariable ""bwc_visor"")}; _Result}";     statement="[BWC_PLAYER] Execvm ""\bwc_pilots\data\scr\raisevisor.sqf""";     }; class ailower_visor     {     displayName="LowerVisor";     position="camera";     onlyforplayer=0;     radius=0.75;     condition="Call {_Result=False; If (This!=Player) Then {BWC_PLAYER=This; _Result=(Alive BWC_PLAYER) And (BWC_PLAYER GetVariable ""bwc_visor"")}; _Result}";     statement="[BWC_PLAYER] Execvm ""\bwc_pilots\data\scr\lowervisor.sqf""";     }; class holster_star     {     displayName="Holster";     position="camera";     onlyforplayer=1;     radius=0.75;     condition="(Alive This) And (""bwc_star"" In (Weapons This))";     statement="[This] Execvm ""\bwc_pilots\data\scr\holster.sqf""";     }; class unholster_star     {     displayName="Unholster";     position="camera";     onlyforplayer=1;     radius=0.75;     condition="(Alive This) And !(""bwc_star"" In (Weapons This))";     statement="[This] Execvm ""\bwc_pilots\data\scr\unholster.sqf""";     }; class raise_visor     {     displayName="RaiseVisor";     position="camera";     onlyforplayer=1;     radius=0.75;     condition="(Alive This) And !(This GetVariable ""bwc_visor"")";     statement="[This] Execvm ""\bwc_pilots\data\scr\raisevisor.sqf""";     }; class lower_visor     {     displayName="LowerVisor";     position="camera";     onlyforplayer=1;     radius=0.75;     condition="(Alive This) And (This GetVariable ""bwc_visor"")";     statement="[This] Execvm ""\bwc_pilots\data\scr\lowervisor.sqf""";     }; Not very pretty, but it gets round the problem of AI and Players sharing user actions. Share this post Link to post Share on other sites
RN Malboeuf 12 Posted January 3, 2008 Quote[/b] ]This bit was solved using two lots of user actions, one lot for the Player only, the other for both the AI and Player: can you explain the idea ? i didn't get it from the example (( Share this post Link to post Share on other sites
UNN 0 Posted January 3, 2008 Quote[/b] ]can you explain the idea ? I will try, but it's an odd problem to explain. Say you have a two man group, Player as commander and AI as subordinate. Both the units in the group have the config user actions for the pistol, with onlyforplayer set to false: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class holster_star    {    displayName="Holster";    position="camera";    onlyforplayer=False;    radius=0.75;    condition="(Alive This) And (""bwc_star"" In (Weapons This))";    statement="[This] Execvm ""\bwc_pilots\data\scr\holster.sqf""";    }; class unholster_star    {    displayName="Unholster";    position="camera";    onlyforplayer=False;    radius=0.75;    condition="(Alive This) And !(""bwc_star"" In (Weapons This))";    statement="[This] Execvm ""\bwc_pilots\data\scr\unholster.sqf""";    }; You as the player, can holster your pistol. As expected, the Holster user action will then disapear and the Unholster user action will appear in its place. But if you then select your AI (F2) and bring up it's action menu (6). You can see the players Unholster user action as well as the AI's option to Holster. This appears to be the problem, even though we have a conditional radius of 0.75, the AI can still see the players user actions, despite being a few meters away. So my first thought was to re-define the user action config and add duplicates with, onlyforplayer=True. Like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class holster_star    {    displayName="Holster";    position="camera";    onlyforplayer=True;    radius=0.75;    condition="(Alive This) And (""bwc_star"" In (Weapons This))";    statement="[This] Execvm ""\bwc_pilots\data\scr\holster.sqf""";    }; class unholster_star    {    displayName="Unholster";    position="camera";    onlyforplayer=True;    radius=0.75;    condition="(Alive This) And !(""bwc_star"" In (Weapons This))";    statement="[This] Execvm ""\bwc_pilots\data\scr\unholster.sqf""";    }; class aiholster_star    {    displayName="Holster";    position="camera";    onlyforplayer=False;    radius=0.75;    condition="(Alive This) And (""bwc_star"" In (Weapons This))";    statement="[This] Execvm ""\bwc_pilots\data\scr\holster.sqf""";    }; class aiunholster_star    {    displayName="Unholster";    position="camera";    onlyforplayer=False;    radius=0.75;    condition="(Alive This) And !(""bwc_star"" In (Weapons This))";    statement="[This] Execvm ""\bwc_pilots\data\scr\unholster.sqf""";    }; But that didn't work, the players Unholster action was still visible in the AI's command menu. On top of that, I now had duplicate user actions for the Player. So I changed the config again, by adding (This!=Player) to the condition for the AI only user actions: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class holster_star    {    displayName="Holster";    position="camera";    onlyforplayer=True;    radius=0.75;    condition="(Alive This) And (""bwc_star"" In (Weapons This))";    statement="[This] Execvm ""\bwc_pilots\data\scr\holster.sqf""";    }; class unholster_star    {    displayName="Unholster";    position="camera";    onlyforplayer=True;    radius=0.75;    condition="(Alive This) And !(""bwc_star"" In (Weapons This))";    statement="[This] Execvm ""\bwc_pilots\data\scr\unholster.sqf""";    }; class aiholster_star    {    displayName="Holster";    position="camera";    onlyforplayer=False;    radius=0.75;    condition="(This!=Player) And (Alive This) And (""bwc_star"" In (Weapons This))";    statement="[This] Execvm ""\bwc_pilots\data\scr\holster.sqf""";    }; class aiunholster_star    {    displayName="Unholster";    position="camera";    onlyforplayer=False;    radius=0.75;    condition="(This!=Player) And (Alive This) And !(""bwc_star"" In (Weapons This))";    statement="[This] Execvm ""\bwc_pilots\data\scr\unholster.sqf""";    }; Now everything worked fine, no duplicates and no Player user actions showing up under the AI. The bit with BWM_PLAYER: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Call {_Result=False; If (This!=Player) Then {BWC_PLAYER=This; _Result=(Alive BWC_PLAYER) And (""bwc_star"" In (Weapons BWC_PLAYER))}; _Result} Was something I added myself. In the past, sometimes it was useful to know (globally) which AI had just execute, or been order to execute, a user action. This… <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(This!=Player) And (Alive This) And (""bwc_star"" In (Weapons This)) …does the same thing without the global reference. Share this post Link to post Share on other sites
RN Malboeuf 12 Posted January 3, 2008 hmm... but AI can holster in game without any tricks Quote[/b] ]So my first thought was to re-define the user action config and add duplicates with, onlyforplayer=True. Like this: so why not having the only action with   onlyforplayer=1; or alike condition ? Share this post Link to post Share on other sites
UNN 0 Posted January 3, 2008 Quote[/b] ]hmm... but AI can holster in game without any tricks Not it the way Obmar wants. Quote[/b] ]so why not having the only action with   onlyforplayer=1; or alike condition ? Because then, the user actions for the AI. Would not show up under it's command menu. Which was Obmar's original requirement. Share this post Link to post Share on other sites
Obmar 0 Posted January 9, 2008 Thanks for your hard work UNN, I have released the Pilot and the Puma. The reason I was having so many problems is because not only does the pilot holster his weapon (Pistol) but you also see the weapon in the holster unlike the ArmA holstering where the pistol disapears. So now with UNN's scripts, when the pilot unholsters the pistol, the pistol leaves the holster. When he holsters the pistol, the pistol returns to the holster...... UNN you are the man..... my pilot model animates the way I expected it to! Share this post Link to post Share on other sites