The Hebrew Hammer 10 Posted October 9, 2011 One thing I noticed, there doesn't seem to be anything that puts these units into an ambush mindset, is there a way to add something along the lines of: hold fire unless BLUFOR detected within X distance for each one of those units? Or anything to change their stance to prone or crouched? Share this post Link to post Share on other sites
twirly 11 Posted October 9, 2011 (edited) Yes. All of the above can be done with the commands... setBehaviour setCombatMode distance setunitpos Edited October 9, 2011 by twirly Clarity Share this post Link to post Share on other sites
The Hebrew Hammer 10 Posted October 9, 2011 I'm familiar with the commands, but only with scripted ambushes. I wouldn't know how to implement them into a script that is somewhat random. Hence why I merely suggested it, I'll try to play around with it but no guarantees.. usually I just use a trigger to spring an ambush so distance is the only thing I don't really use. Share this post Link to post Share on other sites
Skelt 10 Posted October 10, 2011 Yeah they are just hanging out at the moment, but I ran the mission a few times and they did react quit well, whether I was in a helo or on the ground, they engaged quickly and changed positions. For this to seem somewhat realistic it depends on the position, some of my ambush positions are better than others. I'm pretty sure the defualt behavior is safe. I would imagine we can set various behaviors via _unit setBehaviour "AWARE"; _unit setCombatMode "RED"; what you also could do, is _unit setCombatMode "BLUE"; //never fire _trg=createTrigger["EmptyDetector",getPos _unit]; _trg setTriggerArea[100,100,0,false]; _trg setTriggerActivation["WEST","PRESENT",false]; _trg setTriggerStatements["this", "_unit setCombatMode 'RED'", "NONE"]; I don't know if that would work, but that is one way I think you could do it, by creating a trigger at the location. ---------- Post added at 05:52 AM ---------- Previous post was at 05:45 AM ---------- PS: I am going to be working on the IED portion tomorrow. I am hoping to incorporate it with MCC's ied script. But for now I just want to get the IEDs randomly placed which should be pretty easy. The hard part will be getting the IEDs named after creation so they can interface with MCC's ied script. (Detectable / Defusable / Deadly or Crippling) Share this post Link to post Share on other sites
The Hebrew Hammer 10 Posted October 10, 2011 (edited) Ah, that's exactly what I'm talking about. I'm going to run this with Takistani Militia and without any vehicles on the Sangin map, see how it works. edit: getting the OPFOR to spawn is working well, it's just a matter of getting the groups to be in the right formation for the area they're going to ambush from. Since it's kind of a one size fits all script, all my ambush points need to be ground level and they all require that the AI can shoot from the kneeling position. But I'm thinking: why can't I just set the probability of presence to something like 30% Before I work on this further, that's what I'm wondering. If I set the group leader's probability of presence to a low number does that effect the subordinates? Edited October 10, 2011 by The Hebrew Hammer Share this post Link to post Share on other sites
Skelt 10 Posted October 10, 2011 Yeah, the group leader I would think is the first unit assigned to the group, however, I'm sure your aware of how they instantly call everyone to the wedge formation when you create a group in the editor. use: _unit1 setDir 45; //You'll need to play with this to get his direction correct _groupOne setFormation "LINE"; //Formation Line - prime ambush stuff. Or, if you want, you can get real specific and create a number of smaller groups and be very specific with their placement and direction. However, keep in mind Arma only allows for 144 groups - so once you clear this area or part of the mission, we gotta delete the groups we made, to free those spots for future groups. As for probility of presence, I am not sure how we could set this through scripting, I'm sure it can be done but I don't see anything at the moment in the wiki. (Haven't been real therough.. spent about 5mins haha) ---------- Post added at 05:12 PM ---------- Previous post was at 05:03 PM ---------- No need to script the probability of presence, instead of hard coding the groups, you can just use: BIS_fnc_spawnGroup -- in the array you can define max min to spawn and the probability that the rest will spawn ---------- Post added at 05:13 PM ---------- Previous post was at 05:12 PM ---------- and by the way I have my random IED in... now just to link it to MCC so it does something. I'll update the main post, it's nothing big over what you already have, more of the same, just creating a different vehicle.. an IED. ---------- Post added at 05:21 PM ---------- Previous post was at 05:13 PM ---------- For now I'm getting functionality for testing, later I will optimize with BIS_fnc_SpawnGroup, as well as get a clean up script together that will be called when you no longer need everything created by this script. -- Keep in mind I'm still going to add in camps. Share this post Link to post Share on other sites
Skelt 10 Posted October 12, 2011 (edited) Can someone take a look at this, for some reason it spawns my radio tower and Camo net, but no table, and no laptop. //createMarker::: //CreateMarker for Camo Netting _netting = createMarker ["netting", [4136.17,6094.95,0]]; _netting setMarkerShape "ICON"; "netting" setMarkerType "DOT"; //CreateMarker for Land_Ind_illuminanttower _radiotwr = createMarker ["radiotwr",[4141.41,6096.31,0]]; _radiotwr setMarkerShape "ICON"; "radiotwr" setMarkerType "DOT"; //CreateMarker for Foldtable _tbl = createmarker ["tbl", [4135.19,6094.95,0]]; _tbl setMarkerShape "ICON"; "tbl" setMarkerType "DOT"; //CreateMarker for Laptop_ep1 _intelObj = createMarker ["intelObj",[4135.17,6094.95,0]]; _intelObj setMarkerShape "ICON"; "intelObj" setMarkerType "DOT"; //createVehicle::: //createVehicle Land_camonet_east _net = createVehicle ["Land_CamoNet_EAST",[0,0,0],["netting"],0,"NONE"]; sleep 1; //createVehicle Land_Ind_illuminanttower _radio = createVehicle ["Land_Ind_IlluminantTower",[0,0,0],["radiotwr"],0,"NONE"]; sleep 1; //createVehicle Foldtable _table = createVehicle ["FoldTable",[0,0,0],["tbl"],0,"NONE"]; _table setVehicleInit "this setPos [getPos this select 0, getPos this select 1, 0]"; sleep 1; //createVehicle Laptop _intel = createVehicle ["Laptop_EP1",[0,0,0],["intelObj"],0,"NONE"]; _intel setVehicleInit "this setPos [getPos this select 0, getPos this select 1, 1];_intel = intelObj addAction ['Collect Intel', execVM 'scripts\spawn_ai\delete_intel.sqf']"; No errors in the report, but it seems random, I ran it again just now to check the report, and all it spawned was the tower and laptop. I put the sleeps in just ecanse it had something to do with the fact all objects are created at grid 0,0,0 before being brought in. but makes no difference. I hope it's not because of the createVehicle array... Thanks for your help. Skelt, aka Bones PS: will probably change this to an ammo cache, I tried to get computer to spawn inside houses but I'm having difficulty getting coordinates inside -> always puts it on the outside of the house. Gonna try for another way to get some intel into a random house. Edited October 12, 2011 by Skelt Share this post Link to post Share on other sites
twirly 11 Posted October 12, 2011 (edited) Hi Skelt.... for the second part of your post about the finding of positions inside houses. Here's a little script I wrote sometime ago for randomly placing stuff in buildings. It's not too hard to follow and the code in there should at least help you with your building positions. hideobjects.sqf:- /* Script: hideobjects.sqf TWIRLY 2011 nul = ["Fuel_can",_number_of_fuel_cans] execVM "hideobjects.sqf"; */ private ["_object","_numobj","_randbuilds","_numplaced","_i","_posarray","_rndpos","_pos","_cnt","_fc"]; _object = _this select 0; //the type of object to create _numobj = _this select 1; //the number of objects to create //finds random buildings closeby _randbuilds = nearestObjects [player,["Building"],50]; hint format ["_randbuilds: %1",_randbuilds]; sleep 1; _numplaced = 0; //keep looping till all objects placed while {_numplaced <= _numobj} do { //select one random building _build = _randbuilds select (floor (random (count _randbuilds))); hint format ["_build: %1",_build]; sleep 1; //initailize arrays _posarray = []; _rndpos = []; _pos = []; //set counter to zero _cnt = 0; //as long as building position _cnt not equal to "[0,0,0]" keep looping while {format ["%1", _build buildingpos _cnt] != "[0,0,0]" } do { _pos = _build buildingpos _cnt; //select building position _cnt _posarray = _posarray + [_pos]; //add the position to the list _cnt = _cnt + 1; //increment counter sleep 0.01; }; hint format ["_posarray: %1",_posarray]; sleep 1; //some buildings have no positions...so check for 1 or more available positions if (count _posarray >=1) then { //select a random position _rndpos = _posarray select (floor (random (count (_posarray)))); //create an object there _fc = _object createvehicle _rndpos; //created object seems to fall to the ground!! _fc setpos _rndpos; //move it to the correct position!.. works! hint format ["_fc %1 placed at\n_rndpos: %2",_numplaced,_rndpos]; _numplaced = _numplaced + 1; //increment the number of placed objects sleep 1; }; }; As it is the script only searches 50m around the player for buildings. This can easily be changed by providing more input to the script. Edited October 12, 2011 by twirly Added stuff Share this post Link to post Share on other sites
Skelt 10 Posted October 12, 2011 (edited) Sweet, thanks Twirly. I did find my problem to the above... for one of the markers I had it _bla = createMarker[....]; _bla = setMarkerShape "..."; when it was suppose to be _bla setMarkerShape "..."; took me about 30 minutes of staring at it, and running them one by one.. derrr. I'm on to putting together my breifing now, since I wasn't able to get inside of those buildings, I figured I'd slap together 3 tasks... but I ran into a rather strange issue here is part of my my init dealing with it: // Create a taskHint mk_fTaskHint = compile (preprocessFileLineNumbers "fTaskHint.sqf"); sleep 1; // everything after this line is executed in-game, and not in the briefing screen player setCurrentTask tfbtsk1; [tfbtsk1] call mk_fTaskHint; sleep 7; //Finish world initialization before mission is launched. finishMissionInit; here is part of my briefing: //Triary Mission tfbtsk3 = player createSimpleTask["Triary: Destroy any military grade communications devices you may find"]; tfbtsk3 setSimpleTaskDescription["Destroy radio-relay tower"]; //Secondary Mission tfbtsk2 = player createSimpleTask["Secondary: Destroy any weapons caches you may find"]; tfbtsk2 setSimpleTaskDescription["Destroy two weapons caches."]; //Primary Mission tfbtsk1 = player createSimpleTask["Primary: 'Meet and Greet': Convoy to the nearby town of <marker name='tfbobj1'>Yak Ghar</marker>."]; tfbtsk1 setSimpleTaskDescription ["You don't have an inturpeter with you, so this will only further complicate things, however there has been a lot of enemy movement in the Area so so expect contact when you near the City.]; tfbtsk1 setSimpleTaskDestination (getMarkerpos "tfbobj1"); It all looks good, but I keep getting an error from the init portion, saying something of my tfbtsk1 ->Undefined Variable in Expression. I've been at this since noon, so it's probably a good time for me to break and come back fresh later lol. Thanks for your help once again. Edited October 12, 2011 by Skelt Share this post Link to post Share on other sites
twirly 11 Posted October 12, 2011 ....so it's probably a good time for me to break and come back fresh later lol. That always works for me and is the best thing you can do when nothing makes sense anymore. Just leave it alone and come back later! Share this post Link to post Share on other sites
Skelt 10 Posted October 12, 2011 Yup, I closed up shop for now; that script for the random objects is awesome, was looking it over, and I've thought up some pretty cool stuff I can do with it using ACE objects. Anyways, until later, Thanks again Twirly. Share this post Link to post Share on other sites
Skelt 10 Posted October 13, 2011 So after like four hours of banging my head on my desk about why my briefing.sqf wasn't working, which I deleted, and completely re-wrote I finally figured it out... this setCaptive true; In my init feild... Lovely eh? Anyways, still having some issues with my tasks. They get re-applied every time you die, so by the end of the mission you have like 30 tasks, and your only suppose to have 3. Other then that I'm having some problems with all of my task triggers, but I think im going to seperate them into a different sqf and see if they perform a little better. It's either that, or the objects being generated _veh createVehicle [...]; _veh setVehicleInit "..."; are not being named correctly so the triggers have nothing to pick up, or is it that I wrote the names in the triggers wrong? LoL either way I have a good time ahead! Skelt, aka Bones Share this post Link to post Share on other sites
Skelt 10 Posted October 14, 2011 (edited) I'm using this: //createVehicle Land_camonet_east _vhammoBx = createVehicle ["TKVehicleBox_EP1",[0,0,0],["vhammo","vhammo1","vhammo2"],0,"NONE"]; _vhammoBx setVehicleInit "cacheBox1 = this"; to create a vehicle ammo box, and I'm using this to change my task to succeeded: //create a trigger to tell when cacheBox is destroyed cacheTrg = createTrigger ["EmptyDetector",[0,0,0]]; cacheTrg setTriggerArea [0,0,0,false]; cacheTrg setTriggerActivation ["ANY","PRESENT",false]; cacheTrg setTriggerStatements ["!alive cacheBox1 && (taskCompleted tskObj1)","null=this execVM 'scripts\missions\objective_1.sqf'; hint 'fired'",""]; but the trigger is not firing, as though the item is not being named. Any ideas? thanks, Skelt, aka Bones ---------- Post added at 12:18 AM ---------- Previous post was Yesterday at 11:48 PM ---------- I just tested the triggers with static placed vehicles... they still didn't fire... so it must be something with the activation or statements...hmmph. Edited October 14, 2011 by Skelt Share this post Link to post Share on other sites
The Hebrew Hammer 10 Posted October 14, 2011 I was so close to making this mission work.. It just had to get ruined by the AI's inability to drive. Apparently even with the best convoy scripts they can't figure out how to take a left hand turn. I'll end up with a dumbed down and shorter version for SP, and a longer mission for coop. Share this post Link to post Share on other sites
Skelt 10 Posted October 14, 2011 lawl... script call.. in the trigger. (Fix for my compliant in the above post about my triggers not working...) ---------- Post added at 01:34 AM ---------- Previous post was at 01:33 AM ---------- Which convoy script did you use? ---------- Post added at 01:35 AM ---------- Previous post was at 01:34 AM ---------- I've seen some that work pretty well... but it seems to take them a good long while to arrive at their destinations Share this post Link to post Share on other sites
The Hebrew Hammer 10 Posted October 14, 2011 I really can't remember who's it is, it's not TdC's. The problem I think is in the map design, there's only a single road in the Sangin map that crosses the river from the FOB on the east side to the west, a little past that is a left hand turn that would move the convoy south, but it's weird because you need to turn right and then a hard left. If I knew how to edit maps I would fix it. Share this post Link to post Share on other sites
Skelt 10 Posted October 14, 2011 Hmm, I would have to test it myself, the island does use a road addon so it could very well be that, causing your issues. Share this post Link to post Share on other sites