Jump to content

StopGaps - Script to fill empty player slots with planes


cfrag

Recommended Posts

3 minutes ago, Ic3DevilDog said:

This plus I've considered putting an option to create a "controller slot" where you can designate a specific group with an F10 menu to toggle the stopgap on and off live while the miz is running.

There are no boundaries to overstep here, stopGap is for everyone 🙂

The DML version supports turning stopGap on/off via flags, and it allows you to place trigger zones to exclude all aircraft inside those zones (I dislike name schemes, visual trigger zones are much more mission designer friendly). Personally, I like that stopGaps is simple to use and am hesitant to introduce too many customization options that users must learn and hand-edit. In DML I can take advantage of its immense zone management lifting ability, so  mission designers can edit zone attributes to change stopGaps behavior, instead of having to edit a script. That way "DML stopGap" is much more flexible, yet even easier to use for mission designers than this standalone version. 

 

  • Like 2
Link to comment
Share on other sites

3 hours ago, SteelPig said:

Where can I find the hooks folder to put the lua in?

It should be in 

(main DCS save folder)/Scripts/Hooks/

Your main DCS save folder is very often 

(PC)/C:/Users/<username>/Saved Games/DCS/

Cheers,

-ch

 

  • Like 1
Link to comment
Share on other sites

New companion module "sittingDucks"

I've added the "sittingDucks" companion module (by request from @Panthir) that allows for interesting new multiplayer options: when a static stand-in is destroyed, the associated player slot is closed. This means that players must defend their airfields against enemy attacks lest they lose access to their aircraft. And it allows players to attack enemy bases to deny players of that side access to their planes. 

Enjoy,

-ch

 


Edited by cfrag
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Very cool!

There so many neat ideas in the community. I wonder if ED ever considers to add some of those awesome features in the core. Or at least I'm curious what's stopping them.

  • Like 3

"Muß ich denn jedes Mal, wenn ich sauge oder saugblase den Schlauchstecker in die Schlauchnut schieben?"

Link to comment
Share on other sites


I love coming across these kind of threads. Seeing something created, often at great length for no other reason than to make DCS better for everyone. Then to see people chipping in to add or help fix different bits and basically make everybodys DCS time better.

As for this, I’ve only scratched the surface with the ME so haven’t even used any scripts or triggers yet. I’ve already spent hours on end and can only imagine what time and effort this will save people. This looks like something ED should be protecting, or paying you for. Protecting from the update malfunctions I mean.

Hats off to cfrag and all the contributors. What a tool to have in the box.

  • Like 1
Link to comment
Share on other sites

On 5/26/2023 at 4:22 AM, Hiob said:

Very cool!

There so many neat ideas in the community. I wonder if ED ever considers to add some of those awesome features in the core. Or at least I'm curious what's stopping them.

Someone sure has a sense of humor haha

Link to comment
Share on other sites

  • 2 weeks later...

Good afternoon! Tell me, how can I make your script work when playing a track recording? We flew a small company on our server, the mission included your StopGaps script, it worked fine during the server operation, but when playing the track recording of these flights, it is played incorrectly: static helicopters are not deactivated, and client slots are not activated. Accordingly, nothing happens on the record and it is impossible to view flights. How can this be fixed?

Link to comment
Share on other sites

 

3 hours ago, Ру19300 said:

how can I make your script work when playing a track recording?

Tracks in DCS are notorious for not working. Unfortunately, I do not know which events are invoked and what interacts with a recorded multiplayer game. 

Link to comment
Share on other sites

Loving this so far. Am having an issue getting statics to not show up before airfield is captured. As in there are apaches on the russian airfield before its nato's airdrome. Is this possible to prevent? Am I doing it wrong or am I dealing with a limitation with how it tracks asset location?


Edited by Server God
Link to comment
Share on other sites

6 hours ago, Server God said:

Am having an issue getting statics to not show up before airfield is captured. As in there are apaches on the russian airfield before its nato's airdrome. Is this possible to prevent?

If I read you correctly, you have created a mission where an airfield holds both blue and red units in ME, and you want one side's stand-ins to only show up when the airfield is owned by that side. Is that correct?

