Jump to content
Sign in to follow this  
WingmanSR

Night Infil: AI detection behavior

Recommended Posts

Scroll to my post below. This is now working almost exactly as I would like. New mission creators might be interested in this information, then again they might not :-p

Hello,

I'm a complete novice and aspiring mission creator. Right now I'm trying to create a two-man team night infiltration/sabotage mission. I'm studying Mr. Murry's and Taurus's excellent scripting guides, but I am having trouble instituting one particular feature of this mission.

What I would like to accomplish:

While my team is in the trigger area, if they are detected by opfor, I would like us to have 5 seconds to eliminate the unit(s) that have detected us(to simulate the detecting units sending out a radio message), otherwise an alarm will sound, our current position will be revealed to all opfor within the base,all opfor set to "combat" behavior.

What I have attempted to do to make this happen:

-Trigger

-act by: "any group member", Detected by OPFOR (repeatedly)

-Countdown: 5, 5, 5

-condition: this

-on activation:

{_x reveal [t1,t2]} foreach allunits; {_x setBehaviour combat} foreach allunits;

effect: "trigger:Alarm"

I want this to happen for all OPFOR because I can't group 30+ of the units in the mission, because they are in guard towers and I don't want them to form up on the leader(which they seem to do even when set to "special:none")

Obviously, in my ineptitude, I'm missing something important here, because nothing happens except for the alarm sounding.

If any of you scripting/editor gurus could provide me with some guidance, I would be very appreciative.

Regards

Edited by WingmanSR

Share this post


Link to post
Share on other sites

What is t1 and t2? Unit's right?

Well it would be much easyer with a script but ok...

{if (_x countEnemy [t1] > 0) then {_x reveal t1; _x reveal t2; _x setBehaviour "COMBAT"} } forEach allUnits;

Try it. ;)

Share this post


Link to post
Share on other sites

Thank you for your help SNKMAN! I didn't expect a response so quickly :D.

yeah, t1 and t2 are the players. I have tried your suggestion, but it seems that the OPFOR patrols remain in "AWARE" mode. Could this be because of their waypoint cycle, which is a "move(sync to infil trigger):aware, open fire"? Maybe if I remove the behavior from the waypoint and place "this setBehaviour aware" in init field of the patrol group leaders it would fix it. going to try it.

Edit(1): Once I'm a bit more sure of what I'm doing, I will start to use .SQF files. For now, while I'm learning, using "init" and "on act" fields lets me adjust things quickly in the editor and fix my errors.

Edited by WingmanSR

Share this post


Link to post
Share on other sites

To anyone else interested in making stealth oriented missions with AI detection and alarm triggers this is how I finally got this to work (might seem a bit crude/sloppy to a more seasoned mission designer :-p )

Trigger 1 - This trigger should cover the whole area where you want the AIplayer(s) to be able to trigger the detection trigger.(note: if you are detected outside the trigger area, this trigger will activate as soon as you enter the area.)

 -name : DetVarSwitch
 -Activation : link the trigger to player group using "group", select "any group member" on the activation drop down menu, set to "detected by OPFOR"
 -condition : this
 -On activation : A1 = true;publicVariable "A1" /*edited*/

You need to set " publicVariable "A1" " to sync the variable with other players in a multiplayer mission. You can add publicVariable "A1" to another trigger, but I'm fairly sure it has to be set BEFORE "A1 = true" to work properly. Edit: Thank you for correcting my usage of "publicVariable", shk. :)

Trigger 2 - This trigger should enclose the whole area where there are AI you want to be alerted.

  -Name = DefineAI /*can be whatever you want, but this is important*/
  -Activation : OPFOR, present
  -condition : A1       (make sure you remove the word "this")
  -on act. : {_x reveal t1; _x reveal t2; _x setBehaviour "COMBAT"; _x setCombatMode "YELLOW"; _x setSpeedMode "NORMAL"} forEach list DefineAI;

This is why the name of the trigger is important(DefineAI). You can set whatever trigger area you want the AI to be alerted in, just have to name the trigger and reference it here. You also should name the player units you want revealed to the AI, if you want their positions revealed. Here you can see I named them "t1" and "t2".

Now, you might like to add an alarm sound when you are detected, which is pretty simple.

trigger(s), set the size to "axis a:0" "axis b:0"

  -name:whatever
  -activation : none
  -condition : A1
   effects > Trigger > scroll down to "Alarm"(the first one)

you can put as many of these as you want around the area to have alarms coming from different buildings or towers.

I hope this was helpful to any other novice mission designers! :)

Regards

Edited by WingmanSR

Share this post


Link to post
Share on other sites
but I'm fairly sure it has to be set BEFORE "A1 = true" to work properly.

PV syncs the variable when you run the PV, so obviously you run PV AFTER you have assigned it the value.

Share this post


Link to post
Share on other sites
PV syncs the variable when you run the PV, so obviously you run PV AFTER you have assigned it the value.

:j: Thats what I said... ::discretely edits post::

Thank you for pointing that out to me, apparently my logic was backwards. I was thinking you had to establish the variable as public before it is activated, but then how could it sync the variable if it doesn't actually "exist" yet. silly.

Share this post


Link to post
Share on other sites

Hi,

I have applied these triggers but I do have a question or two:

1. alarm seems to be raised immediately when an enemy soldier spots me, even if I kill him straight away. Can we apply the 5 seconds window within which I have to eliminate the enemy before he can report my presence and raise the alarm? I'm not sure how to do that because timeout seems to be just delaying the trigger that is otherwise inevitable. These 5 seconds seem plausible and would add more more pressure to those sticky situations.

2. I wonder if the enemy know my exact location once the alarm is triggered regardless if they have eyes on me. It's understandable that they know where I am if someone spots me but if I kill all those present then they should know only my approximate position.

Otherwise the idea of the triggers is great, and I thank you for sharing the solution you have arrived at.

Hope someone can answer my questions!

Share this post


Link to post
Share on other sites

1. Probably easier with a small script than triggers. Doable anyhow.

Share this post


Link to post
Share on other sites

OK then, could you point me to such a script please? I'd appreciate it!

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  

×