Home   Help Search Login Register  

Author Topic: Detecting enemies within a marker; complete objective when all enemies are dead  (Read 2249 times)

0 Members and 1 Guest are viewing this topic.

Hey everybody.

I know this is a very basic question, but I searched and couldn't find anything.

In my mission, the players have to clear three villages. I have added a marker around every village, indicating the "boundaries". When all enemies within these boundaries are dead or gone, I want that objective to be completed. In other words, I need a trigger that checks whether enemies are present (dead or alive or gone) within those markers. When all three villages are cleared, I want the mission to end (victory). How do I do this?

Thanks.

Offline Pirin

  • Members
  • *
You'd need 4 triggers:

1 each around each town, OPFOR NOT PRESENT ONCE as it's options.  In the OnAct:

Code: [Select]
tskObj1 setTaskState "SUCCEEDED"; hint "This town is clear!";
Then a fourth trigger, replace it's Condition with:

Code: [Select]
taskState tskObj1 == "SUCCEEDED" && taskState tskObj2 == "SUCCEEDED" && taskState tskObj3 == "SUCCEEDED"
Then set it's TYPE to End1.

Personally I like to put a few seconds in the Timeout for End type triggers.  Maybe play some music or display some text.

Heya,

Sorry for the long reply, been busy lately. I'll try that out, thanks man.


Personally I like to put a few seconds in the Timeout for End type triggers.  Maybe play some music or display some text.

Hello,

This is exactly what I've been trying, but I'm unsuccessful.

When I finish all three objectives, I first want to play some music for about 20 seconds, and then end the mission.

What I've done is: make one "outro music" trigger that actives when all three towns are cleared (using your instructions), but NOT make it end the mission (End#1). It plays some music and displays some text.

Then, I duplicated that trigger, removed the Effects, gave it a delay of 20 seconds and turned it into an End#1 trigger.

My idea was to active both triggers at the same time, but give the END_MISSION trigger a delay of 20 seconds, so the mission would end after 20 seconds of music. However, this doesn't work. Nothing happens when I clear the final town. The triggers that check if each town is clear DOES work, though.

Any ideas? ???

EDIT: FYI, ending the mission DID work, but not with the music.
« Last Edit: 02 Oct 2009, 00:46:22 by buzz_fledderjohn »

Offline tcp

  • Members
  • *
    • Violator Gaming
I don't think the timeout or the countdown works with end type triggers.
Use a script instead:
On Act:
nul = execVM "end.sqf";

Code: (end.sqf) [Select]
playMusic "Track06_Abandoned_Battlespace";
cutText ["Congratulations. Mission accomplished.", "BLACK OUT",15];
sleep 20;
endMission "END1";

This doesn't appear to be working. :(

I created that end.sqf, and then made a new trigger that has this Condition:

Code: [Select]
taskState tskObj1 == "SUCCEEDED" && taskState tskObj2 == "SUCCEEDED" && taskState tskObj3 == "SUCCEEDED"
On act:

Code: [Select]
nul = execVM "end.sqf";
But again, nothing happens. The mission doesn't end and the effects aren't played. Am I doing something wrong?

Offline tcp

  • Members
  • *
    • Violator Gaming
Try setting trigger conditions to radio alpha, so you can figure out if its the tasks condition is wrong, or if the effects aren't working. Although, I tested the trigger and script so I suspects the tasks aren't updating. Are you using publicVariables?

Alright, it works now! (using the method in your first reply, tcp, with the end.sqf).

I think what happened is that one or two of my patrols entered one of the towns after I have cleared it, re-rendering that objective as "Active" instead of Successful. So I modified their waypoints a bit so they don't enter the towns at all.

Thanks for the help!
« Last Edit: 04 Oct 2009, 01:58:00 by buzz_fledderjohn »