Jump to content

SWAPR - SWeet Automatic Player Replacement script


Hardcard

Recommended Posts

Can't use "Pilot" as prefix, since that encompasses pretty much all aircraft in the mission.

 

Ship-based clients and clients starting in the air are not supported by SWAPR, if you try to target them using the generic "Pilot" prefix, you'll experience problems.

 

I'm working on a new version of SWAPR, it should automatically ignore clients that start in the air (regardless of prefix). Initial testing has been successful so far, fingers crossed.

 

The harrier issue is quite baffling, though... I still have no idea of what's causing it.

 

Will need to review the spawn mechanic from SWAPR, but, for now, make those Sochi harriers start from ramp instead of the ground.

 

As for the KA50 pilots ejecting and the endlessly clicking hueys, that's due to SWAPR forcing them to start hot with no fuel, so the AI keeps trying to start the engine...

 

I could revert back to forcing static replacements for all choppers... but then they'd spawn half-buried in the ground...again :cry:

 

 

 

Perhaps I can come up with another workaround, we'll see. I'll keep you posted.


Edited by Hardcard
Link to comment
Share on other sites

It's ok. I can wait. That misdion was a quick test to transform a mission I currently use. That's why when I saw I have to rename 160 pilots name prefixes I got the idea of just using pilot as a prefix.

 

Ignoring the Airborne starts would make sense though.

 

By the way. Is it remotely possible to have a plane slot replaced not only by a static correspondent but also a group of static objects arranged in a certain pattern? Like having a refuel truck nearby or a ground APU and some technicians?

 

One more thing. Would it be possible to have an option that some prefixes have their corresponding AI or static placed few meters behind?

 

We can have now planes starting from the ground but it is necesarry to placed the very close to a road so they don't get stuck in the dirt. Ofcourse... When using your script on them they create obstacles on road with their noses so having those static placed actually a bit in the back would clear the path.

[sIGPIC][/sIGPIC]

I5 4670k, 32GB, GTX 1070, Thrustmaster TFRP, G940 Throttle extremely modded with Bodnar 0836X and Bu0836A,

Warthog Joystick with F-18 grip, Oculus Rift S - Almost all is made from gifts from friends, the most expensive parts at least

Link to comment
Share on other sites

@zaelu

 

Sure, it's possible to assign specific static templates to client replacements and spawn everything together.

 

It's also possible to add coordinate offsets to those templates, so everything spawns where you want it.

 

I've done this sort of stuff in the past (to spawn small base/outpost templates)... however, I foresee that adding such a mechanic to SWAPR would be a nightmare, given the problematic nature of scripted replacement spawning.

 

I mean, all those issues you reported above are just child's play when compared to the host of issues that such a feature would introduce.

 

Don't get me wrong, it's a nice idea that would allow mission creators to populate airbases / FARPs automatically (ground crews, equipment, etc)... but right now I don't want to bite off more than I can chew.

 

First I need to figure out this harrier/warbird nonsense (still baffled), then we'll see.


Edited by Hardcard
Link to comment
Share on other sites

@zaelu

 

I've continued working on the new SWAPR 1.3 version and I'm happy to say that all the problems you reported seem to be fixed now (fingers crossed).

 

 

There were some nasty issues in your mission, which took me a while to figure out:

  • Some clients were using duplicated unit names, Mission Editor seems to allow this if the units belong to different coalitions (yet another reason to name all clients properly).
  • There were a couple hidden harriers at Sochi, which explains why 4+ harriers were spawning, instead of just 2.
  • Those 2 harrier clients at Sochi were moving on their own because of the wind (I think). The problem disappeared when I positioned them perpendicularly.
  • Some of the airborne clients at Roma FARP (A-10C, viggen, etc.) required a waypoint type reset, since the mission code still had them set to "takeoff from ground hot"... really weird issue, first time I've encountered it.

 

 

I've attached a modified version of your mission, it uses the revised SWAPR 1.3 version. Test it thoroughly and report back, please.

 

It's set to run in MP, btw, if you want to test it in SP, you'll need to open SWAPR 1_3_1 and set Game_Mode to "SP".

 

I made some minor changes to the ME trigger order and delay (Moose.lua runs at mission start, SWAPR is loaded 3 seconds later, MIST is loaded 10 seconds later and so on).

 

You can now set clients to "takeoff from ground hot" (chopper replacements will still be forced to start cold), no more Ka-50 ejections, huey clicking or rotors turning.

