Jump to content

Dynamic Medevac Script


Recommended Posts

Just checked my code and the ID of the "pilot" and his group is a randomly generated number between 1000 and 10000 which means it is a pretty slim chance that it takes up the ID of a client aircraft (especially since you probably don't have over 1000 units in your mission). Also, my understanding is that if a new unit is created with the same ID as an old unit the old unit is removed and the new unit is created. I really don't have an idea how it could be that you're having this issues. I guess its especially frustrating to have issues in multiplayer :(

 

I came to the conclusion that you need to handle name + groupId + unitId within our own counter: do a global var that starts to 500 (not to collide with ME units) then increment it each time you need it:

 

generatedItemsNb = 500
function getUUID()
   generatedItemsNb = generatedItemsNb + 1
   return generatedItemsNb
end

 

and use that method to build up your group data.

 

I would like to enhance this by two different ways, but need you help:

 

  • I would like to protect the getUUID() as it can be in Java with synchronized keyword. What is the equivalent in lua ?
  • I am looking for a true UUID getter in lua language. All the implementations that I found on the web did not satisfy me. :(


Edited by galevsky06
Link to comment
Share on other sites

Thanks for the tip!

 

I *think* all Lua-code in DCS is synchronised but I am not sure. Someone else might be able to tell us if that is true.

 

The code you posted might be enhanced with a check if the ID is already taken but other than that I can't see why it isn't perfect already?

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Thanks for the tip!

 

I *think* all Lua-code in DCS is synchronised but I am not sure. Someone else might be able to tell us if that is true.

 

Hum.... my issue is that I am generating bandits thanks to F10 menu. If 2 different clients ask for unit generation in the same time, both will call getUUID(), and I don't want to see the second one to increment before the first call returned the value. So this is an issue I think.... unless someone confirms that it is not ?

 

The code you posted might be enhanced with a check if the ID is already taken but other than that I can't see why it isn't perfect already?

 

Yep.. but... I am just launching some random choice to generate a few bandits, and the game freezes about 800ms in-game when I call the generation function....

 

I would mostly prefer to get real UUID feature as in other languages, not to care about its content (means avoid extra loop for checks).


Edited by galevsky06
Link to comment
Share on other sites

Found the problem with ground troops taking the place of "client" aircraft.

You were correct, it did not involve the Medevac script.

 

The problem was with the Transport script. The "unitcounter" was set to begin at 100. Most of the client planes began at 220. I had built a mission based off a created mission using "nodes", so there were at least 200 ID's in use. I suppose that if a client aircraft had not been "initialized" before the transport script generated unitID's, they would take the place of a client aircraft.

 

I changed the unitCounter = 100 to unitCounter = 400 and no more problems!

 

Thanks for the help

Intel i7-3770K,Windows 10 64,Noctua NH-U12S ,ASRock Z77 Extreme4 ,G.Skill 32GB DDR3 2400,EVGA GTX 1080,ADATA XPG900x2 RAID 0, CM HAF XB Case,Thrustmaster Warthog,Combat Rudder Pedals,Logitech G930 with wireless TrackIR 5, 39" Insignia LED 120Hz Monitor, Oculus Rift

Link to comment
Share on other sites

  • 1 month later...

Hello,

Thank you for your script. I like it so much and I think that it is the best script so far for DCS. It gives a real new experience to UH1 and Mi-8. Now those birds have a real value on the battlefield together with other plances.

 

I placed the script on the UVP dedicated server.

 

Questions:

1)F10 for active tasks doesn't work ?

2) I set survive to 100% but still most of the soldiers dies imediately after the vehicle is hit ( from the original explosion ??) or they are killed seconds after by anohter attack of the enemy.

 

- I think that it would be better to spawn them a little bit later to avoid the imediate dead

- Can I set those soldiers immortal ?

 

3) If I pick up soldiers and I don't receive any new messages with request - should I turn of the counter ?

 

Thank you very much + big REP... :thumbup:

[sIGPIC][/sIGPIC]

.....Vladimir, let's go to Sukhoi.......

Link to comment
Share on other sites

Hello,

Thank you for your script. I like it so much and I think that it is the best script so far for DCS. It gives a real new experience to UH1 and Mi-8. Now those birds have a real value on the battlefield together with other plances.

 

I placed the script on the UVP dedicated server.

 

Questions:

1)F10 for active tasks doesn't work ?

2) I set survive to 100% but still most of the soldiers dies imediately after the vehicle is hit ( from the original explosion ??) or they are killed seconds after by anohter attack of the enemy.

 

- I think that it would be better to spawn them a little bit later to avoid the imediate dead

