Jump to content
Sign in to follow this  
aook002

Trigger activation...

Recommended Posts

In the 'mission editing FAQ' post i came across this:

Quote[/b] ]Bn880 helped me on this one  

How do I make a trigger activate when another trigger is activated and a unit is in the trigger area?

If you want the second trigger to be activated by a specific person or group, group the trigger to them.  Then type in the ACT. field on the first trigger

Code Sample  

t1=true  

Then type in the second triggers Cond. field

Code Sample  

this && t1

This insures that the triggger won't activate until the first trigger is activated and your group is in the second triggers area.

And I was just wondering what it would be if i wanted it a trigger to activate if 2 other triggers had already been activated and a unit is in the 3rd trigger area.

For example, i wanted to reach a crashed helicopter and check if the Pilots (P1 and P2) are alive.

Trigger 1 = 'T1': If P1 = Not Present. On Act: t1 = true

Trigger 2 = 'T2': If P2 = Not Present. On Act: t2 = true

So for Trigger 3 would it be...

'T3': If Player = Present. Cond field: ? ? ? ?

Thanks In Advance

Aook  smile_o.gif

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">t1 && t2 && this

smile_o.gif

Share this post


Link to post
Share on other sites
right. that's why balschoiw said "or"  wink_o.gif

Well I guess so.

The reason to why I pointed this out is that OR

(which can be written)

||

or

OR

In version 1.46 OR doesn't work in either scripts nor conditionfields of triggers.

so, perhaps the same thing goes for AND and %%

Share this post


Link to post
Share on other sites

sure it works.

Tt is the same but some people maybe can remember that better.

At least I am no pc geek biggrin_o.gif

Share this post


Link to post
Share on other sites
sure it works.

Tt is the same but some people maybe can remember that better.

At least I am no pc geek biggrin_o.gif

Ahh come on, you hang around the forums, you're a geek of some kind ,we all are. tounge_o.gif

Share this post


Link to post
Share on other sites
Ahh come on, you hang around the forums, you're a geek of some kind ,we all are.  tounge_o.gif

LOL!!

Balschoiw

I really tried using OR in scripts for version 1.46 and it didn't turn out to well.

Share this post


Link to post
Share on other sites
so, perhaps the same thing goes for AND and %%

i assume you meant AND/&& tounge_o.gif

afaik "or" works since ofp v1.00.

Share this post


Link to post
Share on other sites

So then...

Is there anyway, I could check if either:

         a)P1 and P2 are alive?

         b)P1 and P2 are dead?

         c)P1 is dead but P2 is alive?

         d)P2 is dead but P1 is alive?

All at once, so say when the player 'S1' enters an area around the chopper 'BH' it checks to see what the status is of the two aircrew (P1 and P2) and then tells Papa bear the status using 'sideChat'

This is so that when I get to the helicopter and depending on the outcome it could say:

         a)Both pilots are alive...

         b)Both pilots are dead...

         c)The pilot is dead but the gunner is alive...

         d)The gunner is dead but the pilot is alive...

But the thing is, I don't want this to occur more than once, so could it be made?

Just say if you need more info.

Thanks

Aook  crazy_o.gif

Share this post


Link to post
Share on other sites

Yes, it should work, but you can not do it directly in the trigger.

e.g.

trigger1

activation: (side of your soldier)

trigger: once

condition: this

onActivation: [] exec "checkaircrew.sqs"

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