Due to this change, chopper replacements might spawn half-buried in MP...we can't have it both ways, I'm afraid.

 

Airborne clients will be automatically ignored, you should be able to use "Pilot" prefix without issues (although I don't recommend it).

 

Make sure to wait at least 10 seconds before joining a client slot (plenty of stuff being loaded/running in the first 10-15 seconds, so give it time).

SWPR_MercInc Training Caucasus 2020 Mai No MODS No WW2 asst (test).miz


Edited by Hardcard
Link to comment
Share on other sites

Thanks, I will test it.

 

I also modified the mission to be more in line with swapr requirements and stopped all planes (made them cold). No more ejections but ww2 planes were still sliding so I removed them from swapr.

[sIGPIC][/sIGPIC]

I5 4670k, 32GB, GTX 1070, Thrustmaster TFRP, G940 Throttle extremely modded with Bodnar 0836X and Bu0836A,

Warthog Joystick with F-18 grip, Oculus Rift S - Almost all is made from gifts from friends, the most expensive parts at least

Link to comment
Share on other sites

I have tested, all problems seem gone besides the ww2 planes. I still can run smoothly the mission though due to performance.

 

Any difference in principle between static and AI planes in CPU load?

 

I have reattached the mission modified. I decided to rename all pilots to something different than pilots and I have a set that are disabled by not including their names in the list.

 

Could you force AI planes to have chokes on wheels? That would stop them from sliding I think.

SWPR_MercInc Training Caucasus 2020 Mai No MODS No WW2 asst.miz

[sIGPIC][/sIGPIC]

I5 4670k, 32GB, GTX 1070, Thrustmaster TFRP, G940 Throttle extremely modded with Bodnar 0836X and Bu0836A,

Warthog Joystick with F-18 grip, Oculus Rift S - Almost all is made from gifts from friends, the most expensive parts at least

Link to comment
Share on other sites

Any difference in principle between static and AI planes in CPU load?

 

I'm afraid not.

 

 

To improve perfomance a bit, you can disable sheltered replacements and reduce the total number of clients being replaced.

 

Could you force AI planes to have chokes on wheels? That would stop them from sliding I think.

 

I thought about that, but I don't know if it's possible.

 

Even if it were possible, I still wouldn't know how to do it.

 

 

See if I can come up with a fix... ;)

Link to comment
Share on other sites

@zaelu

 

I don't see any problems in the last mission file you provided, ww2 planes are sitting on their parking spots, like they should.

 

Where are you experiencing problems with ww2 planes? Is it another mission?

 

If so, please provide the problematic mission file, otherwise it's hard for me to troubleshoot.

Link to comment
Share on other sites

Hi, nice script you have created. Thanks for sharing!

 

I'm testing it on a multiplayer server, hoping the FPS impact won't be too much.

 

I'm having one problem with the Hidden_AI_Replacements option:

 

- I have working Swapr slots in the starting field, nothing else. I switched from Static to AI and it works.

- I tried to set the option Hidden_AI_Replacements = true, but nothing changes from false state, I can see all the AI slots in the F10 Map the same way for true or false. Is there something I'm missing somewhere?

 

 

Now, some suggestions:

 

- Can you make a delayed/lateRequested spawn/despawn of some replacements??

This would be great to spawn replacements for slots on a base once you capture it (it starts on red side, so no replacements are set for blue side on start but you do have late activated slots), and to despawn the replacements for slots of the other coalition once they loose the base.

 

 

Maybe multiple lists for multiple replacement activations during the mission?

 

- Can you add an option for when you select AI Replacements to have them spawn in Cold state, without pilot regardless of the unit starting state in ME??.

 

 

This helps when you have all client slots to start HOT, but you don't want all the swapr replacements be Hot too, but you still want them to be armed as set in ME.

 

Regards

 

Pablo

Link to comment
Share on other sites

@pacastro

 

Hidden_AI_Replacements option only works for AI replacements, not static replacements. This is explained in the video / OP / script comment

 

Sure, I can look into base capture mechanics, spawn only those replacements belonging to the coalition controlling the base.

Could be tricky to implement, though... we'll see.

 

The hot start issue is already solved in my development build, but it's still not ready for prime time.

 

