• Register

The game you are trying to view has ceased development and consequently been archived. If you are a member of this game, can demonstrate that it is being actively developed and will be able to keep this profile up to date with the latest news, images, videos and downloads, please contact us with all details and we will consider its re-activation.

What happens when your inner demons come alive? And how do you survive when all you can do is run? In Spotted, you play as a 47-year-old man abandoned by his mother and devastated by the recent death of his father. The spiraling depression and unstable mental state that results spawns strange and terrifying creatures before his eyes. When what's in your head can kill you, all you can do is run, but when heart failure poses a constant threat, running can be the most difficult task in the world. Spotted is an upcoming survival horror game with an alpha release planned for 2014.

Post tutorial Report RSS UDK Kismet: Flashlight with camera rotation

A short Tutorial for UDK to setup a switchable flashlight that follows the camera.

Posted by on - Basic Client Side Coding

Fist of all you have to copy the following script into a text file and save at your UDK folder under Deveolopment/Src/Engine/Classes as SeqAct_GetPlayerRnL.uc.

class SeqAct_GetPlayerRnL extends SequenceAction;

var vector rotationVector;
var vector locationVector;

// Events
//====================================================

event Activated()
{
	local SeqVar_Object ObjVar;
	local Pawn player;
	local Rotator viewRotation;

	foreach LinkedVariables(class'SeqVar_Object', ObjVar, "Target")
	{
		player = Pawn(ObjVar.GetObjectValue());
		
		viewRotation = player.GetViewRotation();
		locationVector = player.GetPawnViewLocation();

		rotationVector.X = viewRotation.Pitch;
		rotationVector.Y = viewRotation.Yaw;
		rotationVector.Z = viewRotation.Roll;
	}
}

//====================================================

DefaultProperties
{
	bCallHandler=false

	ObjName="Get Player Rotation and Location"
	ObjCategory="Player"

	VariableLinks(1)=(ExpectedType=class'SeqVar_Vector',LinkDesc="Rotation Vector",bWriteable=true,PropertyName=rotationVector)
	VariableLinks(2)=(ExpectedType=class'SeqVar_Vector',LinkDesc="Location Vector",bWriteable=true,PropertyName=locationVector)
}

Now you should make a full recompile in UnrealFrontend (make sure the UDK editor is closed it may cause some issues)

UnrealFrontend is located in the UDK folder/Binaries

UF_fullrecompile

If thats done start the UDK editor to create a simple map with a Playerstart or open the map you want to implement the Flashlight.

My map look like this i added no light source so you have a better effect of the flashlight:

UDK_tut

The next step is to add a Spot Light Moveable go to the ContentBrowser(Ctrl+Shif+F) and select actor classes and search for Spot light movable. Know position it in front of the Playerstart (make sure it is pointing towards the blue arrow).

It should look like this:
UDK_map

If thats done go to Kismet by pressing on the green K+ icon next to the ContentBrowser icon:
kismet

In
the upcoming Kismet window make the sequence look like this:

Kismet_tut

The blue comments are the location of the Kismet Nodes in the add menu (RightClick in Kismet window)

The Red lines show where you have to connect the variables

The black arrow show how the properties have to be changed(the rest can be the default properties)
After that is done there just one thing that is missing the light. Select the Spot Light Movable in the editor window. Open Kismet press RightClick and select New Object Var Using SpotLightMovable_0
(the number at the end may be different)

To finish this you just have to connect the SpotLightMovable var with the target of Set Actor Location and the target of Toggle.

The Kismet sequence should look like this in the end:
kismet_tutFin

Know you should rebuild the map by pressing the button with the blue cube and the light bulb
buildall

Start the map and it should work like that:

I hope this Tutorial was helpful. If you have problems or question on this write them in the comment section. And don't forget to give feedback!

Here you can download the finished result including the script file:
Flashlight Tutorial Finished Result

Also you might be interessted in one of these links:

TheDj245(my youtube channel): Youtube.com
Spotted (game project): Indiedb.com
One Man Studio(facebook page): Facebook.com


Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: