Ruckus 0 Posted May 8, 2007 Update: Link now available. DAI_CTI.Sara.rar Hi guys.  I've been playing around with scripting for the past few weeks,  trying to learn this stuff.  What I've created is a simple implementation of what "DAC" was for OFP.  It is not quite as extravagant as "DAC",  however it was really designed for me to learn scripting..  I call it "DAI",  for Dynamic placement AI. In its basic form,  you place a named trigger on the map and then call a script from the activation field.  This script sets up groups of AI and generates random waypoints within the trigger area based on the Array that is passed on to this script.  Vehical groups as well as Unit groups can be created with this script call. The script call from the activation field looks like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">["z1",[25,"white","aware","RANDOM","RANDOM","RANDOM","RANDOM"],4,6,5,"east",BasicSquadG,0.7]exec"DAI\createzone.sqs" Parameter # 1.Zone Name. This is the Trigger Name ("z1") 2.Waypoint Pool. How many waypoints for this whole zone (10-?) 3.Waypoint Combat Mode. "RANDOM","green","white","yellow","red"] 4.Waypoint Behaviour.["RANDOM","safe","aware","combat"," stealth"] 5.Waypoint Speed. ["RANDOM","limited","normal"] 6.Waypoint Formation. ["RANDOM","vee","column","wedge","stag column"] 7.Waypoint Delay Time. How long to wait at each Waypoint ["RANDOM","0 - 120sec"] 8.Waypoint Type. ["RANDOM","MOVE","SAD"] 9.Number of Groups. [1-144] 10.Number of Units. [1-?] 11.Waypoints per Group. [1-?] 12.AI side. ["east","west"] 13.Squad Type. Defined in Init.sqs  [basicSquadE, WeaponsSquadE, SniperSquadE, SpecialSquadE .....ect] 14.Difficulty. [0.1 - 1.0] When the createzone script runs it does the following:  Measures the Trigger size.  Generates a block of random waypoints inside this zone defined by (parameter 2).  It will not create  waypoints in water or too close to buildings.  Creates the defined number of groups defined by (parameter 9) of the side defined by (parameter 12).  Creates the defined number of AI units and poplulates the groups with the defined number of units per  group as defined by (parameter 10). It pulls these units from a pre-defined group type defined by  (parameter 13) and sets their difficulty as defined by (parameter 14)  Randomly selects the defined number of waypoints from the block of waypoints for the zone defined by  (parameter 11).It adds one additional waypoint at the end and defines it type "CYCLE" and places that near waypoint 1. This creates a endless loop.  Adjusts each waypoints Combat Mode, Group Behaviour, Speed,  Formation and Delay Time defined by  (parameters 3 - 8).  Each of these can be selected to be of the type in the parameter list above,  or it  can be selected for "random"  and will randomly select a parameter.  Once this is done, the AI begin to follow their waypoint with the defined behaviours as defined in the array  call to the script. There are several options that are controlled in the init.sqs file. One of these is to Reduce the groups size if they are not within the defined range.  If they are outside this range,  all of the units except the group leader are deleted and that unit continues to patrol the waypoints.  Once they come within the defined range,  the groups are restored to the original size.  This helps with lag.  I tested by creating one zone that was the entire size of Sarani,  and populated it with 100 groups of 6 units per group for a total of 600 units and it was smooth without any lag whatsoever. There is another function that allows you to see markers placed on the map that shows the Waypoints for the whole zone as well as the Waypoints for each group.  There is also a option to have markers placed on the map showing the paths of each of the groups. What I'm currently working on:  Allow groups that take heavy casultys to be able to call for help from other Groups.  Allow groups to pass between defined zones. All of this is included in a starter CTI type map that I call "Clear the Island".  I was hoping some of the real scripters out their might look this over and give some constructive critisizim as well as any suggestions.  This all was driven from me missing "DAC",  and I hope "DAC" is released in the future. Share this post Link to post Share on other sites
smoke52 0 Posted May 8, 2007 nice i want to use it! just use rapidshare.com or filefront.com or megaupload.com until it gets hosted Share this post Link to post Share on other sites
Ruckus 0 Posted May 8, 2007 nice i want to use it!just use rapidshare.com or filefront.com or megaupload.com until it gets hosted thanks....I'll try that tonight when I get home from work. Share this post Link to post Share on other sites