Jump to content

Complete transport script


geloxo

Recommended Posts

Hi,

 

I made a new script based on Deck´s HueyDrop2 script (all credits to him for the original idea) that extends the functionallity much more, allowing both human and AI units to drop troops. Also logistics are incorporated so you can transport equipment as well. It´s compatible with air and ground forces (even controlled by players via Combined Arms addon).

 

Important:

 

Remember to reload script on the mission editor everytime you change the configuration.

 

Features:

 

Complete Troops Transport Script (CTTS) v1.04 (Original version)

Updating to latest DCS release by Ciribob also attached in this post

 

TROOPS TRANSPORTATION

 

- Script is compatible with both air and ground transports controlled by players or AI

- Transports will drop troops types based on the coalition they belong to and the number of previously loaded troops

- Typically the troops are loaded inside a pickup trigger and dropped inside a drop trigger, but usage of triggers is not mandatory

- Pickup and drop smoke markers can be enabled, disabled and their colours configured

- To enable a UNIT to use the transport script set its UNITNAME in the list of transports names or use any of the predefined ones in your mission

- To manually define a GROUP as extractable add its GROUPNAME to the list of extractable groups or use any of the predefined ones in your mission

- Dropped troops will stay close to drop point or go to closest enemy position (default 2000m)

- Human players need to use F10 radio action to load/unload troops or to check the cargo status

- Players can only load troops inside the pickup trigger or alternatively load any pre-defined extractable group or spawned group everywhere. In both cases you can drop them everywhere

- Troops can be extracted by players if transport is near their current position (default 50m)

- Troops can be returned to pick zones by players (acting as Medevacs, for instance)

- AI transports will automatically load troops only when inside the pickup triggers. AI transports won´t extract any unit automatically (to avoid interferences with human players)

- AI transports will automatically unload troops only if they are close enough to drop triggers center (default 500m for ground units and 10km for air units). This allows AI ground units to enter triggers without dropping

- Ground Commander take control of AI transports via Combined Arms module and manually load and unload troops with them (this will disable the auto load/unload feature for the AI transport)

- Ground Commander can move any of the deployed troops manually in the field

 

LOGISTICS

 

- Human players can load equipment when close to any logistics supplier group from their coalition and deploy it everywhere

- Any human controlled transport enabled for troops transportation will be automatically enabled for logistics as well (AI transports do not support logistics, cause it´s useless in this case)

- To manually define a GROUP as logistics supplier add its GROUPNAME to the list of logistics groups or use any of the predefined ones in your mission

- An extractable group of troops can be used as logistics as well (by setting the same name in both lists)

- Deployed logistic items can be transported by any coalition (you can steal the enemy ones)

- There´s no need to define logistic items in mission. You need to spawn them with the standalone function (this is used to keep consistency between cargo 3D models)

 

Notes:

 

1. It´s NOT MANDATORY to place in mission any pickup or drop triggers as you can always use extractable units instead or pre-load transports with troops manually. ONLY if you are using AI transports you need at least ONE DROP trigger to perform the automatic unload. You can use any of the predefined names for triggers or use your own ones.

 

2. Predefined extractable groups can be used to trigger actions during mission as their groupnames will be kept during the mission when transported by human players

 

3. To pre-load units with troops during mission call at least 10s after mission started via DoScript action the following standalone function:

 

LoadTransport("unitName", number)

Where:
- "unitname" = the name of the transport
- number = optionally the number of troops.

Examples:
a. LoadTransport("helicargo1") This will load with default number of troops the unit "helicargo1"
b. LoadTransport("helicargo1",4) This will load it with 4 troops

As an alternative to this you can always use a AI transport that enters a pickzone to load them automatically

 

4. You can generate groups of extractable units during mission, that will search for enemy as well, using the following standalone function:

 

CallSpawn("groupside", number, "triggerName", radius)

Where:
- "groupside" = "ins" for insurgents, "red" for Russia and "blue" for USA
- number = number of groups to spawn
- "triggerName" = trigger to use as spawn
- radius = random distance for units to move from spawn zone (0 will leave troops at the spawn position - no search for enemy)

