trainingmission 1 vs 1

Home > User Files > trainingmission 1 vs 1
DCS World 2.7
F/A-18C

trainingmission 1 vs 1

Uploaded by - vinchante
Date - 03/03/2023 15:13:35
Tex Gunslinger asked a open question:
create Random Appearing Enemy: I do a lot of single player flying to practice new skills.
One thing i don't like is because i set up the mission, i pretty much know the location of the enemy.
Does anyone know of a way to make the enemy appear in random locations, at random times through out the mission and even change up the number of enemy each mission?

So I made him a simple missions with 1 enemy Fulcrum Mig-29 spawning every time in a different zone and height. I also explained a bit about my thinkingproces and simple lua code and the use of Moose (for beginners wanting to try some programming too).

1. I use Moose and run that script at mission start (after a few seconds)
2. then I run a short mission lua script which is already in the missionfile but pasted below to tell you more about it:
zones = {
"Zone-1",
"Zone-2",
"Zone-3",
"Zone-4",
"Zone-5",
"Zone-6",
"Zone-7",
"Zone-8",
"Zone-9"
}
function Spawn_enemy()
enemy = SPAWN:New( "Fulcrum" )
zone = zones[ math.random(1, 9) ]
height = math.random(1000, 8000)
local SpawnPointVec3 = ZONE:New( zone ):GetPointVec3( height )
enemy:SpawnFromPointVec3( SpawnPointVec3 )
end

this script lists all zones I've added in the mission editor. You are free to add more zones if you want that, or move them arround. But adding extra also need you to change a line in the code. The function kicks in when you use the Radioitem: Spawn Enemy. It will randomly select each time a different zone and another height


  • License: Freeware - Free version, Unlimited distribution
  • Language: English
  • Size: 1.18 Mb
  • Downloaded: 372
  • Comments: 4
FOLLOW US