Code Help: New key commands and Entity coding - DIGI Byte - 12-19-2010
Quote: This is a help request to the Dev's, Luis and any other coders
(I don't know everyone names yet )
We have a small project going on, to create a flashlight entity, fully coded and scripted without overwriting the original lantern.
I have a few questions on limitations and if we can work around them
---------------------
First, how far can we go as creating a fully working flashlight entity?
Is it possible to write our own keybinds?
I'm looking to change these 2 keybinds and make them take effect in game
Code:
<Lantern Primary="Keyboard::L" Secondary="" />
<Flashlight Primary="Keyboard::F" Secondary="" />
I have created the pick up entity which allows the player to use the lantern.
However this needs to be changed to activate the flashlight and I'm kinda stuck at that part, The wiki doesn't have anything that's helpful and updated for HLP2
Code:
<UserDefinedVariables EntitySubType="Lantern" EntityType="Item">
<Var Name="Health" Value="100" />
<Var Name="Toughness" Value="0" />
<Var Name="MaxFocusDistance" Value="0" />
<Var Name="MainPhysicsBody" Value="" />
<Var Name="ShowMesh" Value="true" />
<Var Name="DissolveOnDestruction" Value="false" />
<Var Name="DissolveTime" Value="1.0" />
<Var Name="EffectsOnSound" Value="" />
<Var Name="EffectsOffSound" Value="" />
<Var Name="EffectsOnTime" Value="1" />
<Var Name="EffectsOffTime" Value="1" />
<Var Name="EffectsOffLightColor" Value="0 0 0 0" />
<Var Name="EffectsOffLightRadius" Value="-1" />
<Var Name="ShowHints" Value="true" />
<Var Name="StaticMoveCheckCollision" Value="false" />
<Var Name="StaticMoveStartSound" Value="" />
<Var Name="StaticMoveStopSound" Value="" />
<Var Name="StaticMoveLoopSound" Value="" />
<Var Name="RandomizeAnimationStart" Value="true" />
<Var Name="SubItemTypeName" Value="Flashlight" />
<Var Name="ImageFile" Value="flashlight.tga" />
<Var Name="PickSound" Value="Generic" />
flashlight.ent code
Spoiler below!
Code:
<Entity>
<EditorSession>
<Performance CamClipPlanes="0.05 1000" LightsActive="true" PSActive="true" ShowFog="true" ShowSkybox="true" WorldReflection="true" />
<ViewportConfig BGColor="0.2 0.2 0.2 1" GAmbientLight="true" GPointLight="true" GridSnap="false" GridSnapSeparation="0.25" SelectedViewport="0" UsingEnlargedViewport="false">
<Viewport CameraPosition="0 0 180" CameraTarget="0 0 0" CameraZoom="4.8" GridHeight="0" GridPlane="2" Preset="0" RenderMode="1" ShowAxes="true" ShowGrid="true" UsingLTCam="false" />
<Viewport CameraPosition="180 0.00484981 -0.0319652" CameraTarget="0 0.00484981 -0.0319652" CameraZoom="4.7" GridHeight="0" GridPlane="0" Preset="1" RenderMode="1" ShowAxes="true" ShowGrid="true" UsingLTCam="false" />
<Viewport CameraPosition="0 180 0" CameraTarget="0 0 0" CameraZoom="0" GridHeight="0" GridPlane="1" Preset="2" RenderMode="1" ShowAxes="true" ShowGrid="true" UsingLTCam="false" />
<Viewport CameraPosition="-0.357328 0.0124795 -0.012736" CameraTarget="0.326762 -0.218764 0.0262875" CameraZoom="4.23613" GridHeight="0" GridPlane="1" Preset="3" RenderMode="0" ShowAxes="true" ShowGrid="true" UsingLTCam="false" />
</ViewportConfig>
</EditorSession>
<ModelData>
<Entities />
<Mesh Filename="entities/item/flashlight/flashlight.dae">
<SubMesh Active="true" ID="0" Material="C:/Program Files (x86)/Steam/steamapps/common/amnesia the dark descent/entities/item/flashlight/flashlight.mat" Name="mesh_PIVOT" Rotation="3.14159 0 0" Scale="0.05 0.05 0.05" SubMeshID="0" Tag="" WorldPos="0 0.0418419 0" />
</Mesh>
<Bones />
<Shapes>
<BodyShape Active="true" ID="5" Name="Shape_1" RelativeRotation="0 0 0" RelativeScale="0.08 0.08 0.6" RelativeTranslation="0 0 0" Rotation="0 0 0" Scale="0.064 0.064 0.33" ShapeType="Box" Tag="" WorldPos="0 0.0390146 0" />
</Shapes>
<Bodies>
<Body Active="true" AngularDamping="0.2" BlocksSound="false" BuoyancyDensityMul="1" CanAttachCharacter="false" CollideCharacter="false" CollideNonCharacter="true" ContinuousCollision="true" HasGravity="true" ID="7" LinearDamping="0.2" Mass="1" Material="Generic_Hard" MaxAngularSpeed="20" MaxLinearSpeed="20" Name="collision" PushedByCharacterGravity="false" Rotation="0 0 0" Scale="0.8 0.8 0.55" Tag="" UseSurfaceEffects="true" Volatile="false" WorldPos="0 0.0390146 0">
<Shape ID="5" />
</Body>
</Bodies>
<Joints />
<Animations />
</ModelData>
<UserDefinedVariables EntitySubType="Flashlight" EntityType="Item">
<Var Name="Health" Value="100" />
<Var Name="Toughness" Value="0" />
<Var Name="MaxFocusDistance" Value="0" />
<Var Name="MainPhysicsBody" Value="" />
<Var Name="ShowMesh" Value="true" />
<Var Name="DissolveOnDestruction" Value="false" />
<Var Name="DissolveTime" Value="1.0" />
<Var Name="EffectsOnSound" Value="" />
<Var Name="EffectsOffSound" Value="" />
<Var Name="EffectsOnTime" Value="1" />
<Var Name="EffectsOffTime" Value="1" />
<Var Name="EffectsOffLightColor" Value="0 0 0 0" />
<Var Name="EffectsOffLightRadius" Value="-1" />
<Var Name="ShowHints" Value="true" />
<Var Name="StaticMoveCheckCollision" Value="false" />
<Var Name="StaticMoveStartSound" Value="" />
<Var Name="StaticMoveStopSound" Value="" />
<Var Name="StaticMoveLoopSound" Value="" />
<Var Name="RandomizeAnimationStart" Value="true" />
<Var Name="SubItemTypeName" Value="Flashlight" />
<Var Name="ImageFile" Value="flashlight.tga" />
<Var Name="PickSound" Value="Generic" />
</UserDefinedVariables>
</Entity>