[aps]gnat 28 Posted May 24, 2004 Found a couple of threads on the issue but none seem to provide a proper answer. Anyone found the solution? I find it hard to believe this "Scan Horizon" command to AI cant be executed via the ACTION command ..... seems just about everything else can !!! Worst case ... I'd be interested in a script that simulates it ... BUT allows AI to engage enmy .... not just force them into a spin forever. (... for an M2 gunner ...) Cheers. Share this post Link to post Share on other sites
toadlife 3 Posted May 24, 2004 You'll find that many commands that are on the menu cannot be executed using the action command - like RELOAD For Scan Horizon, you can do it with a script, but you would have to figure out a way to make them stop. Here is a function that emulates the 'Watch Direction' you can give yo your soldier int he game. It could be used to make a scan horizon script. http://www.ofpec.com/editors/funcref.php?letter=W#WatchDirection Share this post Link to post Share on other sites
[aps]gnat 28 Posted May 25, 2004 thanks toad ...... real shame about the missing commands I'll use your function and see if I can add some scriptin to get these M2's to intelligently scan and engage ... Cheers! Share this post Link to post Share on other sites
[aps]gnat 28 Posted May 25, 2004 the combination works surprisingly well ! using toads 'Watch Direction' + this script. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0 _wmax = _this select 1 _unit SetCombatMode "RED" _unit SetBehaviour "COMBAT" #A _ww = random _wmax ~ _ww _wd = random 360 [units _unit, _wd] call WatchDirection goto "A" Call it in a units INIT field like this. (Like M2 MG) [this, 12] exec "scan.sqs" >12< is the max random time (secs) the unit will wait between changing to face a new random direction. Doesnt effect them engaging enmy ..... they may flinch for a fraction of a sec when the script issues a new direction but they immediately re-engage any existing targets. Hint: For M2 static MG's anyway .... make the skill higher and up the rank ..... they are more likely to engage targets. Share this post Link to post Share on other sites
Major Fubar 0 Posted May 25, 2004 Cool...I might try this solution for my watchtower lookout. Share this post Link to post Share on other sites
Unnamed_ 0 Posted May 25, 2004 Probably not much use to [APS]Gnat unless he wants to increase the detection range of the MG gunner. But for a watch tower observer, you could try this: http://www.flashpoint1985.com/cgi-bin....t=38886 As it was designed for just this kind of job. Thats assuming you dont mind using addons Share this post Link to post Share on other sites
[aps]gnat 28 Posted May 25, 2004 well ... I would consider those nice addon's ... cept its for an MP missions and I dont control the Server addons .... Thanks anyways unnamed. Share this post Link to post Share on other sites
Unnamed_ 0 Posted May 25, 2004 No worries, thats why I mentioned it. Addons can be a double edged sword in MP Share this post Link to post Share on other sites
[aps]gnat 28 Posted May 26, 2004 ooops! Forgot a; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? _unit !alive : exit inside the "A" loop for tidyup purposes ..... . Share this post Link to post Share on other sites
-=BT=- Matty R 0 Posted May 26, 2004 so what is the script i got confused now Share this post Link to post Share on other sites
[aps]gnat 28 Posted May 26, 2004 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0 _wmax = _this select 1 _unit SetCombatMode "RED" _unit SetBehaviour "COMBAT" #A ?!alive _unit : exit _ww = random _wmax ~ _ww _wd = random 360 [units _unit, _wd] call WatchDirection goto "A" . Share this post Link to post Share on other sites
somebloke 0 Posted May 26, 2004 You do realize there is a scan horizon feature within the squad command. Just select a man from your squad then go to either Target or Engage (can't remember which one) and it should have an option, scan horizon. Share this post Link to post Share on other sites
MrZig 0 Posted May 26, 2004 But do you realize that he knows that? Quote[/b] ] find it hard to believe this "Scan Horizon" command to AI cant be executed via the ACTION command ..... seems just about everything else can !!! He wants to make lookout ai scan horizon that are not in his group. Share this post Link to post Share on other sites
Major Fubar 0 Posted May 27, 2004 It's hard to believe that there isn't a way to execute all of the squad commands through an action in a unit's init line...hope someone eventually figures it out. Share this post Link to post Share on other sites
toadlife 3 Posted May 27, 2004 FYI: Over at OFPEC there is a thread that lists all of the actions people have figured out. There are quite a few. Share this post Link to post Share on other sites
toadlife 3 Posted May 27, 2004 Cool...I might try this solution for my watchtower lookout. I've used this for sentrys in all of my missions. It makes guards *much* more effective. Share this post Link to post Share on other sites
[aps]gnat 28 Posted May 29, 2004 small problem ... the ALIVE test is only testing M2 gun itself .......... not the soldier who was manning it. Any idea how to ALIVE test just the soldier manning the M2 ... not the M2 itself ? "this select 1" or something ? One side effect is that if you man the MG after you shot the gunner, you and your group is issued Change Facing commands LOL ... Share this post Link to post Share on other sites
MrZig 0 Posted May 29, 2004 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(Alive) gunner m2 : hint "The gunner of the m2 is dead" Share this post Link to post Share on other sites
[aps]gnat 28 Posted May 30, 2004 Thanks Zig! ** All New and Improved AI Scan Horizon script ** <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; AI Scan Horizon by Gnat ; USE, eg in INIT ; [this, 12] exec "scan.sqs" ; >12< is number of secs between a facing change ; uses toadlife's WatchDirection function: See OFPEC.com _unit = _this select 0 _wmax = _this select 1 ; set the behaviour (your choice, manual) _unit SetCombatMode "RED" _unit SetBehaviour "COMBAT" _unitX = _unit ; is there a gunner in the object ... then select just him. ?alive(gunner _unit) : Â _unitX = (gunner _unit) ; if this is not a "man" and there is no gunner ..... exit ?("Man" counttype [_unit] != 1) AND (!alive(gunner _unit)) : Â exit ; main loop ... exit when the man/gunner dies #A ?!alive _unitX : exit _ww = random _wmax ; wait a random time ~ _ww ; Select a random direction _wd = random 360 [units _unitX, _wd] call WatchDirection goto "A" - Now works on AI manned vehicles (with gunners only) - Also works on men or groups. One note, script is terminated when the man/gunner dies, if an AI runs up and re-mans a gun (as they do from time to time) the script wont re-initiate. Probably a simple change (prob an @alive) but didnt think it was worth it. Share this post Link to post Share on other sites
MrZig 0 Posted May 30, 2004 Quote[/b] ]One note, script is terminated when the man/gunner dies, if an AI runs up and re-mans a gun (as they do from time to time) the script wont re-initiate. Probably a simple change (prob an @alive) but didnt think it was worth it. Could always use a get-in eventhandler Share this post Link to post Share on other sites
Blanco 0 Posted June 1, 2004 neat script, this give me some ideas... Â <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _unit = _this select 0 _wmax = _this select 1 _unit SetBehaviour "SAFE" ? !(_unit hasweapon "binocular") : _unit addweapon "binocular" #A ?!alive _unit : exit ? behaviour _unit != "SAFE" : goto "alarmed" _ww = random _wmax ~ _ww _wd = random 360 [units _unit, _wd] call WatchDirection ? behaviour _unit == "SAFE" : _unit selectweapon "binocular" goto "A" #alarmed hint "alaaaaaarm!!!" ;;... whatever you need... ... exit Not for AI gunners... This way the lookout uses his binocular everytime he watches a new direction Not tested yet, but it should work. ** edited** thx Zig Share this post Link to post Share on other sites
MrZig 0 Posted June 1, 2004 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? !(_unit hasweapon 'binocular") : _unit addweapon "binocular" In the first 'binocular", you have a ', not a ". So it should be <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? !(_unit hasweapon "binocular") : _unit addweapon "binocular" Share this post Link to post Share on other sites