Example: CallSpawn("red", 2, "spawn1", 1000) This will spawn 2 groups of russians at trigger "spawn1" and they will search for enemy or move randomly withing 1000m

5. You can check the amount of extracted units inside a particular trigger using the following standalone function:

 
CountExtracted("triggerName", flagBlue, flagRed)

Where:
- "triggerName" = name of trigger to supervise
- flagBlue = userflag to count the number of blue units inside trigger
- flagRed = userflag to count the number of red units inside trigger

Example: CountExtracted("trigger1", 200, 201) this will count the units inside "trigger1" and store the values in the flags 200 and 201 (which can be accessed during mission)

6. You can generate logistic items on the field during mission using the following standalone function:

 
CallSpawnLogistics("groupside", number, "triggerName", radius)

Where:
"groupside" = "ins" for insurgents, "red" for Russia "blue" for USA
number = number of items to spawn
"triggerName" = trigger name in mission editor between commas
radius = separation between items

Example: CallSpawnLogistics("blue", 2, "spawn1", 30) this example will spawn 2 cargo items for USA at trigger "spawn1" separated 30m 

7. You can check the amount of logistics dropped items inside a particular trigger using the following standalone function:

 
CountLogistics("triggerName",flagLog)

Where:
"triggerName" = name of trigger to supervise
flagLog = userflag to count the number of logistic items inside trigger

Example: CountLogistics("trigger1",300) this will count the items inside "trigger1" and store the values in the flag 300 (which can be accessed by mission)

8. Always RELOAD SCRIPT in mission after any changes on its configuration

 

Example mission included.

 

Also CTTS includes a new standalone set of functions for radio transmissions. Use them to configure radio beacons with periodical recall for JIP or to send messages without any group configuration on the editor.

 

RADIO AM/FM TRANSMISSION CONFIGURATION

 

I prefer this scripted approach due to its flexibility and to avoid loosing your configurations in case unit is deleted by mistake (as it happened to me..). If the soundfiles you want to use where not present in the .miz file add them manually to it and then open the mission in editor later on.

 

 
Examples:

RadioAM("huey1", 226, "Atmospheric.ogg", "Information") this will send a message with subtitles "Information" from huey1 on freq 226 AM (UHF)
RadioFM("huey1", 30, "Atmospheric.ogg", "Information") this will send a message with subtitles "Information" from huey1 on freq 30 FM
BeaconAM("huey1", 117, "Atmospheric.ogg") this will set an AM beacon on huey1 on freq 117 AM (VHF)
BeaconFM("huey1", 40, "Atmospheric.ogg") this will set a FM beacon on huey1 on freq 40 FM
RadioHQ("huey1", 118, "Atmospheric.ogg", "Information") this will send a periodical message with subtitles "Information" from huey1 on freq 118 FM

I hope you like it ;)

CTTS.lua

Transport Tutorial.miz

CTTS_CiribobEdit.zip


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

Pick and drop and reinsert will be available. I made tests yerterday and plan to release a new version today or during weekend. This allows more teamwork in missions as one can be just moving troops to an intermediate point while others take those and insert them in front line. Also allows to change position of inserted troops on demand in case reinforcements are needed elsewhewe in the combat area

  • Like 1
Link to comment
Share on other sites

First post updated and also example mission included (uploading to downloads too). Now you can extract previously inserted troops or return them to pick areas. Humans can deploy and extract troops everywhere (it´s not limited to drop areas only). AI still needs a drop trigger to perform the automatic unloading.

 

I decided not to add much more features cause I see this is quite complete as it is now and there are also other nice Medevac and CSAR scripts available that you can use for those purposes.

 

Happy transporting!

Link to comment
Share on other sites

Nice script geloxo, and thanks for taking the time to do this.

I have used this in a mission and it works great.

How would one tweak the code to include additional pick-up points.

