Jump to content

Is there a way to set a flag in the waypoint advanced menu?


Recommended Posts

I was wondering if there was a way to set a flag for a waypoint. Im not to familiar with the trigger function for advanced waypoint options, but is there a way to trigger a flag once an AI plane passes over a waypoint without adding a trigger zone in the ME.

Ryzen9 5800X3D, Gigabyte Aorus X570 Elite, 32Gb Gskill Trident DDR4 3600 CL16, Samsung 990 Pr0 1Tb Nvme Gen4, Evo860 1Tb 2.5 SSD and Team 1Tb 2.5 SSD, MSI Suprim X RTX4090 , Corsair h115i Platinum AIO, NZXT H710i case, Seasonic Focus 850W psu, Gigabyte Aorus AD27QHD Gsync 1ms IPS 2k monitor 144Mhz, Track ir4, VKB Gunfighter Ultimate w/extension, Virpil T50 CM3 Throttle, Saitek terrible pedals, RiftS

 

Link to comment
Share on other sites

Via lua scripts probably. Even then it is likely that the script requires area coordinates to execute properly.

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

Link to comment
Share on other sites

Thanks for the reply Grimes. I'm just trying figure out the best way to deactivate AI flights after they've flown their sorties without having to put up different trigger zones around the waypoint.. This is what i ended up doing unless there is a better way, but i just thought i could set a flag on by passing through a waypoint and go from there.

Ryzen9 5800X3D, Gigabyte Aorus X570 Elite, 32Gb Gskill Trident DDR4 3600 CL16, Samsung 990 Pr0 1Tb Nvme Gen4, Evo860 1Tb 2.5 SSD and Team 1Tb 2.5 SSD, MSI Suprim X RTX4090 , Corsair h115i Platinum AIO, NZXT H710i case, Seasonic Focus 850W psu, Gigabyte Aorus AD27QHD Gsync 1ms IPS 2k monitor 144Mhz, Track ir4, VKB Gunfighter Ultimate w/extension, Virpil T50 CM3 Throttle, Saitek terrible pedals, RiftS

 

Link to comment
Share on other sites

There are a few ways to do it. I liked setting up a triggerzone so that when they were on finals they would deactivate.

 

Could also do it based on speed. When a group spawns set flag X. In the deactivate trigger check "time since flag X is (however much time to get airborne) && Unit speed is less than 20 && unit speed.... > Deactivate group.

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

Link to comment
Share on other sites

There are a few ways to do it. I liked setting up a triggerzone so that when they were on finals they would deactivate.

 

Could also do it based on speed. When a group spawns set flag X. In the deactivate trigger check "time since flag X is (however much time to get airborne) && Unit speed is less than 20 && unit speed.... > Deactivate group.

 

I tried the flag approach with no luck. I'm pretty sure I followed your scheme:

 

Once > group alive (SEAD) > Flag On (10)

 

Once > Time since Flag (10,8000) and Unit speed less than (40knts) > Group deactivate (SEAD)

 

I was assuming since once the editor checked that group alive at spawn it turned on flag 10, then once the condition that the flag was true for 8000 seconds and the unites speed was reduced to less than 40m/s after they landed they would deactivate. They didn't deactivate. Not sure what I did wrong, but I definetly like this approach if i can get it to work.

Ryzen9 5800X3D, Gigabyte Aorus X570 Elite, 32Gb Gskill Trident DDR4 3600 CL16, Samsung 990 Pr0 1Tb Nvme Gen4, Evo860 1Tb 2.5 SSD and Team 1Tb 2.5 SSD, MSI Suprim X RTX4090 , Corsair h115i Platinum AIO, NZXT H710i case, Seasonic Focus 850W psu, Gigabyte Aorus AD27QHD Gsync 1ms IPS 2k monitor 144Mhz, Track ir4, VKB Gunfighter Ultimate w/extension, Virpil T50 CM3 Throttle, Saitek terrible pedals, RiftS

 

Link to comment
Share on other sites

Attach a message to it to verify the first trigger executed.

 

I would set up that first trigger 1 of 2 ways.

 

A. If they are trigger spawned. Once> The condition> Activate Group, Flag 10 On

 

B. If they are alive at the start or a pre-defined time. Once> Time more than 1 second> Flag 10 On

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

Link to comment
Share on other sites

Stand by for some stupid-hard lua scripting advice... according to most people, you need a college PHD to understand this, so maybe on second thought, don't bother ;)

 

What you want to do, set a flag at a certain waypoint, involves the incredibly difficult step of adding a whopping 1 lines of lua code, of this ridiculously over-complicated form:

trigger.setUserFlag(<flag number>, true)

 

