Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×

camo1018

Member
  • Content Count

    26
  • Joined

  • Last visited

  • Medals

Everything posted by camo1018

  1. I'm trying to make an existing group forget about its enemies so when new units are spawned into the group, they will act as though they haven't encountered an enemy yet. This is rather troublesome as reveal command only increases the knowsAbout value. Does anyone know a way I can achieve this? Thanks for your help as always.
  2. Hey all, I started working on an AI script when the commands related to line of sight came out through one of the beta patches for ArmA 2, but I haven't been putting real efforts into it until recently. I've been fooling around mostly and just lazily put some code together for my own amusement. I found that it really spices up CQB missions for me, so I thought I would like to share it for those of you who want to try it. It's a work-in-progress, so expect some rough moments if you want to test it out. Feel free to modify it as you see fit. I'm going to try to polish it up as soon as I have time, but if you have any other ideas for the script and you can't do it on your own, let me know what I can do. You can probably expect updates to come in the coming week or so. So far, the goodies contain: 1. CQB AI. -Requires CBA_A3 With a lot of help from the ArmA 2 Editing Community, I was able to create an alternative approach to the native CQB AI, which I feel is quite lacking even in ArmA 3 (it is an alpha, so hopefully it'll improve by the final release). The cqb script will be constantly running on all AI units in the mission. Each unit will cycle through all its known enemies within 100 meters and check if he has a line of sight to any of them. If he does, then he will lock onto his enemy and open fire. Firing is simulated because I can't directly modify where the unit's weapon is facing. Also, locking on is instantaneous. I'll get to that later. Put cqb.sqf, cqbDiscipline.sqf, fire.sqf, and nodrag.sqf into your mission folder. To use this script, first place a gamelogic named "firelogic" in the mission. Then, on any object's init field, put "nul = [] execvm "cqb.sqf", where cqb.sqf is the name of the cqb ai script, assuming you placed the script into your mission folder. There is a special option called CQB Discipline. You need to bind a button to "User18" for this action to work. Select your units and activate this action to basically stop the CQB AI from running on them. 2. Quick Move With units under your command automatically going into danger mode, it's sometimes hard for them to sprint out of danger. Pathing can sometimes get wonky and your units will be moving around an entire village just to get to a point 5 meters away. This is sort of a "cheese" script to let a unit take a direct path to his destination while ignoring anything around him. No pathing calculations are done and the unit will walk through walls if there are any between the unit and his destination. Pretty cheap, but I find it useful to getting my units into cover quickly. To use this script, put "nul = [] execvm "sprint.sqf", where sprint.sqf is the name of the quick move script, assuming you placed the scripts into your mission folder. Place all the sprint-related scripts into your mission folder. This script adds three actions that uses the "User1", "User2", and "User3" keys. You should bind them in the controls menu so you can use them. User1 - "Order Sprint" - Issues your selected unit (only one unit is supported at a time for now) to sprint to the location designated by the center of your screen (NOT your position cursor). Your unit will ignore all dangers on the way. If you use the cqb ai with this, it will NOT engage any hostile unit it encounters. User2 - "Order Move" - Issues your selected unit to move (with weapon raised) to the location designated by the center of your screen (NOT your position cursor). Your unit will ignore all dangers on the way. If you use the cqb ai with this, however, the unit WILL engage any hostile unit it encounters. User3 - "Order Stop" - Issues your selected unit to stop carrying out either a sprint order or a move order. That's it for me for now. Feedbacks are always welcome. Have fun! https://dl.dropboxusercontent.com/u/34103944/AI%20Scripts.rar
  3. I agree with you guys. I usually don't like to get hyped for any game, but being a fan of this series, I couldn't help myself but to have high expectations for the alpha release of ArmA 3. But my, I would be lying if I didn't say I was blown away. Really looking forward to the release of the full game!
  4. Simply marvelous. I had taken a crack at CQB AI just about a year ago, but I ended up spending most of the efforts in developing my own LOS system using invisible bullets. In fact, by the time I had finished developing that system, I thought I had quite enough of that so I held it off. Never got back into it. But now, with this new system, I can definitely resume my work, although tpw here has done a wonderful job with his own script. I'll definitely give it a try and report back. Thanks for all your hard work!
  5. It seems that deleting the group and creating a new one did what I wanted it to do.
  6. Thanks for all your inputs. I figured out that was what I had to do last night.
  7. Hello all, I was wondering if anyone here knew how to get the head height of a unit relative to anything (sea level, terrain level, etc.). Since there are really no good ways to find the stances of a given unit, I thought this might work, if I can even get it to work. Thanks for all your help.
  8. Very interesting, twirly. I wish I had stumbled on that when I was searching frantically for answers this morning. Thanks so much for that link and for your work. EDIT: Everything worked out the way I wanted. Thank you all for your help! They have been very helpful. EDIT 2: Now I'm wondering another possibility. Is it possible to find the point at which the bullet impacted? If that's not possible, is there any way to check whenever a bullet is close enough the player to count as being hit? I'm using this for a possible Line of Sight checker.
  9. Hi all, I've been working on a script for scripted AI snipers. I'm trying to create an illusion as if the AI sniper was very accurate by adding a "Fired" eventhandler that will (if it worked out) redirect the last fired bullet to the player. This is what I have to so far... _target = _this select 1; _fired = _this select 0; _bullet = nearestobject [_fired select 0,_fired select 4]; _Pa_shot = getpos _bullet; _Pb_shot = getpos _target; _abx_shot = (_Pb_shot select 0) - (_Pa_shot select 0); _aby_shot = (_Pb_shot select 1) - (_Pa_shot select 1); _abz_shot = (_Pb_shot select 2) - (_Pa_shot select 2); _Pab_shot = [_abx_shot, _aby_shot, _abz_shot]; _bullet setVelocity _Pab_shot; player sideChat "SHOT!"; Can anyone point me in the right direction? Thanks in advance.
  10. I believe that is exactly what I was looking for. Thank you all for your inputs and help. I'll give Big Dawg's script a try later tonight. It's nice to know that this community has plenty of talented and helpful developers. I've been trying to figure this out for hours early this morning but was about to give up to my frustration. With this, I hope things will be sorted out. It really wouldn't so much trouble if BI added functions for I think setWeaponDirection to actually force the AI to aim in a certain direction. Hopefully Arma 3 will have those, but this will do for now. Once again, thanks for all your help.
  11. Were you able to get this to work? I tried combinations of setVectorDir , setVectorUp and setVelocity but I was unable to get any wanted results out of it.
  12. I guess that would be the way to do this if I must. I find that the current AI isn't menacing enough to have the player scrambling for cover. Can an expert tell me if manipulating the fired bullet is even possible?
  13. Thanks for your inputs. However, I am not looking to kill off the player as soon as the sniper fires. I want to create a sense of urgency for the player to take cover. If he fails to do so, I want the bullet to kill the player.
  14. Hi all, I'm trying to come up with a script that forces the AI to aim at a certain target. I've managed to achieve the basics of this by manipulating vectorDir. This only works to an extent, however, because while I can manipulate the orientation of the unit itself, I do not know of a way to manipulate weaponDirection. Has anyone found a way to do this? If not, all I need to be able to do at this point is to be able to manipulate the pitch of the direction at which the AI is aiming (up and down motion) in order for the AI to be able to handle targets that are above or below it. Thanks for all the help in advance.
  15. camo1018

    This is amazing

    Yep. They're definitely being warped at the last minute, but I think I can see where this is going, too. It would be very helpful in precise positioning of AI squad members.
  16. camo1018

    AI Bug when Switching Weapons

    For now, I'm able to alleviate this problem by forcing open the gear menu for the troublesome squad member, dropping the main weapon, and then ordering him to pick it up again. Time-consuming and unnecessary, but it works. :)
  17. I'm running ArmA 2 1.5 on Steam with mods ACE 2.7 beta and SLX 1.8. I'm encountering an issue where when I order one of my squadmates to pick up another weapon from a corpse, they refuse to move after a short delay. They can turn, shoot, and respond to my orders, but they cannot move. Has anyone had this problem before? Thanks in advance.
  18. Please make sure your playmove or switchmove commands are not executed at the very beginning of the mission, ie. init field.
  19. I tried, but had no success either. I mean, it's okay when the propaganda voices as one voice, but when it echoes into what seems to be 3+ voices speaking over themselves, it's really painful to the mind and the ears. I think the developers wanted to have an effect close to a PA System, but the end result really painful to hear.
  20. camo1018

    Trial by Fire

    I agree. Ambush was probably one of the best missions designed officially, in my opinion. I remember playing that mission every time I loaded up OFP. Anyways, Trial by Fire get be either frustratingly hard or frustratingly easy depending on your settings in difficulty. I always play with AI skills set to 1 on both sides with Super AI turned on. My team rarely makes it to the airport in a group with more than three members.
  21. Thanks for the help, both! So, if I get this right. I should first initialize the script via execVM, but the script itself should be safe to recall itself using "call". Am I close? Anyways, I guess it's up to me to find it out for myself.
  22. Hey all, I'm still in a development stage in a script where I'm trying to improve the AI's reactions better in terms of shooting. It's mainly to please my tastes, but I'm encountering a problem here. I run the script by executing it on every individual unit. The problem here is that the game crashes unpredictably whenever the scripts are running. Sometimes the game won't crash, while at other times, it would. This is the code I've written so far. There's a lot of commands involved every frame, so I'm wondering if the crash is caused by overload or is there something that I'm doing that the game does not like? _a = _this select 0 _b = _this select 1 ?(isplayer _a): goto "abort" #setup _bulletcount = 0 _burstlimit = 5 + random 4 _notarget = 0 #check _alpha = _a findnearestenemy _a ?(isnull _alpha)): goto "check" goto "death" #death _b action ["USEWEAPON", _a, _a, 0] ~0.1 _bulletcount = _bulletcount + 1 ?_bulletcount > _burstlimit: goto "wait" ?(isnull _alpha)): goto "check" Goto "death" #wait ~random 7 _bulletcount = 0 goto "setup" #abort exit For additional notes, this script is executed by the following line _x exec "Scrip.sqs" Any assistance would be appreciated.
  23. Thanks for the reply, "Suspending is not allowed in this context" I'm still getting this error no matter what I do. The interesting thing is, another script of mine does not return this error. It is setup similarly to this script and also uses sleep command. The BIS Wiki does not contain much information about this error. Once again, any help would be appreciated.
  24. Sorry for double post::: I'm trying to write a SQF version of the script above, but I'm having a trouble. I am encountering an error stated "Suspending is not allowed in this context" yet I do not understand why I'm getting such an error. Can anyone look over and point out what I've done wrong? Thanks, private ["_a", "_b"]; _a = _this select 0; _b = _this select 1; while {(alive _a) && (!isplayer _a)} do { _bulletcount = 0; _burstlimit = 5 + random 4; _alpha = _a findnearestenemy _a; if ((isNull _alpha)) then { while {_bulletcount <= _burstlimit} do { _b action ["USEWEAPON", _a, _a, 0]; _bulletcount = _bulletcount + 1; sleep 0.1; }; }; sleep 2.0; };
  25. Thank you for your advice. I'll try it out now and tell you if something comes up! EDIT: I've been tinkering around, and I've come a conclusion that the command FindNearestEnemy is causing the crash. When I remove this code, the game does not crash. In order to avoid using that command, I'm thinking about using a different code to detect if the user of the script has encountered a hostile unit. I'm kind of stuck here. Can anyone give a lead as to what possible commands I could use to substitute FindNearestEnemy? EDIT 2: Now I'm just confused. I just encountered another crash without the troubling command. I haven't transposed the script into a SQF, so I'm going to do that now. It's going to be a little tough since I'm new to the SQF syntax. Anyways, I'll give more updates soon.
×