I have tried to copy and change the [1] and [2] code line with additional values of [3] and [4], but only the first smoke marker will show.

I am able to land in the added zone and load troops, but the smoke marker will only show for the first pick up point.

 

PickupZones = {
   [1] = {
       ZoneName = "Bluepickup",
       SmokeColor = trigger.smokeColor.Blue,
   },
   [2] = {
       ZoneName = "Bluepickup2",
       SmokeColor = trigger.smokeColor.Blue,
   },
   [3] = {
       ZoneName = "Redpickup",
       SmokeColor = trigger.smokeColor.Red,
   },
   [4] = {
       ZoneName = "Redpickup2",
       SmokeColor = trigger.smokeColor.Red,
   },
}

 

**EDIT** Not sure why but got it working now


Edited by shelt
found solution

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

I simplified and expanded the configuration in the new Transport.lua regarding the original Hueydrop.lua to avoid mistakes. Don´t touch anything or add entries like that. Use the following method instead, and don´t forget the "" for the names.

 

To edit pick/drop zones change names and smoke colors here:

PickZones = {
"pickzone1", "blue",
"pickzone2", "blue",
"pickzone3", "none",
}
DropZones = {
"dropzone1", "red",
}

 

To disable or enable already configured smoke markers use:

smokepick = true
smokedrop = false

 

To edit human players pilot names:

HumanTransportsNames = {
"helicargo1",
"helicargo2",
"helicargo3",
"helicargo4",
...
}

 

And for AI transports:

 
AITransportsNames = {
"transport1",
"transport2",
"transport3",
"transport4",
...
}

 

Below that you don´t need to touch anything. It´s the pure content of the script itself.

 

But if it works for you now let it be anyway :thumbup:


Edited by geloxo
Link to comment
Share on other sites

script stops working

 

hey Geloxo

Firstly this is a great script and I'm having a ball playing around with it

However, I seem to be having a problem where the script stops working a few minutes after the mission starts.

It works fine for a short time but then the smoke in the pickup zone fades. Troops can still be picked up but can't be dropped even though the radio commands are still there.

Any suggestions on where I'm going wrong here

Thanks in advance :)

Link to comment
Share on other sites

hey Geloxo

Firstly this is a great script and I'm having a ball playing around with it

However, I seem to be having a problem where the script stops working a few minutes after the mission starts.

It works fine for a short time but then the smoke in the pickup zone fades. Troops can still be picked up but can't be dropped even though the radio commands are still there.

Any suggestions on where I'm going wrong here

Thanks in advance :)

 

Seems to be the typical problem I faced several times. Check that you have added the trigger zones correctly to both the map and the sctipt section (names for pick and drop zones).

 

I have edited the script to remove the option to spawn troops on the pick zone. I realized at the end produces a lots of unused troops in the pick zone due to players unloading them. The problem is related to a player being killed while he was loaded with troops. After respawn the variable for defining troops loaded is kept. I had not figured how to detect a player respawn so I decided to delete that feature. You can however still return troops to base which will set you as empty (but this didn´t do anything even in the past). Alternative to bring back troops and really spawn them is to unload them elsewhere in base but not on the pick zone. Commander can, for instance, send them to another duty from base since you had returned back

 

Cheers


Edited by geloxo
Link to comment
Share on other sites

thanks for the speedy reply

yes it does seem related to the names of the zones, specifically, the zones being named AFTER the script was loaded in to the mission editor.

I managed to get it working for a while by reloading the script in the editor and saving the mission. Then I reloaded the mission and typed the exact same names for the zones. saved again and then restarted.

This worked fine until I edited the script and reloaded it. This gave me the exact same problem but this time I haven't been able to fix it :(

Link to comment
Share on other sites

hello and thank you for the script.

I tried to adapt your script to a simple mission by adding a pick and drop zone.

UH can load the troops but I can not unload the troops. Should we add something else to the mission?

 

I join the miz file

 

Thanks

 

You need to delete any pickup zones you are not using in the script. I tried it as a test with your attached mission and it worked as it should.

 

