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

Offline SuperCaffeineDude

  • Colonel
  • ****
  • Posts: 108
    • 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: 1933
  • 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: 498
    • 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

  • Colonel
  • ****
  • Posts: 108
    • 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: 1224
  • 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: 1933
  • 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: 1224
  • 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: 1933
  • 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: 1224
  • 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: 1933
  • 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.

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #25 on: December 24, 2019, 12:40:50 am »
Anyone found some trick to make X-Com spawned units recoverable?
I just finished a portable robot only to discover that I can't recover it in any way aaahhhh


Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #26 on: December 24, 2019, 10:15:34 am »
Anyone found some trick to make X-Com spawned units recoverable?
I just finished a portable robot only to discover that I can't recover it in any way aaahhhh

Using "civilianRecoveryType".

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #27 on: December 24, 2019, 10:50:37 am »
Using "civilianRecoveryType".
It works! Thanks a lot.

Offline TBeholder

  • Sergeant
  • **
  • Posts: 41
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #28 on: January 02, 2023, 05:53:03 pm »
Items that may be used to enable this behavior are:
  • Firearms that use themselves as ammo - lasers, single-shot launchers, etc.
  • Any ammunition for a firearm.
  • Melee weapons or melee attacks on any item.
  • Grenades and proximity mines.
  • Psi-amps.
So, things that count as “attacks”.

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
Mods use this for arbitrary spawns pre-placed on map as “grenades”. That could also be invisible and timed or toggling / unreliable, perhaps.
Hmm, maybe proxy mines as ambush / wildlife type spawns?
Doom spawn cubes / Half-life Nihilant’s teleports as “guns”…

Also, spawning does not interfere with the usual functionality (such as explosion, which goes off before the unit is spawned). I can only think of 2 uses: “splat! lol, telefrag” and special effects of “summoning in a puff of smoke” sort.

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [Documentation] Spawning Units from Items
« Reply #29 on: January 09, 2023, 04:46:58 am »
One problem i encounter:
"spawnunit" does not work with corpseitem, used with "specab".
It leads to broken functionality with resurrecting units. (like phoenix) Only working decision now for that is an item, placed in a unit's pocket. But this grenade-item will explode and spawn new unit not only after wearer's death, but after stunning too. So these units become non-capturable, or bugged.
Two ways to fix it i see:
- first, add spawnunit functionality to corpsess with specab.
- second, make some kind of built-in weapons dropable. Dont know how to do it, really.