1) Make UFOs spawn/despawn on a specific alien base to simulate take-off/landing
This can be used also for total conversions where the enemy is not an extraterrestrial force parked in Earth's orbit. A player should be able to figure out the location of hostile bases in this matter, with the radar detecting the 'ufos' taking off/landing between their missions (but revealing the bases still requires a craft).
Another suggestion to implement would be through a new waypoint:
ufoTrajectories:
- id: L0
waypoints:
- [6, 0, 0]
- [0, 3, 74]
- [0, 1, 28]
- [1, 1, 47]
- [6, 0, 0]
A 6 setting tells the game that the ufo's starting location is an alien base (the two 0s refer to 0 height and 0 speed)
One issue to solve is how to determine which alien base is used to spawn the ufo. If the mission is spawned by a specific base (through genMission on alien Deployments) then the issue is solved since that base is used. If the mission is spawned through missionScripts then the game should check for any existing alien bases that fit the criteria (namely any specific regions defined on that missionScript entry) and choose randomly.
So, I have added some new attributes to alien mission ruleset.
The main attribute is
"operationType", which says if it is an Earth-based operation or not.
Possible values:
- 0 (default) = AMOT_SPACE = not Earth-based, UFOs enter and exit in the upper atmosphere; all values > 0 represent Earth-based operations
- 1 = AMOT_REGION_EXISTING_BASE = use an existing alien base in the mission region, if there is none, abort the mission
- 2 = AMOT_REGION_NEW_BASE = create a new operation base in the mission region
- 3 = AMOT_REGION_NEW_BASE_IF_NECESSARY = use an existing alien base in the mission region, if there is none, create a new one
- 4 = AMOT_EARTH_EXISTING_BASE = use any existing alien base, regardless of region, if there is none, abort the mission
- 5 = AMOT_EARTH_NEW_BASE_IF_NECESSARY = use any existing alien base, regardless of region, if there is none, create a new one (in the mission region)
- 6 = AMOT_EXISTING_BASE_HUNT_MISSION = don't do anything = use the already assigned base that spawned this mission
Nice side effect is that
you can create new alien bases with this at the beginning of the alien mission... I will leave it to your imagination, how this can be used.
The alien base will need to know where to spawn... for that there is a new attribute
"operationSpawnZone", which works same way as "spawnZone"... I used a new attribute so that you can have different zones for operation base and other bases or mission sites created by this mission.
The base will also need a deployment, which can be defined in the attribute
"operationBaseType", which again works similar to "siteType" attribute, but I created a new one so that you can use the old one to spawn mission sites.
Both new attributes are necessary only when creating a new base... so for operation types 2, 3 and 5.
This operation base assignment is
only relevant for alien missions created by mission scripts and from dogfights.
"Hunt missions" and "Supply missions" created by bases themselves will already be assigned to those bases and
will skip the above functionality.
Please note that you
SHOULD still mark your hunt missions as Earth-based, any value > 0 will do, but I recommend setting = 6 (AMOT_EXISTING_BASE_HUNT_MISSION), as it was added exactly for this case.
This is needed, because it tells the spawned UFOs they should take off from the base and land at the base... instead of at random locations.
The hunt missions were taking off at the base automatically until now...
since now, you need to specify it explicitly.
Also, I
don't recommend setting the Earth-based operations to ALIEN_SUPPLY missions, because you don't want them to start at the same base they are supplying (and reach destination immediately)... these missions are just inherently Space-based, so leave them like that...
All mission types and UFO types support taking off at the operation base, even supply ships and retaliation ships.
Landing at the operation base is also supported for all mission types and UFO types, but will be overridden by functionality that transforms a landed UFO into a mission site... since we still might want to use that.
Everything else will just ignore the trajectory's last waypoint's zone and go fixed back to operation base. Altitude and speed from the trajectory is still used.
If the operation base is destroyed, any live UFOs obviously cannot return to it... so they will then use the last waypoint's zone (so don't ignore it and
define it properly).
After the base is destroyed, all missions based in that operation base are
interrupted and won't generate anything anymore.
Feedback welcome.
alienMissions:
- type: STR_ALIEN_TERROR_FROM_EARTH_BASE
#
operationType: 3 #Use an existing base in the region or create a new one if there is none
operationSpawnZone: 4 #Mission zone for alien bases
operationBaseType: STR_ALIEN_OUTPOST
#
points: 10
objective: 3 #OBJECTIVE_SITE
spawnZone: 3 #Mission zone for terror missions
siteType: STR_MY_CUSTOM_TERROR_SITE
raceWeights:
0:
STR_SECTOID: 30
STR_FLOATER: 70
1:
STR_SECTOID: 60
STR_FLOATER: 40
waves:
- ufo: STR_SMALL_SCOUT
count: 1
trajectory: P1
timer: 15000
- ufo: STR_LARGE_SCOUT
count: 1
trajectory: P1
timer: 9600
- ufo: STR_TERROR_SHIP
count: 1
trajectory: P7
timer: 9000
objective: true