wiggum2 31 Posted September 18, 2011 I just cant get this work... I would need a script for a night mission that reveals all enemy units closer then 25m distance to all friendly units in 50m distance. So a example: East group patrols and one unit of the east group comes closer then 25m to 3 west soldiers. Now the east unit should reveal these 3 west soldiers to all friendly (east) soldiers in 50m distance. The same thing should work for west units too, i dont know if i would need 2 seperate scripts...and i dont care about that anyway... ;) These script(s) should run the hole time over the complete map and should affect all units (east & west). I need such a script because units without NVG are blind as hell even if it is a bright night...this can result in odd situations. Can someone help ? Share this post Link to post Share on other sites
gossamersolid 155 Posted September 18, 2011 Well I'll link you to two commands that you can use to achieve this. Then you can work on it and re-post here when you have something working and need some additional help: http://community.bistudio.com/wiki/reveal http://community.bistudio.com/wiki/nearObjects Share this post Link to post Share on other sites
wiggum2 31 Posted September 18, 2011 I know about these commands and have tried many differend scripts but none of them worked. Sadly i deleted my last attempt and cant post it but i will try: if (side _x == east) AND (_x distance units group player < 25) then { _x reveal units group player; }; } foreach units (_x distance <= 50); Share this post Link to post Share on other sites
gossamersolid 155 Posted September 18, 2011 (edited) Your forEach syntax is wrong, here's an example that would work: { if (typeOf _x == "MustardTiger") then { hint "poop"; }; } forEach _arrayOfUnits; EDIT: Incase you didn't see it, you are missing an opening bracket for your forEach statement. Edited September 18, 2011 by GossamerSolid Share this post Link to post Share on other sites
celery 8 Posted September 18, 2011 The reveal command unfortunately has little effect in low light combat conditions, because a unit needs at least 1.4 knowsAbout to engage another unit, and reveal only sets it to 1. Share this post Link to post Share on other sites
wiggum2 31 Posted September 18, 2011 (edited) Mhh. thats bad... Any idea how to fix it because it breaks low light combat totally for me. I came up with this: while {true} do { _pos=_this select 0; _targetsArray = nearestObjects [_pos, ["Man","Tank", "Air", "Car"], 50]; _units = player; { if (side _x == EAST) then { _units reveal _x; }; } forEach _targetsArray; sleep 5; }; And yes, i was not able to identify a enemy right next to me.... :eek: That guy stared at me and i at him and he was still "Unknown Man" to me. Found another thread about the same issue: http://forums.bistudio.com/showthread.php?t=119874&highlight=knowsabout There are scripting commands for just everything...but not for set knowsabout ? Edited September 18, 2011 by Wiggum Share this post Link to post Share on other sites
f2k sel 164 Posted September 18, 2011 odd I tried the reveal and knowsabout returns 1 but after about 10-20 seconds it jumps to 4, neither units are moving. Removing reveal, knowsabout returns 0 and unit never fires. The same happens in total darkness with no night vision. Share this post Link to post Share on other sites
wiggum2 31 Posted September 18, 2011 (edited) I now got it working a bit better using sucha trigger: BLUFORE detected by OPFORE / repeatedly: GermanArmy = nearestObjects [AL1, ["I44_man_G"], 200]; {_x setbehaviour "COMBAT"; _x setcombatmode "RED"} foreach GermanArmy; {_x reveal ((list AL1) select 0)} foreach GermanArmy; Inside those trigger area the enemy will detect me after a few seconds and start shooting at me. all enemy units inside that area (200m) will hunt me down. Now i need something for my side too... EDIT: No...looks like some random behaviour, now it does not work again...arh ! It looks like someone has to shoot first to raise "knowsAbout" high enough so that both sides know they have a enemy unit right infront of them ! Edited September 18, 2011 by Wiggum Share this post Link to post Share on other sites
f2k sel 164 Posted September 18, 2011 (edited) I can get East revealed to West but not the other way around. //null=[location] execvm "find.sqf" _pos = _this select 0; _eastmen = nearestobjects [_pos,["SoldierEB"],50]; _westmen = nearestobjects [_pos,["SoldierWB"],50]; hint format ["west %1 east %2",count _westmen,count _eastmen]; sleep 2; // reveal West to East { _temp = _x; {_temp reveal _x} foreach _westmen; } foreach _eastmen; // reveal East to West { _temp = _x; {_temp reveal _x} foreach _eastmen; } foreach _westmen; I think reveal is broken, I just tried revealing a named west unit to east unit and nothing but it works the other way around. reveal only seems to work up to 25 meters anyway. Edited September 20, 2011 by F2k Sel Share this post Link to post Share on other sites
CarlGustaffa 4 Posted September 19, 2011 You can heighten AIs awareness by creating #lightpoint only on the server. Normal flares won't help AI at all, strangely enough. Keep in mind this approach doesn't work that good on hosted missions, obviously, only on dedicated. Share this post Link to post Share on other sites
wiggum2 31 Posted September 19, 2011 You can heighten AIs awareness by creating #lightpoint only on the server. Normal flares won't help AI at all, strangely enough. Keep in mind this approach doesn't work that good on hosted missions, obviously, only on dedicated. And it will not work in SP missions i think. (I need a solution for a SP mission) Someone in another topic told me that it would be possible to "set the AI to daylight" while for the player its still night. I did a quick search and was not able to find some infos about that. Does someone know more about that ? Share this post Link to post Share on other sites
demonized 20 Posted September 19, 2011 possible workaround idea: have one unit join the "spotted" group and then leave and report to the "enemys" via reveal. that should give a value of 4 right away, most likely without being noticed by player since it happens fast.... FAR from perfect though... place 1 civilian unit out of the mission area, name it whatever here i use spotter. run this from init.sqf with _null = [] execVM "script.sqf"; _spot = spotter; // civilian "spotter" name // make spotter safe, dumb and invisible. _spot allowDammage false; _spot setCaptive true; hideObject _spot; _spot setSkill 0; removeAllWeapons _spot; _spot disableAI "AUTOTARGET"; while {true} do { { _unit = _x; { if ((_unit distance _x) < 25 AND (side _x) != (side _unit)) then { if ((_unit knowsAbout _x) < 2) then { [_spot] joinSilent (group _x); waitUntil {(_spot knowsAbout _x) >= 2}; [_spot] joinSilent (group _unit); _unit reveal _x; }; if ((_x knowsAbout _unit) < 2) then { [_spot] joinSilent (group _unit); waitUntil {(_spot knowsAbout _unit) >= 2}; [_spot] joinSilent (group _x); _x reveal _unit; }; }; _spot joinSilent grpNull; } foreach allUnits; } foreach allUnits; sleep 1; }; just a untested idea, fiddle with it, might prove utterly useless in the end if much are going on in your mission. also, not MP compatible at all as is. Share this post Link to post Share on other sites
wiggum2 31 Posted September 19, 2011 Thanks for your script Demonized but it makes no difference for me. I think the problem is really that reveal only sets "knowsabout" to 1 while 1.4 would be needed. Thats why i hope set the AI to daylight is possible... ;) Share this post Link to post Share on other sites
demonized 20 Posted September 19, 2011 ops, there was a quick error in the script, this is with the _spotter revealing as it was intended. i highlighted the change, just a stupid mistake, still untested though. _spot = spotter; // civilian "spotter" name // make spotter safe, dumb and invisible. _spot allowDammage false; _spot setCaptive true; hideObject _spot; _spot setSkill 0; removeAllWeapons _spot; _spot disableAI "AUTOTARGET"; while {true} do { { _unit = _x; { if ((_unit distance _x) < 25 AND (side _x) != (side _unit)) then { if ((_unit knowsAbout _x) < 2) then { [_spot] joinSilent (group _x); waitUntil {(_spot knowsAbout _x) >= 2}; [_spot] joinSilent (group _unit); [b]_spot reveal _x;[/b] }; if ((_x knowsAbout _unit) < 2) then { [_spot] joinSilent (group _unit); waitUntil {(_spot knowsAbout _unit) >= 2}; [_spot] joinSilent (group _x); [b]_spot reveal _unit;[/b] }; }; _spot joinSilent grpNull; } foreach allUnits; } foreach allUnits; sleep 1; }; Share this post Link to post Share on other sites
wiggum2 31 Posted September 20, 2011 Im currently working on a script to get the reveal thing working for a specific area: Thats a part of the script: //Inform near comrades in radius x about spotted enemy. {_x setbehaviour "COMBAT"; _x setcombatmode "RED"} foreach (_areaname nearObjects ["I44_man_G",_areasize]); {_x reveal ((list _areaname) select 0)} foreach (_areaname nearObjects ["I44_man_G",_areasize]); hint "Informed"; The problem is that only the nearest buddys of the unit that spotted me will come into my direction and start shooting at me... Although the reveal thing works for all (testetd with another trigger and a knowsAbout check). It looks like enemy groups have to be the same distance from the center (_areaname) to make them all move towards me ! If one group is closer then the other, only the closest will hunt me down... But why ? I also tried "nearestObjects" with no succes. Share this post Link to post Share on other sites
demonized 20 Posted September 20, 2011 you did not specify if you used guard wps or something else. if using guard wps, only 1 group will respond and if threat is to big for that group alone, more groups will come to aid. At least thats how i understand it works, anyone correct me if its not so. Share this post Link to post Share on other sites
wiggum2 31 Posted September 20, 2011 (edited) No waypoints at all. Just 2 groups placed inside the specified radius, but only the closest moves, the other does nothing. For better understanding: _areaname is the name of a enemy soldier (groupleader) _areasize ist the alarm area around that soldier 1 & 2 are enemy groups inside that alarm area, they will get informed and change their behaviour to combat which will make them move towards the player (blue dot) 3 is a enemy group outside the alarm area, they will not get any informations about the player and dont change their behaviour With my current script (post #15) only the enemy group closer to _areaname will move towards the spotted player. But i want all enemy groups inside the alarm area to move towards the spotted player and search for him. EDIT: This does not work also: In this case not even the reveal works. {if ((side _x) == east) AND (_x in list _areaname) then { _x setbehaviour "COMBAT"; _x setcombatmode "RED"; _x reveal ((list _areaname) select 0); } forEach allUnits; }; Currently i attache a trigger to the unit that should trigger the alarm. So _areaname is the name of a trigger. I have set the trigger to NONE and as CONDITION "e1 KnowsAbout p0 > 1.3" (e1 is the name of the soldier who should trigger the alarm) With BLUFOR DETECTED BY OPFOR and CONDITION "this" it worked... Edited September 20, 2011 by Wiggum Share this post Link to post Share on other sites
f2k sel 164 Posted September 20, 2011 (edited) You may want to check out today's Beta patch, Reveal has been updated. This may or may not make things better. http://forums.bistudio.com/showthread.php?t=125098 Edited September 20, 2011 by F2k Sel Share this post Link to post Share on other sites
wiggum2 31 Posted September 20, 2011 (edited) I tried the new BETA but after countless tests im sure that the behaviour is very RANDOM ! Sometimes both groups will move towards the player position, sometimes only one and sometimes none of them... But i would like to have both groups always move towards the player. Another problem: If you have two triggers with BLUFOR DETECTED BY OPFOR who are overlap each other, both will fire if BLUFOR is detected... Any way to prevent that and male only one trigger fire ? Or even better, can i reveal to all units in an area without using thislist and a trigger ? (Take a look at my script in post #15 please) Edited September 20, 2011 by Wiggum Share this post Link to post Share on other sites
f2k sel 164 Posted September 20, 2011 (edited) Isn't there a problem in your script. There should be extra () around the If statement {if (((side _x) == east) AND (_x in list _areaname)) then Here's another problem the If won't activate correctly. Ie. _areaname = _this select 0; { if (((side _x) == east) AND (_x in list _areaname)) then { hint "east"; _x setbehaviour "COMBAT"; _x setcombatmode "RED"; _x reveal ((list _areaname) select 0); } forEach allunits; }; Nothing happens not even the hint. I think this should work the foreach was trapped inside the If statement so never activated. _areaname = _this select 0; { if (((side _x) == east) AND (_x in list _areaname)) then { _x setbehaviour "COMBAT"; _x setcombatmode "RED"; _x reveal ((list _areaname) select 0); }; } forEach allunits; In the script I posted earlier that does work without trigger and since the beta bot sides reveal to each other. I'm not sure how you would get them to advance to each other as I think they will advance to the last unit in the list. I did add a domove after the reveal and it looks ok but I'm not sure how to test if they are moving to the same location. Edited September 20, 2011 by F2k Sel Share this post Link to post Share on other sites
wiggum2 31 Posted September 20, 2011 I used you script from site one but the behaviour is not that improved. The other enemy groups get informed about me (via reveal). I have a check trigger with: badguy2 knowsAbout player > 1.3 hint "works" badguy2 i 500m away from the location i get detected by badguy1. This trigger fires after the reveal part of the script ! Man, all i would need is partoling AI groups that (once i got detected by one) will inform all other enemy groups in a 500m radius and all these groups start hunting me and then patrol again...total simple isnt it ? :D Share this post Link to post Share on other sites
demonized 20 Posted September 21, 2011 why not just use doMove and or waypoints and send both groups on search and destroy at last known position, you could also add some random location of SAD point to make it look more dynamic. Share this post Link to post Share on other sites
wiggum2 31 Posted September 21, 2011 (edited) I came up with this, but there is still a error in the script, most likely with the red marked part: _unit = _this select 0; _groupHunter = _this select 1; _groupTarget = _this select 2; _delay = _this select 3; _enemySide = west; _foundEnemys = false; _nearTargets = (position _unit) nearObjects ["I44_man_B",500]; [color="Red"]{ if ((_unit knowsabout _x) == 1.3 AND (side _x) == _enemySide )} foreach _nearTargets then {[/color] hint "1"; while {count waypoints _groupHunter > 0} do { deletewaypoint (waypoints _groupsHunter select 0) }; hint "2"; waituntil {count waypoints _groupHunter == 0}; hint "3"; _delay = (if (count _this > 2) then {_this select 2} else {10}); hint "4"; while { ({alive _x} count units _groupName > 0) && ({alive _x} count units _grouptarget > 0) } do { _groupName move getpos leader _grouptarget; sleep _delay; }; }; ...because hint "1" never shows up ! Edited September 21, 2011 by Wiggum Share this post Link to post Share on other sites
twirly 11 Posted September 21, 2011 (edited) Well first off... it's structured all wrong. Try it like this and immediately it becomes apparent that there's something wrong with your brackets. There seems to be an extra one on top that you don't need....and also no closing bracket for the "if" statement. I don't use it myself but maybe using Squint will help you big time. I'm not sure about your line in red.... get the structure right first. [color="Red"]{[/color] if ((_unit knowsabout _x) == 1.3 AND (side _x) == _enemySide )} foreach _nearTargets then { hint "1"; while {count waypoints _groupHunter > 0} do { deletewaypoint (waypoints _groupsHunter select 0) }; hint "2"; waituntil {count waypoints _groupHunter == 0}; hint "3"; _delay = (if (count _this > 2) then {_this select 2} else {10}); hint "4"; while { ({alive _x} count units _groupName > 0) && ({alive _x} count units _grouptarget > 0) } do { _groupName move getpos leader _grouptarget; sleep _delay; }; }; Edited September 21, 2011 by twirly Clarity Share this post Link to post Share on other sites
wiggum2 31 Posted September 22, 2011 Sorry twirly but this still does not work, i have done much more wrong i this sript i think... ;) Anyway, look like im finally got the enemy to behave realisticly at night. A combination of "reveal", knowsAbout triggers, eventhandler "fired" and a trackdown & flare script... I will post my solution once i think its finished ! Share this post Link to post Share on other sites