Home   Help Search Login Register  

Author Topic: i need a trigger condition please...  (Read 3525 times)

0 Members and 2 Guests are viewing this topic.

Offline filth

  • Members
  • *
  • Who's the bad man?
i need a trigger condition please...
« on: 21 Jun 2007, 15:43:07 »
i need a trigger to fire when:

any four members of a group are present inside the trigger area.

and i don't know the syntax for the condition field.

can anyone help please?

cheers,

filth.
« Last Edit: 29 Jun 2007, 13:10:32 by filth_merchant 101 »

Offline filth

  • Members
  • *
  • Who's the bad man?
Re: i need a trigger condition please...
« Reply #1 on: 21 Jun 2007, 17:11:44 »
actually...

a slight amend...

i need the trigger to fire when any four members of two different groups are present inside the trigger area.

that is to say if i start the mission with two squads of eight soldiers each, any four of those 16 soldiers can be present inside the trigger for it to fire.

cheers,

filth.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: i need a trigger condition please...
« Reply #2 on: 21 Jun 2007, 17:29:07 »
 :dry:

you've been a member of this site long enough to know about the modify button... do not double post.

condition

Code: [Select]
((_x in thislist) count units group_one) + ((_x in thislist) count units group_two) > 4
« Last Edit: 21 Jun 2007, 17:32:28 by bedges »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: i need a trigger condition please...
« Reply #3 on: 21 Jun 2007, 18:46:28 »
Should be > 3
urp!

Offline filth

  • Members
  • *
  • Who's the bad man?
Re: i need a trigger condition please...
« Reply #4 on: 21 Jun 2007, 19:41:13 »
er.. actually, i've never used the modify button. and didn't know it was there. sorry. but i know now.

thanks for the condition line. but it's throwing up the error:

local variable in global space.

also, will this check to see if the members of the groups are within the trigger area?and if i name the groups alpha and bravo, should the syntax be as follows:

((_x in thislist) count units group_alpha) + ((_x in thislist) count units group_bravo) > 3

?

thx.
« Last Edit: 21 Jun 2007, 20:07:57 by bedges »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: i need a trigger condition please...
« Reply #5 on: 21 Jun 2007, 20:08:37 »
my error, it should be

Code: [Select]
({_x in thislist} count units group_one) + ({_x in thislist} count units group_two) >= 4
curly braces.

Offline filth

  • Members
  • *
  • Who's the bad man?
Re: i need a trigger condition please...
« Reply #6 on: 21 Jun 2007, 21:19:18 »
i'm not getting the trigger to fire :(

this is what i have in the leader of the first groups' init line:

alpha = group this.

this is what i have in the init line of the second group leader:

bravo = group this

this is what i have in the condition field of the trigger:

({_x in thislist} count units alpha) + ({_x in thislist} count units bravo) >= 4

i have 6 members of two groups (three from each) standing inside the trigger.

but it's not firing.

can anyone explain why?

thx.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: i need a trigger condition please...
« Reply #7 on: 21 Jun 2007, 21:37:49 »
what is the trigger activated by? east? west? none? it needs to know what's supposed to trigger it before it can populate thislist.

incidentally - there's no need to space your posts out like that - it's taking up a lot of space for not much content.

Offline filth

  • Members
  • *
  • Who's the bad man?
Re: i need a trigger condition please...
« Reply #8 on: 21 Jun 2007, 22:00:13 »
blimey. i've never been criticised for the way i post on this site. i thought i was just being clear by using the line spacing the way i did. i didn't realise the post police were so strict these days. anyway, as i said in my first post, i need the trigger to fire when four members of two squads are present inside the trigger area. i was hoping that the person who answered my question would be able to give me the answer to what actually sets off the trigger, as that was the original question.

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: i need a trigger condition please...
« Reply #9 on: 21 Jun 2007, 22:25:50 »
I think he did answer it Filth Merchant 101. I tried the code and it worked. You must have detected by west/east or whatever selected in order for the Trigger to activate. Once a unit of that side enters the area, the condition field takes over and checks if the units meet the condition. I'm not "exactly" clear on your request but change the number at the end to fit the amount you want to activate it. Example: If you want any one unit out of only those 16 to activate the trigger, just change the 4 to 1.
Sorry to Hijack your thread Filth but I am still a noob at code syntax and since it was mentioned here by Bedges.........  :whistle: Can anyone explain the difference between the Curly {}, curved() and square[] brackets and where it is required to use them. Or at the least, provide a link to a thread or tute on them? Pleeeeeease? :D
« Last Edit: 21 Jun 2007, 22:28:15 by savedbygrace »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: i need a trigger condition please...
« Reply #10 on: 21 Jun 2007, 22:48:08 »
curved brackets define discreet parts of a statement.

for example 1 + 2 * 3 = 7, because the multiplier has precedence. (1 + 2) * 3 = 9, because the brackets keep the first bit discreet.

square brackets are used in conjunction with arrays, for example loon setpos [getpos loon select 0, getpos loon select 1+2]

curly brackets are interchangeable with "" quotes, so the above example could just as well be written

