How do you tell a factory what unit's it can build?

Discussion in 'Mod Discussions' started by igncom1, September 16, 2014.

  1. igncom1

    igncom1 Post Master General

    Messages:
    7,961
    Likes Received:
    3,132
    How do you tell a factory what unit's it can build?

    Like ive made (Or attempted) a orbital boom bot but I don't know how to make it build able.
  2. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    I haven't actually added a buildable unit, but this should be a start:

    Factory/fabber: buildable types. You're probably going to leave this one alone, but the unit has to match.

    ex: Orbital factory:
    Code:
      "buildable_types": "Orbital & FactoryBuild", 
    
    Units: unit types

    ex: Boom Bot:
    Code:
      "unit_types": [
        "UNITTYPE_Bot", 
        "UNITTYPE_Mobile", 
        "UNITTYPE_Land", 
        "UNITTYPE_Basic", 
        "UNITTYPE_FactoryBuild"
      ], 
    
    Practically speaking, the unit also needs to be in /media/ui/main/shared/js/build.js so it appears in the UI, and /media/pa/units/unit_list.js will allow it's info to appear on hover etc.
  3. igncom1

    igncom1 Post Master General

    Messages:
    7,961
    Likes Received:
    3,132
    Hummmmmmm...... did try that but the unit doesn't appear yet.
  4. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    Can you post/PM the unit blueprint, and confirm you've added an entry to unit_list.json & build.js?

    Edit: @wondible: unit_list.js doesn't control hover info, it is actually the master list of unit blueprints the engine will load. If it's not in this list, the game simply does not know about it.
  5. igncom1

    igncom1 Post Master General

    Messages:
    7,961
    Likes Received:
    3,132
    Code:
    {"base_spec":"/pa/units/orbital/base_orbital/base_orbital.json",
    "display_name":"!LOC(units:avenger.message):Wizz",
    "description":"Cruse Missile- Fast moving orbital shuttle for offense.",
    "max_health":10,
    "build_metal_cost":45,
    "gravwell_velocity_multiplier":6.0,
    "wreckage_health_frac":0.0,
    "spawn_layers":"WL_Orbital",
    "attachable":{"offsets":{"root":[0,0,0]}},
    "unit_types":["UNITTYPE_Mobile","UNITTYPE_Offense","UNITTYPE_Orbital","UNITTYPE_Fighter","UNITTYPE_Basic","UNITTYPE_FactoryBuild"],
    "command_caps":["ORDER_Move","ORDER_Patrol","ORDER_Attack","ORDER_Assist"],
    "guard_layer":"WL_Orbital",
    "guard_radius":200,
    "navigation":{"type":"orbital","acceleration":50,"brake":50,"move_speed":300,"turn_speed":30,"circle_min_time":2,"circle_max_time":4,
    "hover_time":-1.0,"aggressive_behavior":"circle","aggressive_distance":150,"bank_factor":1},
    "physics":{"radius":5,"push_class":15,"gravity_scalar":0.001},
    "recon":{"observer":{"items":[{"layer":"orbital","channel":"sight","shape":"sphere","radius":250}]}},
    "model":{"filename":"/pa/units/land/bot_bomb/bot_bomb.papa",
    "animations":{"death01":"/pa/units/land/bot_bomb/bot_bomb_anim_death01.papa",
    "idle":"/pa/units/land/bot_bomb/bot_bomb_anim_idle.papa",
    "walk":"/pa/units/land/bot_bomb/bot_bomb_anim_run.papa"},
    "animtree":"/pa/anim/anim_trees/bot_bomb_anim_tree.json","walk_speed":40},
    "tools":[{"spec_id":"/pa/units/orbital/orbital_boom/orbital_boom_tool_weapon.json","aim_bone":"bone_root","muzzle_bone":"bone_root"}],
    "events":{"build_complete":{"audio_cue":"/SE/Build_Complete/bot"},"fired":{"audio_cue":"","effect_spec":""},"died":{"audio_cue":"/SE/Death/Bot_bomb","effect_spec":"/pa/units/land/bot_bomb/bot_bomb_ammo_explosion.pfx","effect_scale":1.0}},"audio":{"loops":{"move":{"cue":"/SE/Movement/bot/T2_bot_bomb_loop","flag":"vel_changed","should_start_func":"is_moving","should_stop_func":"is_not_moving"}},"selection_response":{"cue":"/SE/Selection/bot/bot_bomb"}},"TEMP_texelinfo":6.38702,"mesh_bounds":[3.8,4.5,3.2]}
    For the unit list and build.js, is there a specific folder structure I need to house them?
  6. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    That might in fact be true for buildable units, but you can paste them just fine; see Puppetmaster's drop_pod_launcher.
  7. masterdigital

    masterdigital Uber Alumni

    Messages:
    438
    Likes Received:
    833
    To get a unit to appear in the build bar, you need to assign it a position. You should add an entry to the list in build.js. (ui/main/shared/js). Probably around line 67.
    squishypon3 likes this.
  8. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Your unit file can be anywhere (mounted; e.g. in an enabled mod), but unit_list and build are global resources; only one mod can shadow each at a time. Shadowing means the relative path in your mod has to exactly match the path within PA's media folder. It might be possible to runtime modify the build data used by the app, and to modify certain uses of unit_list, but now you're in territory where I fear to tread ;^)
    squishypon3 likes this.

Share This Page