Jump to content
Sign in to follow this  
aeggwards1

Undercover Units

Recommended Posts

Hi,

I want to make a mission where I have an undercover special forces team performing recon on a insurgent held town. I want to make so that they will only be fired upon if they are closer than 30 metres to the enemy.

I will have a repeatable trigger set up that sets setCaptive true/false based on a distance condition. How would I go about finding their distance from the nearest enemy without naming all the insurgents? Would this work if the leader of the sf team was named p1?

p1 distance (p1 findNearestEnemy p1) < 30

Share this post


Link to post
Share on other sites

findNearestEnemy works off the knowsAbout rating, which apparently only works if both units are local, so in a SP mission this would probably work, but in multiplayer I think you're going to run into a lot of problems.

This seems to work at first blush for Single Player at least:

In your OPFOR group leaders put this:

{_x disableAI "TARGET"; _x disableAI "AUTOTARGET"; _x setBehaviour "CARELESS"} foreach units group this;

Then in a trigger put this:

Condition:

(player findNearestEnemy position player) distance player < 30

OnAct:

op = (player findNearestEnemy position player);{_x enableAI "TARGET"; _x enableAI "AUTOTARGET"; _x setBehaviour "COMBAT"} forEach units group op;

You'll be able to walk around and be ignored till you get within 30m of a target, at which point their group will give you the whatfor. :yay:

Share this post


Link to post
Share on other sites

Sorry for the late reply Kylania but that works perfectly thanks.

Share this post


Link to post
Share on other sites

How easy would it be to set it up so that the OpFor units will become hostile when fired upon/if the player takes an offensive action, as I tried that and it works well, but if you fire at them they just sit there and take it :D

Share this post


Link to post
Share on other sites
How easy would it be to set it up so that the OpFor units will become hostile when fired upon/if the player takes an offensive action, as I tried that and it works well, but if you fire at them they just sit there and take it :D

I'd like to know this too. I assume it can be done using a fired eventhandler but I have no idea how to.

Share this post


Link to post
Share on other sites

As has been said many times before, just join the player to a group of the 'enemy' they are infiltrating, then use the fired EH (or whatever) to join them back to a group of their own side.

Share this post


Link to post
Share on other sites

In my tests (20+ of them) joining a friendly/civilian unit to an OPFOR group, only once did they actually engage me. All the other times they just yelled "ENEMY!" at me then ran off to rejoin their new group formation. So if you're looking for a surprise ambush, simply joining an OPFOR group won't be enough.

Share this post


Link to post
Share on other sites

Sorry, trying this myself I found that it only works with groups that have not yet met them. Bizarre. Has sometimes worked, but that is the exception. Stranger yet, often groups that have not met them will fire upon them, but after a few seconds - if they haven't killed the player - will become friendly. As kylania has alluded to, this works between some groups, but differently between others.

Share this post


Link to post
Share on other sites

I have being doing some testing with the fired eventhandler that seems to work. All I did was change the original trigger from being activated once you came to close to be activated when a variable called "fired" equals one.

I then put

this addEventHandler ["fired", "fired=1"]

into the init line of the player and squadmates. Works fine.

Share this post


Link to post
Share on other sites

Hi I have absolutely no idea as to how I can add the fired event handler, I have gone to all the wikis and the forums but cant make much sense of the techno babble ( im am utterly clueless when it comes to coding) but I really want to make a couple of missions featuring undercover operatives. In this regard couldya show exactly how you got the AI to react to your shots?

Thanks

Share this post


Link to post
Share on other sites

@ Demo man

I did check it out but ( I know this sounds stupid) I coudnt fiure out how to assign a name to the group and besides I found the method mentioned here to be easier. Like I said my scripting is weak an this is an understatement. But thanks for postin the links man appreciate it. PS i still could use a lil help with the name assignments :)

Share this post


Link to post
Share on other sites

I also have a few more questions regarding UC operators

1. Concealed weapons: is it possible for the operators to conceal a supressed pistol or SMG and blow their cover when drawn?

2. Can anyone figure out a way to make a UC script which has all the elements like being in cover with concealed weapons and also maintaining a certain distance from some OPFOR units to avoid detection

If anyone can help it would be of great help cause I have a scenario in my head that I cant get out which involves some close target recon and target identification by UC followed by directed airstrikes and a raid by 'heavy' SF guys

Share this post


Link to post
Share on other sites

Original post by [b]shobhit[/b]
1. Concealed weapons: is it possible for the operators to conceal a supressed pistol or SMG and blow their cover when drawn?

How about just giving your team magazines for the weapon but no weapon. Then add an action or trigger that gives them the weapon but then makes them a target for the enemy.

2. Can anyone figure out a way to make a UC script which has all the elements like being in cover with concealed weapons and also maintaining a certain distance from some OPFOR units to avoid detection

Once you've given your team the weapons you could add a condition that EAST knowsabout PLAYER > 2 or something like that. That way the enemy would have to see your team before they realise you're a threat. For the distance bit, just use the code from earlier in this thread as an extra condition.

Sorry can't put together an example mission for you, I'm at work at the minute and then away for the week.

I've got a question if anyone can help though. I've been putting together an undercover mission. The mission involves been driven into a city by the AI, I've set my team to setcaptive true, so the enemy won't fire on them. Set their behaviour to CARELESS, but whenever the driver sees the enemy he takes evasive action and tuns the car around and bugs out. I've tried setting the OPFOR teams as captive TRUE, this does work but then the triggers which detect my team using the earlier code "FINDNEARESTENEMY" don't work because it doesn't recognise OPFOR as enemy.

Any ideas how I can stop my men reacting to OPFOR but not set them as captive true?

Share this post


Link to post
Share on other sites

@MOSTLY

Thanks for the ideas man. I think the concealed weapons thing would definately work but two problems here

1. I cant script to save my life :)

2. It doesnt sound very flexible. Id prefer an ON/OFF switch of sorts. Weapons out BLOWN!! weapons in SAFE. But that raises the question as to what does the AI do after the weapon has been concealed. Eg; you're undercover, you take out a suppressed M9 to pop a sentry the other guard spots you but you quickly conceal the pistol and the AI goes back to normal "undetected routine". So we need a robust weapon concealment script. Im guessing a system that incorporates the proximity detection with weapons drawn. Is it possible to play around with the line of sight of the AI?? I guess this involves a HUGE amount of scripting for now I would settle for a normal "draw weapons-AI freaks out" script.

Thanks again for the ideas though!! :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×