As for pilots inside AI replacements, they only appear if the replacement is starting hot (unless it's a huey or harrier, I believe)

 

Finally, please always provide the mission file + dcs.log in your reports.


Edited by Hardcard
Link to comment
Share on other sites

I tested a bit more.

 

The ww2 planes from Sochi were not included in the script. I added them back (the pilots were Merc.Inc and only MercInc was included. for testing) and I observed the following two things:

 

1. Those set cold on ground were half dug in the ground or Sochi AB

2. After setting them all Hot on ground they were all wheels on ground but... those facing the wind were slowly blown away...

 

As you can see in 3rd picture the windsock is witness :)

 

Solution would be to turn those planse into wind also.

 

- I tried to set the option Hidden_AI_Replacements = true, but nothing changes from false state, I can see all the AI slots in the F10 Map the same way for true or false. Is there something I'm missing somewhere?

 

I have same thing visible on 2nd screenshot. I thought they are AI not static... must recheck.

 

 

I have reattached the new mission variant if you need it.

11111.thumb.jpg.40a12b4b279a45b20f6558ea0a5b561f.jpg

222222.thumb.jpg.6081df575bfa7a158cfad9852a4d4366.jpg

33333.thumb.jpg.0bc8e94c5e03f65198596772d218ac51.jpg

SWPR_MercInc Training Caucasus 2020 June No MODS No WW2 asst.miz


Edited by zaelu

[sIGPIC][/sIGPIC]

I5 4670k, 32GB, GTX 1070, Thrustmaster TFRP, G940 Throttle extremely modded with Bodnar 0836X and Bu0836A,

Warthog Joystick with F-18 grip, Oculus Rift S - Almost all is made from gifts from friends, the most expensive parts at least

Link to comment
Share on other sites

1. Those set cold on ground were half dug in the ground or Sochi AB

 

Told you... can't have it both ways until ED fixes this issue. Btw, I can't set them to "Takeoff from ground" or "Takeoff from ground hot" in ME... have you modified DCS files to be able to do that?

 

2. After setting them all Hot on ground they were all wheels on ground but... those facing the wind were slowly blown away...

 