- Can I set those soldiers immortal ?

 

3) If I pick up soldiers and I don't receive any new messages with request - should I turn of the counter ?

 

Thank you very much + big REP... :thumbup:

Thanks!

 

1) Did you mean that you can't see the F10-menu or that nothing happens when you call "Active tasks"?

- If you don't see the menu, you need to navigate to the main radio menu by pressing F11, then close the menu by pressing F12 and then opening it again by pressing the radio-button.

- If nothing happens when using the "Active MEDEVAC tasks" - menu item I'd like you to do the following: Run the mission and make sure you reproduce the bug. Save the track-file and the dcs.log file located in your saved games folder under DCS World/Logs. PM me those files together with your mission and I will have a look to see what's going on.

2) Do you see any dead infantry units around the destroyed vehicles? If not then the script isn't working. As for the crew being killed by enemy fire I'd say the way it is now is more realistic IMHO but I keep your suggestions in mind. Also, you might want to check out my modification of MBots suppression script as it will make the crew flee when taking fire, thus might survive longer.

3) What do you mean with turning off the counter?

 

Also, if you haven't you should try version 3.2 of this script which is a few posts up. I haven't updated the first post yet but I really should. If you finish making your mission I really like to try it out! :)

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Updated first post with version 4. Only difference from 3.2 is that you can now turn off the search for downed pilots/SAR - feature as I believe there are other scripts that do that now and they probably do it better.

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Hi,

Thank you for all your hints.

 

1) I tried to use radio many times,but I don't see the Active task menu. I tested all described combination. Could it be because I run it on mission on dedicated server?

 

2) I see dead infantry around vehicles immediately when the vehicle is destroyed. I estimate that 80% are dead immediately with the unit dead message on screen. The rest are alive and waiting for picking up also with the correct message.

I think that the infantry dies because they spawn too early and the original explosion kills them.

As results I have only few tasks for rescue.I would appreciate the immortal infantry.

 

3) bleeding time, nevermind I installed the new version.

 

4)I love the way this script works, especially how wounded troops are running to your chopper when you land near them. Could you please also add a possibility to deploy troops with RPG which will be attacking the nearest enemy? I don't expect it in this week :)

 

 

Thank you very much again.

 

PS: The script runs on UVP Dedicated server.

[sIGPIC][/sIGPIC]

.....Vladimir, let's go to Sukhoi.......

Link to comment
Share on other sites

I don't expect it in this week :)

No, but you get it today :D Attached are a modified script where the crews are invincible and includes one RPG soldier. Please note that there is no western RPGs in the game.

 

About the menu not appearing: Please look into your C:\Users\Your name\Saved Games\DCS\Logs folder for the dcs.log - file after you encountered the bug. Also, under Tracks you'll find the track of the mission you just played. If you could send this to me with your mission it would help A LOT to find the problem.

Medevac_SAR v4 alexej21.lua

MEDEVAC_SAR-demo v4 alexej21.miz

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

  • 3 weeks later...

RagnarDa,

 

Awesome job with this script. Our group uses it on all our missions. I do have a request to add to the script.

 

Is there any way to have the survior deploy their smoke more then once. Some medevacs have BAD days and when shooting the approach, they fall out of the sky and die. So when the medevac goes back into action to recover the survivor again, the soldier does not deploy another smoke.

 

v/r

 

Xillinx

[sIGPIC][/sIGPIC]

 

http://1stcavdiv.conceptbb.com/

Link to comment
Share on other sites

Thanks! Nice to hear people find my work adds something to their game experience!

 

I updated the script as per request but I haven't had much time to test it. If you would try it out and see if the units place smoke even after the medevac crashed I would be very grateful! Also please note that sometimes they will not pop smoke because there are already smoke nearby and they will only give you distance to the smoke.

Medevac_SAR v4_1.lua

  • Like 1

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Hi,

I'm back again. Unfortunately the F10 menu still doesn't work in my missions. The other functions work nice. I love it.

 

Sometime I just want to fly Search and Rescue mission in Mi8.

My idea of very easy totally random mission for Rescue choppers UH1 a Mi8 is:

 

Set Trigger zone any size and wherever you like and call it Rescue zone.

 

First script: Spawn unit in the random position inside of the Rescue zone and after few second let the unit explode.

 

Second script: Run you dynamic medevac script.

 

 

=== Endless fun for alone MedEvac flying. If you would get bored from the zone of flying then you just move it in the ME to another corner of the map or the zone can have 200kms..

 

Save mission with different type of weather or time and then just load the one you want to fly now, almost instant action..

 

 

Could you do the first script for me ?

 

 

