Jump to content

Mission Editor question: Can someone please define "Flags'?


Recommended Posts

Posted

I'm learning the Mission Editor using the Flaming Cliffs 2 Editor manual and the new AI supplement in the Beta 2 docs folder. I understand most of the concepts (triggers, conditions, actions) but the one concept that seems to lack an explanation is "flags". Can someone help me out? Many thanks.

Posted

They are basically TRUE/FALSE variables.

 

Create a zone. Make a trigger that sets FLAG 1 to TRUE when a unit enters the zone. Then have a second trigger which checks for FLAG 1 to be set, then does something.

 

It's a little confusing having to keep track of what each flag number means, trying to remember that flag 1 was your 'in the zone' flag and flag 3 was 'such and such unit destroyed' but you can name your Triggers with the flag they use or set to help keep track.

  • Like 1
Posted

Great info, many thanks, just one probably dopey follow up: why would I use a flag to trigger an action when the trigger itself can perform this task? Would you mind giving me an example? Thanks again.

Posted (edited)

You can also use them for conditional AI tasks based on true/false state of the flag.

 

There was a discussion on how to do that here:

 

http://forums.eagle.ru/showthread.php?t=60639.

 

You can use it for example to give artillery the ability to cover multiple fire zones or let AI aircraft break from orbits and attack specific user input targets.

Edited by Geskes

I7920/12GBDDR3/ASUS P6T DELUXE V2/MSI GTX 960 GAMING 4G /WIN 10 Ultimate/TM HOTAS WARTHOG

Posted
let AI aircraft break from orbits and attack specific user input targets.

That sounds interesting. By "user input targets" do you mean targets designated by the user (player) in-flight, or by the mission designer? If the latter, I need to do some research, as I know the targeting system has changed since BS/LOMAC.

Posted
Great info, many thanks, just one probably dopey follow up: why would I use a flag to trigger an action when the trigger itself can perform this task? Would you mind giving me an example? Thanks again.

 

Think of flags as a way to store information for a later time. They can also be used as a poor mans programming language to achieve results which are not normally possible. For instance I used flags in FC2 to create "completition percentage bar" incremented at 5% at each interval. The time interval itself was selected and chosen via the status of multiple flags, which were determined by the number of players inside a zone. I even defined specific conditions for whether a player was "counted" as in the zone, basically they had to maintain a specific altitude altitude. Since the objective was to maintain a CAP over the zone I needed a condition to exclude players who had landed inside the zone or who were flying to low to be efficient at the CAP.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • 6 years later...
Posted (edited)

*edit* i found the thread by search and noticed just now, that it is in the wrong section. sorry! should probably be in the mission editing section.

 

hello,

i still do not get the nuances of setting a flag true or false (set flag on/off) and giving different values to flags.

 

I was trying to order AI around with 3 different tasks set by the f10-menu.

first i created three f-10 entrys: the first would set flag 1 to 1, the second would set 1 to 2 and the third entry would set flag 1 to 3.

than i created 3 tasks on the unit (escort "a", escort "b", "switch waypoint"), and made 3 triggers, each pushing a task depending on the state of flag 1.

 

i discovered though, that for the unit to stop their escort task, "switch waypoint" was not "strong enough", so i needed to stop the escort task, before setting the "switch" task. in the stop condition for "escort" however, i could only choose "user flag x IS yes/no". i would have expected sth. like "user flag x is y".

 

is a user flag set to 0, the same as setting it to "off" and why can i set a user flag #0 and higher and in the other case i can set user flag only from #1 and higher.

 

could someone explain, why there are these two approaches and if say can be used together or should be used exclsively.

 

thanks:)

Edited by twistking

My improved* wishlist after a decade with DCS ⭐⭐⭐⭐🌟

*now with 17% more wishes compared to the original

Posted (edited)

Bahger, please take some time to look at the Mission Editor Resources page on my site, see the WC's Flags document. The first question I asked here was "How do flags work?"

 

 

---edit ooops that's an old post

Edited by Wrecking Crew

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Posted (edited)
... i could only choose "user flag x IS yes/no". i would have expected sth. like "user flag x is y".

.

.

.

could someone explain, why there are these two approaches and if say can be used together or should be used exclsively.

 

thanks:)

 

The Is User Flag is looking for a True/False return.

 

You can certainly increment flag values and test for the values in subsequent events, or use separate flags for just a True/False determination. It is totally up to you.

 

 

From the WC's Flags.txt -- with this you can test for a value other than 1. 1 is True; 0 is False.

 

===

The 'Is User' flags are limited to less than five digits.  This script can be used for five digit flags within Advanced Waypoint Actions:
--- Stop Condition when a flag is true
if trigger.misc.getUserFlag(58104) == 1 then 
return true
end

===

Edited by Wrecking Crew

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...