I have also noticed in a mission I am building, which has multiple pick-up zones, if you use the same color in sequence, like blue, only the first smoke will appear.

Not only that, no other smoke markers will appear.

The mission is a Red vs Blue type mission. I am wanting to use blue smoke for blue side and red smoke for the red side. With orange and white for the drop zones.

 

If I did the code as this:

"USPickupa", "blue",
"USMZPU", "blue",
"RUPickupa", "red",
"RUPickupb", "red",

 

only the very first blue pick up zone would produce smoke and the smoke dissappeared when I entered the zone.

 

If I did the code as this:

 

"USPickupa", "blue",
"RUPickupa", "red",
"USMZPU", "blue",
"RUPickupb", "red",

 

all the smoke markers will appear and would stay.

 

That was the problem I was having with the first post I made about having issues with the script.

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

Be sure to use the exact names in both the script and mission editor and always reload script in editor and save mission after any changes in the names or script configuration. This is needed by the game itself to update the mission properly.

  • Like 1
Link to comment
Share on other sites

Script was updated to correct the failure where chopper spawned loaded if you where killed while being loaded as well. I also added a new menu to check your loading status and tuned the messages to be coalition dependant, so script can be used in PvP missions. The missions have been updated in accordance as well and are packed in a zip at the download section

Link to comment
Share on other sites

I have one more time updated the sctipt cause I needed extra functionality for my next mission. There are fresh new features such as the predefined extractable groups and a new "check cargo status" action on the menu. Also now the amount of troops deployed is based on the amount you loaded before. I have also fixed some minor errors and improved the features, so I consider this quite stable now and won´t include new corrections unless needed during the next missions.

 

Example mission is included.

 

Updated Airmobile missions to add the new script: http://forums.eagle.ru/showthread.php?t=109337

 

Remember to reload script in your own missions in the editor after you do any changes in the configuration.


Edited by geloxo
Link to comment
Share on other sites

Thanks for the work on this, geloxo. Guess the coding is sometimes like building a mission, you have to refine it until it is polished.

The changes you have made since the original are amking it very easy to understand how to configure.

Have you been able to determine why using additional pickup points the colors have to be alternated to get all to show? or have you tried that yet?

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

Thanks. Yeap, according to the needs of my missions I add more things but I think it´s quite complete and powerful now to be used in many scenarios. Regarding your question I have no idea about what´s the problem. The code just takes each single row in pairs (trigger name and smoke color) and then places the smoke with it´s color at the related trigger :huh:

 

 
function SmokeTimer(arg, time)
if smokepick == true then
 for i=1,#PickupZones do
  local zone = trigger.misc.getZone(PickupZones[i].ZoneName)
  SpawnSmoke(zone.point.x, zone.point.z, PickupZones[i].SmokeColor)
 end
end

if smokedrop == true then
 for i=1,#DropoffZones do
  local zone = trigger.misc.getZone(DropoffZones[i].ZoneName)
  SpawnSmoke(zone.point.x, zone.point.z, DropoffZones[i].SmokeColor)
 end
end

return time + 270
end 

 

Are you sure you didn´t made any mistake such as missing commas, wrong namings or things like that in the configuration section? In the Mission 1 you have an example where 3 pickzones are used: first two are blue and third is hidden. It works there... Download it from the mission pack thread and check it.

 

Cheers


Edited by geloxo
Link to comment
Share on other sites

Yeap, this is something I want to include since the beginning as well but I can´t figure which lua function to use. If someone tells to me I can put is as trigger for the action instead of the radio menu. This is a very simple change in the script, but you need the right command which I don´t know :-(

 

By the way shelt, I have solved your problem with smokes :-P I made a modification that improves the config phase much more, cause know you don´t have to care about commenting or uncommenting the trigger names. If the trigger name that you used is not an existing trigger script will ignore it. This means now you will have a set of predefined names available (simular to the units names) and you just use any of those names in the mission.

 

Testing it now and will upload it shortly. Everything works so far.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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