Home   Help Search Login Register  

Author Topic: Question about group linked trigger  (Read 1501 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Question about group linked trigger
« on: 13 May 2009, 00:20:39 »
 :scratch:

EDIT: Version 2 is the CORRECT way. Version 1 seems to only care about the first guy detected even though spottedguy is reset as objNull. The rest of the group are still setCaptive, even though detected. My guess is that no one else will be setCaptive false until the first guy is NOT detected anymore.

Sounds plausible ?


I want group members that are detected in a certain area to be setCaptive false IF they are detected after "myTarget" is dead. Group members NOT detected under those conditions should remain captive.

I know about the delay (units are still counted as detected for a while even when out of sight), but that's OK, I'm only worried about the onActivation thing. Those group members that are detected when AND after "myTarget" is dead must be setCaptive false.

Version 1

Trigger with 300m radius

Activation: -Any Group Member -Detected by OPFOR -Repetedly

Condition: this AND ! (alive myTarget)

onActivation: spottedguy = thislist select 0; spottedguy setCaptive false; spottedguy = objNull


Version 2

onActivation: {_x setCaptive false} forEach thislist


Will these two versions have the same results?
Or which one is better?
If none of the two works, what could work better?

Cheers,

Laggy
« Last Edit: 13 May 2009, 16:05:33 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Question about group linked trigger
« Reply #1 on: 21 May 2009, 00:59:10 »
The former method will only setCaptive the first person and the later will only setCaptive the first ones to enter the zone. More people will only be affected if everyone is undetected for a time and someone is detected again. The reason for this is a common misconception on how trigger conditions work. OnAct is run only when the whole condition flips from true to false and OnDeact is run only when the condition flips from false to true. Setting a trigger REPEATEDLY only means that it will run these events indefinitely as the condition flips from true to false to true to false, not that they will trigger each time the condition is checked and found to be true.

To cut the Gordian Knot (although your second solution seems to work fine)...
Code: (init line for myTarget) [Select]
this addEventHandler ["KILLED", { { _x setCaptive false } forEach units myGroup }];
Code: (init line for someone in my group) [Select]
myGroup = group this;
What you really want, it seems, is that everyone should be unset as captive after the target is killed. If you aren't detected by the enemy, then not being a captive isn't dangerous so there isn't a problem.
« Last Edit: 24 May 2009, 04:21:15 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Question about group linked trigger
« Reply #2 on: 21 May 2009, 14:51:42 »
Quote
What you really want, it seems, is that everyone should be unset as captive after the target is killed. If you aren't detected by the enemy, then not being a captive isn't dangerous so there isn't a problem.

Hmmm... not quite true in my case.

This is for my mission "One Shot One Kill"

The players (all in the same group) are "undercover" wearing enemy uniforms.
They can walk around quite safely before target is assassinated, target is an enemy general/politician.
However when target is killed (by someone in players group) the enemies should be more on their guard and suspect/attack any (now detected) unfamiliar faces in the "crime" area.

That's why I need a solution.
The point being, if you have planned and carried out the assassination perfectly, you should be able to "walk" away easily.

Any other solution will cause unrealistic effects/results like:

A group member who has been standing alone on the other side of the map all day doing nothing is all of a sudden setCaptive false - doesn't make sense, he hasn't been doing anything suspicious.

Same thing goes for an assassin who has perfectly infiltrated the assassination area and was never seen at all.

I might be picky, but that's my philosophy in mission editing... it has to make sense   :scratch:

Laggy
« Last Edit: 21 May 2009, 19:30:44 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.