Home   Help Search Login Register  

Author Topic: Looking for Endmission trigger with minimum distance of enemies to player  (Read 1602 times)

0 Members and 1 Guest are viewing this topic.

Offline mathias_eichinger

  • Missions Depot
  • Administrator
  • *****
  • I'm a llama!
Hi all!

I use a trigger that is set to OPFOR present, activated once, with (count thislist)<5 in the condition field and a radio message on activation.

What I am trying to achieve is that the trigger would only fire if these last 5 loons are at least 100 m away from the player, to avoid ending the mission with enemies right in front of him.

What would be the required line of code here?

Thanks in advance,

Mathias

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
First group the opfors as (group loons)  :)

try in the condition:

(count thislist)<5&&player distance (group loons) >= 100.

Luke
Pesky Human!!
Wort Wort Wort.

Offline mathias_eichinger

  • Missions Depot
  • Administrator
  • *****
  • I'm a llama!
Ah, my problem is that I have multiple groups of enemies, some of them even spawned. The (count thislist)<5 trigger apparently works for the whole OPFOR side, and I want it to keep working that way, so I can't just group one squad. Or did I get it wrong?

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Humm. So basically what you want is:

a) NO loons within 100 meters of him (?)
or
b) LESS THAN 5 loons within 100 meters of him (?)
or
c) There are 5 specific loons (that can be from several groups?) that aren't to be within 100 meters of the player

A) is easy enough, just add a 100 meter "OPFOR not present" trigger around the player and shazam, it'll run when there aren't any enemies around.

B) is also fairly easy: just make a 100 meter "OPFOR present" trigger, and make the Condition read: count thisList < 5
That way, if there're less than 5 loons within the trigger, the trigger will activate.

C) is a little more complicated, but having something like the trigger above, except with a condition field that reads like: {_x in thisList} count [loon1,loon2,loon3,loon4,loon5] == 0 should do it (then all the loons would be named).

I'm easily confused though, so more information would be nice!

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline mathias_eichinger

  • Missions Depot
  • Administrator
  • *****
  • I'm a llama!
Thank you people for thinking this through, sorry for not having been clearerl
The situation is this:

There's a 500 m trigger covering Corazol. When the enemies (all OPFOR, some of them spawned) are less than five, the mission ends. Up to there it's a classic solution to the "hunt the last loon problem". What I want to avoid is to have the mission end with an "area clear" message right when a loon is close to the player, because this would be a contradiction.
But as the trigger is now, this situation is perfectly possible, because that loon could well be one of the last 4.

So, I want to add a distance to the end condition, yet it should still apply for the whole 500 m trigger, e.g. when the last 4 loons are more than 100 m away from the player (out of sight) INSIDE the mission area (trigger area) only then should the trigger be activated and the mission should end. And because some of the enemies are spawned, I can't just create an array with about 40 or so names in it.

I hope it is a bit clearer now?

Offline Cheetah

  • Former Staff
  • ****
Two conditions that have to be met mathias.

1. < 5 in the 500 m trigger. That code is already there with the (count thislist)<5.

2. next. create a trigger 100 m radius activates when NO opfor are present with a countdown of 3 seconds (for 3 seconds, no one in the 100 m radius). finally, create a script that setpos's the trigger at the player's position every two seconds.

Combine both triggers so that if both conditions are met the mission ends.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline MachoMan

  • Honoured
  • Former Staff
  • ****
  • KISS, Keep it Simple Stupid
Use getNearestObject of the type of the units that are spawned and check if those are not below some distance. Do not add the normal end trigger in the editor but create in from once the first condition is satisfied. (use createTrigger)

Alternatively you could just and in the trigger and check for the above too.
« Last Edit: 23 Jul 2008, 22:23:17 by MachoMan »
Get those missions out there you morons!

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
getNearestObject ???


Planck
I know a little about a lot, and a lot about a little.

Offline MachoMan

  • Honoured
  • Former Staff
  • ****
  • KISS, Keep it Simple Stupid
argh I mean nearestObject and you know it :P So what if my commands are a bit rusty ;)
Get those missions out there you morons!