Jump to content
Sign in to follow this  
eisa01

Detect 2 units present in area

Recommended Posts

i need a trigger to activate if two planes are inside a trigger area.at least 1 will be flying. i also need a trigger to activate if 1 plane is inside the area and the other is dead. hope ya understood me!

Share this post


Link to post
Share on other sites

Make a trigger with west (or east depending on what side the planes are on) present. Make it the right size for the end area.

In the triggers condition field put:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">planename1 in list this && planename2 in list this<span id='postcolor'>

RED

Share this post


Link to post
Share on other sites

i type in this

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">sop1 in list this && sop2 in list this<span id='postcolor'>

when i preview this error message comes up:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">'sop1 in list this &&|#| sop2 in list this': Error list: Type Boo,l expected Object<span id='postcolor'>

any ideas of what causing this?

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">sop1 in list trig1 && sop2 in list trig1<span id='postcolor'>

Call the trigger trig1, sorry my mistake smile.gif

RED

Share this post


Link to post
Share on other sites

thank you smile.gif

do you know how to make a trigger activate if one of the planes are dead and the other is inside the trigger area??

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">sop1 in list trig1 && sop2 in list trig1 OR sop1 in list trig1 && not(alive sop2) OR not(alive sop1) && sop2 in list trig1<span id='postcolor'>

That should do it.

RED

Share this post


Link to post
Share on other sites

THANK YOU BOTH xmas.gif

youre almost making the mission for me tounge.gif

Share this post


Link to post
Share on other sites

I've got a similar trigger and it's not working. sad_o.gif

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class Item19

{

position[]={1581.931152,24.974998,5549.689453};

a=50.000000;

b=75.000000;

rectangular=1;

activationBy="WEST";

repeating=1;

age="UNKNOWN";

text="Support Area";

name="Supportarea";

expCond="(tank2 in list Supportarea) and (aP in list Supportarea) and (canMove tank2)";

expActiv="support = true; hint ""support=true""";

expDesactiv="support = false; hint ""support=false""";

class Effects

{

};

};

It's simple, I want the trigger to activate if both the player (aP) and the player's vehicle (tank2) are within the trigger area and the vehicle is still functional. I also don't care if the player is in or out of the vehicle - just as long as they're both there.

TIA. smile_o.gif

Share this post


Link to post
Share on other sites

just put

.. in thislist

twice, as it pertains to the area defined by your trigger

hope this helps

also the first AND is making it too restrictive

you know that when a unit is in a vehicle, it becomes invisible to the OFP radar

you can first put

player == vehicle player

to avoid this problem

and then put

vehicle player in thislist

or use OR

Share this post


Link to post
Share on other sites

When I change:

(aP in list Supportarea)

to:

(vehicle player in list Supportarea)

it works unless I get out of the vehicle. Then it deactivates.

But what doesn't it like about my unit name ."ap", that should activate the trigger and it's not - especially when I get out of the vehicle?! crazy_o.gif

I've also tried substituting "player" for "aP" but it also didn't work when I left the vehicle. Here's what I have now that only triggers when I'm in the area in the vehicle:

(tank2 in list Supportarea) and ((vehicle player in list Supportarea) or (player in list Supportarea)) and (canMove tank2)

I'll change it to "thislist" later, when my headache here is over.

I don't know why you say the first AND is too restrictive. Please explain. Logically it makes sense.

Share this post


Link to post
Share on other sites

IMHO this should solve your problem

Quote[/b] ]((vehicle player in list Supportarea) or (player in list Supportarea)) and (canMove tank2)

BTW, this was one of the hidden spoilers in my "Realistic Crime City" mission: if you didn't leave the car, you could smash all the guards at ease without getting detected

Share this post


Link to post
Share on other sites
IMHO this should solve your problem
Quote[/b] ]((vehicle player in list Supportarea) or (player in list Supportarea)) and (canMove tank2)

No because it activates the trigger even when the vehicle is outside of the trigger area, as long as the player is within the area, either in a vehicle or out.

The vehicle in intially defined as:

side="EMPTY"

with the player's init line saying:

this moveInDriver tank2

I wonder what would happen if the vehicle started off as:

side="WEST"

with its init line set to remove its pilot. Do you remember the command that does that???

Seems like an OFP bug or limitation that OFP does not recognize that the empty vehicle is in the trigger area. rock.gif

Share this post


Link to post
Share on other sites
I wonder what would happen if the vehicle started off as:

side="WEST"

with its init line set to remove its pilot. Do you remember the command that does that???

Solution on this thread I started a long time ago.

I'll give it a try and see what happens.

Share this post


Link to post
Share on other sites
IMHO this should solve your problem
Quote[/b] ]((vehicle player in list Supportarea) or (player in list Supportarea)) and (canMove tank2)

No because it activates the trigger even when the vehicle is outside of the trigger area, as long as the player is within the area, either in a vehicle or out.

The vehicle in intially defined as:

side="EMPTY"

