Modding in new Buildings

Discussion in 'Mod Discussions' started by kerbalweirdo123, September 29, 2014.

  1. kerbalweirdo123

    kerbalweirdo123 New Member

    Messages:
    15
    Likes Received:
    7
    How could I mod in a new building, I want to add a tower that slowly heals all nearby units. It would be buildable by commanders and adv-fabbers. Has anyone here modded in a building before? Also how could I create custom behaviour for my building?

    Also, first post! :D
  2. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    There is something similar going on in this thread. No definite results yet though.
  3. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    Custom is a limited term. However, it sounds like you could take a single laser tower, change the weapon to a combat fabber's weapon, and give it a large range of like 150-250.

    Take some server mods that add units. Use them as a framework of how a server mod works. Read up on it. From there, just note that the combat fabber's build arm in their folder (or possibly in the "pa/tools" folder), can copy pasted into the single laser tower's weapon .json with notepad, and pretty much work instantly. It already specifies "auto repair in range" and you would have to turn up the range value.

    Also, as denim pointed out, the structure apparently needs a navigation field. Just copy another unit's "navigation":{...} area and paste it into the single laser tower, and give it movement values of 0. Oh, also, give it "Command Caps" like a base_commander's command caps, that is what give the unit it's sidebar. Give it assist, reclaim, repair, and patrol. Obviously don't give it fire-secondary and "move".
    Last edited: September 29, 2014
  4. CryFisch

    CryFisch Member

    Messages:
    98
    Likes Received:
    28
    Something i made for me, double laser tower with autorepair.

    If you set it on patrole, it supports factorys or constructing

    Code:
    {
      "base_spec": "/pa/units/land/base_bot/base_bot.json",
      "display_name": "!LOC(units:fabrication_structure.message):Fabrication Structure",
      "description": "!LOC(units:missing.message):Missing.",
      "max_health": 1500,
      "build_metal_cost": 150,
      "atrophy_rate": 7.5,
      "atrophy_cool_down": 15,
      "spawn_layers": "WL_AnyHorizontalGroundOrWaterSurface",
      "unit_types": [
        "UNITTYPE_Fabber",
        "UNITTYPE_Structure",
        "UNITTYPE_Basic",
        "UNITTYPE_Land",
        "UNITTYPE_SurfaceDefense",
        "UNITTYPE_Defense",
        "UNITTYPE_FabBuild"
      ],
      "command_caps": [
        "ORDER_Patrol",
        "ORDER_Build",
        "ORDER_Reclaim",
        "ORDER_Repair",
        "ORDER_Assist",
        "ORDER_Use"
      ],
      "guard_radius": 120,
      "guard_layer": "WL_AnySurface",
      "recon": {
        "observer": {
          "items": [
            {
              "layer": "surface_and_air",
              "channel": "sight",
              "shape": "capsule",
              "radius": 130
            }
          ]
        }
      },
    
        "navigation": {
        "type": "land-small",
        "acceleration": 0,
        "brake": 0,
        "move_speed": 0,
        "turn_speed": 0,
        "dodge_radius": 0,
        "dodge_multiplier": 0,
        "wobble_factor": 0,
        "wobble_speed": 0
        },
    
    
      "model": [
        {
          "layer": "WL_LandHorizontal",
          "filename": "/pa/units/land/laser_defense/laser_defense.papa",
          "animtree": "/pa/anim/anim_trees/defense_turret_anim_tree.json",
          "skirt_decal": "/pa/effects/specs/skirt_defense.json"
        },
        {
          "layer": "WL_WaterSurface",
          "filename": "/pa/units/sea/floating_laser/floating_laser.papa",
          "animtree": "/pa/anim/anim_trees/defense_turret_anim_tree.json"
        }
      ],
      "tools": [
        {
          "spec_id": "/pa/units/land/fabrication_structure/fabrication_structure_build_arm.json",
          "aim_bone": "bone_pitch"
        }
      ],
      "fx_offsets": [
        {
          "type": "build",
          "filename": "/pa/effects/specs/fab_spray.pfx",
          "bone": "socket_rightMuzzle",
          "offset": [
            0,
            -1.891,
            -0.11
          ],
          "orientation": [
            0,
            0,
            0
          ]
        },
        {
          "type": "build",
          "filename": "/pa/effects/specs/fab_spray.pfx",
          "bone": "socket_leftMuzzle",
          "offset": [
            0,
            -1.891,
            -0.11
          ],
          "orientation": [
            0,
            0,
            0
          ]
        }
      ],
      "events": {
        "build_complete": {
          "audio_cue": "/SE/Build_Complete/structure_small"
        },
        "died": {
          "audio_cue": "/SE/Death/structure_small",
          "effect_scale": 0.6
        }
      },
      "mesh_bounds": [
        6,
        6,
        17.2
      ],
      "TEMP_texelinfo": 10.2184,
      "area_build_separation": 18
    }
    Weapon base is the advanced bot fabber

    Code:
    {"base_spec":"/pa/tools/engineer_build_arm_adv/engineer_build_arm_adv.json",
    
    "yaw_rate":360,
    "pitch_rate":360,
    
    "pitch_range":300,
    "yaw_range":300,
    
    "auto_repair": true,
    "auto_reclaim": true,
    "auto_assist": true,
    
    "max_range":80,
    
    "construction_demand":{"energy":3000,"metal":80}}

    Edit: picture

    Attached Files:

    Last edited: September 29, 2014
  5. CryFisch

    CryFisch Member

    Messages:
    98
    Likes Received:
    28
    "UNITTYPE_CmdBuild", to let to commander build it
  6. kerbalweirdo123

    kerbalweirdo123 New Member

    Messages:
    15
    Likes Received:
    7
    Thanks for this! But what about also making another (new) unit able to build it as well, but ONLY that unit and commanders?
  7. CryFisch

    CryFisch Member

    Messages:
    98
    Likes Received:
    28
    fabrication bot
    "buildable_types":"Land & Structure & Basic | Factory & Basic | Factory & Advanced & Bot & Land | FabBuild",

    maybe you need to create a new unittype for your bouilding and add it to the buildable types

    just an idea, dont know if it works
  8. stuart98

    stuart98 Post Master General

    Messages:
    6,009
    Likes Received:
    3,888
    You can't create unit types, but you can use custom1, custom2, etc for it.
    squishypon3 likes this.

Share This Page