Desert-Rat 0 Posted June 4, 2006 Is it possible to make a kind of virtual gunner? it is possible to make the driver can fire and drive but then you can aim only at targets infront of you , i want a kind of virtual gunner which can aim enemys itself or the driver lock targets and the "virtual" gunner aims at them Share this post Link to post Share on other sites
Cpt Viper 0 Posted June 4, 2006 Uhm. AI ? I'm not sure what you mean with this, but I guess AI does quite the same for you. Share this post Link to post Share on other sites
Desert-Rat 0 Posted June 4, 2006 Well i mean that the tank just have one crew , but the turret works like if a gunner is in  that he moves the turret in the direction of the enemy without the chassis follow the gun Share this post Link to post Share on other sites
hardrock 1 Posted June 4, 2006 Of course. You just have to put an AI into the gunner slot that can't get out and doesn't get damaged. Or you do it like in the editor updates, where there exist tanks with 1 AI, means the player drives the tank and fires the gun at once (BF style). Share this post Link to post Share on other sites
Desert-Rat 0 Posted June 4, 2006 ya that sounds cool does it needs a script or is that written in the cfg? Share this post Link to post Share on other sites
franze 196 Posted June 4, 2006 I think what you're looking for is in createvehicle. If you create a soldier unit and then put him into a fake gunner's seat on the vehicle, it'll function just like an AI gunner without having to group the soldier. *If* that's what you're looking for. Share this post Link to post Share on other sites
UNN 0 Posted June 4, 2006 Check out the M1AbramsAuto, it's defined in the default OFP config. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class M1AbramsAuto: M1Abrams { scope=protected; displayName=$STR_DN_M1A1_AUTO; hasGunner=false; hasCommander=false; }; But basicly, if you set hasgunner and hascommander to false. You can drive and shoot. If you want the gun fixed, you might have to mess around with the turrent definition. Share this post Link to post Share on other sites
Desert-Rat 0 Posted June 4, 2006 @Franze Ya thats what i am searching how to do this? Share this post Link to post Share on other sites
action man 0 Posted June 4, 2006 Yeah man,the game already let's you do it Once in a armed tank/helicopter/apc/plane ect if you are the driver/pilot, right mouse click,then you will get an option for "manual fire".Hey presto you can then fire even if you are driving p.s try it it's "ace" Share this post Link to post Share on other sites
UNN 0 Posted June 5, 2006 Quote[/b] ]i want a kind of virtual gunner which can aim enemys itself or the driver lock targets and the "virtual" gunner aims at them I think I misread this the first time round. I think Desert-Rat does want an AI gunner, only one thats not visible to the driver\player in any way. There would be a couple of ways of doing it. Build it as a regular OFP vehicle then either, remove the gunners proxy from the view LOD's or use an invisible unit. Game logics won't do, it has to be class man. On top of that, you would have to move the gunner into a seperate group with some simple scripting run from the vehicles init event. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Vehicle=_This Select 0 ;Get the vehicles gunner _Gunner=Gunner _Vehicle ;Wait for the group to be initialised @!(IsNull (Group  _Gunner)) ;Move him into a speperate group [_Gunner] Join GrpNull You would also need to do something to stop him leaving the vehicle if it's damaged, using the getout event. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Vehicle=_This Select 0 _Pos=_This Select 1 _Unit=_This Select 2 ;If it's not the gunner then exit If (_Pos!="gunner") Then {goto "Exit"} ;If he get outs because the vehicle is disabled then delete him else return him If !((CanMove _Vehicle) Or (Alive _Vehicle)) Then {DeleteVehicle _Unit} Else {_Unit AssignAsGunner _Vehicle; _Unit MoveInGunner _Vehicle} #Exit If your creating your own vehicle, you would call these scripts from the config.cpp events. This is just a quick idea of what scripts you might need to run. Plus there is still the problem of replacing the gunner of a damaged vehicle thats been repaired. But I'm still not 100% sure this is what Desert-Rat is after? Share this post Link to post Share on other sites
Desert-Rat 0 Posted June 5, 2006 yes thats what i am searchin for Share this post Link to post Share on other sites
franze 196 Posted June 6, 2006 Our Kiowa Warrior has the feature you're looking for, you don't need to use createunit - here's the script the Kiowa uses (performed via action menu): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _oh58 = _this select 0 ?(fz_oh58scripts == 0): exit ?!(local _oh58): exit _oh58 animate ["copilot",0] _fakeguy = "fz_boxdude" createvehicle [0,0,1000] _fakeguy assignascargo _oh58 _fakeguy moveincargo _oh58 _oh58 vehiclechat "Gunner controls ENABLED." #waitloop ~0.00001 ?!(alive _oh58): goto "quit" ?(getdammage _fakeguy > 0.01): _fakeguy setdammage 0 ?!(_fakeguy in _oh58): goto "quit" ?(_oh58 animationphase "copilot" == 1): goto "quit" goto "waitloop" #quit _fakeguy setpos [0,0,0] deletevehicle _fakeguy exit Essentially, the script creates a fake soldier (in the case of Kiowa, a custom guy with no detail lod) with createvehicle and places him in either the gunner seat or the 'back' seat. For all intents and purposes, it functions the same as if a regular gunner was in the gunner seat. It also has a continuous loop to ensure that the fake gunner isn't killed until the helicopter itself is destroyed, preventing the helicopter from carrying more than two real crewmen. In short, here's what you need for your tank: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _vehicle = _this select 0 _fakeguy = "SoldierWB" createvehicle [0,0,1000] _fakeguy assignasgunner _vehicle _fakeguy moveingunner _vehicle #loop ~0.01 ?!(alive _vehicle): exit ?(getdammage _fakeguy > 0.01): _fakeguy setdammage 0 goto "loop" Share this post Link to post Share on other sites
Desert-Rat 0 Posted June 6, 2006 thanks i will try out Share this post Link to post Share on other sites