[TUTORIAL] Creating a new unit from scratch

Discussion in 'Mod Discussions' started by killerkiwijuice, January 3, 2016.

  1. themax267

    themax267 New Member

    Messages:
    21
    Likes Received:
    15
    20170214002530_1.jpg Got it to scale down right.
  2. themax267

    themax267 New Member

    Messages:
    21
    Likes Received:
    15
    I have two critical questions which I can't find the answers to. First off I've basically been trying to replicate the hover tank and spinner aa vehicle animation models in order to figure out how to make my turret move. Do I have to animate them or do I just have to put the bone labels inside of my anim_tree file with the correct axis orientation. Also for making a hover animation is that done by moving the bone_root or do I have to animate a new bone?
  3. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    You can use existing animations, but the position, rotation, and size have to be exactly the same. It would be easier just to make a new animation, in the rare case of hover animations as described below.

    Bone root is always 0,0,0. The part of a unit that makes it hover is actually defined in the unit spec. Check out the hover tank, it should have something that says hover: path in its animation section. This animation can be easily reused.
    stuart98 and themax267 like this.
  4. themax267

    themax267 New Member

    Messages:
    21
    Likes Received:
    15
    Okay thanks that's pretty straightforward. So do I have to animate my turret as well or does the game just move it by itself when I give it which axis to use for aiming in the anim_tree? I want to have the turret base move independently of the turret gun. So it would be the turret's base or stand first rotating to the direction of the target, then the turret gun adjusting the pitch.
    Last edited: February 14, 2017
  5. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    Yes, that would be in the anim tree. Check out some preexisting trees if you want to see how it works throughout various bone structures.
  6. themax267

    themax267 New Member

    Messages:
    21
    Likes Received:
    15
    Got my model to work okay, It now moves the turret with the pitch and pivot, plus it hovers. My only problem now is that when my model is shooting at something that's behind it it will move the pivot fine but for some reason the pitch bone in the actual turret makes it flip over giving me this. It shoots from the front and the sides fine though. Just to clarify it can shoot at targets behind its just the pitch bone's look that is wonky. 20170216133111_1.jpg
  7. themax267

    themax267 New Member

    Messages:
    21
    Likes Received:
    15
    Nvm I figured it out, I just had to put my pivot bone first before the turret one. Thank you all for helping me get my first PA mod together I really appreciate the help. :)
    cdrkf, stuart98 and killerkiwijuice like this.
  8. cdrkf

    cdrkf Post Master General

    Messages:
    5,721
    Likes Received:
    4,793
    So is this new unit going to be released on the CMM? I'd love to have a play around with it...
    themax267 likes this.
  9. themax267

    themax267 New Member

    Messages:
    21
    Likes Received:
    15
    Yes I definitely want to put it on CMM. I just have some balancing tweaks to do plus maybe change some of the particle colors for it's weapon. I also might try to figure out how to get the ai to use the unit as well.
    cdrkf likes this.
  10. themax267

    themax267 New Member

    Messages:
    21
    Likes Received:
    15
    Is there an easy way to incorporate my unit into the ai's build order or do I have to write a whole new ai? Also can I easily make my unit mod compatible with Queller AI and Legion?
  11. stuart98

    stuart98 Post Master General

    Messages:
    6,009
    Likes Received:
    3,888
    Hey, can I use your unit in Planetary Obliteration? Credit will be given.

    AI?

    Here's how I recommend you handle AI:

    First, you need a new unit map file, located in /pa/ai/unit_maps/

    call it maxunits.json

    Format it like so:
    Code:
    {
       "unit_map": {
         "MaxHoverRaft": {
           "spec_id": "/pa/units/land/max_hoverraft/max_hoverraft.json"
         }
       }
    }
    You can now call upon the unit in AI code with the name MaxHoverRaft.

    Next, copy all of the factory builds files from each AI (make sure that the directories match!). You'll need to set your mod's priority to a lower number than normal (90 should work) to make sure that everything is properly overwritten.

    Add something like this in each factory build file, after another unit:

    Code:
    {
         "name": "Basic Hover Raft",
         "to_build": "MaxHoverRaft",
         "instance_count": -1,
         "max_num_assisters": 10,
         "priority": 97,
         "builders": ["BasicVehicleFactory", "UnitCannon"],
         "build_conditions": [
           [{
             "test_type": "HasPersonalityTag",
             "string0": "Vanilla",
             "boolean": true
           }, {
             "test_type": "AloneOnPlanet",
             "boolean": false
           }, {
             "test_type": "CanDeployLandFromBase",
             "boolean": true
           }, {
             "test_type": "CanAffordBuildDemand"
           }],
           [{
             "test_type": "HasPersonalityTag",
             "string0": "Vanilla",
             "boolean": true
           }, {
             "test_type": "AloneOnPlanet",
             "boolean": true
           }, {
             "test_type": "CanAffordBuildDemand"
           }, {
             "test_type": "OtherPlanetCanReceiveLandUnitAssistance",
             "boolean": true
           }, {
             "test_type": "UnitCountOnPlanet",
             "unit_type_string0": "Structure & Teleporter",
             "compare0": ">",
             "value0": 0
           }]
         ]
       },
    
    That was copied from the ant; you might want to change it somewhat.

    Don't use the vanilla factory builds file, it's very important that you use the one from the AI Mod Compatibility Patch instead.

    If you did everything right, it should now be working.
    Last edited: February 20, 2017
    themax267 likes this.
  12. themax267

    themax267 New Member

    Messages:
    21
    Likes Received:
    15
    Thanks that helps a lot. That sounds great what kind of mod is it?
  13. stuart98

    stuart98 Post Master General

    Messages:
    6,009
    Likes Received:
    3,888
    PO is a mega-mod that Adds new units to MLA and legion while rebalancing everything.

    Your unit looks like a fine model to replace the Legion laser hovertank, currently using the one on the left:
    [​IMG]
    Pretty bland model; yours is much more interesting looking.

    BTW I just looked at your model and you've got a very inefficient allocation of tris. You should see how many tris you can remove without compromising the look of the unit (the barrel has a bunch)
    Last edited: February 20, 2017
  14. themax267

    themax267 New Member

    Messages:
    21
    Likes Received:
    15
    Sounds good, I'll try
    Sounds good, I'll see what I can do.
    stuart98 likes this.
  15. themax267

    themax267 New Member

    Messages:
    21
    Likes Received:
    15
    I've made a few modifications, one being the barrel is now a hexagon with three rectangles. Plus I've also eliminated a few unnecessary lines. The model is also a little bit smaller. BTW I'm going to post to my WIP thread for now on just for organization's sake.
    20170222145650_1.jpg 20170222145708_1.jpg 20170222145716_1.jpg 20170222145722_1.jpg 20170222184456_1.jpg
    Last edited: February 23, 2017
  16. Anonemous2

    Anonemous2 Member

    Messages:
    35
    Likes Received:
    58
    While in 3ds Max, you need to add the mask, diffuse, and material textures to the model before exporting as .fbx .
    What parameters do you need to change in order to difference the textures from each-other?
  17. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    Technically you just need to unwrap, but painting on the model with different colors for each mask is a good idea to get the feel of the final texture. The names of the texture papa files determines the difference. However, mask and material need the correct colors to work correctly.
    Anonemous2 likes this.
  18. Anonemous2

    Anonemous2 Member

    Messages:
    35
    Likes Received:
    58
    So I could export a unit without entering the materials editor (assuming I had its UV map so I could make its textures), and it would look for its own textures in the same directory as the model?
  19. manlebtnureinmal

    manlebtnureinmal Active Member

    Messages:
    138
    Likes Received:
    131
    yeah normally.

    Just got the thing I was testing last night working; the texture editing can be done completely separately of the model exporting.
  20. killerkiwijuice

    killerkiwijuice Post Master General

    Messages:
    3,879
    Likes Received:
    3,597
    After all, the uv unwrap is just a bunch of coordinates that determines which parts of the textured picture go where on the model. Its been a while, but I think I used the automatic uv unwrap then used that to determine which face of the model I was editing and directly colored that in PS. So, I didn't color in 3ds.

Share This Page