Garry's Mod

Garry's Mod

Drivable prop_vehicle_apc
82 Comments
kwaHliveD  [author] Jan 3 @ 2:40am 
i don't know how to fix it because there are many camera bugs that occured later after some time.

sometimes the player view gets limited to weird angles
sometimes the target view position is cauculated as nan on the client, thus blanking the player's view screen.

sometimes none of these happen.

all of them happen mostly because of the lack of enter / exit anims and a proper view position.

overriding the combine_apc.mdl with required attachments and anims fixes the problems above, but i don't want to override default models.
张他妈 Jan 2 @ 9:51pm 
Can you fix the camera bug when player drive this vehicle?
Gordon, GORDAN! Aug 3, 2024 @ 7:40pm 
https://steamcommunity.com/sharedfiles/filedetails/?id=3290744524&searchtext=Combine+Flatline

I wonder if you could give the other APC addon your console commands?
ellen61788 Apr 16, 2024 @ 10:26pm 
camera
fix pls
:steamthumbsdown:
nicowavv Dec 16, 2023 @ 1:43am 
can anyone help me? ive been trying to find an addon of a combine apc. it could shoot repetitevely, be first-person, and the mounted turret would be very accurate (it could shoot rockets). i will be very thankful.
kwaHliveD  [author] Dec 15, 2023 @ 1:18am 
5-) this also exists, but it isn't easy to access it. create an npc_apcdriver while you are inside the apc and assign npc_apcdriver's vehicle as your apc. following changes will occur:

5.1-) if npc_apcdriver has an enemy, your crosshair will not aim and it will assist you with aiming and shoot the target for you. it will use only one weapon at a time but you can use the other weapon to assist with the apc.

5.2-) if the npc_apcdriver has a valid route, it'll track the route even when you're still the driver. while npc_apcdriver is driving, you can still command your apc to either move forward & backward, steer or break, that will alter npc_apcdriver's behaviors. when the npc_apcdriver doesn't have any route, you are fully in command of the apc.
kwaHliveD  [author] Dec 15, 2023 @ 1:18am 
1-) hud elements surpass my aims within this mod; to make undrivable prop_vehicle_apc drivable and fully functional.

2-) this overrides apc default functionality and can't be an aim within this mod.

3-) i intentionally disabled boosting feature because default turbo settings are incorrectly set in apc_npc.txt, temporarily breaks apc physics and makes the apc loose gravity and occasionally flip upside-down instead.

4-) this functionality actually exists. bind +attack3 to any button and when you press it, the apc will select a target closest to your crosshair.
Gordon, GORDAN! Dec 14, 2023 @ 2:48pm 
For additions in the future (not now)

I would like an ammo display if possible to come on, along with a variable that makes the APC Gun act like the Airboat's in terms of ammo regeneration.

An option for the rockets to shoot straight out the barrel instead of fly in a weird angle from the APC's side before shooting forward.

And a less clumsy way for the auto-target to work that doesn't disable the vehicle's boost function.

I would have either the reload key or a combination between the RMB and reload key on a target enable the APC's missiles to focus on an enemy selected with the crosshairs.

I would add an option in the convars for the ability to have the Machine Gun also target a selected enemy so that the player can drive and shoot without having to worry about aiming much.
Gordon, GORDAN! Nov 15, 2023 @ 12:29pm 
I searched for a command like that yesterday and I realized that the closest thing mentioned was a rocket CLIP, not a reload delay. That's what tipped to Me some wires weren't done right.
kwaHliveD  [author] Nov 15, 2023 @ 1:44am 
apc trying to retrieve a console variable which i had commented out before releasing. fixed.
Gordon, GORDAN! Nov 14, 2023 @ 8:58am 
[Drivable prop_vehicle_apc] lua/autorun/prop_vehicle_apc_fixer.lua:206: attempt to index global 'sk_apc_ply_rocket_reloaddelay' (a nil value)
1. APC_WeaponModifiers - lua/autorun/prop_vehicle_apc_fixer.lua:206
2. APC_WeaponThink - lua/autorun/prop_vehicle_apc_fixer.lua:274
3. v - lua/autorun/prop_vehicle_apc_fixer.lua:428

