Page 1 of 12 1234511 ... LastLast
Results 1 to 10 of 117

  Click here to go to the first Developer post in this thread.  

Thread: Line Of Sight (Example Thread)

  1. #1
    CWR² Developer SaOk's Avatar
    Join Date
    Nov 23 2006
    Location
    Helsinki, Finland
    Posts
    1,314

    Lightbulb Line Of Sight (Example Thread)



    Newer vid (by McLupo) with eye direction demonstration:


    Here is example of the new LOS commands that came with the recent beta. I have two units on map (AI named b, player a) and functions module placed on map. LOS is counted for eye positions and eye directions for AI . Use, edit & expand freely.

    Requires Beta 94103 or newer.

    LOS.sqf:
    Code:
    private ["_a","_b","_dirTo","_eyeD","_eyePb","_eyePa","_eyeDV"];
    //Player
    _a = _this select 0;
    //AI to see or not
    _b = _this select 1;
    while {true} do {
    _eyeDV = eyeDirection _b;
    _eyeD = ((_eyeDV select 0) atan2 (_eyeDV select 1));
    if (_eyeD < 0) then {_eyeD = 360 + _eyeD};
    _dirTo = [_b, _a] call BIS_fnc_dirTo;
    _eyePb = eyePos _b;
    _eyePa = eyePos _a;
    if ((abs(_dirTo - _eyeD) >= 90 && (abs(_dirTo - _eyeD) <= 270)) || (lineIntersects [_eyePb, _eyePa]) ||(terrainIntersectASL [_eyePb, _eyePa])) then {
    hintsilent "NOT IN SIGHT";
    } else {
    hintsilent "IN SIGHT";
    };
    sleep 0.1;
    };
    LOSforSingleCheck.sqf:
    Code:
    private ["_a","_b","_dirTo","_eyeD","_eyePb","_eyePa","_eyeDV"];
    //Player
    _a = _this select 0;
    //AI to see or not
    _b = _this select 1;
    _eyeDV = eyeDirection _b;
    _eyeD = ((_eyeDV select 0) atan2 (_eyeDV select 1));
    if (_eyeD < 0) then {_eyeD = 360 + _eyeD};
    _dirTo = [_b, _a] call BIS_fnc_dirTo;
    _eyePb = eyePos _b;
    _eyePa = eyePos _a;
    if ((abs(_dirTo - _eyeD) >= 90 && (abs(_dirTo - _eyeD) <= 270)) || (lineIntersects [_eyePb, _eyePa]) ||(terrainIntersectASL [_eyePb, _eyePa])) then {
    hintsilent "NOT IN SIGHT";
    } else {
    hintsilent "IN SIGHT";
    };
    https://www.dropbox.com/s/5644ns4x9o...ht.Desert_E.7z
    Last edited by SaOk; Apr 5 2013 at 12:16.

  2. #2
    I shall not insult moderators
    Join Date
    Nov 25 2010
    Posts
    1,576
    Excellent work! Looks like it will be usefull for AI behavioural FSM's?

  3. #3
    Excellent!
    scripting: RUBE library | missions: RUBE Fire Ants (SP)

  4. #4
    Makes me want to make a Metal Gear Solid style "Huh, what was that noise?" sound that's played whenever you enter LOS

  5. #5
    Master Gunnery Sergeant Hellfire257's Avatar
    Join Date
    Feb 17 2009
    Location
    (getPosATL player)
    Posts
    1,207
    Very impressive! Thank-you for sharing.

  6. #6
    First Lieutenant CameronMcDonald's Avatar
    Join Date
    Oct 10 2005
    Location
    Sydney, Australia.
    Posts
    5,554
    Combined with knowsabout that could come in handy for tweaking AI reaction in stealth missions. Nicely!

    Everyone tempted to post another inane/useless/whogivesatoss topic in the A3 forum - here.

  7. #7
    Master Gunnery Sergeant Rydygier's Avatar
    Join Date
    Aug 22 2011
    Location
    Poland, Pomerania
    Posts
    1,067
    Very interesting. Must to try this, wneh official, stable patch with this commands will be released. Just looking for most efficient way for doing similar things, and want to compare this with some sqf solutions. One of the most exciting scripting topic for me, but rather for some kind of overall, wide sector FOV checks, than for strictly, precise LOS test between two guys/objects/positions.

  8. #8
    Lance Corporal Phazon's Avatar
    Join Date
    Jul 10 2007
    Location
    Sydney, Australia
    Posts
    43
    I can see this potentially solving quite a few issues. The main one I can think of is AI shooting heavy machineguns while standing or kneeling that should only be shot while prone. A script could be setup to force the AI to go prone when it detects an enemy within a certain range while also maintaining line of sight. If it loses line of sight it goes back out of prone and back to its normal behaviour.

    WIP for Iron Front - Phaze Sound Mod

  9. #9
    CWR² Developer SaOk's Avatar
    Join Date
    Nov 23 2006
    Location
    Helsinki, Finland
    Posts
    1,314
    Author of the Thread
    I released new version 1.9 for my Zub mission featuring these LOS/Body Direction commands. You can find it here if interested:
    http://forums.bistudio.com/showthrea...ssions-by-SaOk

    In the mission, bodies need to be now seen to be spotted. Civilians react on dead bodies for player if he is getting too close (if seeing those). Also checks are made, that certain things are not seen - friendly side and captives are not acting like blind now or all seeing in certain events.

  10. #10
    I think the biggest problem this could solve would be forcing AI to stop and shoot at units he has line of sight to that are under 50m away. If the scripts works instantly or close to it, the AI could actually be aware and competent in urban CQB.
    My Chernarussian Civil War SP missions:
    Enfilade Ambush
    Autumn Siege

Page 1 of 12 1234511 ... LastLast

Similar Threads

  1. Line Of Sight code
    By Wolffy.au in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 0
    Last Post: Feb 8 2011, 02:13
  2. Script/function request: Line-of-sight check
    By [FRL]Myke in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 12
    Last Post: Dec 4 2009, 02:48
  3. Is getting line of Sight possible in anyway?
    By Second in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 13
    Last Post: Jun 22 2007, 20:28
  4. Non-Line-of-Sight Launch System (NLOS-LS)
    By Thunnder Bunny in forum ADDONS & MODS: DISCUSSION
    Replies: 0
    Last Post: Feb 24 2007, 01:11
  5. RPG - line of sight...
    By VecteR in forum TROUBLESHOOTING
    Replies: 12
    Last Post: Nov 25 2001, 11:48

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •