[Modding Guide] - Custom Vehicles

Discussion in 'PC Mods' started by Phacops, Jun 7, 2014.

  1. Phacops

    Phacops Here To Help

    3.3.9 Resource Convertor: www.precambriandesigns.com/drupal/misc/RC339.zip


    Will use any feedback to come back to make edits for clarity, and do this myself, as well.

    See main modding thread for programs, setup, and tips that pre-text this guide: https://forums.undeadlabs.com/threads/custom-mesh-modding-how-to-how-three-how-four.36233/

    Here's the actual .Zip to look through. Edit: Updated Zip package with the FlowGraph for spawning vehicles at the start of the game. Doesn't respawn them if you exit the game and continue.
    Package is tested and working, not perfect but what necessitates a hacky approach should be assumed to have a hacky result. Particularly speaking of the keypress spawn which sometimes takes a few presses, for some reason.

    Used Nexus Mod Manager for quick Install/Uninstall as a Zip.

    Unit1.jpg
    • Blender > New File
    • Starts with the default cube

    • Let's clear up a couple things for visibility first:
      • Right side has a toolbar
      • At the top should be "Scene" with a Camera, a Cube, and a Light
      • Left click the icon to the left of Camera
      • Hover the mouse in the main space where you see your cube
      • Press Delete key
        • Confirm deletion
        • Click OK
      • Do the same for Light
    • Next, doubleclick the name Cube on the right, where we deleted Camera and Light.
      • Change the name to hull
        • All lowercase
          • Very important because that will have the game automatically set it up in the file
    • Go to the already applied material
    • Change the name to suit what will be produced by CryBlend through our ExportNode, otherwise it won't work.
    • Click the pluses to the left of hull until you see Material
    • Doubleclick the name Material and change it to whatever your vehicle file will be named
    • testvehicle__1__one__physNone is mine
    • Let's look at the structure:
      • testvehicle
        • [name]
      • __
        • [That's a double underscore, very important because Python will not export it if it's a single]
      • 1
        • [A 1 to indicate it is the first material]
      • __
        • [All double underscores, see a trend?]
      • one
        • [Whatever the name needs to be to be obvious, since this is very basic we don't need GunMetal for a gun's metal material, or WindowsillWood for the windowsill's wood, etc.]
      • __physNone
        • [Notes that this will be rendered but no physics will be applied, very important because this will be a complex polygon and physics on every little piece would be ridiculous amounts of processor time]
        • We can fasttrack typing physics details by using the CryBlend menu at the top of the screen with the Material selected and all the info laid out except the physics on the end.
        • Go to CryBlend menu, then Add Material Physics and choose what you need
    • Note: You can also do material things - if you're a material girl living in a material world - through the Material menu
      • That's below the section with the objects we deleted and hull
      • A little pink checkered sphere/circle which will have a flat list rather than be part of a hierarchy.

    Now we have hull, a material to get it textured by, and the physics label to tell the game what it should be doing.
    • Press the 'N' key to reveal the right-side toolbar with the info we need
      • Assuming it isn't showing already, that is. It should have the spacial position and dimensions of the object, etc., very handy.
    • Right click cube to select it, press S (to scale) then Y which is the green arrow (To change only the Y-Axis when scaling)
      • Giving it something like ~2.5 squares on the grid in size
    • Hold down the mouse wheel button and drag to move the view around the selected object, this box
    • Or press 7 on the Numpad for a 100% top view to see it better
    • Now we can do the X-axis, press S (to scale), then X which is the red arrow (To change only the Y-Axis when scaling)
      • Giving it something like ~2 squares on the grid in size
    • It should already be a good enough size for a basic model on the Z-axis, in blue.

    Next, the wheels.

    Note on image: I changed it so things were easier by replicating the SoD labels of the wheels so they should be wheel1, 2, 3, 4, instead of the screenshot which shows wheel_1.

    Unit2.jpg
    • Top-menus > Add > Circle
    • Then select the circle with a right click and then press F, to make it a face, that is close it all off instead of being open.
    • Press E, to Extrude and, before moving the mouse, press Z, to only move it on the Z-Axis
    • Extrude will grab that face we made, and all the points, duplicate them and run them along the Z-axis we chose to make a cylinder.
      • We could have just made a cylinder but this saves the work of selecting all those vertices and trying to close them off properly.
    • We just move the mouse up until it becomes a cylinder that looks like a basic wheel
    • Hover over a vertex and press L, this will select all lines that are connected, resulting in a full object. Useful for very complex meshes like buildings where you need one piece to move or reshape.
    Now we need to spin it so it lines lines up correctly with the hull.
    • We want to check the positive Y-direction which will be the way the green arrow faces when you select an object.
    • This will be the front of the vehicle, so we want the wheel on the front-left.
      • Note: If you hang it out a bit from the front end then it can drive up surfaces and over fences and such instead of slamming the front end - assuming you want this to be a vehicle like that.
    • Super fast way, with the cylinder (which will now be referred to as 'wheel') selected:
      • Don't move the mouse yet, press R for rotate, then Y for Y-Axis only, then type 90 into the numbers row above the letters on the keyboard. This will rotate it 90 degrees on the Y axis, perfectly. Super easy!
    • Then we move it into position next to the vehicle leaving a small amount of space between them for what we do next, which you can move manually by having it selected again, and just left clicking and dragging it on the directional poles, or you can press G to move the whole thing in any direction though that gets a little wonky.
    • Now that we have it in position we, with the wheel selected, press Shift+D to duplicate that entire object, then we press S to scale, and move it very slightly away from the mesh so that it makes a bigger one around that one.

    Now we have one small wheel inside one big wheel. If it's hard to tell then you can press Z to go to wireframe mode, and Z to come back to full-mode after, if needed.
    • Now we go into Wireframe mode by pressing Z, then, we want only the bigger wheel surrounding the wheel to be selected, not the inside one.
     
    Last edited: Oct 30, 2015
    Griffonclaw39, Analen, yk999 and 4 others like this.
  2. Phacops

    Phacops Here To Help

    We will go to the right side where we messed with materials, into the little pink checkered icon for Materials. Press the + sign on the right to add a new material. You can then click the first material and copy the name below that mini-window and then click the new material, or just click on the new material and then under that miniwindow you'll see a button labelled "New."

    • Press that New button, then in the typing area where it says Material, we'll delete that and write:
      • testvehicle__2__proxy__physProxyNoDraw
        • __physProxyNoDraw, meaning it's a proxy so still cause it to collide with things but don't make it visible in-game
    • With that outer wheel selected still, we'll click on that material we just made and press assign.
      • We can make sure it worked by pressing A in the main window if it's selected, which will clear all selections, then click on the button that says Select underneath either and it will select. Let's do just the second material to make sure. Should be just the outer wheel.
      • Then press A, to deselect, then click the first material, and click select, which should only be the hull and inner wheel. Good!
    Now we want only the inner and outer wheel selected so we can move it to its own object for CryEngine to tamper with.
    • Do that using your handy "L" key to select them based on one point of each.
    • Now we press P to separate, then do By Selection to only remove and put into a new object what we have selected.
    Voila!

    Now we have hull, and hull.001. We'll doubleclick the name of hull.001 in the right side top-window and change to wheel1

    Last leg...or last wheel, perhaps?
    • Select that wheel and press tab if we're in edit mode
    • That's when you can see each vertex
    • This will get us out so it's the whole object.
    • Press A to select everything
    • Press Shift+D to duplicate
    • Left click once to leave it where it is.
    Now we have a second wheel object which we will move to the front right of the vehicle in the same position.
    • Do this by not moving the mouse and pressing G
    • Press X, for X-Axis only,
    • Move the mouse to get it to the other side
    This might be a useful time for the orthographic view which removes perspective shifts.
    • Press 5 on the numpad, then 7 on the numpad for top.
      • Much easier to see what you're moving now.
    • Now that we have it in position let's change the name of this one by doubleclicking the name in the top-right, and changing it to wheel2
    • Then we repeat the process of duplication for each wheel. Let's use wheel2 to make wheel4 by, again, selecting it all by pressing A to select everything, then do Shift+D to duplicate, left click once to leave it where it is.
    • press G
    • Then Y, for Y-Axis only since we're moving it a different direction, and get it down at the bottom right of the car
    • Doubleclick the name and change to wheel4.
    • Repeat for wheel3 taken from wheel4
    • Moving it left again by pressing G, then X.

    Phew! Almost done!

    Now we'll add a place for a person to sit, specifically the Driver. You'll add one for every additional passenger, though you shouldn't need more than 3 or 4 additional seats. See the vanilla vehicles for how to name those.

    Note: Just get it in the general area and you're good, we can fix it in the XML, later as these are just reference points for the game to hitch onto, not your master's thesis, or your life's work, or 10 years of toenail clippings (Eww). :)

    • Top menus > Add > Empty > Plain Axes
      • Empty is also known as a Helper, in 3DS or other similar programs which is the name used in the XML files
      • Helpers can add places a gun would attach, or a light, or even where zombies should be tacking on as you'll see in helpers in the XML files as well.
    To my understanding, we want this at the center of the character's pelvis when sitting. Design around that and tweak to perfection in the XML.

    Move it where you like. A 1-person vehicle could be in the center, 2-person with even spacing, etc. Odd seats like the 5-seat cowcar can be placed...oddly. Again, perfect it in the XML.

    • Doubleclick the name Empty in the top right
      • We'll be changing to what SoD uses just to keep it sane - it can be anything as long as you match it in the XML.
    • Rename it to driverSitPos for the driver
      • Additional seat empties would be passengerSitPosRF for right-front, passengerSitPosLR for left-rear, and so on.
    • Last, we'll duplicate the hull for the hull_proxy.
      • This is for physics so we want this as simple a mesh as possible. That's because more vertices = more physics to act on them, = more processing, = more chances for things hitting it to get stuck. See notes in main mesh modding guide about emabling physics on complex meshes and getting zeds stuck in the hood and inside the grill - fun, but naughty mesh building technique :)
    • Do that by simply pressing tab so all objects are green
    • Left click on hull in the top right mini-window
    • Shift+D to duplicate
    • Rename that to hull_proxy by double clicking the name in the top right window
    (Easier to see the idea in 3DS)
    Screenshot 2014-06-09 14.12.31.jpg
    Screenshot 2014-06-09 14.12.31.jpg

    Now let's fix it so it is also a proxy mesh.
    • Left click the name in the top right to highlight it,
    • Go to our materials sub-window in the pink checkered icon just below that
    • In the main window, press Tab to go into edit mode where the lines turn black
    • Press A to select all of the hull_proxy items
    • Then in the material window click the second material which was the one ending in __physProxyNoDraw and click the Assign button under that.

    Alright now we have all the base bits. Next is creating a hierarchy to show the game it's one object. This makes it easily exported and helps assign it to an ExportNode which does the actual exporting.

    To do this:
    • Click and drag the driverSitPos onto hull in the top right mini-window and BAM! it's a child
    • Do the same for the wheels by dragging them onto hull
    Now they're all one big happy family.

    • Press Tab for Object mode where they all turn green
    • Press A to select all
    • Go to menus just below the main window
    • Click Transform
    • Choose Origin to Geometry
    Screenshot 2014-06-07 12.49.24.png

    Last thing:
    • Select all
    • Press Ctrl+A
    • Choose Rotation & Scale
    • Press Ctrl+A again
    • Choose Location
    • If you don't do this then you may find your exported object goes insane and wheels are funny shapes and in funny places.
    • Select each wheel
    • Bottom menu, Object
    • Transform
    • Origin to Geometry
    • Do this for all 4
    • Press A to select all
    • Go to CryBlend menu
      • Top bar, far right
    • Click Add CryExportNode
    • Type the name that you chose in your materials or it won't work

    Enable the error console, just in case
    • Top bar, Window menu
    • Toggle System Console
      • This brings up a separate window with console text

    • CryBlend menu again
    • Export to Game
     

    Attached Files:

    Last edited: Jun 10, 2014
  3. Phacops

    Phacops Here To Help

    This will popup:
    Screenshot 2014-06-07 12.47.39.png

    • On the left is a dropdown for the file type to export.
      • .CGA is animated geometry like cars or moving objects
      • .CGF is static geometry, like buildings that don't break down
      • .CHR is for characters.
    • Choose .CGA
    • Aside the existing checkmarks:
      • Put a check in Run RC and do Materials
        • RC stands for Resource Convertor
        • This program shifts the output .DAE file into the .CGA/.CHR/.CGF formats that CryEngine uses.
        • Do Materials just takes the materials we made and creates a file with those parts, no assignments to them, just the names.
    • Click Export to Game
      • Top right
    • This will run it, so we move to the console window
      • If it shows 0 (zero) Errors then everything should be great!
    • You should now have these now in your folder:
    • [whatever you named it].cga
    • [that same name].mtl
    • [that same name].dae
    Next bit is the XML file which can be had either by copying an existing one and matching the setup - although with my method you wouldn't have the body as the parent to hull.

    Those would be held in C:\Program Files (x86)\Steam\SteamApps\common\State of Decay\Game\scripts\entities\vehicles\implementations\xml

    Key point is at the top, which will be the custom name, A.K.A. the Class of your vehicle, which we will see later in the FlowGraph, that segment looks like:
    <Vehicle name="testvehicle">

    Looks as follows with the handling we did before:
    <Parts>
    <Part name="
    hull" class="Animated" component="hull">
    <Parts>
    <Part name="
    wheel1" class="SubPartWheel" component="wheel_1" mass="200">
    <SubPartWheel axle="0" density="0" damping="-0.69999999" driving="1" lenMax="0.40000001" maxFriction="1" minFriction="0" slipFrictionMod="1" stiffness="0" suspLength="0.25" rimRadius="0.31999999" torqueScale="1.1"/>
    </Part>
    <Part name="
    wheel2" class="SubPartWheel" component="wheel_2" mass="200">
    <SubPartWheel axle="1" density="0" damping="-0.69999999" driving="0" lenMax="0.40000001" maxFriction="1" minFriction="0" slipFrictionMod="0.6" stiffness="0" suspLength="0.25" rimRadius="0.31999999" torqueScale="0.89999998"/>
    </Part>
    <Part name="
    wheel3" class="SubPartWheel" component="wheel_3" mass="200">
    <SubPartWheel axle="0" density="0" damping="-0.69999999" driving="1" lenMax="0.40000001" maxFriction="1" minFriction="0" slipFrictionMod="1" stiffness="0" suspLength="0.25" rimRadius="0.31999999" torqueScale="1.1"/>
    </Part>
    <Part name="
    wheel4" class="SubPartWheel" component="wheel_4" mass="200">
    <SubPartWheel axle="1" density="0" damping="-0.69999999" driving="0" lenMax="0.40000001" maxFriction="1" minFriction="0" slipFrictionMod="0.6" stiffness="0" suspLength="0.25" rimRadius="0.31999999" torqueScale="0.89999998"/>
    </Part>
    </Parts>
    <Animated filename="
    objects/testvehicle.cga" filenameDestroyed="" id="idModel"/>
    </Part>
    <Part name="massBox" class="MassBox" mass="1000" position="0,-0.15,0.65" disablePhysics="0" disableCollision="0" isHidden="0">
    <MassBox size="1.25,1.0,0.85" drivingOffset="-2.5"/>
    </Part>

    <Part name="massBox2" class="MassBox" component="" mass="16000" position="0,-0.30000001,0.5" disablePhysics="0" disableCollision="0" isHidden="0">
    <MassBox size="0.30000001,1.0,0.80000001"/>
    </Part>

    <Part name="massBox3" class="MassBox" component="" mass="6000" position="0.5,0,-1" disablePhysics="0" disableCollision="0" isHidden="0">
    <MassBox size="0.30000001,1.0,0.20"/>
    </Part>

    <Part name="massBox4" class="MassBox" component="" mass="6000" position="-0.5,0,-1" disablePhysics="0" disableCollision="0" isHidden="0">
    <MassBox size="0.30000001,1.0,0.20"/>
    </Part>
    </Parts>

    Note that the target file you see in objects/testvehicle.cga can be anywhere within the game folder as long as you target it. Only placed here for visibility.

    You'll see the components there at the top in the file (not pictured here), and these are the actual parts we had in the file. If you want more bits like guns or dice in the mirror that are separate objects then those would go in as parts and have helper objects as well should you want to do anything with them.

    Notable helpers are things like the locations that animations start or, in SoD's example, where zombies attach to the hood when clinging. That looks like:

    <Helper name="zombieHoodFront" position="0,2.55,0.0" direction="0,-1,0" part="hull"/>
    Coupled with:

    <Attachment name="HoodCenter" helper="zombieHoodFront"/>

    Note that I stripped out about half to 2/3 of the objects and left the rest as basic demos of what could be there. File works without all the rest so no trouble, just easier to parse out, I think.

    Should you want to update it, see the next tutorial bit.
     
    Last edited: Jun 10, 2014
  4. Phacops

    Phacops Here To Help

    Although this part doesn't require CryEngine, and you can choose to simply pull that XML out of the box and edit it manually - it will be ~100+ times faster to do it with CryEngine where it handles all the nasty bits in one micro-GUI.

    Your choice :)

    So, you'll need CryEngine, see the referenced Custom Modding core Tutorial for more info on that. Note that when I'm doing things that are version agnostic, like tampering with vehicles, I use the latest free version 3.5.8 because it loads in about 2 seconds while the old one for me takes a few minutes. I also only load up the newer version with the immediate files I'm working on, passing them from a protected dropbox folder so I won't overwrite them, to CryEngine, doing fixes, then passing to SoD. If everything works and I get a seemingly stable version then I dump that in the protected Dropbox folder in an inner folder with "Working - [Whatever I was trying to get working, stable]" Then if I bust something, I can revert :)

    Start with a basic level and we can grab our already made vehicle or copy another out.

    You can do this, with your files in the CryEngine folder in the right locations. The .CGA we made can go anywhere if you know where to find it, I tend to put it in Objects directly, for testing. Easier to get to, easy to update.

    And your vehicle XML, if already made by taking the one I had, would be in C:\Program Files (x86)\Steam\SteamApps\common\State of Decay\Game\scripts\entities\vehicles\implementations\xml

    We then make sure the rollup bar is open so we can drag the vehicle entity into the level by going to View > and making sure Show Rollup Bar is checked.

    The Rollbar is the bit on the right with all sorts of junk in it. Looks like this:
    Screenshot 2014-06-07 17.33.57.jpg

    So you click Entities, then press the plus to the left of Vehicles, then find your vehicle based on the name from the XML file, in my case it would be testvehicle.

    If you're copying another just save it as what you want in the same folder as the other vehicles, mentioned above, and you'd have to change the name in the GUI for the vehicle to be what you want, then click Hull inside it and change that to your chosen file. Easy enough, see how that's done in the next bit.

    Once you've got CryEngine open and your Vehicle Entity has been dragged into the level, hop in and let's hit the top menus by going to View > Open View Pane > Vehicle Editor.

    Then select your vehicle in the world, and in the Vehicle Editor Pane click Open Selected if you already have the XML file provided.

    Note: If you don't then you'd have to dump another vehicle in, like the HMMWV that comes with CryEngine, then do open selected. One then make edits by clicking HMMWV, in the middle portion, changing the name to what you want, then clicking hull, and in the right pane change filename to your vehicle .cga you made, then save as your vehicle name.

    Once we are at the point of editing we can look at what has been opened - and I'll just go over the basics here.

    Main points:
    Display is initially minimized to the most basic of listings which are the core parts, massboxes, hull, and seating.

    Brightly enough, we can simply right click hull and tell it to add a part or a seat. We could have used this method to build it all ad hoc instead of using my file which is mostly SoD parts, up to you.

    You can also right click a seat and point to a part as the primary weapon. I haven't done the research on vehicle weapons to get that to work so maybe you're the one to do it before I do :)

    Massboxes are very key point. It looks like SoD generally uses a single massbox. I like to have 2-4 for a bit more realism, or anti-realism where needed. For example my small scout vehicle from the Fortitude vehicles has 4 massboxes with a center, a wide, and two very low flanks. This keeps it almost always upright (Had to give that little chance in case of a bug where you got trapped in the car, sadly).

    Generally it seems the single massbox option would be one with a center just below that of the hull, around as long and wide as the car, but less tall.

    You can then put a check in the boxes for other bits like components and helpers to see them show up on the screen, which is why I left them in.

    Looks like:
    Screenshot 2014-06-07 17.48.18.jpg

    Screenshot shows it as the copied version in which the host file doesn't have the referenced helpers to target properly so they are the already modified values which leaves them in wild places.

    Nicely enough you can just click and drag these around with comparison to your vehicle to get them in the perfect placements. Save them, and voila you're done!

    Once we summon our vehicle through the flowgraph as we'll see in the next section, we can use it (and lose it).
     
    Last edited: Jun 7, 2014
  5. Phacops

    Phacops Here To Help

    Flowgraph #1, Spawn on KeyPress

    The FlowGraph is needed for testing your new vehicle and assuring it works correctly with as little trouble as possible in finding it and using it or overcoming the unthinkable - topsy-turvy-wacky-spin-drive if you fouled up your XML settings and turn your well-cooked character into a gooey bit of balderdash.

    Find that in the Zip pack from the main post, and note that it will appear in C:\Program Files (x86)\Steam\SteamApps\common\State of Decay\Game\Libs\ui\UIActions in case you want to crack it open and fiddle with it in CryEngine.

    In that folder the engine says "Hey there's an XML file in UIActions! I better sweep that up when I start and add it into the mix, it must be important!" And so it does. As for this, I may simply incorporate this into the Debug Tool, haven't decided.

    Probably will because when testing your vehicle, if you forget to fix the positioning and, say, your Driver gets in and is 20ft above your vehicle then it tips over into some zeds at one point...you may have wanted to press that GodMode (Yes, this happened, haha)

    In it's current incarnation we'll go over what it does and why it does it.

    Screenshot 2014-06-07 18.49.02.png
    Screenshot 2014-06-07 18.49.02.png

    From left to right:
    • The keypress handler, Input:Key
      • Tells us which key makes the action happen, automatically enabled
    • This feeds into doing a a Game:LocalPlayer check - that's you, the player
      • This gives the Player's EntityID should you ever use this elsewhere in a FlowGraph, for teleports, or animations checks, etc.
    • This feeds the EntityID into a Position checker
      • Tells us our location in space, and which way we face, and rhymes all over the place (What a disgrace).
    • This feeds into the vehicle spawner named Entity:Spawn
      • Uses the vector coordinates and rotation to place the vehicle under us
    • Entity:Spawn feeds to the debug text emitter, HUD: DisplayTimedDebugMessage with what type of vehicle it is, and concatenates that with a failure message, just in case, so we know which one broke
    • Note: The place to change the name of the vehicle to your own, if you didn't choose testvehicle, would be in that String:SetString box so it feeds the spawner and the debug text

    So now we have the vehicle spawning at the player, next we handle some checks to make sure the vehicle actually works and lets us use it:

    • Entity:Spawn outputs the EntityID into Math:Less,
    • Math:Less checks if it is less than 65535
      • Game mechanics dictate that it doesn't allow us to use it if EntityID > 65535

    • If Math:Less shows EntityID > 65535 it feeds it to a loop fix
      • Physics:Enable disables the physics on it so it no longer needs computations done
      • Entity:BeamEntity casts it into a void where noone can see it, at the coordinates 0,0,0

    • If Math:Less shows EntityID < 65535
    • Then it is in the useful range of EntityID < 65535
      • Physics:Enable enables the physics on the vehicle so it can drive
      • Vehicle:VehicleMovement warms up the engine for us like a remotely engaged mid-size family luxury sedan in middle "uh-murrica," preparing to host 2 adults and 2.5 children
        • (In normal statistics the ".5" looks weird, but in a Zombie apocalypse, it's pretty clear what happened to the other half...)

    Simple enough, this is placed in UIActions and when you start up the game you can press F7 and you get a car. Done. Enter, exit, dance on it; it works. Only issue - and I haven't deduced why - is that sometimes you have to press it several times to make it spawn, for custom cars only. For now, you can get it with some persistence, usually it works.


    -----


    Flowgraph #2, Spawn on Game Start


    Here's the FlowGraph, then a short explanation:
    Screenshot 2014-06-09 07.10.47.jpg
    Screenshot 2014-06-09 07.10.47.jpg

    Easy enough.

    From left to right:

    • Start Node
      • This gets triggered as the game loads
      • Not immediate, and you can tell this by watching the MasterClock or debug startup message for the Debug Tool as they pop a few seconds in as they get triggered by Start as well
    • On start, triggers Time: Delay
      • This one seems weird, I'm sure, but it is needed
      • Seems to need additional time to get the game world ready before vehicles can spawn, Time: Delay waits 20 seconds to give it that time
      • How this was uncovered, you ask?
        • Given: Keypresses worked, this direct spawn didn't
        • Therefore the method works but not the trigger
        • Hooked debug message to Start which said "Running!" on game start
          • Working, Script was running
        • Given: Keypresses work and Script isn't failing, another issue is causing it
        • Given: VikingMode fails if pressed too early because player doesn't exist yet
          • Script may be firing too early, Vehicles may not be able to exist yet
        • Time: Delay applied at 10 seconds
          • Sometimes vehicles don't appear
          • Delay increased to 20 seconds
            • Working, vehicles always spawn
    • Note: If you use this, let me know if your system loads longer and thus it doesn't work. I have a higher end system and went above the appropriate load time for me of around 12 seconds that always showed vehicles.
      • I tested multiple times and the vehicles spawned every time.
      • QA time ~6 hours, with minor position tweaks and vehicles spread across the map

    All the next nodes after Start and Time: Delay are the same as the previous graph so see description on that.

    Note on spawning at game start:
    • When developing your coordinates in the game using my location debugger in the debug tool,
      • Use the coordinates when you're standing in the spot you want with the direction you want (Vector Position, Vector Rotation)
      • If you use coordinates taken from inside the vehicle, as I first thought might be best, you will be off by ~0.5 meters in cars, and ~1 meter in a truck.
      • This leaves your vehicle hovering in the air and trucks too high to enter :)

    This Flowgraph is now part of the main Zip.

    Just unpack in your State of Decay directory, and note that it is separated from the Debug flowgraph. Can also use the Nexus Mod Manager to install the Zip contents.

    If you use your own vehicles you'll have to change the class names in there.
    If you don't do that, and you don't have the debug tool then you won't see them because it requires the vehicles that come packed in it.​

    Phew, lots of notes :)

    TestVehicleSpawner.xml - For keypress triggered spawning, use this for immediate use with no walking.

    Fortitude-VehiclesOnStart.xml - For direct spawn at start of game, use this for a demo through the Fortitude vehicles to see how to spawn your own in-game.

    Note: Rename your file when saving from the Fortitude-VehiclesOnStart.xml to your own package or I will cry when you overwrite mine :)
     
    Last edited: Jun 9, 2014
  6. Phacops

    Phacops Here To Help

    Stealing this comment part back for notes.


    I purposely smegged up my file a bit to see what the results of it were. So, here's some quick tips:

    Issue - The game refuses to spawn your vehicle.
    Solution - Oddly, it doesn't result in a failure message if the class name is wrong in the file. Make sure the name in the XML file matches what is being put into the flowgraph into the Class section, capitals, lowercases, and symbols matter.

    Issue - Game crashes immediately when I try to spawn my vehicle.
    Solution - Either the file structure is full wrong, such as copying a vehicle over incorrectly, missing a closing tag or similar, having more than 4 wheels in an arcadewheel setup - could be possible? Maybe I was just doing it wrong, tried for 6, no go. You can check your XML tags easily by running it in a browser which will tell you where you missed a tag and what tag was the issue, giving you some degree of understanding. If it populates all the XML then the close tags weren't the issue.

    Issue - My vehicle spawns with lumpy wheels in funny places.
    Solution - Don't be so judgemental! It is equal to other cars - celebrate the differences. Alright, if you must, make sure that the wheels in your Blender file have been clicked and then told in the Object menu at the bottom to apply Scale & Rotation, and also Transform > Origin to Geometry. Which will make the origin in the wheel center, which would otherwise send them to funny places in reference.

    Issue - I'm sorry I didn't mean issue, I was trying to say Tissue, but I have a cold...
    Solution - ...

    I didn't want to release the FlowGraph that drops them on start of the game until I knew I could get around potential conflicts.

    • While searching for how to detect the DLC you were using I had an epiphany:
      • They could have played the old dev-game of using a different coordinate space for population
      • I picked up LifeLine and found this to be, quite propitiously, true.
    What does this mean to our loyal viewer?
    • Lifeline exists in the same X,Y coordinate space
    • Vanilla/Breakdown spawns that happen at game start shouldn't conflict with LifeLine
    • You can reach some of the spawn points I chose for Vanilla/Breakdown, such as 1747.185, 2553.025, 89.907, which is in the top-left of the map for both map types

    So you say "But Phacops, you jus' said they wouldn't conflict but that you could reach the spawn points...so they must conflict, right?"

    Nay! Well, not exactly, and here's the rub:
    • The last number in the Vector Coordinates is the Z-axis
    • You can reach X and Y
    • But, for Z, the lowest coordinates in Vanilla/Breakdown are still ~20 meters above the highest points in LifeLine
    • So, they do exist in the same space but in the air! Hark, a Hummer, sire, harbinger of the end times...either this or Mary Poppins has joined the military.
    • The way to0 fix this is using GameTokens but that's reasonably more advanced than simple meshing and exporting so I'll just say it isn't as pretty with the basic method :)
    See here, spotted over Boswell, Newt Smeggisco:
    UFO.jpg


    Note on small vehicles:
    I'm unsure what is causing it and haven't found a means to stop it, but super small vehicles seem to have a bit of funny business with the shock absorbers which means that the wheels tilt at very strange angles quite often. Also means they take large bumps oddly, sometimes.

    -----
    Leaving this because Swiss' comment would look really weird otherwise ;)

    Well, smeg it. Like a good little scientist, I went back to try to reproduce my process once more to assure it was something that could be copied by others. For some reason the second vehicle, when mounted, rears up like an ugly pony stepping on a more ugly snake, flinging rider and floating off down the street.

    I see no logical explanation for this and, assuming it was my massbox tampering, I copied the entire XML from the original and it still goes all wild-ass.

    Fiddling with the file now, may just proffer my file cluster that is working rather than providing a guide until it works. Hold onto your hats.
     
    Last edited: Jul 15, 2014
  7. You can release it as "[Modding Guide] Vehicles: Bull Rider Edition"
     
    Griffonclaw39 likes this.
  8. Phacops

    Phacops Here To Help

    Correction, the next tampering fixed it. It was something to do with the location of the hull. I cleared location which dumped it beneath the ground plane - thus implying the location hadn't been applied? - then shifted it back up so the wheels were on the ground plane, as it moves the whole thing due to being a parent, applied location in the object menu, and now it's all happy and fine.
     
  9. Phacops

    Phacops Here To Help

    Haha, if your bulls can float. I should have done some video of that actually, because one of the tests was to get on then get off again to see if it kept going wild. Once I left the ride, it then bucked up and down by a couple feet, front-back-front-back like a bad Rap video from the 90's.

    Anyway, all fixed, sadly looks like we won't have Bull Rider Edition, after all :(
     
  10. We'll get you into Modders Anonymous and you can slip in the bull rider cars alongside my super zeds...
     
    SilentResident likes this.
  11. SilentResident

    SilentResident Got Your Back

    I am sure this took you a long time to write down this detailed tutorial, Phacops!

    Undead Nicole or Undead Sanya, please, if can you stick this thread...
     
  12. Phacops

    Phacops Here To Help

    I've been working on it to make sure it works and writing down the results for about 8 hours now :)

    Given, the last hour or so was concern over the bucking bronco trapped inside my vehicle mesh, haha.

    Thank you though :)
     
  13. Phacops

    Phacops Here To Help

  14. Undead Nicole

    Undead Nicole Community Manager Staff Member

    Consider it done!
     
  15. Phacops

    Phacops Here To Help

    Huzzah! Or your choice of favorite comparable exulatation of goodness. Thanks, mate :)
     
  16. Phacops

    Phacops Here To Help

    Updated all posts, should be a workable model to get started with.

    Until I figure out how to check whether you're on Lifeline or not, I can't post up the means to populate the game with your vehicles in locations you choose because funny business will happen. Look for that in the future, for now you could work on your model ;)

    Also includes the core Blender file so you don't have to make your own and can simply reshape click onto the hull, apply whatever mesh you want, then increase the size and mildly reshape the hull_proxy to suit.
     
    SilentResident likes this.
  17. SilentResident

    SilentResident Got Your Back

    Thank you, Nicole, because the people will find it useful! :)
     
  18. Last Post

    Last Post Got Your Back

    @Phacops

    Awesome detailed guide !
    I don't understand half of it because I don't even know how to do 3d modelling.
    Still very much appreciated :)
     
    SilentResident likes this.
  19. Phacops

    Phacops Here To Help

    "The people?" I guess it's a modding Manifesto advocating social egalitarianism and I missed it :) The car is red though...

    Well, my initial guide covers the 3D modelling as well LastPost :)

    But thank you all - I hope this means we can get our little modding munchkins able to create their wildest dreams in custom vehicles and deploy them for all the fantastical land. I'm currently resisting the urge to rework all my vehicles since I'm no longer trapped in the constraints of the prior proxy, but I have so many things I want to do, gah.
     
  20. Phacops

    Phacops Here To Help

    Majorly reworked the posts for clarity through color and minimized word count, as well as bulleting. Let me know if this is more sensible or what needs more clarity.

    Updated Zip package with the vehicles to spawn at the start of the game. All 6 fortitude vehicles - assuming you have the debug tool - will now spawn in specific locations around the normal game world. Does not affect LifeLine, testing more on that and probably only spawning one vehicle.

    The 5-seater cow car is best hidden, with the needler in second. The rest are semi-hidden.

    I wanted more surprises for exploration and this will lead into that philosophy with further developments as I continue working.

    Anyway, you can use this as a method to spawn any vehicles you create and just pop them into their own flowgraph so you don't clash with anyone else's - so to say, don't name yours Fortitude-VehiclesOnStart because that's "like, totally mine, man." And I'd cry...if my stone-eyes had tear ducts.
     
    Last edited: Jun 9, 2014

Share This Page