I haven't found a way to force wheel chocks... it's either that, turn them perpendicular to/against the wind or force static replacements (but then they'd spawn half-buried as well, IIRC)

 

 

I have same thing visible on 2nd screenshot. I thought they are AI not static... must recheck.

 

 

  • The new attached mission has SWAPR set to static replacements, that's why Hidden_AI_Replacements isn't working.
     
  • Warbirds at Sochi are still set to start in air. (If you have modified DCS files to have "Takeoff from ground" available for those planes, let me know. Keep in mind that SWAPR isn't meant to support people's experiments, though)
     
  • There are still some units that have the same unit name (adding a blank space doesn't cut it for SWAPR).
     
    Example:
    Rome A10C = MercInc #014
    Sochi L39C cold = MercInc #014 -- Same unit name with just an extra blank space... don't do that, use underscores instead of blank spaces, please


Edited by Hardcard
Link to comment
Share on other sites

@pacastro & anyone interested

Looks like I managed to implement base/FARP capture mechanics in the development version of SWAPR.

 

Only replacements belonging to the coalition that controls the airbase/FARP will spawn.

 

When the airbase/FARP is captured, all replacements belonging to the previous coalition are wiped and those belonging to the controlling coalition are spawned.

 

Need to do further testing before releasing it, but SWAPR 1.3.1 is looking really nice so far ;)

Link to comment
Share on other sites

@pacastro

 

Hidden_AI_Replacements option only works for AI replacements, not static replacements. This is explained in the video / OP / script comment

 

I know and I tested it with AI replacements. I tried again and I found that Hidden_AI_Replacements won't work if you are using it in a multiplayer server. I tried to run it directly from the ME to test it out (switched config to SP) and it works out OK, it hids the AI replacements. Tried that same mission in a multiplayer server (switched confign to MP) and AI planes are not hidden. (I have the hook file under scripts/hook)

 

 

 

Really good news regarding the dynamic replacement for capturing bases!!! can't wait to try it!

 

Thanks!

swapr_test.miz

Link to comment
Share on other sites

Told you... can't have it both ways until ED fixes this issue. Btw, I can't set them to "Takeoff from ground" or "Takeoff from ground hot" in ME... have you modified DCS files to be able to do that?

 

Yes, you need to add 2 lines in me_route.lua from

 

DCS World\MissionEditor\modules

 

There are several good things about this.

First is you can now have grass airfields. You can't rearm/refuel unless you really manage to fit a FARP close to a hill so you can taxi your plane onto it.

Secondly you can have like in my mission more planes than the airport supports

 

Also you can use the moded file to create the mission and then just disable the mod (which is btw IC compatible) and fly the mission without it... I create that mission and I am the only one that has the moded file the rest of my friends can use the planes without any mod.

 

This is where this mod was taken: https://forums.eagle.ru/showthread.php?p=4253221#post4253221

 

I know is not your job to support mods.

 

 

 

T

[*]There are still some units that have the same unit name (adding a blank space doesn't cut it for SWAPR).

 

Example:

Rome A10C = MercInc #014

Sochi L39C cold = MercInc #014 -- Same unit name with just an extra blank space... don't do that, use underscores instead of blank spaces, please

 

This is a slip on my part. One unit was renamed (the pilot) by adding the prefix in front of "Pilot #014" replacing the word "pilot" and the existence of that space made it look OK for the game but not for Swapr. The other was made by completely erasing the pilot name with the #014 and placing just the Prefix which was modified by the game into MercInc #014 with one single space by coincidence.

 

The fact that you have prefixes and sufixes make this scxript so much easier to work with than CTLD or CSAR where you really need to edit the whole list of pilots names in the script and game. But... such mishaps can happen. Thanks for pointing it out. I will double check the mission names to be sure.

 

edit, I have added the lua file with the two edits.

me_route.lua


Edited by zaelu

[sIGPIC][/sIGPIC]

I5 4670k, 32GB, GTX 1070, Thrustmaster TFRP, G940 Throttle extremely modded with Bodnar 0836X and Bu0836A,

Warthog Joystick with F-18 grip, Oculus Rift S - Almost all is made from gifts from friends, the most expensive parts at least

Link to comment
Share on other sites

@pacastro

 

I have modified your test mission, it uses a new development version of SWAPR, which includes base capture mechanics.

 

I've added some ground vehicles for both coalitions, a capture group, an atrillery group and a commander slot for each coalition.

 

Red has a tunguska to the west of Anapa and artillery + tanks to the south.

Blue has a Gepard and artillery + tanks to the east.

 

If you own Combined Arms, you should be able to command all these vehicles, or drive them yourself.

 

Feel free to blow up replacement aircraft with the tanks / artillery, this way you can test slot block as well.

 

Anapa will start as Blue, only blue replacements will spawn. If you then move a red vehicle into the airbase area, it'll be captured (as long as there aren't any enemy vehicles within the same area... aircraft replacements don't count).

Once the airbase has been captured, all replacements from the enemy coalition will be wiped, and friendly replacements will spawn.

 

I've been testing it for a few days (both in SP and MP), all the obvious issues I found seem to be fixed.

AI replacements are correctly hidden on map if I'm hosting the mission.

Now all replacements will spawn cold (regardless of clients being set to hot start in ME) and without pilots (except for huey replacements).

 

I haven't tested it on a dedicated server, though, so there's a chance some replacements will spawn half-buried there.

 

Btw, the attached mission is set to run in MP mode, so you'll need the hook as well.

 

Give it a try and report back :thumbup:

swapr_test(SWAPR_1_3_1_mod).miz


Edited by Hardcard
Link to comment
Share on other sites

Tested it, the capture mechanics works really well!! The capture zone that has to be without enemy units is the black circle you see in the ME surrounding each airfield?

 

I found just one thing that I'm not sure if it's a flaw or it is intended that way:

 

I went as Blue and destroyed all the red AI replacements, then destroyed one red tank that was inside the capture area. Base captured and blue replacements spawned. Then I switched sides and went in with a red tank, destroyed the blue tank and captured the base back for red.... but only one AI replacement spawned, I'm thinking the rest of them didn't because of the remaining wreckage of the first replacements destroyed by the blue tank (see attached screenshot, only 1 KA-50 respawned with remaining wreckage on background).

 

I'm trying this in a dedicated served, and for me the problem with not hiding AI replacements in the F10 map persists, included are screenshots of F10 map one from red coalition and another from blue coalition, in both you can see in the map all the red AI replacements. The mission is unmodified from the one on your last post, with AI replacements and option of hidden set to true (hook is in its place).

 

Thanks for your great work here!

Screen_200603_154226.thumb.jpg.dce0d728b2820ae4d8d9a39c8a7ca213.jpg

Screen_200603_153156.thumb.jpg.3d2ca751d980cf7198524c8fcb3a28f8.jpg

Screen_200603_152804.thumb.jpg.e09aa21dea104b15c9c52281f970a3de.jpg

Link to comment
Share on other sites

@pacastro

 

The way it works right now, only replacements that haven't been completely destroyed will respawn.

 

You probably didn't destroy the Ka-50 100% before taking the base, so it was the only replacement allowed to spawn (just guessing). This is still WIP, of course, there are several things to be done before I can release it.

 

Also, DCS seems to automatically disable slots if there's wreckage around (not always, though).

 

 

As for replacements not being hidden in dedicated servers, I was afraid that would happen. Also, I bet that if you change replacement type to statics, those choppers will spawn half-buried...

 

Looks like I need to write extra code to make it work in dedicated servers... need to figure it out.

 

I'll keep you guys posted.


Edited by Hardcard
Link to comment
Share on other sites

Ok, tried it again but this time I set the Slot_Block option to false, repeated the side changing thing described in my previous post and all red replacement planes spawned on top of the wreckage!! so it was the slot blocking doing its work what prevented all replacements to spawn the previous time. That's perfect, you can have both ways.

 

Only thing I would suggest regarding the blocking part of swapr (when enabled), is to add an option to reset the blocking and unblock slots after a period of time.

Link to comment
Share on other sites

When replacements are destroyed, that normally leaves craters / wreckage around, that's why I made it so replacements would no longer spawn there.

 

In the absence of proper cleanup/airbase repair functionality (craters/wreckage can't be removed AFAIK), I don't see the point of resetting blocked slots... that would just lead to clients blowing up on spawn.

 

As for spawned statics not being hidden and AI replacements remaining visible in dedicated servers, I'm afraid this is a DCS problem, not much I can do about it.

Link to comment
Share on other sites

I can make statics hide in F10 map using the hidden option for them in ME, it works in my dedicated server also.

 

I have no idea how you are making the Swapr magic work, but hidden static's is not an option because they are spawned after mission start?

Link to comment
Share on other sites

I can make statics hide in F10 map using the hidden option for them in ME, it works in my dedicated server also.

 

It only works with units/statics that are present at mission start.

 

I haven't been able to make it work with spawned statics... and believe me, I've tried :cry:

 

 

As for spawned AI units, it only works in SP and when hosting, but not when connecting to dedicated server... like I said, it's probably a DCS problem, nothing I can do about it.


Edited by Hardcard
Link to comment
Share on other sites

  • 2 months later...

Has anyone had any success getting SWAPR to work with SUNTSAG's Marston Mat / AM2 Farp Mod?

 

I tried to set this up, set aircraft to start from ground, etc. and I can hop into the individual aircraft on the farp but I don't see the other farp'ed aircraft set up within the mission/site.

 

As an experiment in the same mission I put a couple aircraft on the ground at a normal air strip (Batumi) and that works fine of course. Just the mod farps don't work.

 

I realize it is outside of the bounds of expectation for this mod to work with other mods but in case I'm doing something wrong versus it working properly or maybe someone worked through this already I thought I would ask...

 

SUNTSAG's mod relies on the configuration changes in this post (see C:/Program Files/Eagle Dynamics/DCS/MissionEditor/modules/me_route.lua specifically):

 

https://forums.eagle.ru/showpost.php?p=4328281&postcount=7

 

Anyone encountered this, worked around? I'm trying so set up some farps at the uncontrolled cross of airstrips just outside of the town of Kobuleti proper.

 

Insights appreciated. :)

Link to comment
Share on other sites

  • 2 weeks later...

@reece146

 

How many times do I have to tell you guys to include the mission file and dcs.log in your reports? :cry:

 

 

9XUz.gif

 

 

 

Yes, like you said, SWAPR isn't meant to support people's mods (unless the modder has managed to make the mod assets work just like DCS assets).

 

That said, I can still look into it and see whether the problem is easy to fix (or fixable at all).

Link to comment
Share on other sites

LOL - that was a great movie. Need to watch it again.

 

Thanks for reaching out to have a look at this - appreciated.

 

I figured I'd ask first in case it was something obvious/known and to see if there was interest in troubleshooting. :)

 

One thing I did notice is that if you have two aircraft that are hooked up with swapr sitting side by side and the farp is too close to both of them only one works as desired. If you move the farp about 300m away from both aircraft (IIRC) then both swapr connected aircraft act as desired. I forget the exact distance - haven't played with this in a few days.

 

I'll send something later when I'm in front of the computers again.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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