Home   Help Search Login Register  

Author Topic: Trigger / Script activated by vehicle under new management^^  (Read 1399 times)

0 Members and 1 Guest are viewing this topic.

Offline diogenes

  • Members
  • *
Hi,

I'm building a mission in which the player is part of a team to attack a convoy and steal one or more of the convoys trucks. In order to end the mission one (or more) of the trucks should reach a certain position. The problem is that all the (3) Trucks are in one group (along with some other vehicles) so i can't seem to use a trigger and group it with the trucks (then all the vehicles would have to reach that destination...) so i tried a script. This is what i wanted to use but nothing happens (this version is from a smaller test-mission with 2 civilian bikes b1/b2 as the targets, _ctr is an H (invisible) as the center for the destination):

Quote
_ctr = _this select 0

#check
? (((vehicle b1) distance _ctr) <= 50 OR ((vehicle b2) distance _ctr) <= 50) : hintc "OK"
~2
goto "check"

exit

First i tried "b1 distance _ctr" but that didn't work (i suppose that actually is the driver?). I could probably just create empty vehicles, name them and that should work but i don't want to do this, because then i would have to completely change the mission (also i would have no idea how to let multiple vehicles in different groups drive in formation along a road...).
So, if anyone has any tips, i'd appreciate that.

Thanks, diogenes

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Trigger / Script activated by vehicle under new management^^
« Reply #1 on: 08 Sep 2008, 14:05:53 »
Welcome to OFPEC!

When you group a trigger to a unit, you are given several options to choose from in the 'Activated By' part of the trigger dialog. I can't remember off the top of my head, but it's something like [activated by this group], [this unit], [any member of this group].

Offline diogenes

  • Members
  • *
Re: Trigger / Script activated by vehicle under new management^^
« Reply #2 on: 08 Sep 2008, 15:42:12 »
Yes, i know. But i don't see a way to get the trigger activated by one (or more) specific vehicles of the group. As i said there are two jeeps and three trucks in the group and the trigger should be activated by any of the three trucks, but with the player (or one of his side) on the wheel...

EDIT: And thanks for the welcome  :D
« Last Edit: 08 Sep 2008, 15:45:14 by diogenes »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Trigger / Script activated by vehicle under new management^^
« Reply #3 on: 08 Sep 2008, 16:04:14 »
In that case, make the 'Activated By' trigger by any member of this group, and in the 'Condition' field put

Code: [Select]
this and (vehicle player in thislist)
From the COMREF:
Quote
Array variable thisList is set to list of all vehicles that would satisfy primary sensor activation condition.

So no matter which vehicle in the group reaches the trigger first, it won't fire unless the player is there. If you really really want the trigger to fire only when the player is driving (and not in a cargo seat) you'll need an extra conditional:

Code: [Select]
this and (vehicle player in thislist) and ((driver truck1 == player) or (driver truck2 == player) or (driver truck3 == player) or (driver jeep1 == player) or (driver jeep2 == player))
« Last Edit: 08 Sep 2008, 16:09:21 by bedges »

Offline diogenes

  • Members
  • *
Re: Trigger / Script activated by vehicle under new management^^
« Reply #4 on: 08 Sep 2008, 18:01:12 »
That definetely helps but is not all i wanted  :)

The trigger is to fire as soon one of the three trucks (NOT the jeeps, which are in the same group) arrives at the trigger. Driven by the player or one of his subordinates. It doesn't matter if the player is there or which or how many of the trucks arrive there.  So i would need the trigger to check wether one of the trucks is there...
I tried
Quote
vehicle tr1 in thislist
and
Quote
this and (vehicle tr1 in thislist)

(where tr1 is one of the trucks) but that didn't work. I suppose vehicle checks for the vehicle the driver of tr1 (who is dead at this point :)) is in? So i need the name for the vehicle that was spawned as tr1 after the original driver is dead (and as i said the new driver would be either the player or one of his teammembers)...
« Last Edit: 08 Sep 2008, 18:09:35 by diogenes »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Trigger / Script activated by vehicle under new management^^
« Reply #5 on: 08 Sep 2008, 18:35:41 »
If tr1 is the variable you entered in the 'name' field of the truck, then that's its name, regardless of who's driving it.

Condition feld now becomes

Code: [Select]
this and ((tr1 in thislist) or (tr2 in thislist) or (tr3 in thislist))

Offline eegore

  • Members
  • *
Re: Trigger / Script activated by vehicle under new management^^
« Reply #6 on: 10 Sep 2008, 10:26:57 »
 
  I am certain this is not the answer you will be looking for, but I had a mission almost exactly like this a while back.

  What I did was "joingrp Null" in a radius around the final destination for the jeeps so that they were no longer in my group just before I hit the final destination.  I gave them domove getpos gamelogics to provide cover. 

  That way when any of us neared the final destination the group only consisted of me and the 2 trucks that would trigger the mission ending and the jeeps would take up cover positions. 

  Obviously my knowledge of scripting and trigger information is limited.