OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: buzz_fledderjohn on 08 Sep 2009, 20:22:03

Title: Detecting enemies within a marker; complete objective when all enemies are dead
Post by: buzz_fledderjohn on 08 Sep 2009, 20:22:03
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.
Title: Re: Detecting enemies within a marker; complete objective when all enemies are dead
Post by: Pirin on 08 Sep 2009, 22:15:05
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.
Title: Re: Detecting enemies within a marker; complete objective when all enemies are dead
Post by: buzz_fledderjohn on 15 Sep 2009, 23:43:08
Heya,

Sorry for the long reply, been busy lately. I'll try that out, thanks man.
Title: Re: Detecting enemies within a marker; complete objective when all enemies are dead
Post by: buzz_fledderjohn on 02 Oct 2009, 00:43:34

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.
Title: Re: Detecting enemies within a marker; complete objective when all enemies are dead
Post by: tcp on 03 Oct 2009, 06:28:45
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";
Title: Re: Detecting enemies within a marker; complete objective when all enemies are dead
Post by: buzz_fledderjohn on 03 Oct 2009, 15:07:35
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?
Title: Re: Detecting enemies within a marker; complete objective when all enemies are dead
Post by: tcp on 03 Oct 2009, 19:23:36
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?
Title: Re: Detecting enemies within a marker; complete objective when all enemies are dead
Post by: buzz_fledderjohn on 04 Oct 2009, 01:55:43
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!