Jump to content

SWAPR - SWeet Automatic Player Replacement script


Hardcard

Recommended Posts

Attached are the logs and missions for two TF51s sitting in parking at Kutaisi with an AM2 FARP.

 

 

The one that works as expected has the FARP quite a distance away.

 

 

The one that does not work has the FARP at the "elbow" of the parking area - something like 80m away from the aircraft.

 

 

The one that works... well works.

 

 

The one that does not work makes SWAPR not work effectively. You can still choose/use the slots but you can't see the other aircraft when in the cockpit and from the spectators view you can't see either plane.

 

 

I took a look at the log files - nothing really interesting in there but I don't know what I'm looking for so...

 

 

Here's the link to the mod so you don't have to go hunting for it:

 

 

https://forums.eagle.ru/showpost.php?p=4328283&postcount=8

 

 

Let me know if there is anything else you need/want.

 

 

 

Thanks!

swapr_farp_issue_demo_works.miz

swapr_farp_issue_demo_no_swapr.miz

dcs_swapr_farp_issue_demo_works.log

dcsswapr_farp_issue_demo_no_swapr.log

Link to comment
Share on other sites

  • 2 weeks later...

I was trying to implement SWAPR in a new mission and ran into the following error:

Mission script error: [string "Scripts/Moose/Wrapper/Airbase.lua"]:515: attempt to index local 'DCSAirbase' (a nil value)

 

Since this was coming from Moose, I loaded the sample mission that comes in the SWAPR_1_3 download. After testing it without any mods SWAPR worked correctly. I updated Moose within the test mission to the latest version in the Release branch. This caused the same error as I was seeing in my mission.

 

After more troubleshooting, I found a fix. Needed to modify lines 320, 322 and 324 in the SWAPR_1_3.lua, changing "GetClosestAirbase(Airbase.Category.AIRDROME)" to "GetClosestAirbase2(Airbase.Category.AIRDROME)". This change allowed SWAPR to work again for me. Something must have changed in the latest updates to Moose.

  • Thanks 1
Link to comment
Share on other sites

Very simple test mission. Single player. Set to AI, and I know it's working because the aircraft starts with a pilot in the cockpit (when static the cockpit is empty).

 

AI spawns and sits there forever isntead of taking off.

 

mission and dcs.log included.

SWAPR test.zip

P-51D | Fw 190D-9 | Bf 109K-4 | Spitfire Mk IX | P-47D | WW2 assets pack | F-86 | Mig-15 | Mig-21 | Mirage 2000C | A-10C II | F-5E | F-16 | F/A-18 | Ka-50 | Combined Arms | FC3 | Nevada | Normandy | Straight of Hormuz | Syria

Link to comment
Share on other sites

Very simple test mission. Single player. Set to AI, and I know it's working because the aircraft starts with a pilot in the cockpit (when static the cockpit is empty).

 

AI spawns and sits there forever isntead of taking off.

 

mission and dcs.log included.

 

They are supposed to sit there forever until that spot is used by a client, then the client spawns and takes control.

 

What Swapr does is place planes in the spots (client slots) you define, in order to populate airfields with planes in the parking spots. They don't move. The AI setting lets the model "inherit" loadouts and settings like "hidden".

 

 

If you want them to take off and perform tasks, you have to set them as AI with specific task in ME... but then they are no longer client spots. Or use MOOSE AI_Balancer module (https://flightcontrol-master.github.io/MOOSE_DOCS/Documentation/AI.AI_Balancer.html), I haven't used this module but it is supposed to use free client spots for AI that performs tasks (move), not sure if it works on single player though.


Edited by pacastro
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hi, Got pointed to this script from the MOOSE Discord, and it is great for what I need. Thanks. 

 

I do have a question though. When I spawn into a Client slot on a multi-client group, the AI "Wingman" disappears. e.g. the Client taking the slot prevents any AI in the group. Am I missing something or is that the intended function?

 

If it is the intended function, may I feature request to have AI "Wingman" remain in the group. 

 

Thanks.

Azza.

Link to comment
Share on other sites

  • 2 weeks later...

@mboddicker

 

Nice detective work there. 

 

Yes, you're probably correct, I haven't updated SWAPR to be compatible with the latest MOOSE builds yet. 

 

I might do it one of these days, when I feel like torturing myself some more 😅

 

 

@gavagai

 

What @pacastro said.

 

 

 

@Fankmaster

 

By not using the prefix/suffix of clients you don't want SWAPR to replace.

 

 

 

@Azza276

 

I'd avoid multi-client groups, stick to one client per group only.  

 

As for AI wingmen within client groups, I seem to remember that SWAPR automatically removes AI replacements for the specific client spawned (and respawns them if needed).   

 

I'll look into it when I decide to update SWAPR (if I feel like torturing myself again, like I said), but don't hold your breath.

 

 

 

@All

 

Sorry for the late replies, I'm not as interested in scripting/DCS as I used to be, so I barely check the forum these days.

 

Happy new year, btw.

 

 

Link to comment
Share on other sites

  • 2 months later...

Hey there. Just set up my mission with your script and I love it. Airports feel so alive!
Any news for updates to be compatible with the latest MOOSE builds? Cause I use some new functions from the latest Moose=)
Thanks!

Link to comment
Share on other sites

On 9/12/2020 at 11:35 PM, mboddicker said:

