raedor 8 Posted December 29, 2006 Here you go. I'm sorry, but the vectorDir solution was not possible (as you have to step the dir). Well, I took vb's idea to save a lot performance anyway (if you know how a computer computes sin/cos, you know why it saves a lot ). I hope the 10.000 while do limit is fixed within the next patch, that's why I didn't add more while do's. I added a new argument for the up/down angle of the searchlight.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private["_sl","_ang","_del","_dir","_h","_dis","_px","_py","_sin","_cos","_i","_c"]; _sl=_this select 0; _ang=(_this select 1)/2; _del=_this select 2; _h = _this select 3; _dis = 20; _py = position _sl; _px = _py select 0; _py = _py select 1; _sin = []; _cos = []; _dir = direction _sl; for "_i" from _dir-_ang to _dir+_ang step 1 do { _sin = _sin + [(sin _i)*_dis]; _cos = _cos + [(cos _i)*_dis]; }; _i = -1; _c = _ang; while {true} do { while {alive gunner _sl} do { _sl doWatch [_px + (_sin select _c), _py + (_cos select _c), _h]; sleep _del; _c = _c + _i; if (_c < 0) then { _i = 1; _c = 0; sleep _del*5; }; if (_c > 2*_ang) then { _i = -1; _c = 2*_ang; sleep _del*5; }; }; };(I'm sorry for the format, but my tabs are ignored by IB) Share this post Link to post Share on other sites
BadAss -Mapfact.net- 0 Posted December 29, 2006 Well then i give it a try. Looks just like we're gonna get this done this year?! Thanks a lot to all! EDIT: I'm getting an error message in line 31. Quote[/b] ]_sl #doWatch Type anything?(jede in german), expecting number. EDIT 2: Fixed it mysself. Â Added the height parameter to the script call and changed line 9-11 from _py = position _sl; to _pos = position _sl; and so on. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private["_sl","_ang","_del","_dir","_h","_dis","_px","_py","_sin","_cos","_i","_c"]; _sl=_this select 0; _ang=(_this select 1)/2; _del=_this select 2; _h = _this select 3; _dis = 20; _pos = position _sl; _px = _pos select 0; _py = _pos select 1; _sin = []; _cos = []; _dir = direction _sl; for "_i" from _dir-_ang to _dir+_ang step 1 do { _sin = _sin + [(sin _i)*_dis]; _cos = _cos + [(cos _i)*_dis]; }; _i = -1; _c = _ang; while {true} do { while {alive gunner _sl} do { _sl doWatch [_px + (_sin select _c), _py + (_cos select _c), _h]; sleep _del; _c = _c + _i; if (_c < 0) then { _i = 1; _c = 0; sleep _del*5; }; if (_c > 2*_ang) then { _i = -1; _c = 2*_ang; sleep _del*5; }; }; }; Call from you init.sqs (or init.sqf) with: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">searchlight = compile preprocessFile "searchlight .sqf"; [UnitName,AngleToCover,Delay,Height] spawn searchlight; With the height added by raedor you have excellent AA searchlights if you want to. So once again, thanks for all your help! Share this post Link to post Share on other sites
raedor 8 Posted December 29, 2006 Huh? It works just fine for me, I'm executing it with<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">dummy=[sl2,180,.1, 5] execVM "MAP_Searchlight.sqf"; Share this post Link to post Share on other sites
BadAss -Mapfact.net- 0 Posted December 29, 2006 Yeah, see my Edit 2. I just didn't see that you've added the height parameter that wasn't there before... Share this post Link to post Share on other sites
raedor 8 Posted December 29, 2006 I added a new argument for the up/down angle of the searchlight. You remember Lester's sig? Share this post Link to post Share on other sites
sickboy 13 Posted December 29, 2006 Sweet! Nice Ones Share this post Link to post Share on other sites
BadAss -Mapfact.net- 0 Posted December 29, 2006 Allright, i see. just focused on the script not your text. Share this post Link to post Share on other sites
sickboy 13 Posted December 29, 2006 Was thinking though... How about a trigger on the map (or an array of detectable units), with somewhere a variable of which side can be detected by the searchlights? Where it will break the loop and shines the light on their enemies, if they (or nearby enemies?) KnowsAbout anyone of the chosen side or the mentioned array, that would be sweet wouldn't it? Share this post Link to post Share on other sites
raedor 8 Posted December 29, 2006 Was thinking though...How about a trigger on the map (or an array of detectable units), with somewhere a variable of which side can be detected by the searchlights? Where it will break the loop and shines the light on their enemies, if they (or nearby enemies?) KnowsAbout anyone of the chosen side or the mentioned array, that would be sweet wouldn't it? It would be, definitely Maybe we can include something like that. Share this post Link to post Share on other sites
sickboy 13 Posted December 29, 2006 It would be, definitely Maybe we can include something like that. Well, we can for sure, just let me know if it's wanted, and if noone else would be working on it, and which timeframe ppl are thinking of needing this for release, and i'll probably work it out for yah Share this post Link to post Share on other sites
raedor 8 Posted December 29, 2006 It would be, definitely Maybe we can include something like that. Well, we can for sure, just let me know if it's wanted, and if noone else would be working on it, and which timeframe ppl are thinking of needing this for release, and i'll probably work it out for yah BadAss is about to contact you. Share this post Link to post Share on other sites
Blanco 0 Posted December 29, 2006 Was thinking though...How about a trigger on the map (or an array of detectable units), with somewhere a variable of which side can be detected by the searchlights? Where it will break the loop and shines the light on their enemies, if they (or nearby enemies?) KnowsAbout anyone of the chosen side or the mentioned array, that would be sweet wouldn't it? Yeah, I was thinking the same when I've wrote mine. Even make it possible to detect friendly dead bodies and put them in some sort of known list. Problem is.. what happens when there's an object (like a building) between the spotted enemy and the searchlight. The spotter will follow him but he's not able to see him. Why do you need a trigger or array with enemies when there's a command that finds the nearest enemy from a specific position? Nearestenemy That should create your enemies array automatically. Never tried that command before, but I think it's definitely worth a try. Share this post Link to post Share on other sites
deanosbeano 0 Posted December 29, 2006 Quote[/b] ]what happens when there's an object (like a building) between the spotted enemy and the searchlight.The spotter will follow him but he's not able to see him. thats no problem in arma ,just bring the building down lol. only joking . i have been working on this but plane and helo spotting. crashdome was helping me earlier and i just saw this thread. you might wanna try the nearestobjects ,its a fanatastic lil thing, you can create arrays of helis men buildings etc within a certain range of your light and then deduce from the array ,when using man/air class of course who is enemy and who isnt.myabe create a lil pause at each unit or if its a high risk threat then increase the pause. btw the nearestobjects is also useful for when the spotlightt is idle too, just send it an array of nearest buildings and it will look at them one by one , you can adjust the height to make it look up and down the building too. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Atw = Nearestobjects [_watcher,["Building"],100] hope someone can write some efficient sqf stuff using these commands.i tried to learn from biki ,but alot of the code there gives me problems. Share this post Link to post Share on other sites
sickboy 13 Posted December 29, 2006 ... Gonna let it cross my mind in the weekend... Nice ideas etc! Thanks Share this post Link to post Share on other sites
BadAss -Mapfact.net- 0 Posted December 30, 2006 Nice ideas for sure. As long it's adding to the atmosphere or used to make player feel hunted it's well worth having it. On the other hand this little and easy to implement function could easily turn into a mean ai addon. But before going in too deep i'ld rather suggest to think about it from the in game results of it. I see a lot of script work with tons of exeptions for a rather not measurable result. - With the OpFor using NVGs it's rather counterproductive. - Helos will be 'spotted' by ear rather then by sight - in case you don't have any AA weapons it doesn't make sense to light the chopper - that just tells 'em where to fire his guns - in case we're not talking 'bout nightstalkers the choppers might be lit up like x-mas trees - just another exception - How does the ai react in darkness generally? Do they 'see' less? Does light effect them? I'm not at all trying to discourage someone. Just my experience from my last OFP SP mission... Share this post Link to post Share on other sites
sickboy 13 Posted December 30, 2006 @ Dec. 30 2006,10:56)]Nice ideas for sure. As long it's adding to the atmosphere or used to make player feel hunted it's well worth having it. Quote[/b] ]I'm not at all trying to discourage someone. Just my experience from my last OFP SP mission...LOL, throwing up some other, good, views, aint discouraging in my books m8 We better be realistic and don't waste time for projects that seem little value when finished Quote[/b] ]How does the ai react in darkness generally? Do they 'see' less? Does light effect them?Actually I've been so busy that I didn't watch/recognize it yet, but I thought it would be ofp like Quote[/b] ]- Helos will be 'spotted' by ear rather then by sight- in case you don't have any AA weapons it doesn't make sense to light the chopper - that just tells 'em where to fire his guns Then don't light up choppers, or even turn off search lights in case of enemy chopper nearing? Quote[/b] ]- With the OpFor using NVGs it's rather counterproductive.The purpose of having this option, might be for making missions without NVG on opfor's side, while basing the spotting etc. with the search lights Quote[/b] ]On the other hand this little and easy to implement function could easily turn into a mean ai addon. But before going in too deep i'ld rather suggest to think about it from the in game results of it. I see a lot of script work with tons of exeptions for a rather not measurable result.For sure, let's check it out with some tests here and there, if the above mentioned texts got you hot for the option Quote[/b] ]- in case we're not talking 'bout nightstalkers the choppers might be lit up like x-mas trees - just another exceptionI didn't get this part :P Share this post Link to post Share on other sites
deanosbeano 0 Posted December 30, 2006 you have some very valid points there badass. If you consider though that the command wiil take subclasses too you can narrow down the amount of unwanted clutter from the search pattern. and also 5 or 6 logics in a circle can be randomly spotted whilst the spotlight is idle you just need to select 2 +random (??) for some variety of height . simply replace buildings with Logic . i have recently used this command for some addons i made ,which of course narrows down the size of the array considerably. Share this post Link to post Share on other sites
BadAss -Mapfact.net- 0 Posted December 31, 2006 Quote[/b] ]- in case we're not talking 'bout nightstalkers the choppers might be lit up like x-mas trees - just another exceptionI didn't get this part :P Okay, i was exaggerating a bit. Â Â OFP / ArmA helos have their position lights on, not exactly like a christmas tree. Just to stress my point that choppers are not really invisible exept maybe for the famous Nightstalkers - 160th Special Aviations Regiment. @ deanosbeano: breaking something complex down to smaller and easier to swallow chunks seems to be a good idea. On has to remind one self from time to time. I tend to forget that, unfortunately regularily. Maybe it'll be a good point to start with reaserching ai skills according to light and darkness. For that the knowsAbout command will be our best friend, i guess. Share this post Link to post Share on other sites
deanosbeano 0 Posted December 31, 2006 "Maybe it'll be a good point to start with reaserching ai skills according to light and darkness. For that the knowsAbout command will be our best friend, i guess. " well i did some testing when you mentioned about lighting helos up , so far with 2 men in the dark without nvg , both with clear line od sight about 15 -20 meters apart, knowsabout = 0,i focused searchlight on east soldier , no change same with 2 and 3 lights. so i guess light has no effect at all.( where ai is concerned of course). next i will try m2 static and have ai walk across its path in dark with and without light on Share this post Link to post Share on other sites
BadAss -Mapfact.net- 0 Posted December 31, 2006 Hey, cool thing you've started testing already! Thanks! As to the results: rather disappointing that the light seems to have no effect. Can you please send me your test mission? So i can try it out with the exact same settings like you? So we can compare the results and see if that's a general rule of ai skill and behaviour? As an addition we could test all the same in the birghtest light of day to see if there's a difference between night and day at all. Share this post Link to post Share on other sites
deanosbeano 0 Posted December 31, 2006 yes of course you can have it, i will pm you my icq ,if you have it ? one thing i have found that is strange. scenario 1 :start up mission .touch nothing all is calm , all knownabouts are 0. abort misssion restart . all is calm. scenario 2 start up misssion . focus 1,2,3,4 searchlights on east man . all known abouts = 0. abort misssion restart . known abouts = 4 bang east soldier dead. hmm weird. ok after further testing ,scrap the above ,it wasnt lights it was the engine having a random guess at who kows about what . @daylight . at roughly 4.36 am everyone knows about everyone they can see . Share this post Link to post Share on other sites
landdon 0 Posted June 3, 2007 Gentlemen, I would like to add this to a mission I am building. Â I not following the instructions in here. Do you have a demo mission I could use? Share this post Link to post Share on other sites
mattxr 9 Posted December 20, 2007 Here you go. I'm sorry, but the vectorDir solution was not possible (as you have to step the dir). Well, I took vb's idea to save a lot performance anyway (if you know how a computer computes sin/cos, you know why it saves a lot  ). I hope the 10.000 while do limit is fixed within the next patch, that's why I didn't add more while do's. I added a new argument for the up/down angle of the searchlight.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private["_sl","_ang","_del","_dir","_h","_dis","_px","_py","_sin","_cos","_i","_c"];_sl=_this select 0; _ang=(_this select 1)/2; _del=_this select 2; _h = _this select 3; _dis = 20; _py = position _sl; _px = _py select 0; _py = _py select 1; _sin = []; _cos = []; _dir = direction _sl; for "_i" from _dir-_ang to _dir+_ang step 1 do { _sin = _sin + [(sin _i)*_dis]; _cos = _cos + [(cos _i)*_dis]; }; _i = -1; _c = _ang; while {true} do { while {alive gunner _sl} do { _sl doWatch [_px + (_sin select _c), _py + (_cos select _c), _h]; sleep _del; _c = _c + _i; if (_c < 0) then { _i = 1; _c = 0; sleep _del*5; }; if (_c > 2*_ang) then { _i = -1; _c = 2*_ang; sleep _del*5; }; }; }; (I'm sorry for the format, but my tabs are ignored by IB)When you shoot the guy on the searchlight you loose about 10 fps and then another you loose about 5? Im not sure what happens but it seems the script cant work when the man dies.. i need help. Share this post Link to post Share on other sites
thegunnysgt 1 Posted May 23, 2008 Hi, I'm looking over this thread looking for a working searchlight script and wanted to know what is the latest working script? I want to get the latest one that works, but through all the discussion in this thread, I don't want to get one that is still being worked on. Share this post Link to post Share on other sites