camo1018
Member-
Content Count
26 -
Joined
-
Last visited
-
Medals
Community Reputation
0 NeutralAbout camo1018
-
Rank
Private First Class
-
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
-
Share your first Arma3 Beta Impressions (all first impression type posts here pls)
camo1018 replied to fabrizio_t's topic in ARMA 3 - BETA DISCUSSION
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! -
Line Of Sight (Example Thread)
camo1018 replied to SaOk's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
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! -
Making a group forget about its enemies
camo1018 replied to camo1018's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
It seems that deleting the group and creating a new one did what I wanted it to do. -
Making a group forget about its enemies
camo1018 posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
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. -
Function to Return Head Height of a Unit
camo1018 replied to camo1018's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Thanks for all your inputs. I figured out that was what I had to do last night. -
Function to Return Head Height of a Unit
camo1018 posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
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. -
Magic Bullet Script
camo1018 replied to camo1018's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
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. -
Magic Bullet Script
camo1018 replied to camo1018's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
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. -
Magic Bullet Script
camo1018 replied to camo1018's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
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. -
Magic Bullet Script
camo1018 replied to camo1018's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
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? -
Magic Bullet Script
camo1018 replied to camo1018's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
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. -
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.
-
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.
-
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.