Phaedin
Member-
Content Count
3 -
Joined
-
Last visited
-
Medals
Community Reputation
10 GoodAbout Phaedin
-
Rank
Rookie
-
AI In building hiding then attacking.
Phaedin posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I have what I think should be a simple request I want a group of units to ambush a road from inside buildings. I want them to move out of the building if they want. I want the AI to do the work AFTER the trigger is hit. I have 10 units total group of 4 and 2 groups of 3. I have a few guys near a building, I use _OpForAmbGrp01_Gren1 setpos (((getpos this) nearestobject 96652) buildingpos 0); Which works flawlessly. I want to have the 3 different groups of units stay in there groups but Stealth and Never Fire so they don't fire and try not to be seen. (Lay inside the buildings) So easiest way i know to do this is _OpForAmbGrp01 setBehaviour "Stealth"; _OpForAmbGrp01 setCombatMode "BLUE"; So now i need to assign groups. Simple all I did was _OpForAmbGrp01 = group _OpForAmbGrp01_TLead1; But the problem, as most of you know, is if they are in the building and I change Behavior and Mode they will change formation and get out of the building positions. So I fixed this by changing the Behaviour and Mode before I moved the units with setPos, then I disabled the AI from moving for each unit, and re-enabled it some seconds later. (Timing doesn't matter i can get that right later.) The issue I run into is getting them from Stealth Never Fire to Combat Open Fire, Fire At Will. I'm sure this could be done through waypoints but it is nearly impossible to link triggers to waypoints in buildings especially when there are 4 units in the building each with 2 waypoints... 1 to set stance for Stealth/Never Fire and the 2nd to combat/open fire. I'm using nul = [] execVM "Ambush01.sqf"; on the trigger (Also I only did the setpos for the first group... didn't want to do it to all 10 if it didn't work.) Here is full script: \\Ambush01.sqf _OpForAmbGrp01 = group _OpForAmbGrp01_TLead1; _OpForAmbGrp02 = group _OpForAmbGrp02_TLead1; _OpForAmbGrp03 = group _OpForAmbGrp03_TLead1; _OpForAmbGrp01 setBehaviour "Stealth"; _OpForAmbGrp01 setCombatMode "BLUE"; _OpForAmbGrp02 setBehaviour "Stealth"; _OpForAmbGrp02 setCombatMode "BLUE"; _OpForAmbGrp03 setBehaviour "Stealth"; _OpForAmbGrp03 setCombatMode "BLUE"; Sleep 3; _OpForAmbGrp01_Gren1 setpos (((getpos this) nearestobject 96652) buildingpos 0); _OpForAmbGrp01_TLead1 setpos (((getpos this) nearestobject 96652) buildingpos 1); _OpForAmbGrp01_AutoR1 setpos (((getpos this) nearestobject 96652) buildingpos 2); _OpForAmbGrp01_ATR1 setpos (((getpos this) nearestobject 96652) buildingpos 3); _OpForAmbGrp01_TLead1 disableAI "move"; _OpForAmbGrp01_Gren1 disableAI "move"; _OpForAmbGrp01_AutoR1 disableAI "move"; _OpForAmbGrp01_ATR1 disableAI "move"; _OpForAmbGrp02_TLead1 disableAI "move"; _OpForAmbGrp02_MSpec1 disableAI "move"; _OpForAmbGrp02_AstMisSpec1 disableAI "move"; _OpForAmbGrp03_TLead1 disableAI "move"; _OpForAmbGrp03_Gren1 disableAI "move"; _OpForAmbGrp03_AutoR1 disableAI "move"; sleep 20; _OpForAmbGrp01_TLead1 enableAI "move"; _OpForAmbGrp01_Gren1 enableAI "move"; _OpForAmbGrp01_AutoR1 enableAI "move"; _OpForAmbGrp01_ATR1 enableAI "move"; _OpForAmbGrp02_TLead1 enableAI "move"; _OpForAmbGrp02_MSpec1 enableAI "move"; _OpForAmbGrp02_AstMisSpec1 enableAI "move"; _OpForAmbGrp03_TLead1 enableAI "move"; _OpForAmbGrp03_Gren1 enableAI "move"; _OpForAmbGrp03_AutoR1 enableAI "move"; _OpForAmbGrp01 setBehaviour "Combat"; _OpForAmbGrp01 setCombatMode "RED"; _OpForAmbGrp02 setBehaviour "Combat"; _OpForAmbGrp02 setCombatMode "RED"; _OpForAmbGrp03 setBehaviour "Combat"; _OpForAmbGrp03 setCombatMode "RED"; -
forcing a unit to fire at target
Phaedin replied to anusmangler's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I use this to have a unit fire a RPG at a predefined target. In this case a battery above the tail rotor of a heli. //nul=[AAMan1,TestBird] execvm "FireMissile.sqf" _AAMan1 = _this select 0; //AT/AA man who will fire missile missile _Heli = _this select 2; _fakeTarget = "Land_Battery_F" createVehicle (getPos _Heli); _fakeTarget attachTo [TestBird, [0, -6, -10]]; doStop _AAMan1; _AAMan1 setUnitPos "up"; _pWeap = primaryWeapon _AAMan1; _AAMan1 selectWeapon _pWeap; _AAMan1 doTarget _Heli; _AAMan1 doFire _Heli; Code was adapted from http://www.kylania.com/ex/?p=21 -
You can also use I would also suggest having them select the weapon too. Also there is a 'addMagazines' to add multiple (i also noticed yours didn't end with 'mag') _unit addweapon "tb_arifle_scarlp"; _unit selectweapon "tb_arifle_scarlp"; _unit addMagazines ["30Rnd_68x43", 8];