aliens

Author Topic: [Solved] specify the quantity of spawned units  (Read 1356 times)

Offline Alex_D

  • Colonel
  • ****
  • Posts: 482
    • View Profile
[Solved] specify the quantity of spawned units
« on: September 16, 2021, 05:23:01 pm »
Background:
Currently the game spawns other units from dead units, or from items using the "spawnUnit" and "spawnUnitFaction" commands. Examples:
Code: [Select]
units:
  - type: STR_ZOMBIE
    spawnUnit: STR_ZOMBIE_CRAWLER

items:
  - type: STR_BURROWED_ZERG_ZERGLING
    spawnUnit: STR_ZERG_ZERGLING
    spawnUnitFaction: 1
But it's currently limited to only one unit at the time.

Request:
I'd like to see if it's possible to implement the following feature: Specify the quantity of spawned units. Example:
Code: [Select]
units:
  - type: STR_MEGAWORM #2x2 unit
    spawnUnit: STR_MICROWORM
    spawnUnitQty: 4

items:
  - type: STR_COCOON_ZERG_ZERGLINGS
    spawnUnit: STR_ZERG_ZERGLING
    spawnUnitFaction: 1
    spawnUnitQty: 2

I know there are current workarounds such as activated spawner grenades in backpacks and such, but this may be a more direct and "clean" way to implement this feature.
I don't know if it's even possible due to code limitations. But if it is, can you implement it? If not both, at least the case of a 2x2 unit to "die" leaving behind more than one.
« Last Edit: February 19, 2023, 09:11:50 am by Meridian »

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: [request] specify the quantity of spawned units
« Reply #1 on: September 17, 2021, 12:14:23 pm »
This would require lot of refactoring to make possible as current spawn code effective replace old unit with new one.
This mean you can have multiple spawned units because second spawned unit can't replace old unit as it do not exists any more.

Offline Buscher

  • Colonel
  • ****
  • Posts: 167
    • View Profile
Re: [request] specify the quantity of spawned units
« Reply #2 on: September 18, 2021, 01:10:15 am »
You can do all that with clever use of spawner grenades.
I had a similar proof of concept sitting around to play around with. Back then it was a recursive spawning of units. When they die, they drop spawner grenades, which spawn units, which then die again to drop more spawner grenades.
Now I have refactored and cleaned it up a bit. This also works fine with 1x1 creating 2x2 units.

The number of new units is limited per corpse as the game needs to find a nearby spot to spawn the new units.
You can see an example here.