This got spammed whenever I entered the APC.
TotalChaos Nov 11, 2023 @ 7:25am 
Ah, ok, that makes sense.
I hope that all goes well. And, if you can, please try to make the headlight functionality as vanilla/Valve as possible, using the game's code. If that doesn't work and you have to code custom headlights in, can you please try to make it as accurate to Valve's headlights as possible?
If you don't do it, that's fine. There's always the lamp and weld tools.
kwaHliveD  [author] Nov 11, 2023 @ 7:15am 
to access internal functions, we generally request them to be bound from c++ to Lua API, from Gmod developers. we mostly do that in https://github.com/Facepunch/garrysmod-requests/issues . as far as I know, there isn't any bound functions related to headlights of the jeep. the same functionality can be replicated, though. after my personal work is done, I'll work on the fire rate, reload rate and ammo amount of the APC, then that headlight.
TotalChaos Nov 11, 2023 @ 6:06am 
Yeah, I tried messing with the headlights myself once. I got similar results.
I feel like we're missing something, and we can't just change that value. Is it possible to access internal functions, such as HeadlightTurnOn();, through GLua?
Not only that, but in the client part of the code, there's UpdateHeadlight();, m_pHeadlight, and m_bHeadlightIsOn->TurnOn();. Surely there's a way to access all of those, right? I couldn't find a way, but I'm not very good with coding in any language.
kwaHliveD  [author] Nov 11, 2023 @ 4:05am 
i've tested with Entity:SetSaveValue("m_bHeadlightIsOn",true) and the only problem is that the change in the value must be networked from server to client but it probably does not reflect to client properly, thus the headlights turn on only the moment while the player is exiting the vehicle. if i can find a workaround to this, the headlights may work again.
TotalChaos Oct 22, 2023 @ 8:15am 
Hey, I just got another idea.
Do you think you can reenable the headlights on the jeep? I know the jeep isn't really the focus of this addon, but it would still be cool to see.
In HL2's code, the code to trigger toggling the headlights was commented out (impulse 100 while in the jeep). But the code for the headlights are still there, which means it can still be triggered. In fact, I think the headlights still get turned off when you exit the jeep, even if they're not on.
Just an idea I had, is all.
Cloud7 Oct 21, 2023 @ 7:06pm 
Can you make apc alarm?
TotalChaos Oct 16, 2023 @ 11:48am 
Found another bug.
Your playermodel doesn't move with prop_vehicle_driveable.
That, and sometimes the enter/exit animations break. Sometimes your camera doesn't move with the vehicle, either.
I think this happens with prop_vehicle_apc, too. But it's much rarer. This can be fixed by despawning the vehicle and spawning in another.

There's also an issue where both entities spit you out the wrong side when you exit them (easy to see with enter/exit animations). I'm not sure if this is the addon playing up, or if the original entities did that.
TotalChaos Oct 15, 2023 @ 4:22pm 
I love that prop_vehicle_driveable works now! And the added gun is a nice touch.
I also like that you implemented the alt-fire thing that fires SLAMs. Reminds me of that beta Combine APC thing.
There's one issue where prop_vehicle_driveable starts rolling backwards when it spawns, though. But that happens with the original entity, it's not the addon breaking or anything like that.

Overall, the update works great and I love it. 10/10.
Gordon, GORDAN! Oct 13, 2023 @ 3:43am 
I also noticed that Prop_Vehicle_Apc needs a driver to complete its destruction sequence.

If you destroy it while it's empty, sure some explosions will appear, but it won't properly launch missiles & explode into props unless you enter the destroyed APC.

I think this is the reason why in Route Kanal, You can damage the 2 APCs in the Garage, but never seem to "destroy" them.

It's because they lack drivers & they need one to initiate the destruction sequence properly.
TotalChaos Oct 12, 2023 @ 9:21am 
Ah, okay, that makes a lot of sense, actually. I don't remember seeing that on prop_vehicle_jeep when it uses a model that isn't vehicle.mdl, though.
Whatever, thanks for clearing that up!
kwaHliveD  [author] Oct 12, 2023 @ 9:11am 
prop_vehicle_jeep is for jalopy and spawns with light sprites attached to rear lights. after you enter and exit the prop_vehicle_jeep, yellow lights will flash behind the jalopy. if the necessary attachments don't exist (another model is used other than models/vehicle.mdl), the sprites will be under and between the prop_vehicle_jeep.

