Factory batching/squads, unit cannon-like behavior.

Discussion in 'Mod Discussions' started by bsergent, June 8, 2015.

  1. bsergent

    bsergent Active Member

    Messages:
    236
    Likes Received:
    73
    Would it be possible to make factories release units in batches kind of like how the unit cannon loads and then fires?

    I imagine it would work like this:

    Fac set to infinite, build one infantry bot, infantry bots come out 1 at a time, tell it 2, they come out two at a time, tell it 1 infantry 2 arty, batch of three pops out.

    Like think of it as a build loop, when it reaches the end of a loop, it "releases."

    I've been running into a lot of "this game can't do that" type walls in my mod project wishlist. Is this another one of those things?

    Logically it would seem like it isn't since the unit cannon sort of does this already, but I'm also learning to ignore logic when it comes to modding this game heh.
    sgrock likes this.
  2. Killerkiwijuice

    Killerkiwijuice Post Master General

    Messages:
    3,871
    Likes Received:
    3,608
    There's probably some unit cannon JSON attributes that would work for normal factories. Check to see if there's anything different in the unit cannon.json compared to the normal factory .json s.
    sgrock and bsergent like this.
  3. bsergent

    bsergent Active Member

    Messages:
    236
    Likes Received:
    73
    Well I took a look and tried some quick and dirty cut and pastes.

    I did get it to "store_units" and "hide_units" but if I turn on hiding they effectively vanished. I could find no way to launch them.

    Store units by itself essentially has the units just stand where they are built on top of the factory and you can select and order them normally.

    The files appear pretty radically different to me, but it seems like the basic components of the system will work.

    The unit cannon had this list of spawn points that when added to the factory totally prevented building.

    Code:
      "factory":{
      "deploy_projectile":"/pa/units/land/unit_cannon/unit_cannon_deploy.json",
      "store_units":true,
      "pass_on_orders":false,
      "spawn_points":[
      "socket_build",
      "socket_build",
      "socket_build",
      "socket_build",
      "socket_build",
      "socket_build",
      "socket_build",
      "socket_build",
      "socket_build",
      "socket_build",
      "socket_build",
      "socket_build"
      ],
      "hide_deploy_projectile":true,
      "hide_stored_units":true
      },
    First thing I did was copy that code in and start removing pieces, like the deploy projectile line. Got odd results but no crashes or anything.

    Not sure how I would get it to deploy hidden units.

    Seems to me like the unit cannon has more in common with a fab bot than a bot factory.

    Any suggestions how I should proceed?

    First priority would be to repair or create a way to deploy hidden units, or make sure they aren't being annihilated.
  4. Killerkiwijuice

    Killerkiwijuice Post Master General

    Messages:
    3,871
    Likes Received:
    3,608
    Try changing those spawn points to bone_root . The number of spawn points in that array should determine the number of units per 'cartridge'.

    I'd have to see if i could make a factory like that first, it's all about trial and error with .json s since there's not very much documentation.
  5. bsergent

    bsergent Active Member

    Messages:
    236
    Likes Received:
    73
    If you change them to bone_root there's no change from socket_build (as yet). I reduced the number of them (roots) to 4 and the factory goes through 4 repetitions and stops. Much like a full unit cannon.

    What's missing is a way to deploy/fire them.

    Code:
        "factory":{
        "deploy_projectile":"/pa/units/land/unit_cannon/unit_cannon_deploy.json",
        "store_units":true,
        "pass_on_orders":false,
        "spawn_points":[
            "bone_root",
            "bone_root",
            "bone_root",
            "bone_root"
        ],
        "hide_deploy_projectile":true,
        "hide_stored_units":true
        },
    I have the whole unit cannon folder shadowed as well so the factory actually seems to use that deploy json. The unit cannon has a tool weapon but the factory does not so I added this to the factory tools:

    Code:
        "tools": [{
            "spec_id":"/pa/units/land/unit_cannon/unit_cannon_tool_weapon.json",
            "record_index":0,
            "aim_bone":"bone_turret",
            "muzzle_bone":"socket_muzzle"
          },
    It didn't change anything. I was kind of hoping I could tell the factory to attack somewhere and it would trigger the deployment of the stored units but newp, nothing.

    So I rolled back that change.

    I saw transporter and "release payload" type things in the unit cannon deploy json, so I took a look at the transporter aircraft.

    Still couldn't see any real trigger that says like release your units, except:

    Code:
        "ORDER_Unload",
    So I added that to bot factory.

    Nothing happened except now I had an unload button.

    Between the various elements of the unit cannon there is something that says deploy.

    So unload isn't doing anything... Maybe because it lacks capacity since the unit cannon is granted capacity via the projectiles.

    So I added this to the bot factory:

    Code:
        "transporter": {
            "capacity": 4,
            "transporter_attach_bone": "bone_root",
            "transportable_attach_offset": "root"
        },
    Still nothing...

    So I removed the deploy projectile line. No change.

    Nothing I do will make it launch its stored units.

    Once 4 units are stored I can't get it to unload them or dispose of them. The factory is essentially frozen and useless after that point.

    No idea what else I could try.
  6. stuart98

    stuart98 Post Master General

    Messages:
    6,006
    Likes Received:
    3,888
    Try giving it these command caps:
    'command_caps': ['ORDER_FactoryBuild', 'ORDER_Attack'],
  7. bsergent

    bsergent Active Member

    Messages:
    236
    Likes Received:
    73
    That reduced its compliment of commands to attack and stop. Behavior unchanged.

Share This Page