Jump to content

Recommended Posts

Hello, everyone! I've been mission editing in CWA & ArmA 3 for several years, but this is my first post here.


I'm trying to create a simple "conquest" mission in which the side (East or West) that spends the longest amount of time within a trigger area wins after 1 hour.


For each given side, I have both a "Present" and a "Not Present" trigger for the objective area. When a unit of that side enters the trigger area, I want to continually increase that side's score (ex. add 1 point to a variable named "WestScore" for every 10 seconds that a West unit is present). Once all units of that side exit the trigger area, the score for that side should stop increasing. Then, when my timer runs out after 1 hour, "WestScore" and "EastScore" will be compared to determine which "win" trigger fires to end the mission.


Naturally, I believe that a basic "while-do" loop is required for a continually-increasing score, but I am at a loss as to how to actually implement one in the game.


Can a "while-do" loop be made entirely within my "Present" trigger, or do I need to write an .sqf file (I've never done this before)?

Additionally, how would I incorporate a pause within the loop to slow down its iterations (I see that there is no "sleep" command in OFP/CWA like there is in ArmA 3)?


So far, I've got everything working except for a mechanism to measure the amount of time that each side spends within the trigger area. Any guidance would be appreciated!



Share this post

Link to post
Share on other sites

Late reply here, but I don't want to leave this unanswered.

Anything that goes beyond basic "kill them all" objectives are best not done only with the out of the box triggers available in the editor but with scripts. In Ofp/CWA scripts usually refer to files of type .sqs whereas .sqf refers to functions which can return a value and should only run for small tasks which can be executed in a relatively short time (this is a little different in Arma and later games).


So in your case I suggest to put a trigger in the editor with Activation=anybody;Present; Repeatedly and give it a name, e. g. trigger_1

Then from wherever you deem appropriate (e. g. from the init.sqs script) you can run a script which constantly checks who is in the trigger so that you can calculate scores:


_delay = 1
? !_condition : goto "endWHILE"
    _units = list trigger_1
    ; _units now is an array of all units which are inside the trigger area of the trigger you named trigger_1 in the editor
    ; do whatever calculations you need in here...
~ _delay
goto "WHILE"


Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this