quantenfrik 10 Posted July 21, 2014 hello, currently I am trying to get my AI artillery assets to point their guns at a certain direction with a certain elevation. I tried both dowatch and lookat, but they each take around 15 seconds to stabilize on a static target, and as the reload time of the SPA is only around 9 seconds and because I'd like to include spread and MRSI, this is not really a solution. Would it be somehow possible to animate the turret ( with the animate command)? I searched for animation related topics, but I don't really have an understanding of this one as this is my first bigger project, and they mainly concern infantry animations. Also the animations viewer ingame also only shows infantry animations. If anybody has an idea, please help me with this issue. Thanks in advance Share this post Link to post Share on other sites
TAW_Yonose 11 Posted July 21, 2014 Vehicles dont have any animations, vehicles moves how you make it move through your controls, not animations so you wont find anything there. I dont think you can actually make it point at a certain direction, unless you do a command fire on a target close/far enough that the artillery points where you want. I dont know if the command fire will help you to make it point somewhere when you have the vehicle empty on ammo. Since you dont want it to shoot right? Share this post Link to post Share on other sites
quantenfrik 10 Posted July 22, 2014 Thanks for the reply! But after some further research, I think it might be possible that vehicles have indeed animations, because they're defined in the model.cfg, and I can also access them ingame via animationphase. _Tank = vehicle player; _angle = (_Tank AnimationPhase "mainturret"); hint str _angle; this works without problems, giving me (I think) an angle in radians. However when I run this code _Tank = vehicle player; _Tank animate ["mainTurret", 0.5]; nothing happens. Also this code _Tank = vehicle player; _state = animationState _Tank; hint str _state; just returns an empty string when I'm in a vehicle (which would be an indicator that there are no animations, but why does animationphase then return a value?). To get here I found this old thread http://forums.bistudio.com/showthread.php?63918-Animations, it was hard to read but worth it. So if someone has any further experiences with animations please help me out. Share this post Link to post Share on other sites
quantenfrik 10 Posted July 26, 2014 I've searched further, but still found no solutions, only new questions, which maybe someone can answer: I had a look into the config viewer, and for the Scorcher there are some "Animation Sources", called "muzzle_hide_arty", "muzzle_rot_cannon" and similar. does anybody have an idea what these do? I tried animationPhase on them but they always returned zero, and strangely it will also return zero if the animation doesn't exist at all :S. I also had a look at the awesome m109a6 paladin mod for arma 2 (which I hope is allowed, but I think so because the files are publicly available, right?), and found that they used animate to lay the gun, just as I plan to do too. However, their code works...I found the following in the lay script: _m109 animate ["turret", _deflectionNeeded]; and _m109 animate ["gun", (_elevationNeeded min 1333)]; . I can find no difference to my code; "turret" and "gun" are defined in the AnimationSources as classes, the corresponding entries for the scorcher are "muzzle_hide_arty", "muzzle_rot_cannon" etc. If anyone has an idea why my code doesn't work, please post it. Another approach I had in mind was to "analyze" the scripting commands. I thought in dowatch (which works, but takes too much time) there has to be a part that changes the gun direction, so if I could see the whole code of it, I might be able to understand how it works. Share this post Link to post Share on other sites
reyhard 2082 Posted July 27, 2014 mainTurret and mainGun sources are overridden by body = "mainTurret"; gun = "mainGun"; in turret config, if you leave those fields blank and define those sources to animationSources with source="user" then you will be able to animate it with approach you described above class AnimationSources:AnimationSources { class MainGun {source="user";animperiod=16;}; class MainTurret {source="user";animperiod=22;}; }; if you want to have such ability and still able to rotate gun in normal mode you need to model.cfg something like this class Elev: MainGun { source="Elev"; }; class Lead: MainTurret { source="Lead"; }; and then class AnimationSources:AnimationSources { class muzzle_rot_cannon {source = "ammorandom"; weapon = "rhs_weap_m256";}; class recoil_source {source = "reload"; weapon = "rhs_weap_m256";}; class elev {source="user";animperiod=16;}; class lead {source="user";animperiod=22;}; }; other than that I didn't found any script solution without changing addon for described above issue. 1 Share this post Link to post Share on other sites
quantenfrik 10 Posted July 27, 2014 Thank you very much! But I still could use some help to get it working, because my knowledge and understanding of configs and inheritance is still very limited. I'm trying to get this working on the Scorcher, so I won't be able to access the model.cfg, if I understand correctly; I read it's somehow "baked" into the p3d. But not being able to use the gun in direct fire would be an acceptable trade off in my opinion, because the Scorcher still has the HMG/GMG turret and the cannon is at the moment useless anyways for engaging targets in sight, until a FCS is implemented. But I can't get this to work. I use this code: class CfgPatches { class fixed_scorcher { units[] = {B_MBT_01_arty_F}; weapons[] = {}; requiredVersion = 0.1; requiredAddons[] = {"A3_Armor_F"}; }; }; class B_MBT_01_arty_F; class Turrets; class MainTurret; class AnimationSources; class muzzle_rot_cannon; class CfgVehicles { class B_MBT_01_arty_F; class B_MBT_01_arty_F2: B_MBT_01_arty_F { class Turrets: Turrets { class MainTurret: MainTurret { body = ""; gun = ""; }; }; class AnimationSources: AnimationSources { class muzzle_rot_cannon: muzzle_rot_cannon { source = "user"; animperiod = 16; }; }; }; }; I pbo it with binPBO and it doesn't give me any errors in the log file. It creates a second instance of the Scorcher (B_MBT_01_arty_F2), but I am still able to move the gun manually and can't animate it. Reyhard, I hope I implemented what you said correctly (leaving blank, or better said erasing, body and gun), but as I tried to create a class MainTurret under AnimationSources, it gave me the "member already defined" error, I think because it's already the name the of the turret, so I tried muzzle_rot_cannon, with no success. Am I overlooking something completely obvious or is my entire approach messed up (you didn't mention creating a new addon, but I could think of no other way to change the config entries)? Share this post Link to post Share on other sites
reyhard 2082 Posted July 28, 2014 ah, I forget about animationSourceGun & Turret below code is somehow working but I noticed strange quirk in muzzle behaviour which probably is caused because of artillery computer class CfgPatches { class fixed_scorcher { units[] = {B_MBT_01_arty_F}; weapons[] = {}; requiredVersion = 0.1; requiredAddons[] = {"A3_Armor_F"}; }; }; class B_MBT_01_arty_F; class Turrets; class MainTurret; class AnimationSources; class muzzle_rot_cannon; class CfgVehicles { class B_MBT_01_arty_F; class B_MBT_01_arty_F2: B_MBT_01_arty_F { displayName="nananana"; class Turrets: Turrets { class MainTurret: MainTurret { body = ""; gun = ""; animationSourceBody = ""; animationSourceGun = ""; }; }; class AnimationSources: AnimationSources { class mainGun { source = "user"; animperiod = 16; }; class mainTurret: mainGun { animperiod = 22; }; }; }; }; notice how shell is flying (tried three fire modes - close, med & extreme) http://reyhard.armacenter.pl/arma3/cheating.jpg dunno, if switching off artillery computer will have any effect but you may try adding artilleryScanner=0; below displayName Share this post Link to post Share on other sites
quantenfrik 10 Posted July 29, 2014 Thanks a lot! It looks really nice already! I also experienced the strange shooting behaviour, but unfortunately it was not caused by the artillery computer, I switched it off like you suggested and it didn't change much. I now spent some hours on trying all the different possibilities to make the gun not only point but also shoot in the right direction, but I haven't gotten anywhere, although I must have tried at least 50 variations. What I also don't understand is how it is still possible to move the gun at all after gun, body, animationsourcebody and turret have been erased. I tried to overwrite the source of mainTurret and mainGun as described here https://community.bistudio.com/wiki/Model_Config but with no result. What also came to my mind was changing the turretInfoType, because I thought there was some kind of connection between this and the gun, but this only screwed up the optics. I have also noticed that it is still possible to lay the gun with pgup/pgdown, this won't change the visual direction of the barrel but this will determine the direction in which the shell is shot, also the elv number in the hud will change. Maybe there is another animation defined in the model.cfg, is there anyway to access it? The AI also completey ignores the laying of the gun, it will shoot, even if the direction is horizontally changed, to the front at a low angle (~1°), even if it's like set to 10°. The player shoots in the horizontal direction if (that is really strange, but maybe i observed it incorrecty) the point the optics are pointing to is in range of a high firing solution, otherwise he will also shoot straight up front too. weaponDirection will return a value independent from these, so there are 3 different elevation values in total :S. Share this post Link to post Share on other sites
quantenfrik 10 Posted July 31, 2014 As I searched further, I came accross another idea: My problem could also be about inheriting and referencing. I came to this like this: I modified the code to this class CfgPatches { class fixed_scorcher { units[] = {B_MBT_01_arty_F}; weapons[] = {}; requiredVersion = 0.1; requiredAddons[] = {"A3_Armor_F"}; }; }; //class B_MBT_01_arty_F; class Turrets; class MainTurret; class AnimationSources; //class muzzle_rot_cannon; //class elevation; //class MainGun; //class lead; class CfgVehicles { class B_MBT_01_arty_F; class B_MBT_01_arty_F2: B_MBT_01_arty_F { displayName = "nananana"; artilleryScanner = 0; class AnimationSources: AnimationSources { /*class MainTurret { type="::"; source="::"; memory = ::;//by default animPeriod = ::;//Unknown selection="::"; axis="::";//*possibly* minValue = -::;//rad -360.0 maxValue = ::;//rad 360.0 minPhase = ::;//rad -360.0 maxPhase = ::;//rad 360.0 angle0 = ::;//rad 0.0; angle1 = ::;//rad 0.0; }; class MainGun { type="::"; source="::"; memory = ::;//by default animPeriod = ::;//Unknown selection="::"; axis="::";//*possibly* minValue = -::;//rad -360.0 maxValue = ::;//rad 360.0 minPhase = ::;//rad -360.0 maxPhase = ::;//rad 360.0 angle0 = ::;//rad 0.0; angle1 = ::;//rad 0.0; };*/ class MainTurret2 { type="rotationY"; source="user"; memory = 1;//by default animPeriod = 6;//Unknown selection="otocvez"; axis="otocvez_axis";//*possibly* minValue = -6.2831855;//rad -360.0 maxValue = 6.2831855;//rad 360.0 minPhase = -6.2831855;//rad -360.0 maxPhase = 6.2831855;//rad 360.0 angle0 = 0.0;//rad 0.0; angle1 = 0.0;//rad 0.0; }; class MainGun2 { type="rotationX"; source="user"; memory = 1;//by default animPeriod = 6;//Unknown selection="otochlaven"; axis="otochlaven_axis";//*possibly* minValue = -6.2831855;//rad -360.0 maxValue = 6.2831855;//rad 360.0 minPhase = -6.2831855;//rad -360.0 maxPhase = 6.2831855;//rad 360.0 angle0 = 0.0;//rad 0.0; angle1 = 0.0;//rad 0.0; }; /*class elevation { source = "user"; animperiod = 6; };*/ /* class lead { source = "::user"; animperiod = ::6; }; */ }; class Turrets: Turrets { class MainTurret: MainTurret { body = "MainTurret2"; gun = "MainGun2"; animationSourceBody = "MainTurret2"; animationSourceGun = "MainGun2"; //turretInfoType = "RscOptics_MBT_01_commander"; //gunnerOpticsModel = "\A3\weapons_f\reticle\Optics_Gunner_02_F"; elevationMode = 3; }; }; }; }; which doesn't work as it should, but provided some interesting finds: I basicly redefined the animations for the gun (I also tried to overwrite the original animations, hence all the colons but in this version they are not active) with MainTurret2 and MainGun2, however, ingame I was still able to animate the Turret and Gun with _Tank animate ["MainGun", 0.5]; So it still took the animations from the model.cfg, but somehow made the source to user, as I could animate them (although it was only visual, like described in my post above). But this brought me to the thought that he would not replace the animations because class Turrets; class MainTurret; and class AnimationSources; are defined outside cfgvehicles. I tried to define them then inside cfgvehicles but came to the following problem: I cannot reference them like B_MBT_01_arty_F, of which I basicly created a new instance. When I make something like this: class AnimationSources; class AnimationSources: AnimationSources , I get the member already defined error when starting the game. I also tried a setup found in here http://www.ofpec.com/forum/index.php?topic=31815.0 : class B_MBT_01_arty_F{}; class AnimationSources: B_MBT_01_arty_F{}; class Turrets: B_MBT_01_arty_F{}; class MainTurret: Turrets{}; and also this, which looks like the beginning of the config.cpp of vehicles: class B_MBT_01_arty_F{ class AnimationSources: B_MBT_01_arty_F{}; class Turrets: B_MBT_01_arty_F{ class MainTurret: Turrets{}; }; }; But neither of them work like they should, what I think they do is only take the parts I specially defined (those I want to change), so I can't inherit later B_MBT_01_arty_F2 from B_MBT_01_arty_F, because everything else is missing (icon, vehicleclass etc). Anybody who knows a way to solve this? Also this isn't really a mission editing question anymore, so I guess this could be moved to addons and scripting, but I don't really know how this is handled... Share this post Link to post Share on other sites
7Cav Wiper 10 Posted January 14, 2015 How far did you get with this, was following it for a while back in 2014 @quantenfrik Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted January 14, 2015 How far did you get with this, was following it for a while back in 2014 @quantenfrik Added: New animation source for lowering and raising of turrets Might be what some people have been waiting for. Hopefully it will be included with the next stable branch update. Share this post Link to post Share on other sites
Jona33 51 Posted January 14, 2015 What is your end goal, because I have a function that takes an artillery piece, a range, bearing, elevation difference and calculates the right angle for the gun to shoot at (then makes it shoot at that angle). I'm using it in my artillery system at the moment, it uses the doWatch command by calculating a point to aim at in the air. If you want I can tidy it up a touch and send it to you. Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted January 14, 2015 I'd be interested in this too, mind sharing it on the forums? Can't have enough arty. Cheers Share this post Link to post Share on other sites
da12thMonkey 1943 Posted January 14, 2015 Might be what some people have been waiting for. Pretty sure it's an animation source for raising and lowering ISTAR/Periscope turrets on top of masts like the commander's optics on the Strider/Fennek: From today's dev branch changelog: Added: Strider commander is able to use a blue pill on his turret (controls are not set yet) Share this post Link to post Share on other sites