Code: [Select]
("_x in thislist" count units group_one) + ("_x in thislist" count units group_two) >= 4
thus indeed, the question is answered. and if anyone needs a test missionette to prove it, just ask.

Offline filth

  • Members
  • *
  • Who's the bad man?
Re: i need a trigger condition please...
« Reply #11 on: 21 Jun 2007, 23:16:12 »
i cant' get it to work. i've set the trigger condition to this: ({_x in thislist} count units alpha) + ({_x in thislist} count units bravo) >= 4 and set it to activate when west is present, but nothing happens. :( - a test missionette would be invaluable, thank you.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: i need a trigger condition please...
« Reply #12 on: 21 Jun 2007, 23:31:44 »
your wish is my command. see attached.

Offline filth

  • Members
  • *
  • Who's the bad man?
Re: i need a trigger condition please...
« Reply #13 on: 21 Jun 2007, 23:45:13 »
thank you very much for this bedges. but i still have a problem. and i think i may have worked out the problem is. you see, i want the trigger to fire when 4 members of either group enter the trigger zone. the trigger with your condition only seems to fire if there are members of both groups present inside the trigger area. i want the trigger to fire even if all the members of bravo squad are dead (and are nowhere near the trigger area) and four members of alpha squad enter the trigger area. how can i do this? the reason your trigger didn't fire when i tried it is because my man wasn't grouped as bravo. i was waiting for four members of alpha group to fire the trigger, and they don't seem to, unless a member of bravo is present too. i hope that makes sense.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: i need a trigger condition please...
« Reply #14 on: 21 Jun 2007, 23:59:03 »
the condition still holds.

run the test mission and stay where you are. wait for the conga line. the trigger will fire as soon as four of them enter the trigger, even if you're miles away.

EDIT - to explain a bit better, the condition can be thought of as saying this:

when (the total number of units from group A within the trigger area) added to (the total number of units from group B within the trigger area) is equal to or greater than 4, activate the trigger.

thus even if there are no units from group A within the trigger, when the total number of units from group B in the trigger area reaches 4, it'll activate. if there is one loon from group A in the trigger area, it'll fire as soon as three from group B walk in, and so on.
« Last Edit: 22 Jun 2007, 00:07:17 by bedges »

Offline filth

  • Members
  • *
  • Who's the bad man?
Re: i need a trigger condition please...
« Reply #15 on: 22 Jun 2007, 00:59:15 »
ok. that explains things brilliantly, thanks. i presume that the trigger still fires if all the units from one of the groups is dead? only, i tried deleting the alpha grouping on the player in your mission, let bravo wander into the trigger and the trigger didn't fire. but if i add another unit, group him as alpha, remove the alpha grouping on the player and kill the alpha unit before bravo enters the trigger zone, it does fire. so i presume that as long as there are two groups defined on the map to begin with as alpha and bravo, it will work, even if one group is dead. is this true?

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: i need a trigger condition please...
« Reply #16 on: 22 Jun 2007, 01:11:52 »
indeed. the trigger needs something to go on. if no group is defined as group A and you're testing for both group A and group B, ofp will say "huh? i only see group B. whatchatalkinbout?"

or something to that effect...

glad to have helped.  :good:

Offline filth

  • Members
  • *
  • Who's the bad man?
Re: i need a trigger condition please...
« Reply #17 on: 22 Jun 2007, 01:42:07 »
 :D terrific. understood. thanks m8.  :good:

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: i need a trigger condition please...
« Reply #18 on: 26 Jun 2007, 04:25:11 »
Thanks for the lesson Bedges.  :clap:

Offline filth

  • Members
  • *
  • Who's the bad man?
Re: i need a trigger condition please...
« Reply #19 on: 27 Jun 2007, 01:33:40 »
ok, i didn't want to start a new thread, because this question is related to the answer to this one. here's the situation:

i'm using a modified condition line from this topic to execute a new trigger which i want to fire when members of alpha and bravo group's numbers are down to 2.

the condition line is as follows: ({_x in thislist} count units alpha) + ({_x in thislist} count units bravo) < 3

this works perfectly as long as the group members are not inside a vehicle. the trouble is, there's a really good chance that they will be inside a vehicle when this trigger condition is met. and i have no idea which vehicle, as it's a multiplayer mission. so i can't use the condition lines in the thread i found in a search, started by surpher, as i won't know the name of the specific vehicles.

how can i modify the count unit condition to make sure the units are counted whether they're inside a vehicle or not? (and it needs to apply for any vehicle on the map)

i've been reading some other threads on counting units inside vehicles, and outside vehicles, but i can't seem to see a solution to counting the units in groups whether they're inside or outside at the same time.

is there a way of doing this using this:

_all = [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16]
#loop
westalive = 0
"if (alive _x) then {westalive = walive + 1}" foreach _all;
? westalive == 0 : goto "westdead"
~5
goto "loop"
#westdead
~2
[] exec "alldead.sqs"
exit

this is a script i found for checking that members of the multiplayer environment are alive throughout the game and fires an end scene if everyone dies. is there a way to modify this maybe so that it fires when there are only 2 members left?

fingers crossed...

« Last Edit: 27 Jun 2007, 01:50:56 by filth_merchant 101 »