If so, you need two different scripts to accomplish these different tasks:

  • StopGap (this thread) to make the static stand-ins for slots show up on airfields. StopGap will not show aircraft for those slots that are blocked, so we also need
  • a script to block slots when the airfield is occupied by a different coalition. ssbClient is such a script, and together they work like a charm, even in single-player (although the slots may not be blocked in SP because, well, SP, the information is there, and stopGap has all it needs to know. This (Catch & Keep) is a mission that uses both ssbClient and stopGap to create exactly that effect.

Does this resolve your issue?


Edited by cfrag
Link to comment
Share on other sites

Update 20230618

After running into some issues with stopGap and helicopters on the Sinai map in single-player mode (issues which did not surface in multi-player), I've added a new '-sp' option to selectively exclude an aircraft from stopGap in single-player mode only. stopGap can now detect if it is running in single- or multi-player and self-adjust accordingly. This requires that the new 1.0.1 version of stopGapGUI is installed that provides this information to all clients. If your server hosts an older stopGapGUI version, aircraft marked with '-sp' act as if they are marked '-sg': they will remain hidden, so stopGap is fully backward compatible with older versions of stopGapGUI.

Changes in Detail

  • New '-sp' option (stopGap)
  • Set 'stopGapGUI' flag on server in multi-player (stopGapGUI)
  • Now hosted on ED's user files

 


Edited by cfrag
Link to comment
Share on other sites

  • 4 weeks later...

Salute for a fantastic "tweak" to DCS.

I am getting the attached error each time I try to start a server using my own machine as the host.

Any advise please as to what is causing it?

My install is on the F: drive. The lua file it reports to seems to be the script file for the server?

 

stopGapGUI = {}
stopGapGUI.version = "1.0.1"
stopGapGUI.fVal = -300 -- 5 minutes max block
--
-- Server Plug-In for StopGap mission script, only required for server
-- Put into (main DCS save folder)/Scripts/Hooks/ and restart DCS
--
function stopGapGUI.onPlayerTryChangeSlot(playerID, side, slotID)
    if not slotID then return end 
    if slotID == "" then return end 
    if not DCS.isServer() then return end 
    if not DCS.isMultiplayer() then return end 

    local gName = DCS.getUnitProperty(slotID, DCS.UNIT_GROUPNAME)
    if not gName then return end 
    local sgName = "SG" .. gName 
    -- tell all clients to remove this group's statics if they are deployed
    net.dostring_in("server", " trigger.action.setUserFlag(\""..sgName.."\", " .. stopGapGUI.fVal .. "); ")
    net.send_chat("+++SG: readying group <" .. sgName .. "> for slotting")
end   

 
function stopGapGUI.onSimulationStart( )
    net.dostring_in("server", " trigger.action.setUserFlag(\"stopGapGUI\", 0); ")
    if not DCS.isServer() then return end 
    if not DCS.isMultiplayer() then return end 
    net.dostring_in("server", " trigger.action.setUserFlag(\"stopGapGUI\", 200); ")
end

DCS.setUserCallbacks(stopGapGUI)

Stop-Gap Error.JPG


Edited by DD_Friar

Visit the Dangerdogz at www.dangerdogz.com. We are a group based on having fun (no command structure, no expectations of attendance, no formal skills required, that is not to say we can not get serious for special events, of which we have many). We play DCS and IL2 GBS. We have two groups one based in North America / Canada and one UK / Europe. Come check us out. 

Link to comment
Share on other sites

1 hour ago, DD_Friar said:

I am getting the attached error each time I try to start a server using my own machine as the host.

It looks as if you are trying to run the stopGapGUI from within the mission. That will not work because it accesses the 'DCS' methods which are walled off from the mission context and are only accessible to the server. 

Have you tried to put the stopGapGUI lua into the server Hooks directory (requires a re-start of DCS to take effect)

Cheers,

-ch

Link to comment
Share on other sites

Ah yes I have. I suspect that this is a case of a little knowledge is a dangerous thing..

So, do scripts in the Hooks directory get run automatically? I do not need to run it? When you said if you are getting errors in multiplayer you run the Gui script, I assumed that is what I had to do. Putting it in the Hooks folder runs it?

Also have passed this to work when the server / host is running multi-thread?

Many thanks again.

Visit the Dangerdogz at www.dangerdogz.com. We are a group based on having fun (no command structure, no expectations of attendance, no formal skills required, that is not to say we can not get serious for special events, of which we have many). We play DCS and IL2 GBS. We have two groups one based in North America / Canada and one UK / Europe. Come check us out. 

Link to comment
Share on other sites

Any script in the Hooks folder is run when DCS starts up, and they are run in the server / GUI space (for all intents and purposes they run in the background of the server thread). This holds also true for stand-alone.

  • Thanks 1
Link to comment
Share on other sites

 

10 hours ago, aphill said:

Not sure if it is me or not. 

Unfortunately, that mission is using the WWII pack, and I can't open it.

 

[EDIT: I removed the dependencies and managed to open the miz. see below 🙂 ]


Edited by cfrag
Link to comment
Share on other sites

Some preliminary analysis may indicate a possible culprit:

You have four separate "MISSION START" triggers, where the third and fourth have a dependency: you are assuming that the third start trigger (set ship ID for deck population) executes before the fourth (populate decks). 

image.png

In a Multithreaded environment (to be honest, also in a single-threaded, but it would be less susceptible to this) you have a race condition between the third and fourth trigger. It can be assumed that in some 50% of the cases, the third trigger executes AFTER the fourth. Since when this happens shipID is nil, the code to populate the deck can fail hard because you are passing an invalid unit ID to linkUnit. 

One way to resolve this is to make sure that the code for trigger 3 executes before trigger 4 by packing both into the same action and thereby ensure their sequence:

image.png

I've slightly modified your mission (see below), it may work now. I recommend that you fully resolve the multiple race conditions between the start triggers. In this version of your mission, mist appears not to be required at all, but I assume that this is merely because you kindly removed all other scripts that require it for more clarity.

The good news: stopGap appears not to be the culprit.

 

Eagle familiarization Persian Gulf MULTI P mod.miz


Edited by cfrag
Link to comment
Share on other sites

Hello,
Thanks for this very interesting script idea 🙂

But I think there's a problem when you use hot choppers on the ground on something other than a runway
they spawn a few meters from the ground and fall as soon as you enter the cockpit

DIV_SIN_helico-famille.miz


Edited by Kervinou
add file

System specs: Win10 x64 | i7-9700KF / i9-12900KF | 48/64 GB | GTX 1080 Ti 11 GB / RTX 3090TI 24GB | *NvME PRO 2To | HOTAS Warthog/Virpil | MFG Crosswind Pedals | Button Box

Link to comment
Share on other sites

  • Recently Browsing   0 members

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