Thank you,

[sIGPIC][/sIGPIC]

.....Vladimir, let's go to Sukhoi.......

Link to comment
Share on other sites

Don't need a trigger zone. Just run the script and EVERY Ground vehicle destroyed will produce CASEVAC groups for the corresponding side, as per the Script settings.

Just create or spawn enough (random) vehicles and let them drive around so they attack one another and you get lots of random CASEVAC.

 

I use a combination of lots of Units with pre planned paths, that are randomized by 3 different triggers, so you can adjust the paths for semi-random encounters, e.g. IED hits with mines, or junctions where certain patrols will clash. Add some randomized AAA and foot patrols as challenge for the choppers and you have a lot of fun.

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

Hi,

I'm using the MedEvac script as you describe already. To create a random battlefield is quite complicated and it needs a lot of time and many units on the battlefield.

 

The way I described means: 1 trigger zone, 1 vehicle and 2 scripts and really true random scenario.

 

The script I asked for is very easy withing the Mist I saw it somewhere on the forum but I couldn't find it.

 

spawngroup("group name") but I don't know what is the part with the location = trigger zone name....

[sIGPIC][/sIGPIC]

.....Vladimir, let's go to Sukhoi.......

Link to comment
Share on other sites

Hi,

I'm using the MedEvac script as you describe already. To create a random battlefield is quite complicated and it needs a lot of time and many units on the battlefield.

 

The way I described means: 1 trigger zone, 1 vehicle and 2 scripts and really true random scenario.

 

The script I asked for is very easy withing the Mist I saw it somewhere on the forum but I couldn't find it.

 

spawngroup("group name") but I don't know what is the part with the location = trigger zone name....

 

Ah ok, got it. Randomizing the spawning vehicles on a large scale, not the events... I thought about that, but found the risk of creating totally unpredictable scenarios, too high.

I used a lot of units copy/paste including paths on the roads... the trick for randomizing was to activate them with more than just one random trigger. I used 3 random triggers:

A combination of 3 Triggers of 3 settings each gave me 9 basic setups, plus another combined trigger from the 3 plus a separate one for randomizing number and appearance of AAA.

You are right especially testing is taking quite some time, but the control over the patrols route and possible scenarios was worth it for me.

Next iteration will be to scale enemy forces to the number of players/type of units used by players, e.g. if one takes an A-10C to have more AAA and activate SAM / ManPAD accordingly... if only Hueys or the Mi-8 just ZSU and so on.

I would like to test your mission when ready, to see how the random spawns work out, compared to the triggers...:thumbup:

Shagrat

 

- Flying Sims since 1984 -:pilotfly:

Win 10 | i5 10600K@4.1GHz | 64GB | GeForce RTX 3090 - Asus VG34VQL1B  | TrackIR5 | Simshaker & Jetseat | VPForce Rhino Base & VIRPIL T50 CM2 Stick on 200mm curved extension | VIRPIL T50 CM2 Throttle | VPC Rotor TCS Plus/Apache64 Grip | MFG Crosswind Rudder Pedals | WW Top Gun MIP | a hand made AHCP | 2x Elgato StreamDeck (Buttons galore)

Link to comment
Share on other sites

Sorry for making it a bit hard to use. You can get the in-game coordinates (x and z) by pressing LAlt + Y in the game. Don't forget to give feedback.

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

If your text editor doesn't display line numbers search for "Example points" to find where you're supposed to configure the script.

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

We are just testing your mission Rescure Elbrus. Seems very nice, but I don't konw how to navigate in Mi8 with AM radio.That set freq 250-259 seems to be strange for UH1 as well...

 

?

 

Thx

  • Like 1

[sIGPIC][/sIGPIC]

.....Vladimir, let's go to Sukhoi.......

Link to comment
Share on other sites

We are just testing your mission Rescure Elbrus. Seems very nice, but I don't konw how to navigate in Mi8 with AM radio.That set freq 250-259 seems to be strange for UH1 as well...

 

?

 

Thx

 

@€#%*+^<! I forgot to tell how to complete the mission in the briefing! I posted instruction in the tread of the mission. Really sorry about that. Thanks tons for telling me this! Btw, the Mi-8 can't use its radio for navigation yet.

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

  • 2 weeks later...
the medevac.sar_pilots, will it work with an ejected pilot from a MP client?

Sort of. When the player ejects a AI-soldier will spawn and the medevac-player can pick up that.

 

Has anyone tried this mission using the latest version of MIST? And are the SCT still needed?

I haven't gotten around to try it but I guess it would work. Please report if you do try it!

  • Like 1

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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