You have to make an extremely tough and time consuming change of making <flag number> the number of the flag you want to set. Like 1. Or 100. Or 10000.

 

Next in the huge long list of things you have to do to make this work is to make a waypoint action, at the waypoint you want it to happen at, of type COMMAND-> RUN SCRIPT. Overflow your memory by copying and pasting this endless script in the text window of the RUN SCRIPT command with the <flag number> set to the value of the flag you want to set, like:

 

trigger.setUserFlag(1, true)

 

One could also do another mind-blowingly-difficult-to-comprehend task, of clearing a flag, for example flag 1, at a certain waypoint by making a waypoint action of type COMMAND-> RUN SCRIPT with the following script:

 

trigger.setUserFlag(1, false)

 

If you are able to figure this out and get it in your mission, then you need to get back to publishing your Unified Fields Theory so that everyone else can benefit from your incredibly vast intellect.

 

:D


Edited by Speed

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

homer-doh-square.jpg

 

For some reason I completely forgot that do command> scripts were part of waypoint actions and could only be accessible via conditions.

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

Link to comment
Share on other sites

Thanks Grimes and Speed for the advice. I assigned the flag to the waypoint as per Speeds instructions and it worked like a charm. Thanks again.

Ryzen9 5800X3D, Gigabyte Aorus X570 Elite, 32Gb Gskill Trident DDR4 3600 CL16, Samsung 990 Pr0 1Tb Nvme Gen4, Evo860 1Tb 2.5 SSD and Team 1Tb 2.5 SSD, MSI Suprim X RTX4090 , Corsair h115i Platinum AIO, NZXT H710i case, Seasonic Focus 850W psu, Gigabyte Aorus AD27QHD Gsync 1ms IPS 2k monitor 144Mhz, Track ir4, VKB Gunfighter Ultimate w/extension, Virpil T50 CM3 Throttle, Saitek terrible pedals, RiftS

 

Link to comment
Share on other sites

  • 3 weeks later...

@Speed: what Lua script could I use if I wanted an IF Flag True condition to switch something in the Advanced>Perform Command>Conditions field. For example, say I had an immortal unit and I wanted to change its immortality state to False when Flag X was true?

[sIGPIC][/sIGPIC]

"Great minds think alike; idiots seldom differ.":pilotfly:

i5 3750K@4.3Ghz, MSI Z77A GD55, 8GB DDR3, Palit GTX 670, 24" Benq@1920*1080, X52 Pro, Win 7 64bit.

Link to comment
Share on other sites

@Speed: what Lua script could I use if I wanted an IF Flag True condition to switch something in the Advanced>Perform Command>Conditions field. For example, say I had an immortal unit and I wanted to change its immortality state to False when Flag X was true?

 

Bump. Anyone? I want to make a units ROE change when another unit enters a zone.

[sIGPIC][/sIGPIC]

"Great minds think alike; idiots seldom differ.":pilotfly:

i5 3750K@4.3Ghz, MSI Z77A GD55, 8GB DDR3, Palit GTX 670, 24" Benq@1920*1080, X52 Pro, Win 7 64bit.

Link to comment
Share on other sites

Stand by for some stupid-hard lua scripting advice...

 

.....dosn´t work here:noexpression:

 

I put an A-10 in the Air with 3 Waypoints:

WP 1 - Advanced Waypoint Actions - Perform Command - Run Script - "trigger.setUserFlag(1, true)"

WP 2 - Advanced Waypoint Actions - Perform Command - Run Script - "trigger.setUserFlag(1, false)"

Trigger Menu: Once // Flag is true - 1 // Message "Flag 1 on"

 

Fly over WP 1 and then.....nothing..... :(

 

some Idea?:pilotfly:


Edited by WRFirefox
Link to comment
Share on other sites

  • 2 weeks later...

Ok, sorry for the late reply. I have been away from A-10 due to computer problems, work, AND school.

 

Anyway,

 

trigger.setUserFlag(1, true)

 

works. I've used it many times.

 

Make sure that is in the text field, and not in quotes. DO NOT put that script in the title field of the script. Name the script "Set flag 1 true" or something.

 

Ok, additionally, I believe ONLY AI will trigger this to happen.

 

So in summary:

 

Make sure you put it in the text field of the script, not the title field

 

Make sure the script is not in quote marks.

 

Make sure the unit that has the script in its waypoints is an AI unit. Human units will probably not make the script run.

 

If you want the script to execute for a human player, you need will probably need to follow these steps:

 

1) Make a separate unit, name him something like "scriptman". Place him in the corner of the map,out of the way of all the action.

 

