sakakibara77 10 Posted January 17, 2015 i cant make this script!!!!! i want a script that make the enemy units attack units that are close 50M or changing the AI View Distance without changing player view distance. Example a solider moving around a base, when player or units get closer to 50M he can see them If anyone know how to make this please help me!!!!! Share this post Link to post Share on other sites
guziczek101 11 Posted January 17, 2015 maybe try with "setCaptive" parameter if distance beetwen Player and AI will be greater than 50 m then script will be changing this parameter to True if lower than set to false. I don't have betteqer idea to solve your problem maybe remove all magazines with distance condition. Share this post Link to post Share on other sites
sakakibara77 10 Posted January 17, 2015 (edited) I tried setCaptive and its not what im looking for, Thanks :D anyway Well it should not be 50M any distance is good and i saw this command: " _ESoldier1 doFire _WSoldier1; " this what im looking for but i want to provide a distance something like this (this is fake command) " _ESoldier1 doFire _WSoldier1; When_Distance_50m; " Like when a solider is looking at same side you are coming from he will attack when you are 50M close to him or Like zombie when you get close to a zombie he will attack you when you are close to him Edited January 17, 2015 by Sakakibara77 Share this post Link to post Share on other sites
JdB 151 Posted January 17, 2015 You could make a trigger with a size of 50. The Ai can't see you if you there is an object between you and the unit. Share this post Link to post Share on other sites
Macser 776 Posted January 17, 2015 (edited) This isn't very advanced.But it might do until a more experienced scripter comes along. In the example below I put two units on the map.The player obviously being one of them. I set the redfor unit to careless,and faced away from me,so I could make sure the unit was responding to the trigger. Then I put down a trigger with the code shown.The trigger can be any size. You could also use "Knowsabout" to instantly tell a unit the whereabouts of the player or other unit,when a condition is met. Here's a good source for OFP mission editors,if you haven't already got it. Edited January 17, 2015 by Maczer Share this post Link to post Share on other sites
sakakibara77 10 Posted January 17, 2015 (edited) Thanks guys!!! There is one problem in the command Maczer the unit wont shoot me only when i shoot first i want the enemy to shoot me as soon as i enter the trigger and if i don't enter the trigger he wont attack me, like a restricted area Edited January 17, 2015 by Sakakibara77 Share this post Link to post Share on other sites
zulu1 145 Posted January 17, 2015 (edited) Thanks guys!!!There is one problem in the command Maczer the unit wont shoot me only when i shoot first i want the enemy to shoot me as soon as i enter the trigger and if i don't enter the trigger he wont attack me, like a restricted area Maybe you need to add "sol1 dotarget player" before the dofire command ? Also like Mac suggested a "knowsabout" condition in combination with reveal should work. Edited January 17, 2015 by Zulu1 Share this post Link to post Share on other sites
nikiller 18 Posted January 17, 2015 (edited) hi, Put a gamelogic in the middle of your base and execute this script in its init field (not tested, singleplayer only). ;[gamelogicName] exec "scriptName.sqs" _gamelogic = _this select 0 _enemies=[e1,e2,e3,e4,e5,e6,e7,e8] _player=player _radius=50 _delay=1 _loop="loop" _ende="ende" {_x setSkill 0} forEach _enemies #loop ~_delay ? !(alive _player): goto _ende _distance=_player distance _gamelogic ? _distance>_radius: goto _loop ~_delay {_x setSkill 0.75} forEach _enemies ~_delay {_x reveal _player} forEach _enemies #ende exit cya. Nikiller. Edited January 17, 2015 by Nikiller Share this post Link to post Share on other sites
sakakibara77 10 Posted January 18, 2015 (edited) Thanks both off them worked at first it didn't work i had to name the enemy solider sol1 so it work i was searching for this for a long time The "sol1 dotarget player" before the dofire command and the scriptName.sqs worked perfectly. Here is the result: http://sendvid.com/8fsedge5 The Command I Used: sol1 setbehaviour "aware";sol1 dotarget player;sol1 dofireplayer Edited January 18, 2015 by Sakakibara77 Share this post Link to post Share on other sites