prop_vehicle_apc

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)
C++ Class hierarchy
CPropAPC
↳CPropVehicleDriveable
↳CPropVehicle
↳CBaseProp
↳CBaseAnimating
↳CBaseEntity
C++ vehicle_apc.cpp

prop_vehicle_apc is a model entity available in Half-Life 2 series Half-Life 2 series.

A prop_vehicle_apc using its typical models/combine_apc.mdl model.

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.

Warning.pngWarning: The APC can not be driven by the player, even with a different vehicle script file.
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".)
Note.pngNote: The wheels of the APC model are not solid, but you can prevent the player going through them by immersing them within one or more "Player Clip" brushes. Alternatively, you could replace the collision mesh via mods.

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:
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/+attack2 key.
AttackAxis <floatRedirectOutput/float>
Attack2Axis <floatRedirectOutput/float>
!activator = the player when exitting the vehicle other-wise it's this entity
!caller = this entity
State of the attack/attack2 buttons (can only be 0 or 1). Also called when the player exits the vehicle.


Inputs

BaseDriveableVehicle:
HandBrakeOn
HandBrakeOff
Turns the handbrake on/off, preventing the vehicle from driving but not disabling motion from external forces.
BaseVehicle:
Action <floatRedirectInput/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 <targetnameRedirectInput/string>
A target to fire a missile at.
Destroy
Causes the APC to blow up.