Home   Help Search Login Register  

Author Topic: Trigger doesn't detect truck passengers.  (Read 1050 times)

0 Members and 1 Guest are viewing this topic.

Offline gezegond

  • Members
  • *
Trigger doesn't detect truck passengers.
« on: 22 Apr 2010, 20:31:22 »
Hi! I'm a newbie and this is my first post. I've made some missions before, but only now I've become serious in editing. Please note that I don't know scripting.

Short problem description (if you don't want to read all the boring details): The "Not present" field in the trigger option (in Mission Editor) doesn't seem to detect truck's passengers, so if I have some truck passengers in a trigger's area, the triggers fires off even though the truck passengers are actually present in the said area.

More Details:

OK, I want the mission to end when there's nobody alive on the "WEST" side. So I create a trigger, put in a large radius, choose "West - Not Present", and I put "end" in the "Type" field.

This usually works, but in a particular mission, it doesn't.

In this mission, I've created a WEST Infantry group, a WEST 5t truck, and I grouped them together. I made an EAST infantry group on a town away from the WEST's position, and then I place a "Seek and Destroy" waypoint for the WEST leader to destroy the EAST. I also have the trigger I described above.

When the mission starts, the leader tells the soldiers to get in the truck, then the truck moves to the destination town. When arrived, EAST soldiers fire at the truck and kill the leader (officer) and the driver. At this point the trigger fires off and the mission ends, even though there are still other WEST soldiers in the back of the truck.

I want an Ending trigger that makes sure that there are absolutely no soldiers of a particular side in a defined area.

THANK YOU!

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Trigger doesn't detect truck passengers.
« Reply #1 on: 23 Apr 2010, 17:53:36 »
Hmmm...

The simplest solution I can think of is to modify the "conditions" field of your end trigger from

Code: [Select]
this
to

Code: [Select]
this && "alive _x" count (crew truck1) == 0
Where truck1 is the name of your truck. What does this do? It checks to see if no west in present in the trigger radius AND no one in the truck is still alive. These two conditions are connected by the && symbol.

Code: [Select]
"alive _x" count crew truck1
is a command that returns the number of alive crewmembers of truck1. (Giving the engine a command that "returns" a value is like telling the computer, "go figure out what this is, then use that value in the script.") And "== 0" means "equals zero."

And if you have multiple trucks:

Code: [Select]
this && ("alive _x" count (crew truck1)) + ("alive _x" count (crew truck2)) == 0
Et cetera.

Quote
Please note that I don't know scripting.

OFP's scripting language is not difficult to pick up. You really should give it a try, for it allows 20 times more fun stuff in mission editing. OFPEC alone is bursting with helpful tutorials and the COMREF, not to mention a valuable archive of ancient forum posts. This is where I got started:

http://ofp.toadlife.net/downloads/tutorials/scripting_guide/scripting.htm

Just do the example exercises and play with them until they make some kind of sense.
« Last Edit: 23 Apr 2010, 18:02:02 by RKurtzDmitriyev »
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline gezegond

  • Members
  • *
Re: Trigger doesn't detect truck passengers.
« Reply #2 on: 23 Apr 2010, 20:46:24 »
Thanks, I'll go check it now.
Besides, that script you gave me looks a hell lot like c++ coding, which I'm familiar with, so I'll definitely give OFP scripting a shot.