<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.splashdamage.com/index.php?action=history&amp;feed=atom&amp;title=Vehicle_Scripting%3A_Cockpits</id>
	<title>Vehicle Scripting: Cockpits - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.splashdamage.com/index.php?action=history&amp;feed=atom&amp;title=Vehicle_Scripting%3A_Cockpits"/>
	<link rel="alternate" type="text/html" href="https://wiki.splashdamage.com/index.php?title=Vehicle_Scripting:_Cockpits&amp;action=history"/>
	<updated>2026-06-10T08:34:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.splashdamage.com/index.php?title=Vehicle_Scripting:_Cockpits&amp;diff=1430&amp;oldid=prev</id>
		<title>192.168.0.142 at 16:51, 15 October 2007</title>
		<link rel="alternate" type="text/html" href="https://wiki.splashdamage.com/index.php?title=Vehicle_Scripting:_Cockpits&amp;diff=1430&amp;oldid=prev"/>
		<updated>2007-10-15T16:51:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This article describes how cockpits are hooked up and some of the options they present.&amp;lt;includeonly&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{main|Vehicle Scripting: Cockpits}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cockpit entityDef ==&lt;br /&gt;
&lt;br /&gt;
When the player in a position switches to a view that shows the cockpit a client entity will be spawned for that player only. This entity will use the entityDef pointed to by the &amp;lt;tt&amp;gt;&amp;quot;def_cockpit&amp;quot;&amp;lt;/tt&amp;gt; key, and the script object named by the &amp;lt;tt&amp;gt;&amp;quot;scriptobject&amp;quot;&amp;lt;/tt&amp;gt; key.&lt;br /&gt;
&lt;br /&gt;
For all the basic behaviour of the cockpit - making sure it is at the right position relative to the vehicle, creating interior lights etc - a base class exists that implements all of this. This is called &amp;lt;tt&amp;gt;&amp;quot;vehicle_basic_cockpit&amp;quot;&amp;lt;/tt&amp;gt;. This is derived from for some vehicles to allow for special behaviour, for example animating the hands on the steering wheel and throttle, spinning barrels on gatling guns, etc.&lt;br /&gt;
&lt;br /&gt;
Only the basic cockpit script is descriped here. For examples of more sophisticated cockpits look in the &amp;lt;tt&amp;gt;base/script/vehicles/cockpits&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
'''Keys:'''&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;quot;offset&amp;quot;&amp;lt;/tt&amp;gt; - Offsets the position of the cockpit&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;quot;largeFov&amp;quot;&amp;lt;/tt&amp;gt; - Offsets the cockpit position based on the value of the player's FOV. With 110 FOV the full offset will be added, and with 90 FOV no offset will be added.&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;quot;noEmpEffects&amp;quot;&amp;lt;/tt&amp;gt; - Sets that this cockpit does not get any EMP effects applied to it.&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;quot;climate_skin_key&amp;quot;&amp;lt;/tt&amp;gt; - Allows the cockpit to have a climate skin.&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;quot;joint_attach&amp;quot;&amp;lt;/tt&amp;gt; - The joint to attach base the view from.&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;quot;passenger_id&amp;quot;&amp;lt;/tt&amp;gt; - Position number of the passenger of this cockpit (1, 2, 3, etc). &lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;quot;fx_emped&amp;quot;&amp;lt;/tt&amp;gt; - Effect to play when the vehicle is hit by EMP damage.&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;quot;joint_fx_emped&amp;quot;&amp;lt;/tt&amp;gt; - Joint to play &amp;lt;tt&amp;gt;&amp;quot;fx_emped&amp;quot;&amp;lt;/tt&amp;gt; on.&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;quot;foce_joint_idle&amp;lt;/tt&amp;gt; - Forces the cockpit position to be based off the joint position rather than the player's view position, even if it has a &amp;lt;tt&amp;gt;passenger_id&amp;lt;/tt&amp;gt; set.&lt;br /&gt;
* &amp;lt;tt&amp;gt;&amp;quot;def_light*&amp;quot;&amp;lt;/tt&amp;gt; - Where &amp;lt;tt&amp;gt;*&amp;lt;/tt&amp;gt; is 1, 2, 3 etc. Points to the entityDefs for lights attached to the cockpit. [[Vehicle_Scripting:_Cockpits#Cockpit_Lights|Cockpit Lights]] describes these in more detail.&lt;br /&gt;
&lt;br /&gt;
=== Cockpit Positioning Modes ===&lt;br /&gt;
&lt;br /&gt;
There are three modes for the positioning of the cockpit. The first positions it relative to the vehicle itself. The second positions it relative to a joint of the vehicle. The third positions it relative to the view origin of the player that is in the cockpit. The third method is used if &amp;lt;tt&amp;gt;&amp;quot;passenger_id&amp;quot;&amp;lt;/tt&amp;gt; is set, unless &amp;lt;tt&amp;gt;&amp;quot;force_joint_idle&amp;quot;&amp;lt;/tt&amp;gt; is turned on. The second method will be used if &amp;lt;tt&amp;gt;&amp;quot;joint_attach&amp;quot;&amp;lt;/tt&amp;gt;. Otherwise the first method will be used.&lt;br /&gt;
&lt;br /&gt;
=== Cockpit Lights ===&lt;br /&gt;
&lt;br /&gt;
These allow the interior of the vehicles to be illuminated in interesting ways. Any number of lights are supported, however they will degrade performance.&lt;br /&gt;
The main keys to configure cockpit lights are the same as for other light entities.&lt;br /&gt;
&lt;br /&gt;
Cockpit lights need to have a &amp;lt;tt&amp;gt;&amp;quot;spawnclass&amp;quot;&amp;lt;/tt&amp;gt; of &amp;lt;tt&amp;gt;&amp;quot;sdClientLight&amp;quot;&amp;lt;/tt&amp;gt;, and the &amp;lt;tt&amp;gt;scriptobject&amp;lt;/tt&amp;gt; should be set to &amp;quot;vehicle_cockpit_light&amp;quot;. The other key to set is the &amp;lt;tt&amp;gt;&amp;quot;origin&amp;quot;&amp;lt;/tt&amp;gt;, which is relative to the origin of the vehicle.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;&lt;br /&gt;
 entityDef vehicle_mcp_cockpit {&lt;br /&gt;
     &amp;quot;model&amp;quot;                      &amp;quot;vehicle_mcp_cockpit&amp;quot;&lt;br /&gt;
     &amp;quot;joint_attach&amp;quot;               &amp;quot;pilot_cam&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
     &amp;quot;climate_skin_key&amp;quot;           &amp;quot;weapon_gdf&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
     &amp;quot;offset&amp;quot;                     &amp;quot;7 0 -2&amp;quot;&lt;br /&gt;
     &amp;quot;gui&amp;quot;                        &amp;quot;guis/models/vehicles/mcp/cockpit&amp;quot;&lt;br /&gt;
     &amp;quot;weaponDepthHack&amp;quot;            &amp;quot;1&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
     &amp;quot;ambientCubemap&amp;quot;             &amp;quot;cockpit_mcp&amp;quot;&lt;br /&gt;
     &amp;quot;def_light1&amp;quot;                 &amp;quot;vehicle_mcp_cockpit_front&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 entityDef vehicle_mcp_cockpit_front {&lt;br /&gt;
     &amp;quot;light_radius&amp;quot;               &amp;quot;36 36 48&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
     &amp;quot;_color&amp;quot;                     &amp;quot;0.64 0.6 0.54&amp;quot;&lt;br /&gt;
     &amp;quot;origin&amp;quot;                     &amp;quot;80 21 180&amp;quot;&lt;br /&gt;
     &amp;quot;weaponDepthHack&amp;quot;            &amp;quot;1&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
     &amp;quot;texture&amp;quot;                    &amp;quot;lights/round_flicker3&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
     &amp;quot;spawnclass&amp;quot;                 &amp;quot;sdClientLight&amp;quot;&lt;br /&gt;
     &amp;quot;scriptobject&amp;quot;               &amp;quot;vehicle_cockpit_light&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is from the MCP cockpit. This features a flickering light in the cockpit, as well as a climate skin.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Vehicles]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>192.168.0.142</name></author>
		
	</entry>
</feed>