aliens

Author Topic: Spawn waypoint bug.  (Read 1966 times)

Offline mutantlord

  • Colonel
  • ****
  • Posts: 136
    • View Profile
Spawn waypoint bug.
« on: May 05, 2024, 02:47:32 pm »
Meridian, I am getting a really weird bug that I can't explain.

[2024-05-05_21-41-25]   [FATAL]   A fatal error has occurred: Missing second waypoint! Error occurred while trying to determine UFO waypoint for mission type: STR_CRACKHOUSE in region: LANDSPAWNS; ufo type: STR_CRACKHOUSE, trajectory ID: MISSION_SPAWN.
[2024-05-05_21-41-25]   [FATAL]   0x7ffbcd773f50 RaiseException
[2024-05-05_21-41-25]   [FATAL]   0x7ffbc7146b10 CxxThrowException

[2024-05-05_21-41-25]   [FATAL]   0x7ffbcef11fd0 BaseThreadInitThunk
[2024-05-05_21-41-25]   [FATAL]   0x7ffbd0d3ef90 RtlUserThreadStart
[2024-05-05_21-41-25]   [FATAL]   Crash dump generated at C:/games/UFO/Disconnect Brutal A.I ver/user/2024-05-05_21-41-25.dmp
[2024-05-05_21-41-39]   [FATAL]   OpenXcom has crashed: Missing second waypoint! Error occurred while trying to determine UFO waypoint for mission type: STR_CRACKHOUSE in region: LANDSPAWNS; ufo type: STR_CRACKHOUSE, trajectory ID: MISSION_SPAWN.

Mission spawn ufo trajectories only have one waypoint in its code.

ufoTrajectories:
  - id: MISSION_SPAWN
    groundTimer: 0
    waypoints:
      - [0, 0, 0]

Offline mutantlord

  • Colonel
  • ****
  • Posts: 136
    • View Profile
Re: Spawn waypoint bug.
« Reply #1 on: May 05, 2024, 02:49:00 pm »
Save game and Log attached

Offline zRrr

  • Sergeant
  • **
  • Posts: 31
    • View Profile
Re: Spawn waypoint bug.
« Reply #2 on: May 06, 2024, 06:42:38 pm »
Looks like you're making a mission site. Would you like help?

Problem is, you are using valid ufo type ('STR_CRACKHOUSE') with invalid trajectory (trajectories need at least two waypoints, 'MISSION_SPAWN' only has one). So game creates ufo, tries to assign trajectory and explodes.

You can set objectiveType to '3', specify site deployment in siteType and use nonexistent ufo type in waves:

Code: [Select]
(...)
alienMissions:
  - type: STR_CRACKHOUSE
(...)
    objective: 3 # change to '3' for mission sites
    siteType: STR_CRACKHOUSE  # add name of alienDeployment to use
(...)
    waves:
      - ufo: THIS_UFO_DOES_NOT_EXIST
        count: 1
        trajectory: MISSION_SPAWN
        timer: 1000
        objective: true

If you need multiple different random deployments for single alien mission, you'll have to use missionZones and negative texture ids. See Piratez for example.

Or you can keep it in line with rest of the mod and rename ufo:
Code: [Select]
(...)
alienDeployments:
  - type: STR_CRACKHOUSE
(...)
    customUfo: STR_CRACKHOUSE_UFO # use new ufo name
(...)

alienMissions:
  - type: STR_CRACKHOUSE
(...)
    objective: 0
(...)
    waves:
      - ufo: STR_CRACKHOUSE # there is no such ufo so game skips to mission site creation, and there is deployment with this name
        count: 1
        trajectory: MISSION_SPAWN
        timer: 1000
        objective: true
(...)
ufos:
  - type: STR_CRACKHOUSE_UFO # rename ufo
(...)
« Last Edit: May 06, 2024, 06:54:12 pm by zRrr »

Offline mutantlord

  • Colonel
  • ****
  • Posts: 136
    • View Profile
Re: Spawn waypoint bug.
« Reply #3 on: May 07, 2024, 12:39:30 am »
This is the rul file in my mod. It matched all the condition of your second code contribution.

Offline zRrr

  • Sergeant
  • **
  • Posts: 31
    • View Profile
Re: Spawn waypoint bug.
« Reply #4 on: May 07, 2024, 02:14:57 am »
This is the rul file in my mod. It matched all the condition of your second code contribution.

No, it does not; I've changed ufo name (maybe it was not different enough). See https://github.com/zrrr111/random-diff-stuff/commit/1824d7c866de22f2c38a1480e4dde7a77b2fb901

To reiterate, if you want to spawn mission site, don't use real ufo (defined in ufos:) with fake trajectory, game will crash. Use deployment type from alienDeployments:, that does not match any existing ufo types.

Anyway, changed file attached.

Offline mutantlord

  • Colonel
  • ****
  • Posts: 136
    • View Profile
Re: Spawn waypoint bug.
« Reply #5 on: May 12, 2024, 12:43:23 am »
Thanks for the input, I have added a fix or patch for the problem for the moment. It is working.