with the player's init line saying:

this moveInDriver tank2

I wonder what would happen if the vehicle started off as:

side="WEST"

with its init line set to remove its pilot. Do you remember the command that does that???

Seems like an OFP bug or limitation that OFP does not recognize that the empty vehicle is in the trigger area. rock.gif

How about this?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(player in list Supportarea) && (tank2 in list Supportarea) && (canMove tank2)

Share this post


Link to post
Share on other sites
How about this?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(player in list Supportarea) && (tank2 in list Supportarea) && (canMove tank2)

As I said earlier:

Quote[/b] ]I've also tried substituting "player" for "aP" but it also didn't work when I left the vehicle. Here's what I have now that only triggers when I'm in the area in the vehicle:

(tank2 in list Supportarea) and ((vehicle player in list Supportarea) or (player in list Supportarea)) and (canMove tank2)

sad_o.gif

Something's not working here and it's driving me gaga! crazy_o.gif

BTW, I tried the removing driver bit I mentioned just before. Same problem.

EDIT: Just to refresh and say that the problem here is being caused by the check for tank2 in list Supportarea. It does not detect that.

If that check is removed from the condition equation, the trigger activates when the player enters the area in the vehicle or on foot.

What's interesting is that OFP knows about tank2 because the "canMove tank2" condition is being recognized, yet OFP does not acknowledge tank2's presenece in the trigger radius.

<span style='color:red'>Any chance of getting a BIS developer here? Perdy please?</span>

Something's very buggy here. sad_o.gif

Share this post


Link to post
Share on other sites

Instead of trigger use game-logic unit (named point).

Then check condition:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player distance point < 50 and tank2 distance point < 50 and canMove tank2

This replaces circular trigger with 50,50 axis (for land units only).

You can check this condition in some trigger or in some script.

Share this post


Link to post
Share on other sites
Instead of trigger use game-logic unit (named point).

Then check condition:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player distance point < 50 and tank2 distance point < 50 and canMove tank2

This replaces circular trigger with 50,50 axis (for land units only).

You can check this condition in some trigger or in some script.

Bravo! Using distance measure resolves the problem. But instead of defining a new game logic unit, I simply coded the trigger area's condition as follows:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(tank2 distance aP < 75) and ((vehicle player in thislist) or (aP in thislist)) and (canMove tank2)

I tested this out with both armor and aircraft units, while both in and out of the vehicles.

Now for an academic question: Why? Why isn't the presence of an empty vehicle in the trigger area detected? Was this because most people would use such a trigger only when the vehicle is active (and not in cases where it's destroyed or immobile, etc.)?

If so, BIS should offer an option where an empty vehicle can be detected, too. Another to-do-item for OFP2. smile_o.gif

Thanks again, forum members! Power to the masses! blues.gif

Share this post


Link to post
Share on other sites
Now for an academic question: Why? Why isn't the presence of an empty vehicle in the trigger area detected? Was this because most people would use such a trigger only when the vehicle is active (and not in cases where it's destroyed or immobile, etc.)?

Because it simply doesnt, vehicles arent exactly counted as to being on a side so the trigger only searches for living units. If the trigger were to search for all vehicles present in the area then you would have things like an empty tank or a dead unit screwing up your condition, just as you said.

And if you have the trigger named "SupportArea" then you can refer to it as an object (unless you put list infront of it), so instead of placing an extra gamelogic called point you can just use<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player distance supportarea < 50 and tank2 distance supportarea < 50 and canMove tank2In the same triggers condition field  smile_o.gif

Share this post


Link to post
Share on other sites
Now for an academic question: Why? Why isn't the presence of an empty vehicle in the trigger area detected? Was this because most people would use such a trigger only when the vehicle is active (and not in cases where it's destroyed or immobile, etc.)?

Because it simply doesnt, vehicles arent exactly counted as to being on a side so the trigger only searches for living units. If the trigger were to search for all vehicles present in the area then you would have things like an empty tank or a dead unit screwing up your condition, just as you said.

Understood. Yet there should be any ability in OFP2 to allow a new syntax to specify a unit name under any condition - empty, dead or whatever.

Quote[/b] ]And if you have the trigger named "SupportArea" then you can refer to it as an object (unless you put list infront of it), so instead of placing an extra gamelogic called point you can just use<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player distance supportarea < 50 and tank2 distance supportarea < 50 and canMove tank2
In the same triggers condition field  smile_o.gif

Yes, adjusted to do that:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(tank2 distance Supportarea < 60) and ((vehicle player in thislist) or (aP in thislist)) and (canMove tank2)

Thanks! wink_o.gif

EDIT: Just to document that:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(tank2 distance Supportarea < 60)

measures the 60 meters from the vehicle (possibly its center point - not sure) to the center point of the list area (named "Supportarea" in this example). OFP does NOT measure from the vehicle to the list area's outer perimiter boundary, when a list area is defined with non-zero A and B axis values.

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  

×