?( (alive(P1) AND (alive(P2)) ): goto "CaseA"

?( !(alive(P1) AND !(alive(P2)) ): goto "CaseB"

?( (alive(P1) AND !(alive(P2)) ): goto "CaseC"

?( !(alive(P1) AND (alive(P2)) ): goto "CaseD"

exit

#CaseA

Papa_bear sideChat "Both pilots are alive"

exit

#CaseB

Papa_bear sideChat "Both pilots are dead..."

exit

#CaseC

Papa_bear sideChat "The pilot is dead but the gunner is alive..."

exit

#CaseD

Papa_bear sideChat "The gunner is dead but the pilot is alive..."

exit

Share this post


Link to post
Share on other sites

Thanks for all the replies, but I came across an error Taurus  sad_o.gif

The error is:

'( !(alive(P1) AND (alive(P2)) )|#|': Error Missing )

The code for checkaircrew.sqs is:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?( (alive(P1) AND (alive(P2)) ): goto "CaseA"

?( !(alive(P1) AND !(alive(P2)) ): goto "CaseB"

?( (alive(P1) AND !(alive(P2)) ): goto "CaseC"

?( !(alive(P1) AND (alive(P2)) ): goto "CaseD"

exit

#CaseA

S1 sideChat "Papa Bear, this is Rescue Team, both pilots are alive."

~2

Papa_bear sideChat "Roger that Rescue Team. Escort both pilots to the evac site. Out."

P1 addeventhandler ["hit", {_this select 0 setdammage 0}]

P2 addeventhandler ["hit", {_this select 0 setdammage 0}]

exit

#CaseB

S1 sideChat "Papa Bear, this is Rescue Team, Both pilots are dead, I repeat both pilots are dead."

~2

Papa_bear sideChat "God Damn! Ok Resuce Team, carry on to get the hostage. Out."

exit

#CaseC

S1 sideChat "Papa Bear, this is Rescue Team, the pilot's dead, but the gunner is alive."

~2

Papa_bear sideChat "Roger That Rescue Team. Escort the gunner to the evac site. Out."

P2 addeventhandler ["hit", {_this select 0 setdammage 0}]

exit

#CaseD

S1 sideChat "Papa Bear, this is Rescue Team, the gunner is dead but the pilot is still alive"

~2

Papa_bear sideChat "Roger that Rescue Team. Escort the gunner to the evac site. Out."

P1 addeventhandler ["hit", {_this select 0 setdammage 0}]

exit

I was wondering when I have put <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">P1 addeventhandler ["hit", {_this select 0 setdammage 0}] do is need to change the '_this' to P1?

Aook  rock.gif

Share this post


Link to post
Share on other sites

you don't have to, but you can. it means the same, cos _this select 0 is p1 in this case...

Share this post


Link to post
Share on other sites

Thanks raedor, that's part of the problem solved, now how about the error  rock.gif

He he he

Aook  smile_o.gif

Share this post


Link to post
Share on other sites

oh yes, didn't saw that, you edited it "in" there...

write the first part like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (alive P1 && alive P2): goto "CaseA"

? (!(alive P1) && !(alive P2)): goto "CaseB"

? (aliveP1 && !(alive P2)): goto "CaseC"

? (!(alive P1) && alive P2): goto "CaseD"

Share this post


Link to post
Share on other sites

Well, it got it to work partly, but with a problem  sad_o.gif

The code im using now for the checkaircrew.sqs is:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (alive P1 && alive P2): goto "CaseA"

? (!(alive P1) && !(alive P2)): goto "CaseB"

? (aliveP1  && !(alive P2)): goto "CaseC"

? (!(alive P1) && alive P2): goto "CaseD"

#CaseA

S1 sideChat "Papa Bear, this is Rescue Team, both pilots are alive."

~2

Papa_bear sideChat "Roger that Rescue Team. Escort both pilots to the evac site. Out."

P1 addeventhandler ["hit", {_this select 0 setdammage 0}]

P2 addeventhandler ["hit", {_this select 0 setdammage 0}]

exit

#CaseB

S1 sideChat "Papa Bear, this is Rescue Team, Both pilots are dead, I repeat both pilots are dead."

~2

Papa_bear sideChat "God Damn! Ok Resuce Team, carry on to get the hostage. Out."

exit

#CaseC

S1 sideChat "Papa Bear, this is Rescue Team, the pilot's dead, but the gunner is alive."

~2

Papa_bear sideChat "Roger That Rescue Team. Escort the gunner to the evac site. Out."

P2 addeventhandler ["hit", {_this select 0 setdammage 0}]

exit

#CaseD

S1 sideChat "Papa Bear, this is Rescue Team, the gunner is dead but the pilot is still alive"

~2

Papa_bear sideChat "Roger that Rescue Team. Escort the gunner to the evac site. Out."

P1 addeventhandler ["hit", {_this select 0 setdammage 0}]

exit

When ever i activate the trigger, it always says that both pilots are alive, even though they are blatently dead. So all it says is:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Papa Bear, this is Rescue Team, both pilots are alive."

Then nothing else is said. I'm also wondering are the ~2 commands alright to use?

Thanks for all the help, so far.

Aook  smile_o.gif

Share this post


Link to post
Share on other sites

no wonder. i'm sure p1 and p2 or one of them does not exist. check if you _really_ gave them their names.

and papa_bear does also not exist. i'm not sure, but you've to take something like<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[west, "hq"] sidebla...

Share this post


Link to post
Share on other sites

Ill have to check these things out tomorrow, got to log off now.

"Nite-nite"

Aook *Yawn*  wow_o.gif

Share this post


Link to post
Share on other sites

aook002

sorry for the missleading code, I didn't try it out, and I see now that there are ('s missing crazy_o.gif

Well, you got yourself started

Share this post


Link to post
Share on other sites

The_Taurus

So, i just need to make the brackets equal - just like a giant maths equation? Is this on your or Raedors version of the script?

Or do i just need to change the Papa_Bear to:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[west, "hq"]

And also are the ~2 wait comands alright to use?

Thanks

Aook

Share this post


Link to post
Share on other sites

aook002

you need to check that your pilots are named

P1 and P2

in the editor as raedor said.

And, unfortunatly I do not know how to get "west headquarters" to sideChat.

the "is alive check" needs to look like this:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

? (alive P1 && alive P2): goto "CaseA"

? (!(alive P1) && !(alive P2)): goto "CaseB"

? (alive P1 && !(alive P2)): goto "CaseC"

? (!(alive P1) && alive P2): goto "CaseD"

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

? (alive P1 && alive P2): goto "CaseA"

? (!(alive P1) && !(alive P2)): goto "CaseB"

? (aliveP1 && !(alive P2)): goto "CaseC"

? (!(alive P1) && alive P2): goto "CaseD"

I can not see why this wont work.

If you have placed an chopper with side e.g. west, you only name the vehicle itself.

So in order to name each pilot you need to place an empty chopper and "moveInx" the pilots after you've named them.

Share this post


Link to post
Share on other sites

Ok, im at school  sad_o.gif

BUT....

I can remember that I have already made the pilots P1 and P2 and made them get in the BAS Blackhawk called BH by a get in waypoint. And I can easily find out what 'Papa_Bear' is from the sticky 'Mission Editing FAQ' post  smile_o.gif

Ok, ill try the new code:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (alive P1 && alive P2): goto "CaseA"

? (!(alive P1) && !(alive P2)): goto "CaseB"

? (alive P1  && !(alive P2)): goto "CaseC"

? (!(alive P1) && alive P2): goto "CaseD"

When I get back home.

Thanks for this, and ill get back to you if it works or not.

Aook  unclesam.gif

Share this post


Link to post
Share on other sites

sad_o.gif  sad_o.gif  sad_o.gif  sad_o.gif  sad_o.gif

Problems...

I changed the Papa Bear, that works,and the whole script runs.

But when the pilots are both dead of have been killed by militia and when I go to the trigger area it says that both pilots are alive.

This is probably due to the code.

The code looks exactly the same for the code i shouldn't use and the one to try instead of!

Could some1 please check that

The code I am using at the moment is:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (alive P1 && alive P2): goto "CaseA"

? (!(alive P1) && !(alive P2)): goto "CaseB"

? (alive P1  && !(alive P2)): goto "CaseC"

? (!(alive P1) && alive P2): goto "CaseD"

#CaseA

S1 sideChat "Papa Bear, this is Rescue Team, both pilots are alive."

~2

[West, "HQ"] sideChat "Roger that Rescue Team. Escort both pilots to the evac site. Out."

P1 addeventhandler ["hit", {_this select 0 setdammage 0}]

P2 addeventhandler ["hit", {_this select 0 setdammage 0}]

exit

#CaseB

S1 sideChat "Papa Bear, this is Rescue Team, Both pilots are dead, I repeat both pilots are dead."

~2

[West, "HQ"] sideChat "God Damn! Ok Resuce Team, carry on to get the hostage. Out."

exit

#CaseC

S1 sideChat "Papa Bear, this is Rescue Team, the pilot's dead, but the gunner is alive."

~2

[West, "HQ"] sideChat "Roger That Rescue Team. Escort the gunner to the evac site. Out."

P2 addeventhandler ["hit", {_this select 0 setdammage 0}]

exit

#CaseD

S1 sideChat "Papa Bear, this is Rescue Team, the gunner is dead but the pilot is still alive"

~2

[West, "HQ"] sideChat "Roger that Rescue Team. Escort the gunner to the evac site. Out."

P1 addeventhandler ["hit", {_this select 0 setdammage 0}]

exit

Aook  sad_o.gif

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  

×