Home   Help Search Login Register  

Author Topic: Distance trigger  (Read 625 times)

0 Members and 1 Guest are viewing this topic.

pazuzu

  • Guest
Distance trigger
« on: 15 Aug 2005, 06:43:31 »
I have a trigger in my mission to call a script that has some titletext and sidechat in it.

The condition for the trigger is:

(alive col) AND (p1 distance col) < 3 OR (p2 distance col) < 3 OR (p3 distance col) < 3 OR (p4 distance col) < 3 OR (p5 distance col) < 3 OR (p6 distance col) < 3 OR (p7 distance col) < 3 OR (p8 distance col) < 3 OR (p9 distance col) < 3 OR (p10 distance col) < 3 OR (p11 distance col) < 3 OR (p12 distance col) < 3

This activates a script called info.sqs

The idea is to have any of the units on west team get close to enemy (col) and trigger the script to get some text displayed.

I just noticed when I test it with full team of AI it works perfectly but when I disable the AI it doesn't work.

Does the condition look right?

Thanks.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Distance trigger
« Reply #1 on: 15 Aug 2005, 07:14:30 »
looks like a couple of brackets are missing...

Code: [Select]
(alive col) AND ((p1 distance col) < 3 OR (p2 distance col) < 3 OR (p3 distance col) < 3 OR (p4 distance col) < 3 OR (p5 distance col) < 3 OR (p6 distance col) < 3 OR (p7 distance col) < 3 OR (p8 distance col) < 3 OR (p9 distance col) < 3 OR (p10 distance col) < 3 OR (p11 distance col) < 3 OR (p12 distance col) < 3)
no guarantees.

funkster

  • Guest
Re:Distance trigger
« Reply #2 on: 15 Aug 2005, 08:43:30 »
Im a bit of a scripting newb myself, but just a tip from what I can see there;
it may save you some trouble to define all of the points in a script, then when you want to refer to them all,  you dont have to type all their names.

Eg. In the init.sqs file, you could define them all:

Allps = [p1, p2, p3, p4, p5, p5, p7, p8, p9, p10, p11]



Then later when you want to refer to them in your script, all you would have to type is :

(alive col) AND (Allps distance col)

which is both quicker and easier!(especially if you want to refer to them all again)  (And like bedges said, you were missing a bracket).

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Distance trigger
« Reply #3 on: 15 Aug 2005, 09:07:34 »
You haven't told us enough about the problem, but it could be that the trigger doesn't work when you disable AI because some of these units don't exist.

In other words, if p11 doesn't exist the trigger can't work out what to do and gives up.

Assuming that is the problem, then you need something like this

(alive col) and ("(_x distance col) < 3" count units grpP > 0)

Not tested and syntax not guaranteed but it's something along those lines.

I'm presuming that this is for a MP mission but we won't move it to the MP board until you confirm it.
« Last Edit: 15 Aug 2005, 09:09:08 by macguba »
Plenty of reviewed ArmA missions for you to play

pazuzu

  • Guest
Re:Distance trigger
« Reply #4 on: 15 Aug 2005, 19:10:18 »
I tried your suggestion macguba and it worked perfectly. Its so much easier to write it out that way.

Now I have the same problem with the Knowsabout command. I have for a condition in another trigger:

(alive col) AND (alive maj) AND col knowsAbout p1 >.3 OR col knowsAbout p2 >.3 OR col knowsAbout p3 >.3 OR col knowsAbout p4 >.3 OR col knowsAbout p5 >.3 OR col knowsAbout p6 >.3 OR col knowsAbout p7 >.3 OR col knowsAbout p8 >.3 OR col knowsAbout p9 >.3 OR col knowsAbout p10 >.3 OR col knowsAbout p11 >.3 OR col knowsAbout p12 >.3

Can I write this out in a similar way (counting units)?

Thanks for the help.