• Having problems making a Vehicle for Garry's Mod.
    7 replies, posted
I have been successful at making models for the past day(Models such as a container holder, ect). I wanted t put that model and turn it into a vehicle. So I decompiled another car mod, replaced the models and textures(don't worry, i'm NOT publishing this for public, only my gmod testing use). I then filled everything out to be correct in both the autorun lua file, and the vehicle script. Yet when I try to place it in Garry's mod as a vehicle, it spawns nothing. No model, no physics, not anything(I can't even undo the "spawning" of the car). So I believe that the car isn't even spawning(the model and textures work, if I go to addons tab and then place my prop model of the car). The Lua autorun file: [CODE]local Category = "Test Vehicles" local V = { // Required information Name = "TestVoohocle", Class = "prop_vehicle_jeep", Category = Category, // Optional information Author = "PeaRadiisE, SentryGunMan, Turn 10", Information = "vroom vroomsss", Model = "models/contrans/conextranspottmodel.mdl", KeyValues = { vehiclescript = "scripts/vehicles/critz/testscript.txt" } } list.Set( "Vehicles", "noscopecn", V )[/CODE] The vehicle script: [CODE]"Vehicle" { "WheelsPerAxle" "2" "Body" { "CounterTorqueFactor" "0.9" "MassCenterOverride" "0 -5 10" "MassOverride" "2900" "AddGravity" "1.33" "MaxAngularVelocity" "120" } "Engine" { "HorsePower""380" "MaxRPM""5750" "MaxSpeed""90" "MaxReverseSpeed""16" "AutobrakeSpeedGain""1.1" "AutobrakeSpeedFactor""3" "Autotransmission""0" "AxleRatio""3.5" "Gear""4.2" "ShiftUpRPM""3900" "ShiftDownRPM""2200" } "Steering" { "DegreesSlow" "38" "DegreesFast" "26" "DegreesBoost" "5" "FastDampen" "0" "SteeringExponent" "0" "SlowCarSpeed" "25" "FastCarSpeed" "40" "SlowSteeringRate" "2" "FastSteeringRate" "1" "SteeringRestRateSlow" "3" "SteeringRestRateFast" "2" "TurnThrottleReduceSlow" "0.01" "TurnThrottleReduceFast" "0.25" "BrakeSteeringRateFactor" "3" "ThrottleSteeringRestRateFactor" "2" "BoostSteeringRestRateFactor" "1" "BoostSteeringRateFactor" "1" "PowerSlideAccel" "500" "SkidAllowed" "1" "DustCloud" "1" } "Axle" { "Wheel" { "Radius" "16.5" "Mass" "450" "Damping" "0" "RotDamping" "0" "Material" "phx_rubbertire2" "SkidMaterial" "phx_rubbertire2" "BrakeMaterial" "phx_rubbertire2" } "Suspension" { "SpringConstant" "80" "SpringDamping" "8.7" "StabilizerConstant" "2.5" "SpringDampingCompression" "0.0" "MaxBodyForce" "100" } "TorqueFactor" "1.40" "BrakeFactor" "0.50" } "Axle" { "Wheel" { "Radius" "16.5" "Mass" "450" "Damping" "0.5" "RotDamping" "0" "Material" "phx_rubbertire2" "SkidMaterial" "phx_rubbertire2" "BrakeMaterial" "phx_rubbertire2" } "Suspension" { "SpringConstant" "80" "SpringDamping" "8.7" "StabilizerConstant" "2.5" "SpringDampingCompression" "0.0" "MaxBodyForce" "100" } "TorqueFactor" "0.20" "BrakeFactor" "0.50" } } "Vehicle_Sounds" { "Gear" { "Max_Speed" "0.0" "Speed_Approach_Factor" "1" } "Gear" { "Max_Speed" "0.2" "Speed_Approach_Factor" "0.07" } "Gear" { "Max_Speed" "0.4" "Speed_Approach_Factor" "0.07" } "Gear" { "Max_Speed" "0.6" "Speed_Approach_Factor" "0.07" } "Gear" { "Max_Speed" "0.8" "Speed_Approach_Factor" "0.07" } "Gear" { "Max_Speed" "1.1" "Speed_Approach_Factor" "0.03" } "State" { "Name" "SS_START_IDLE" "Sound" "vehicles/critz/cargo25/start.wav" "Min_Time" "2.70" } "State" { "Name" "SS_GEAR_0" "Sound" "vehicles/critz/cargo25/first.wav" "Min_Time" "0.75" } "State" { "Name" "SS_GEAR_1_RESUME" "Sound" "vehicles/critz/cargo25/first.wav" "Min_Time" "0.5" } "State" { "Name" "SS_GEAR_3_RESUME" "Sound" "vehicles/critz/cargo25/third.wav" "Min_Time" "0.5" } "State" { "Name" "SS_GEAR_3" "Sound" "vehicles/critz/cargo25/third.wav" "Min_Time" "0.5" } "State" { "Name" "SS_GEAR_2" "Sound" "vehicles/critz/cargo25/second.wav" "Min_Time" "0.5" } "State" { "Name" "SS_GEAR_1" "Sound" "vehicles/critz/cargo25/first.wav" "Min_Time" "0.5" } "State" { "Name" "SS_SHUTDOWN" "Sound" "vehicles/critz/cargo25/stop.wav" "Min_Time" "0" } "State" { "Name" "SS_IDLE" "Sound" "vehicles/critz/cargo25/idle.wav" "Min_Time" "0" } "State" { "Name" "SS_REVERSE" "Sound" "vehicles/critz/cargo25/rev.wav" "Min_Time" "0.5" } "State" { "Name" "SS_SHUTDOWN_WATER" "Sound" "atv_stall_in_water" "Min_Time" "0" } "State" { "Name" "SS_GEAR_4_RESUME" "Sound" "vehicles/critz/cargo25/fourth_cruise.wav" "Min_Time" "0.5" } "State" { "Name" "SS_SLOWDOWN" "Sound" "vehicles/critz/cargo25/throttle_off.wav" "Min_Time" "0" } "State" { "Name" "SS_TURBO" "Sound" "vehicles/critz/cargo25/fourth_cruise.wav" "Min_Time" "2.5" } "State" { "Name" "SS_GEAR_0_RESUME" "Sound" "vehicles/critz/cargo25/first.wav" "Min_Time" "0.75" } "State" { "Name" "SS_START_WATER" "Sound" "atv_start_in_water" "Min_Time" "0" } "State" { "Name" "SS_GEAR_2_RESUME" "Sound" "vehicles/critz/cargo25/second.wav" "Min_Time" "0.5" } "State" { "Name" "SS_GEAR_4" "Sound" "vehicles/critz/cargo25/fourth_cruise.wav" "Min_Time" "0.5" } "State" { "Name" "SS_SLOWDOWN_HIGHSPEED" "Sound" "vehicles/critz/cargo25/throttle_off.wav" "Min_Time" "0" } "CrashSound" { "Min_Speed" "350" "Min_Speed_Change" "250" "Sound" "atv_impact_medium" "Gear_Limit" "1" } "CrashSound" { "Min_Speed" "450" "Min_Speed_Change" "350" "Sound" "atv_impact_heavy" "Gear_Limit" "0" } "Skid_LowFriction" "common/null.wav" "Skid_NormalFriction" "common/null.wav" "Skid_HighFriction" "common/null.wav" }[/CODE] does anything look wrong with those? the file paths are 100% correct on my end. Or should I follow anything I will be decompiling the models of the original mod, to see if the model has anything to do with it. I am 100% new to GMod modding. [B]TL;DR[/B] I am trying to spawn my custom model car, it isn't spawning anything. The model s from a prop I made the day before. Does anything look wrong? should I do something to the model for a vehicle that I wouldn't do for a model of a prop? [B]The files aren't mine, only the model and textures. so this is just a test vehicle, not intended for public publishing.[/B] If you want to know anything else, or want to download the entire folder for the mod. I can post/respond. Thank you for your help and time!
I decompiled the .mdl(of the actual working car in the mod I used the code from) and a few others and it appears as they hav a reference skeleton, and it is parented under the body object. Not much else I can find at the moment (the "skeleton" is just spheres all around EDIT: the spheres are bones.)
Well I can not find a single thing in the reference skeleton in to model, that has anything to do with GMOD vehicle files. I'm guessing all bones are grouped?
TBH I think there should be a full blown tutorial for creating cars in gmod. I have tried making one before and the wheels ended up shooting the far left and right and the physics on the car was broken so badly. I think you would also get better help posting this in the modeling section because although it deals with code its more about the compiling of the model that I think the issue is. Also here is valves info on it: [url]https://developer.valvesoftware.com/wiki/Vehicles_%28modeling%29[/url]
Dang, I never saw that before. And I agree, a vehicle tutorial for GMod would be cool. What's worse is the complexity just to make a simple vehicle. Anyways thanks, I will be looking more into this, and if I need more help I'll just move to Modelling.
Body, Engine and Steering are the most important parameters in the vehicle scripts, arguably. Body-Grav-Mult: 1.3-2 (most important part is the one below) Body-Mass: 1200-1800 for peak performance. Body-MaxAngularVelocity: 60-120 These are important to get correct. If you do these wrong, the entire script will be terrible. Each car is different, so each vehicle-script should be different to suit each other's strengths and weaknesses.
I understand that, thanks. Ive seen vehicles with more than 4 wheels as well, I will look into that. I'd like to design heavier vehicles(I'm not interested in sports cars :p) One thing i'd love to fix is vehicle power, I have seen tons of vehicles not able to pull anything(such as a huge dump truck cant even pull a small van). Meanwhile, I will be looking through the decompiled mods QC file, I skipped that and went to the model. Thanks for the information!
That has a lot to do with mass. Occasionally, heavier vehicles are better at handling. If you want to fix that issue, adjust the mass to 1200-2000. My suggestion.
Sorry, you need to Log In to post a reply to this thread.