prop_vehicle_apc
| CPropAPC |
prop_vehicle_apc is a model entity available in
Half-Life 2 series.
Entity description
On its own, the Combine APC is a vehicle with mounted guns, that can be blown up, or commanded to fire a missile at a specific target via FireMissileAt.
The APC should be given the models/combine_apc.mdl world model and the scripts/vehicles/apc_npc.txt vehicle script file.
For a proper APC that is capable of driving along a path_track and firing at enemies on its own, you will also need the npc_apcdriver entity and assign it to your APC using the "Vehicle to drive" (Vehicle) keyvalue.
For APC's that are meant to drive around the map and not fire at potential enemies, use npc_vehicledriver instead.
You may use I/O on the npc_apcdriver such as StartFiring and StopFiring to decide when to attack. You could also use npc_bullseye and ai_relationship to have it fire at seemingly random spots.
Any target further than 1024 units will be attacked with missiles, while anything closer will be shot at with its mounted machinegun.
It is not possible to have the APC's AI attack two independent targets with both of its weapons at once. Think of the APC AI as an NPC that has two weapons to choose from based on distance to the target, rather than two independent weapon AI.
Players can enter the APC vehicle, but doing so causes a softlock, as all input is disabled. Exiting the APC is also not possible.
To prevent the vehicle from being entered, you should set its "Start locked" (VehicleLocked) keyvalue to "Yes".)
Destruction
When destroyed, 5 prop_physics entities and random number of gibs are created. Some missiles may be shot out that are capable of hurting NPC's or the player.
Keyvalues
- Missile Hint Target (missilehint) <targetname>
- Name of one or more info_apc_missile_hint entities to use to determine what to hit. Will fire missiles at its spawn point if no missile hints are available.
BaseDriveableVehicle:
- Starts locked (VehicleLocked) <boolean>
- Players cannot enter vehicle until it is unlocked.
BaseVehicle:
- Vehicle Script File (vehiclescript) <string>
-
The vehicle script files contained in
scripts\vehicles\define the behaviour and handling of a vehicle. It is important to match the right script to the right entity/model:- prop_vehicle_airboat:
airboat.txt - prop_vehicle_apc:
apc.txt/apc_npc.txt - prop_vehicle_crane:
crane.txt - prop_vehicle_prisoner_pod:
prisoner_pod.txt - prop_vehicle_jeep:
jalopy.txt(only in
) / jeep_test.txt - prop_vehicle_choreo_generic:
Half-Life 2: Episode One only:choreo_vehicle.txtchoreo_vehicle_ep1_dogintro.txt
Half-Life 2: Episode Two only:choreo_vehicle_ep2_barn1.txtchoreo_vehicle_ep2_hangar.txtchoreo_vehicle_ep2_intro.txtchoreo_vehicle_ep2_Outland_02.txtchoreo_vehicle_ep2_playertrapped.txt
- There is also
reference_vehicle.txt, which you can modify to make your own vehicle or use as-is. - prop_vehicle_sin:
sincar.txt/sincar_pit.txt(only in
) - p3_vehicle_segway:
segway.txt(only in
)
- prop_vehicle_airboat:
- Scale of action input / framerate (actionScale) <float>
- Used as a scale of how fast the 'vehicle_action' pose parameter increases. Will not do anything unless 'Action' input is also called on the vehicle entity with a non 0 value, since the internal value is set to 0 by default.
Outputs
- OnFiredMissile
- Fired when the APC shoots a missile.
- OnDeath
- !activator = killer
!caller = this entity
Fired when the APC is killed. - OnDamaged
- Fired when the APC is damaged.
- OnDamagedByPlayer
- Fired when the APC is damaged by the player.
BaseDriveableVehicle:
- PlayerOn <void>
- PlayerOff <void>
- !activator = the player
!caller = this entity
Player entered/exited the vehicle. - PressedAttack <void>
- PressedAttack2 <void>
- !activator = !caller = this entity
Player pressed the+attack/+attack2key. - AttackAxis <float>
- Attack2Axis <float>
- !activator = the player when exitting the vehicle other-wise it's this entity
!caller = this entity
State of theattack/attack2buttons (can only be 0 or 1). Also called when the player exits the vehicle.
Inputs
- HandBrakeOn
- HandBrakeOff
- Turns the handbrake on/off, preventing the vehicle from driving but not disabling motion from external forces.
- Action <float>
- Set the speed of the action animation, specifically how fast the `vehicle_action` pose parameter increases. Default is 0.
- TurnOn
- Start engine and enable throttle.
- TurnOff
- Stop engine, disable throttle, engage brakes.
- Lock
- Unlock
- Prevent/allow the player from entering or exiting the vehicle.
- FireMissileAt <targetname>
- A target to fire a missile at.
- Destroy
- Causes the APC to blow up.