Seth 0 Posted January 31, 2008 Hi,i have a question.When AI spots the enemy it`s going prone.What i want to do,is to make AIs go crouch,without going prone,when they detect the enemy.I dont want them to be crouched all the time (via setUnitPos) but to make them crouch instead of prone.Is there a way to do this?I dont like,how they going prone in urban combat.Please,help me After a few hours: And here`s another question (about something different,but i don`t want to write another topic so i placed it here). Is there a way to force AI to select their secondary weapon (when they enter a trigger or via radio)?I was thinking about giving them a silenced pistols,and then there will be two options in radio: "Go silent"-the AI will switch to secondary (silenced) weapons,and "Go assault"-AI will switch back to their primary weapons.Something like in Ghost recon 2.Is there a possibility to do that?I dont know what commands i need to use.I was trying to do this by removing ammo from their equipment (by "removeMagazine "primaryWeaponMagazine" command),and then by giving it back,but it`s not what i want as they will never run out of ammo this way.Can anyone help me with this please? Share this post Link to post Share on other sites
.kju 3245 Posted February 4, 2008 Maybe it change be changed via FSM. It is only a guess though. Share this post Link to post Share on other sites
CarlGustaffa 4 Posted February 6, 2008 I think that would be the combat FSM, which I believe isn't accessible for editing. Only solution I see is scripting, which would possibly take too much effort both to script and on the computer running the mission. Share this post Link to post Share on other sites
MetalGearXM 0 Posted March 4, 2008 Alright Seth, sorry for the month late response, but I do have an answer to one of your questions, although the other I can't fully help you with. Firstly, as for the AI crouching/proning problem. I'm not sure what would be the best way to go about it but there are some cheap alternatives. I couldn't figure out how to check a unit's current pos, but if you could, you could set its unitpos to crouch whenever it goes prone, wait ten seconds, set the unitpos to auto and then go back to checking when it goes prone. There is another alternative I've thought of. If you put all of the enemies in an array you can check the knowsabout value from one unit to another and if it goes over I believe 0.105, you can use setpos to set him to crouch until the knowsabout value drops. I can, however, help you with the switching weapons problem. Now, this is a cheap alternative (again), so it might not fufill exactly what you desire. It will work, however. For each unit in the group you can remove their weapons and give them only the pistol you want them to use. Then when you switch back, give them all their weapons back. You can give them all their weapons with <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _unit = _this select 0 _loadouta = weapons _unit _loadoutb = magazines _unit removeAllWeapons player blablablbla removeallweapons player _wnum = count _loadouta _wnum2 = 0 ?(_wnum2 == _wnum): goto "loopweapba" #loopweapa player addweapon (_loadouta select _wnum2) _wnum2 = _wnum2 + 1 ?(_wnum2 == _wnum): goto "loopweapba" goto "loopweapa" #loopweapba _wnum = count _loadoutb _wnum2 = 0 ?(_wnum2 == _wnum): goto "loopfin" #loopweapb player addmagazine (_loadoutb select _wnum2) _wnum2 = _wnum2 + 1 ?(_wnum2 == _wnum): goto "loopfin" goto "loopweapb" #loopfin exit That blablabla whatever is your other code by the way. Theoretically you can simply remove their primary weapon by doing the same script but leaving out the primary weapon in the weapons array by starting _wnum2 off with 1 instead of 0. Por ejemplo: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _wnum2 = 1 ?(_wnum2 == _wnum): goto "loopweapba" #loopweapa player addweapon (_loadouta select _wnum2) _wnum2 = _wnum2 + 1 ?(_wnum2 == _wnum): goto "loopweapba" goto "loopweapa" The only problem you'd face is that you'd have to have everything in one script because the original loadout for the unit is a local variable, though I'm sure you could find a way around that. Anyways. I haven't tested any of that so I'm not sure how it would work but give it a try and tell us if it works. Also I tried your method for removing magazines and I generated this (Triggered by [this] exec "script.sqs"): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _unit = _this select 0 Stealth = false Assault = false #loop ;Create a new radio command _tri = createTrigger["EmptyDetector",getPos player]; _tri setTriggerActivation ["ALPHA", "PRESENT", false] _tri setTriggerStatements ["this", "Stealth = true", ""] _tri setTriggerText "Stealth" Waituntil Stealth Stealth = false _point = 0 ; Get loadout info about the unit _loadouta = weapons _unit _loadoutb = magazines _unit #find ; Check the magazine loadout array names against itself to find where the magazines are different _mag1 = _loadoutb select (_point) _mag2 = _loadoutb select (_point + 1) ?(_mag1 != _mag2): goto "found" _point = _point + 1 goto "find" #found ; Remove all the magazines of first given type _unit removeMagazines _mag1 "SoldierE" createvehicle getpos player ;Create a new radio command _tri = createTrigger["EmptyDetector",getPos player]; _tri setTriggerActivation ["ALPHA", "PRESENT", false] _tri setTriggerStatements ["this", "Assault = true", ""] _tri setTriggerText "Assault" ; Wait until stealth mode is turned off Waituntil Assault Assault = false #give ; Give back number of magazines we took out _unit addMagazine _mag1 ?(_point == 0): goto "loop" _point = _point - 1 goto "give" Unfortunately he still refused to use his secondary weapon. Was it working for you? Share this post Link to post Share on other sites