Smoerble 11 Posted September 9, 2014 Good day everyone, I look for a possibility, to have the AI work together as a group and also act more clever when under attack. My main goal is: I have several units patrolling an area independant from each other. When one unit is under attack, all other units should come to support this unit. To make it a little difficult, I would like to have this special case: If a unit is under attack, he needs, let's say, 2 seconds, to send a call via radio. These 2 seconds would allow a team of players to eliminate the patrol without alarming the other enemies. But if one unit under attack survives longer than 2 seconds, all others are alarmed and come to support. I know, that there's a mod for stuff like this. But from my experience (feedback from other players), many players want to download only a mission from Steam Workshop and don't like, when a mod is required. My question to all you genius', if you think, this kind of pseudo-code could work: 1) All enemies get a name (patrol1, patrol2 [...]). 2) In a guarding.sqf, I create an array with all patrol names [patrol1, patrol2, patrol3]. 3) I loop over each patrol and set an event handler that checks, if this patrol is under attack (how to check, if a unit is under attack?) 4) When the event handler fires, a sleep 2; waits. 5) After that, check if unit is still alive, if yes, call other units for support. How to tell a patrolling unit that it should do something else? Idea, but don't know if this is possible: the attacked unit knows the location of the player (does it knows where it's attacked from?), then this location is set as a new waypoint to all other units as "Seek and Destroy" waypoint. Do you think, this would work? And if so, do you have code examples that could lead into the direction I am aiming? Do you have a better approach? Share this post Link to post Share on other sites
John Kozak 14 Posted September 9, 2014 (edited) 1.Get an array of patrol groups: patrols = []; patrols += group patrol_leader_1; // patrol_leader_1 is the editor-placed patrol group leader. Make sure he has probability of presence 100% patrols += group patrol_leader_2; // Same for others patrols += group patrol_leader_3; // etc. 2.Create a script which handles one group's behaviour: // This function accepts a group as an argument patrol_script = { // Wait until group knows something about player or is eliminated waitUntil {_this knowsAbout player > 3 || count _this == 0;}; // Sleep for 2 seconds sleep 2; // If the group is still alive if (({alive _x} count units _this) > 0) then { // Group is alive, raise the alarm global_alarm = true; // do something else } } 3.Spawn this script for every group: {_x spawn patrol_script} foreach patrols; Edited September 9, 2014 by DarkWanderer Share this post Link to post Share on other sites
houldendub 10 Posted September 9, 2014 It not only works, but I believe what you're describing is exactly what UPSMON (and in the in-development UPM) does. It'd be worth cracking it open and looking at the scripts involved if you're even just interested. See the thread over here: http://forums.bistudio.com/showthread.php?170803-UPSMON-Updated-to-ArmaIII Note that it's apparently a little broken at the moment in regards to some aspects. Share this post Link to post Share on other sites
Smoerble 11 Posted September 9, 2014 You guys are fast, thanks. Will look into it asap. Share this post Link to post Share on other sites
jandrews 116 Posted September 9, 2014 You can use UPSMON or VCOMAI once its updated and released. Why re invent the wheel? Those 2 scripts can be modified to what your looking for and there are many other features they offer, along with they work together. However, VCOMAI when used correctly with guard waypoints does the same as UPSMON fortify, mostly. Share this post Link to post Share on other sites
barbolani 198 Posted September 9, 2014 Yes, UPSMON has those features and many many many more, like detecting dead bodies and making the AI react.... Share this post Link to post Share on other sites
Smoerble 11 Posted September 9, 2014 Ok, thanks for the info. I will look out for this, still this sounds like I can do at least the basics myself (ofc I will never go into the quality of the other scripts). This would help me to learn some more about the logic behind ArmA Scripting. Share this post Link to post Share on other sites
SavageCDN 231 Posted September 9, 2014 DAC 3.1 and UPSMON depending on your needs. DAC is much harder to learn how to use properly but it is also much more powerful than UPSMON. Share this post Link to post Share on other sites
Beerkan 71 Posted September 9, 2014 I was impressed with the simplicity of these scripts. http://forums.bistudio.com/showthread.php?182914-RELEASE-T8-Units-a-less-dynamic-AI-creator And of course Zenophon-s-ArmA-3-Co-op-Mission-Making-Framework Share this post Link to post Share on other sites
SavageCDN 231 Posted September 9, 2014 ^ yeah I just noticed T-800's script as well - looks great Share this post Link to post Share on other sites
Beerkan 71 Posted September 10, 2014 From the creators of MCC-Sandbox, this just been released... Mission-Template-Stand-Alone-GAIA-engine Share this post Link to post Share on other sites