2) Make a TRIGGERED ACTION for him, NOT A WAYPOINT ACTION. Set the Action type to COMMAND, and the command type to RUN SCRIPT. Name the triggered action "Set flag 1".

 

3) Insert the script:

trigger.setUserFlag(1, true)

into the text field.

 

4) Create a trigger zone at the location where you want the waypoint the human player to fly through and trigger the flag to go on to be.

 

5) Create a UNIT IN ZONE type trigger, make the unit the human player, and the zone the zone you just created. Make the action an AI TASK, and make it run the script you just created for "scriptman". You're done.

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

@Speed: what Lua script could I use if I wanted an IF Flag True condition to switch something in the Advanced>Perform Command>Conditions field. For example, say I had an immortal unit and I wanted to change its immortality state to False when Flag X was true?

 

Sorry for missing this. In the future, you can give me a private message and I will see it.

 

You do this with the TRIGGERED ACTIONS tab. Make a triggered action that sets immortality to false. You can then run a triggered action through the trigger action called AI TASK.

 

This could all be done through lua too, but in this case, it's more simple to do it through the mission editor.

 

Note on terms:

Trigger = a trigger, created by hitting the "Trigger rules" (switch icon) on the left-hand side of the ME.

 

Triggered Action = an action that can be called by a trigger, you create these for specific units by clicking on the triggered action tab (beside the waypoint tab and the armament tab) on the right hand-side of the mission editor, when you have a unit selected.

 

Trigger Action = the action that a trigger does, set through the "Trigger rules" (switch icon) on the left-hand side of the ME. Examples are SET FLAG, MESSAGE TO ALL, AI TASK.


Edited by Speed
  • Like 1

Intelligent discourse can only begin with the honest admission of your own fallibility.

Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/

Lua scripts and mods:

MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616

Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979

Now includes remote server administration tools for kicking, banning, loading missions, etc.

Link to comment
Share on other sites

Thank you Speed, I'm going to give it a go now.

 

Update: worked a treat.:D

 

One must wonder why this gold isn't in the user manual...:music_whistling::megalol:


Edited by McVittees

[sIGPIC][/sIGPIC]

"Great minds think alike; idiots seldom differ.":pilotfly:

i5 3750K@4.3Ghz, MSI Z77A GD55, 8GB DDR3, Palit GTX 670, 24" Benq@1920*1080, X52 Pro, Win 7 64bit.

Link to comment
Share on other sites

  • 7 years later...
Stand by for some stupid-hard lua scripting advice... according to most people, you need a college PHD to understand this, so maybe on second thought, don't bother ;)

 

What you want to do, set a flag at a certain waypoint, involves the incredibly difficult step of adding a whopping 1 lines of lua code, of this ridiculously over-complicated form:

trigger.setUserFlag(<flag number>, true)

 

You have to make an extremely tough and time consuming change of making <flag number> the number of the flag you want to set. Like 1. Or 100. Or 10000.

 

Next in the huge long list of things you have to do to make this work is to make a waypoint action, at the waypoint you want it to happen at, of type COMMAND-> RUN SCRIPT. Overflow your memory by copying and pasting this endless script in the text window of the RUN SCRIPT command with the <flag number> set to the value of the flag you want to set, like:

 

trigger.setUserFlag(1, true)

 

One could also do another mind-blowingly-difficult-to-comprehend task, of clearing a flag, for example flag 1, at a certain waypoint by making a waypoint action of type COMMAND-> RUN SCRIPT with the following script:

 

trigger.setUserFlag(1, false)

 

If you are able to figure this out and get it in your mission, then you need to get back to publishing your Unified Fields Theory so that everyone else can benefit from your incredibly vast intellect.

 

:D

 

very nice :P

and btw: thanks for this post, I laughed my pants off!

Visit https://www.viggen.training
...Viggen... what more can you ask for?

my computer:
AMD Ryzen 5600G | NVIDIA GTX 1080 Ti OC 11GB | 32 GB 3200 MHz DDR4 DUAL | SSD 980 256 GB SYS + SSD 2TB DCS | TM Warthog Stick + Throttle + TPR | Rift CV1

 

Link to comment
Share on other sites

  • 4 months later...

Why don't you just use boolean or integer variables in Lua?

For any waypoint you can set "Perform Command"->"Run Script" and then define your global Lua variable there. Then for your triggers you can use a "LUA PREDICATE" condition and then enter a code like e.g.

return myboolvariable

or

return myintegervariable == 1

in the predicate box. So this is how your waypoints can start your trigger. As a trigger action you could also set a flag value, if you really want to work with flags for whatever reasons. But I find global variables much easier to work with.


Edited by Tiramisu
Link to comment
Share on other sites

  • 9 months later...
  • Recently Browsing   0 members

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