Results 1 to 1 of 1

Thread: Gunfire Awareness

  1. #1

    Gunfire Awareness

    Code:
    nearunits = []; shotsfired = 0; hint "Initializing";
    vehicle player addeventhandler ["Fired", "shotsfired = shotsfired + 1; nearunits = nearestobjects [player, ['Man'], 8];
    nearunits set [0, 'remplayer']; 
    nearunits = nearunits - ['remplayer'];
    {if(side _x == side player || side _x == civilian) then {_x playmove 'aidlpknlmstpslowwrfldnon_idlesteady02'};} foreach nearunits; 
    player groupchat format['Shots fired: %1', shotsfired]; 
    player groupchat format['nearunits = %1',nearunits];
    nearunits = [];"];
    Here's a little practice script I made to get my brain rolling back to the coding mindset. Haven't been able to write much code for a few weeks due to real life stuff.

    Here's what this code does - Whenever you fire, any nearby units will crouch and wait. This avoids those terrible moments where AI will run in front of your line of fire (potentially causing a teamkill or friendly fire incident). This still needs some work done to it such as having your fire only affect your side, and not everyone. Maybe the player's side and civilians.

    Very tired at the moment, but thought this could be a useful piece of code to some people (maybe even potential for a mod?).

    EDIT - Made the gunfire awareness only affect units on the player's side and civilians.
    Last edited by zooloo75; Aug 19 2012 at 01:34.

Similar Threads

  1. Missile/Gunfire related crash.
    By Hank Rearden in forum ARMA 2 & OA - TROUBLESHOOTING
    Replies: 0
    Last Post: Jul 23 2010, 21:35
  2. Automatic Gunfire Sound
    By Pancho in forum GENERAL
    Replies: 17
    Last Post: Apr 13 2006, 04:21
  3. FFUR Automatic Gunfire
    By Pancho in forum ADDONS & MODS: COMPLETE
    Replies: 1
    Last Post: Apr 5 2006, 10:29
  4. Battle / gunfire detection?
    By Gnurf in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 9
    Last Post: Nov 15 2003, 15:14
  5. No gunfire in online multiplayer
    By -=T.C.F=-MADDOG in forum TROUBLESHOOTING
    Replies: 2
    Last Post: Sep 28 2002, 06:12

Posting Permissions

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