Author Topic: [Documentation] Spawning Units from Items  (Read 2009 times)

Offline SuperCaffeineDude

  • Captain
  • ***
  • Posts: 75
    • View Profile
    • supercaffeinedude
Re: [Documentation] Spawning Units from Items
« Reply #15 on: October 17, 2018, 01:28:31 am »
Ah this makes me sad, could the unit/corpse maybe carry drop an additional corpse on it that is recoverable?

Maybe the unit could on death become an enemy "zombie" which then spawns a recoverable body?

Edit: No wait that doesn't make sense if it lives you can't have it if it dies you shouldn't have it :(

Could it be a civilian that is automatically mind-controlled?
That's probably not a thing ::) :P

Well, it's still cool for bio-weapons, like apoc leech-cannons, alien proximity eggs, etc. look forward to seeing what people do with it
« Last Edit: October 17, 2018, 01:59:23 am by SuperCaffeineDude »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1643
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #16 on: October 17, 2018, 02:14:58 am »
The recovery limitation is that the live unit and any items in the unit's inventory are removed from the game before anything is counted to bring back to base, but this only holds for units spawned under the player's control. If the unit dies or falls unconscious, then items it drops besides its corpse can be recovered.

Offline Alex_D

  • Colonel
  • ****
  • Posts: 251
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #17 on: October 17, 2018, 02:31:48 am »
The recovery limitation is that the live unit and any items in the unit's inventory are removed from the game before anything is counted to bring back to base, but this only holds for units spawned under the player's control. If the unit dies or falls unconscious, then items it drops besides its corpse can be recovered.

Thus on the micro UAV example, the spawned unit can have a limited span, with either stun or (better) damage per turn. Then after a few turns it drops "dead". Then it's recovered after the battle ends. However if the battle end with the unit still in the air, then no recovery is possible. Alternatively, the units can be 100% expendable, if made cheap enough can be a good alternative to scouting for heavy encounters.

Offline SuperCaffeineDude

  • Captain
  • ***
  • Posts: 75
    • View Profile
    • supercaffeinedude
Re: [Documentation] Spawning Units from Items
« Reply #18 on: October 17, 2018, 02:59:58 am »
Yeah I was thinking you could definitely give it some sort of bleed, but yeah if the mission ends before the device is out of juice you'll lose it, ideally you'll only want the device returned to the craft if it's intact as well as if it's snoozing.

I think I remember there were mods out there that allowed you to recover damaged armor, but I'm guessing they just used alien-corpses leaving us with a similar problem. Without being able to confiscate the inventory of the unit, or better yet the unit itself, there doesn't really seem a fix without making them disposable as stated.

Still useful, but not ideal for something like a portable turret, servo-skull, pokemon, RC car, etc, unless they're AI driven civilians i guess (which isn't awful).

Offline robin

  • Commander
  • *****
  • Posts: 983
  • ULTIMATE ROOKIE
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #19 on: May 19, 2019, 05:54:28 pm »
Can I spawn item-units into a X-Com craft map block?
Like this:

Code: [Select]
crafts:
  - type: STR_TRANSP
    [...]
    battlescapeTerrainData:
      name: TRANSP
      mapDataSets: *mapDataSetsXcomCraft
      mapBlocks:
        - name: TRANSP
          width: 10
          length: 20
          items:
            STR_ROBOTURRET_XCOM_PLASMA_SPAWNER:
              - [2, 9, 0]  # x, y ,z Position of the item in the map block
              - [7, 9, 0]
          fuseTimers:
            STR_ROBOTURRET_XCOM_PLASMA_SPAWNER: [0, 0]  # Set all fuses on these items to 0

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1643
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #20 on: May 19, 2019, 05:55:54 pm »
Yes! We use this in the 40k mod to give ground vehicles turrets.

Offline robin

  • Commander
  • *****
  • Posts: 983
  • ULTIMATE ROOKIE
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #21 on: May 19, 2019, 06:23:54 pm »
Yes! We use this in the 40k mod to give ground vehicles turrets.
Then... I think I found a bug with the vertical terrains: the item-units are spawned normally when the craft is on a normal terrain but I get Segmentation Fault error when starting the mission on a terrain that uses vertical levels. Maybe the Z coordinate of the item-unit defined for the craft map goes crazy.
But of course there is also a large probability that the issue is in my terrain/script.
« Last Edit: May 19, 2019, 06:30:20 pm by robin »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1643
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #22 on: May 19, 2019, 06:59:09 pm »
Can you upload an example of this? Items should be placed correctly even with vertical levels. Does the log file after you get the crash say anything about the height of the map?

Edit: I was able to reproduce the crash by uncommenting the spawners on the Transporter and using it on the Alien Gate Assault mission. It looks like the height offset of the craft is getting added to the z-position of the items twice, placing your turrets off the top of the map. I'm working on refactoring the verticalLevels code and this is already fixed in my WIP version of OXCE. In the meantime, if you increase the height of the deployment to 11 and leave the height of the verticalLevels at 9, the turrets will be spawned without a crash. They'll also look a little weird since they'll fall from the top of the map to their intended positions.

Offline robin

  • Commander
  • *****
  • Posts: 983
  • ULTIMATE ROOKIE
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #23 on: May 19, 2019, 07:34:52 pm »
Can you upload an example of this? Items should be placed correctly even with vertical levels. Does the log file after you get the crash say anything about the height of the map?

Edit: I was able to reproduce the crash by uncommenting the spawners on the Transporter and using it on the Alien Gate Assault mission. It looks like the height offset of the craft is getting added to the z-position of the items twice, placing your turrets off the top of the map. I'm working on refactoring the verticalLevels code and this is already fixed in my WIP version of OXCE. In the meantime, if you increase the height of the deployment to 11 and leave the height of the verticalLevels at 9, the turrets will be spawned without a crash. They'll also look a little weird since they'll fall from the top of the map to their intended positions.
I see thanks.
Does this also mean I can make brainsuckers rain onto the map?

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1643
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #24 on: May 19, 2019, 09:21:34 pm »
Probably, just put the spawn item high enough on the map blocks.