We are currently changing the Bohemia Interactive forum software. This means http://forums.bistudio.com will be 'Read Only' until Friday. Apologies for the inconvenience.

Page 2 of 16 FirstFirst 12345612 ... LastLast
Results 11 to 20 of 158

Thread: Ai suppression script help

  1. #11
    That already happens. The idea is that rounds passing in close proximity to an AI should also make them suppressed, which doesn't currently happen.

    That can be checked with:

    (((position _unit) nearestObject "BulletBase") distance _unit) < 5
    The easiest way to check this would probably be in a simple FSM, but obviously that would mean running one for every unit, and I don't know how system intensive that would be. AI's behaviour is already governed by FSMs anyway.
    empty all your clips at their locations

    http://feedback.arma3.com/view.php?id=24134 - Hunter MRAPs sometimes won't move to waypoints
    http://feedback.arma3.com/view.php?id=9341 - Random placement of units and waypoints does not work near buildings
    http://feedback.arma3.com/view.php?id=17665 - Backpacks can't be placed accurately in editor

  2. #12
    Impact proximity maybe a good way forward. A more responsive AI to sonic cracks would be a dream! As I normally play with 200-400 AI I'm thinking about how this would work with huge numbers. Anything you do come up with - gimme a shout and I can test it for you with these HUGE numbers

    Keep up the good work.

  3. #13
    Quote Originally Posted by 2nd Ranger View Post
    That already happens.
    I believe that it's not, which is the motivation behind this initiative.
    Quote Originally Posted by 2nd Ranger View Post
    The idea is that rounds passing in close proximity to an AI should also make them suppressed, which doesn't currently happen.
    That would be great but suppression as reaction to bullet impact in close proximity to the AI is more important.
    Last edited by Variable; Feb 10 2012 at 13:51.

  4. #14
    It does happen. Go in the editor and put down any player unit, this setCaptive true. Then a BLUFOR rifleman, this setunitpos "up". Place an OPFOR AI 100 metres or so in front of him with this init: removeAllWeapons this; this disableai "move"; this setunitpos "up"; this allowDamage false. When you enter the mission, the armed AI will obviously start firing at the unarmed one. Stand directly behind the armed guy and shoot a few rounds within 2m of his feet. You will notice that his rate of fire decreases dramatically, his aim becomes erratic and you can hear his heavy breathing.

    That would be great but suppression as reaction to bullet impact in close proximity to the AI is more important.
    Depends on the proximity. If you try what I suggested above you will see that the AI is already suppressed by nearby impacts. The only problem is that the impact area is a bit too small, about 2 meters - because if you are able to hit within that distance of an AI, then more than likely you should be able to hit him too. Another problem with this impact suppression is that it does not work on gunners of static weapons, who should be a major priority for suppression.

    So, if the impact area was increased to about 3-4 meters, that would be great. However, if the AI was affected by passing rounds, I think that would be equally useful. You might know the AI's approximate position behind cover, but for whatever reason be unable to hit near enough to suppress him. But if the AI was simulated to detect sonic cracks, you would be able to suppress him just as well.
    Last edited by 2nd Ranger; Feb 10 2012 at 15:41.

  5. #15
    Sergeant Major
    Join Date
    Dec 8 2010
    Author of the Thread
    Ai do react to nearby impacts but it is often not in the smartest way. They do not react to passing by rounds however and this is what my goal to implement is.

    Thanks for all the ideas guys. I should have enough time to try some of them out when I get home tonight. Also keep in mind that I am learning this as I go.

    @2nd ranger
    You mentioned using fsm to track nearby rounds. Do you have any further info on how to use fsm. It may be system intensive but right now my goal is simply to get this working.

  6. #16
    2nd ranger, thanks for the information, I didn't know that.
    Well then, I agree that increasing the range radius of the impact effect and add passing bullets effect is the priority.

  7. #17
    Sergeant Major
    Join Date
    Dec 8 2010
    Author of the Thread
    Okay guys, this is what I got so far.
    I placed one opfor unit down named "ai"
    I placed 1 blufor player down.
    I created the following eventhandler that is started in the "init.sqf"
    PHP Code:
    _fired player addEventHandler ["fired", {_this execVM "suppression.sqf"}]; 
    This means when I (the player) fires suppression.sqf (below) is run
    PHP Code:
    _ammo _this select 4;

    _round nearestobject [player,_ammo];
    while {(
    speed _round) > 0.1} do {
    _dist _round distance ai;
        if (
    _dist 10then {
    hint "ai is suppressed";
    ai setunitpos "down";
    _saveAccuracy ai skill "aimingAccuracy";
    _saveShake ai skill "aimingshake";
    ai setskill ["aimingAccuracy",0.01];
    ai setskill ["aimingShake",0.01];
    sleep 5;
    ai setskill ["aimingAccuracy",_saveaccuracy];
    ai setskill ["aimingShake",_saveshake];
    ai setunitpos "auto";
    This tracks the shot I have fired and determines if it has come close (10 "units") to the opfor named "ai". if so, it causes "ai" to go prone and have decreased accuracy for 5 seconds before he goes back to his normal stance and accuracy. All this works relatviely smoothly...
    Now my newbie scripting questions are:

    1. How do I make it so the fired eventhandler is not only created for "player", but also for every unit on the map (Besides manually naming all the ai and typing an eventhandler out for each of these names.)

    2. Right now the script only tracks whether the round comes close to "ai". How do I make it so that the distances from the round to all units on the map is measured? (without naming ai1, ai2, ai3...etc. and having corresponding "_dist = _round distance ai;","_dist1 = _round distance ai1;","_dist2 = _round distance ai2;"... etc.)

    If my questions aren't clear please let me now and I will try to explain what I mean better. Thanks for your help.

    from the little "test" I created above, things are looking quite promising in terms of gameplay improvements. If you keep up suppressive fire on "ai" he will go prone and you will sustain very little accurate fire from him. don't keep up the fire and he will start laying down accurate shots and suppressing/hitting you. If this stuff isn't ridiculously system intensive (which it very well may be) I think it will provide alot more depth to firefights.

  8. #18

  9. #19
    Warrant Officer
    Join Date
    Mar 7 2011
    Saxilby, UK
    To add the eventhandler to all the units, there are several methods;

    1. If they are all placed in the editor, the in the init line for each unit, you add;

    0 = this addeventhandler ["fired" , {_this execVM "supression.sqf"}];
    2. If you are adding them in script then simply add the eventhandler to the unit after you create it.

    3. Both of the above if you have some in the editor and some you create in script.

    4. You could add it in a loop;

        _fired = _x addEventHandler ["fired", {_this execVM "suppression.sqf"}];
    } foreach allunits;

    ---------- Post added at 01:32 ---------- Previous post was at 01:28 ----------

    Quote Originally Posted by Xeno View Post
    Well, that would save some work. But I would crack on Coulum as it's good to learn this stuff.
    Jedra's Addons
    Arma 2 : Enhanced Skills Slider
    Take On Helicopters : Take On Taxi | Jedra's Time Trials | Weapon Indicators | No Radar

  10. #20
    execVM a script everytime a unit fires is not an option.
    Just think about heavy firefights with SAW and MG firing. That will start hundreds of scripts in worst case with all the problems it brings.
    The execVM itself already removes the most important advantage that code executed in an eventhandler brings, running in the same frame.

    Btw, the fired EH does return the projectile itself too since 1.54 or 1.55, no need for a nearestobject check.

    Suppresion eventhandler is the only performant way to handle it.

    Last edited by Xeno; Feb 11 2012 at 00:44.

Page 2 of 16 FirstFirst 12345612 ... LastLast

Posting Permissions

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