After more troubleshooting, I found a fix. Needed to modify lines 320, 322 and 324 in the SWAPR_1_3.lua, changing "GetClosestAirbase(Airbase.Category.AIRDROME)" to "GetClosestAirbase2(Airbase.Category.AIRDROME)". This change allowed SWAPR to work again for me. Something must have changed in the latest updates to Moose.

Oh basically this fix is working with the new dev build of MOOSE

Thanks!


Edited by Nox K.
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

@Mav87th

Thanks, I'll take a look. 

You didn't include your dcs.log in the zip file, please provide it as well.

It's located in C:\Users\YourUserName\Saved Games\DCS.openbeta\Logs

 

 

 

EDIT: In any case, I think I've found the problems in your mission:

 

1- "Game_Mode" option is set to "MP" instead of "SP".   If you want to use SWAPR in a single player environment, this option must be set to "SP"

 

 

2- You (or somebody) changed the line  _SETTINGS:SetPlayerMenuOff() (correct syntax)  to  _SETTINGS:SetPlayerMenuOFF() (incorrect syntax)

 

This change generated a scripting error that prevented SWAPR from running.

 

 

I'll need to update SWAPR anyway, since the MOOSE team changed the method used to find airbases, which SWAPR relies on.


Edited by Hardcard
  • Like 1
Link to comment
Share on other sites

@Anyone Interested

 

After days of tweaking and testing, SWAPR 1.4 is finally out!  Main post updated with new videos and links (old videos and links removed)

 

  • 04-05-2021

    • SWAPR 1.4 released!
      • Updated for DCS 2.7
      • Updated for MOOSE 2.7.1
      • Reintroduced replacement offsets for clients without parking spot
      • Other minor changes

Edited by Hardcard
  • Thanks 3
Link to comment
Share on other sites

I'm glad to see that you have continously improved and updated this Script, I'm no longer editing MP missions, but I enjoyed using your script back when I was still doing MP ... nowadays I enjoy DCS more when flying by myself 🙄 .. maybe an age thing 🙂

  • Like 1

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

On 5/4/2021 at 11:16 PM, Hardcard said:

@Anyone Interested

 

After days of tweaking and testing, SWAPR 1.4 is finally out!  Main post updated with new videos and links (old videos and links removed)

 

  • 04-05-2021

    • SWAPR 1.4 released!
      • Updated for DCS 2.7
      • Updated for MOOSE 2.7.1
      • Reintroduced replacement offsets for clients without parking spot
      • Other minor changes

 

It was driving me nuts that i could not get it to work with my simple mission with 4 jets in a flight. Everything was like in your demo mission. I even went and added my four jets in your mission to see if that helped, but it did not. Only the one i spawned in were spawned....

 

That's when it hit me......my aircrafts are in a flight...

 

Apparently it does not work if you have say 2 planes in the same flight (like 2 of 2) only if you place the two planes as two single flights.

 

Lesson learned 😄

 

best regards

Mav

Link to comment
Share on other sites

@Mav87th

The mission file you included in "Mission and Logs" zip was using a modified SWAPR script with invalid syntax in line 19, that's why it didn't work, like I explained. 

 

After correcting that line, I set "Game_Mode" to "SP" and tested in a single player environment, seemed to work fine, even with 4 clients in the same group (which I don't recommend).

 


I tested the same mission with SWAPR 1.4 and noticed some weird behavior:

 

1- First client in the group eventually gets replaced by an AI with the engines running. Also, when jumping back to that slot, the client starts hot, even though it's set to cold start in ME.


This is probably a DCS issue, since SWAPR doesn't force replacements to start hot (it actually does the opposite), also, it can't change the settings of the original clients in ME, it  can only influence their replacements.

 

 

2- The third client in the group is ignored at first (doesn't get the initial replacement used for heading capture), but it does get the actual replacement in the end.

     

I honestly don't know what's going on with that, but it might be linked to having several clients in the same group.

 

 

3- I experienced a couple of abnormal spawns that led to access violations (ie DCS crashes). 

 

This might also be linked to having several clients in the same group, or having some of them in sheltered parking spots and the rest in open parking spots...

 

In any case, I noticed something else in your mission that can potentially cause problems, the group name has a dash in it "Toxic-2".

As a general rule, avoid using Lua characters in group and client names, since it might lead to problems and crashes.

Like I explained in the main post:

  • To be on the safe side, avoid using any of the following characters in either group or unit names
    ( ) [] {} / | # , . ` ´ ' % + - ~ = * ¿? ¡! ¨ ^ $ € @
     

    Underscores are fine, you can use as many as you want.

 

Yes, I know that Mission Editor automatically adds dashes to group and client names, but it doesn't generate replacements like SWAPR does, so it's better to be cautious. 

 

 

Anyway, despite these problems, SWAPR 1.4 seems to work fine with your test mission, even when you have 4 clients in the same group (which, again, I don't recommend)


Edited by Hardcard
Link to comment
Share on other sites

  • 4 weeks later...

seams there are some issues with ground starts at airbases. most of my AC do not spawn unless set to ramp. hornets spawn Ai instead of statics in this instance and are facing the wrong direction. i have been doing my testing on the caucasus map. has anyone else experienced this.

 

 

Link to comment
Share on other sites

I recently (last thursday?) played around with the swapper script (nice!!!), and did not run into any issues. I did notice (i think it was mentioned in the docs) that you need to set up a plane for each side and enter the game via spectator, else there are some bad side effects. 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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