Prop vehicle crane: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(Should probably still be highlighted, though)
 
(One intermediate revision by one other user not shown)
Line 7: Line 7:
It is a player-drivable crane. It requires an attached [[phys_magnet]] (see KVs).
It is a player-drivable crane. It requires an attached [[phys_magnet]] (see KVs).


{{bug|You must change the Vehicle Script KV to <code>scripts/vehicles/crane.txt</code>. The default is the [[prop_vehicle_jeep|jeep]].}}
{{important|In the [[FGD]], a base class with the default script [[prop_vehicle_jeep|jeep_test.txt]] is used, so you need to change the Vehicle Script KV to <code>scripts/vehicles/crane.txt</code>.}}


== Keyvalues ==
== Keyvalues ==

Latest revision as of 08:45, 19 September 2025

English (en)Translate (Translate)
C++ Class hierarchy
CPropCrane
CBaseProp
CBaseAnimating
CBaseEntity
C++ vehicle_crane.cpp
The typical models/Cranes/crane_docks.mdl model, with an attached models/props_wasteland/cranemagnet01a.mdl phys_magnet.

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

It is a player-drivable crane. It requires an attached phys_magnet (see KVs).

Icon-Important.pngImportant:In the FGD, a base class with the default script jeep_test.txt is used, so you need to change the Vehicle Script KV to scripts/vehicles/crane.txt.

Keyvalues

Magnet entity (magnetname) <targetname>
The crane will not show up at all unless a phys_magnet with a model is specified in this field. The crane will automatically be connected to the entity with a rope/wire.
Note.pngNote:Set the magnet's "Mass Scale" to something like 500, or it will be bouncy and unusable.

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>
Todo: How fast the vehicle turns/accelerates?


Inputs

ForcePlayerIn
Force the player to get into the crane. Only works in singleplayer.
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.
Todo: What does this mean?
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.

Outputs

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.


See also