Buildings (or projectile explosions?) auto-spawning units

Discussion in 'Mod Discussions' started by swizzlewizzle, November 6, 2014.

  1. swizzlewizzle

    swizzlewizzle Active Member

    Messages:
    216
    Likes Received:
    56
    As far as I have seen, the only way to spawn units based on arbitrary code in a normal server mod (not direct server scripting) is to enable the spawn units cheat for clients (and hope that they don't create a script to cheat using it).

    As an aside - if anyone knows a better way to spawn units programmatically without the difficulties of having to force people to run offline servers for the mod to work, please let me know.

    Anyways, my question is: Is there some way to attach a looping "spawn" script to a building after it is built? Additionally, could this sort of code be fired off at the impact point of a projectile? (aka, artillery fires a shell.. the shell does not explode, but instead, starts spawning units at the point of impact (or perhaps spawns a building that does so?))

    Does this sound doable with what we have to work with right now?
  2. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    Sounds like you are trying to make the fabled unit cannon. All I can say is, I know others have tried. That being said, it doesn't hurt TO try.

    What I do know, is that factories spawn units. How they do it, could it not be reimplemented to do what you are trying to do?

    I am thinking, in teh case of unit cannon for instance, make the "fx" from the "build arm" instead be a generic pod or if possible a specific unit being fired out instead of nanolathes. Then, make it basically instantly install the entire value of the metal of the unit, or make the build metal output 10000 so the unit practically builds in less than a second. Then, the unit sort of glitchedly appears on the target, if there is some way to specify it possible to build on other planets.

    Going your route, to make a projectile spawn a unit, I am not sure about the boundaries, but firing a rocket and upon its landing making a unit spawn I am sure has been tried, and I have no clue what the problem occured with the attempt.
  3. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Spawning on explosion:
    No, it's not possible the way you would expect it. If you have a look at the orbital launcher, you can see that it is actually possible to pack a unit into a projectile and to release it upon destruction, but unfortunately this uses a slightly different system than the normal weapons, so you have no access to procedural aiming. And without, you are not going to hit anything. As long as you remain on the same planet you CAN try to assign a procedural weapon with the same physic attributes for a ballistic type projectile to the same spawn bone, so the spawn bone is aligned accordingly, but if you do this, you also have to deactivate ALL corrective steering, speed derivation and all other parameters which would make the projectile non-deterministic. You can make the "assist projectile" invisible and 0 damage.

    Just spawning however IS possible. That's just what a factory does, and as you can see on the nuke launcher, construction of a specific unit can also be hardwired to start on creation of the factory.

    And launching units you have loaded in? No, not possible either. The transportable system, the weapon system, and the "launch as a projectile" system are completely unrelated. Maybe it's possible to transfer units in between by server side scripts, but the documentation on the server API is pretty much non-existent so you would have to guess a lot.

    Plus, server side scripts can't be shipped as regular mods currently.
    wondible likes this.

Share This Page