prop_vehicle_jeep_old is for hl2 jeep and doesn't have the rear light sprites.
TotalChaos Oct 12, 2023 @ 9:05am 
Yes, I know that prop_vehicle_apc is hardcoded to play that sound every time. I've worked with the nightmare of source code that is Half-Life 2's before (it really is a nightmare, especially to someone with little to no C++ knowledge whatsoever).

Thirdperson would definitely be a challenge to get right, because, like I said, the driving animation clips through the APC a LOT. I know this because I've used custom driveable Combine APC models in GMod lots of times in the past (with prop_vehicle_jeep, of course).

Also, what's the difference between prop_vehicle_jeep and prop_vehicle_jeep_old, anyway? From what I could gather by messing around with them in-game, and the little documentation of the latter online, they seem to be exactly the same.

(Off-topic but I gotta say that the ability to aim the gun backwards is so weird but cool since you can't normally do that.)
kwaHliveD  [author] Oct 12, 2023 @ 8:51am 
by the way, the locked sound plays because that's the default action when you +use the apc. they set it to play the locked sound, no matter what. i can play an empty sound as soon as player starts entering the apc to suppress the sound.

i haven't thought about the thirdperson view of the apc, since i focused mostly on basic driving concept, especially in singleplayer.
kwaHliveD  [author] Oct 12, 2023 @ 8:48am 
i remember when you freeze the apc while the wheels contact the ground, the apc is removed instantly with a crazy physics debug output to the console. when you freeze the apc on air, nothing happens. i guess that happens because the patch applied on the prop_vehicle_jeep did not include prop_vehicle_apc as well. we can test it with prop_vehicle_driveable and see whether the game crashes, the vehicle gets deleted or nothing happens.
TotalChaos Oct 11, 2023 @ 5:33pm 
I found another bug.
If you get in the APC, then get back out, and freeze the APC with the Physics Gun, the game will either freeze with the APC, or it'll just crash.
I'm not sure if this is the addon at fault, though, because I feel like I remember seeing some patch notes for the game a while back that mentioned fixing something similar with prop_vehicle_jeep.
TotalChaos Oct 11, 2023 @ 11:15am 
Just remembered, there's a few issues with this that I found.
1. The "locked" sound still plays. Maybe that shouldn't play when the APC is unlocked?
2. The playermodel is using the sitting animation, and not the driving animation (although the driving animation clips through the APC a lot).
3. The APC doesn't turn off when you go underwater.

The only other issues with this are all model-related, I think, because combine_apc.mdl isn't made to be driven by the player (it's missing the required attachments).
TotalChaos Oct 11, 2023 @ 10:49am 
kwaHliveD, I understand that you basically have prop_vehicle_driveable with the Tau Cannon disabled on prop_vehicle_jeep/prop_vehicle_jeep_old, but it would still be nice to have it working properly anyway, for the sake of completion (note that prop_vehicle_driveable has different "raytrace" options. One for land vehicles, and two for water vehicles. But one of the water vehicle options crashed every game I tried it on, for whatever reason. It would be nice to see that fixed here, too.).

I would also like to see whatever prop_vehicle_cannon is fixed too. I honestly don't know what that's supposed to be, though. I assume it doesn't work properly, like everything else.



Gordon? GORDAN!, sorry but I will not be releasing that. You'll have to ask kwaHliveD for that to be implemented into the addon officially as like a toggle or something like that.
Also, the broken camera and player positioning can be fixed with a modified model that adds the proper attachments for those.
kwaHliveD  [author] Oct 11, 2023 @ 10:06am 
maybe if i include both "prop_vehicle_apc" and "prop_vehicle_driveable" to the detection hooks in this addon, we won't need another single addon to patch "prop_vehicle_driveable", since both require the same solution.

the only thing is that it is really unnecessary to patch prop_vehicle_driveable in hl2 based mod, since we already have "prop_vehicle_jeep_old" in hl2 branches. they are the same picture, when you disable tau cannon for "prop_vehicle_jeep_old" as for other source engine branches, we have https://github.com/Mikusch/source-vehicles

still, i am glad someone enjoyed this mod.
Gordon, GORDAN! Oct 10, 2023 @ 4:44pm 
Also speaking of APCs... I think the one from Human Error/Entropy Zero 2 could use a GMod port if anyone's up to it.
Gordon, GORDAN! Oct 10, 2023 @ 4:39pm 
@Totalchaos

I wonder if you might release your updated version of Prop_vehicle_apc, possibly with an edit to make the player face the forward end of the vehicle?
TotalChaos Oct 10, 2023 @ 1:46pm 
You have no idea how happy I am that somebody with code knowledge actually took the time to fix prop_vehicle_apc so players can drive it and use the guns on it. After nearly 20 years, somebody finally did it. Fantastic job!
I actually made my own version which disables the auto-aim stuff and re-enables the boost/turbo, because that feels more "vanilla" or "Valve" to me (this version isn't public, I made it for private use).

With all that being said, can you make a version of this addon that fixes prop_vehicle_driveable instead? And do you think you can port prop_vehicle_jetski to GMod, and fix that too? I would love to see both of those entities working properly again, and it would be even better if all of this could be backported to Half-Life 2 and its Episodes (and maybe other games, just for laughs).
Cloud7 Oct 9, 2023 @ 1:52am 
my camera is strange
Gordon, GORDAN! Aug 31, 2023 @ 12:11pm 
I meant that it could be a way of possibly having your mod be used without need of cheats being used. I know what happens when You try to drive a Prop_vehicle_apc without mods.

I think the reason you can enter the APC at all is a remnant of a time when the player COULD drive it.

If I remember correctly, the player drove one to fool the Combine and the functionality had a small test map made on it.

The APC at the original drivable state had different weapons from retail. It didn't have a gun or rockets and instead the center cannon was a grenade launcher.

https://youtu.be/gWzmjBhXa0o
kwaHliveD  [author] Aug 31, 2023 @ 11:32am 
usable prop_vehicle_apc doesn't mean drivable prop_vehicle_apc, unfortunately. when you use any apc in half-life 2, for a reason i don't know, the game does not trigger vehicle driving interface. thus, player is able to enter in an apc but vehicle doesn't consider player driving it. this addon basically calls another EnterVehicle which initiates a proper vehicle start sequence.
Gordon, GORDAN! Aug 31, 2023 @ 11:19am 
There are some unlocked Prop_vehicle_apcs that exist in the game and one of them you can even see in Route Kanal and even get to it without cheating at all!

It's located at one of the bridges next to a wooden platform 2 SMG-using Metrocops are on.

If you instead park the Airboat next to it instead of smashing it, you can get on the platform and use it to get onto the bridge & use the Prop_Vehicle_Apc.
kwaHliveD  [author] Aug 31, 2023 @ 11:06am 
entirely possible, even it can be done without modding. but it's not me who will do the porting.
Gordon, GORDAN! Aug 29, 2023 @ 7:41am 
I wonder if this mod could be ported to HL2?
Gordon, GORDAN! Aug 19, 2023 @ 7:12pm 
@besiege38

because it was optimized for the NPC AI.

The 2-sec reload is likely the burst delay.

I believe the mag size is 10
besiege38 Jun 29, 2023 @ 7:22am 
Why does it take around 2 seconds for the gun to recharge?
Neruel May 22, 2023 @ 8:38pm 
I guess they removed the apc can't find it anymore looked like this but it was better. this is the closest/similar one i could find <<< .
washer28 Mar 27, 2023 @ 11:13pm 
this creating lots of errors in multiplayer
washer28 Mar 7, 2023 @ 10:10am 
[Drivable prop_vehicle_apc] lua/autorun/prop_vehicle_apc_fixer.lua:158: attempt to compare nil with number
1. v - lua/autorun/prop_vehicle_apc_fixer.lua:158
2. unknown - lua/includes/modules/hook.lua:96 (x924)
Ion Feb 17, 2023 @ 3:58pm 
just like entropy zero 2
the universal union Feb 11, 2023 @ 4:37pm 
camera is broken
kwaHliveD  [author] Feb 11, 2023 @ 12:53pm 
for me, if you freeze the apc with the physgun while the wheels contact the ground, it just vanishes away with a crazy physics warning in console. nothing happens when none of the wheels hit the ground.
the universal union Feb 7, 2023 @ 6:26pm 
dont freaze it with the phyisics gun or it will fucking crash the game idk why
cozmo Jan 4, 2023 @ 12:41pm 
Whatever you do, DO NOT GO IN THIRDPERSON WHEN DRIVING IT! It sometimes fucks up your viewmodels and you have to restart the server to fix it
Artificer Nov 20, 2022 @ 8:20am 
It is so difficult to drive!
michka.tmv Nov 18, 2022 @ 6:18am 
hey, please fix camera. addon is good but camera bugged:missing: