View Full Version : scaleform tutorial for OTHER than Huds and menues?
joesan
11-24-2010, 01:09 PM
There are 4 video tutorials from independent sources:
VoxHouseStudio Making a basic menu
AwesomeAllar's Creating a Menu
Grosie's HUD Tutorial
Vickithesmith's A basic menu
Apart from Matt Doyle 3 other tutorials about..... you named it: Huds and Menus
Isn't there anyone interested in how to make a keypad with numbers to enter a code to open a door? A nice switch with a button which when pressed does something? Messages shown on screen that requires interaction ( not just the ubiquitous start play, or set profiles...), creating a picture that shows up on screen to alert you from peril? enter a full word in the keyboard when a message shows up on screen?, etc
I am sure not all of us work with UDK to make big bucks making a game for the comunity but just to amuse ourselves and are not interested in a menu on screen.
A nice tutorial from Doyle, for instance, would be nice.
xXSLAD3Xx
11-24-2010, 01:16 PM
A nice tutorial from Doyle, for instance, would be nice.
Well, he has stated on numerous occasions that making tutorials for this community isn't his only job at Scaleform, and that he doesn't have that much time on his hands.
ffejnosliw
11-24-2010, 01:38 PM
All of the examples you give are, in fact, menus in the most basic sense. I'm not sure what the real difference would be between that and what may be considered a "main menu" in terms of how to create it and how it works.
More examples and tutorials are always good, but what exactly is it that you want to see? Is it how to create and open a Scaleform movie at will at any point during the game? How to make them interact with the world to trigger events? Something else?
Matt Doyle
11-24-2010, 04:29 PM
The key pad door lock is relatively easy. In fact, one of our first Unreal 3 Scaleform tech demos had a keypad that required the user to enter a code to open a door. Here was the basic setup (NOTE: This is a very old demo from over a year ago, and the code may no longer be the best way to do this):
1. A keypad Flash movie is created. This movie had some ActionScript logic in it to listen for keyboard input, and display what the user types. After the user has typed in 6 digits, the Flash file tests to see if the new value entered is the correct code. If so, it changes the color of the keypad to green (it starts out red), and sends an fscommand to Kismet ('DoorUnlocked'). If the user enters the max number of keys without entering the correct code, it resets the keypad and sends an fscommand 'DoorLocked'.
The keyboard input listener looks like this in ActionScript:
var curr_idx:Number = 1;
var correct_key_code:String = "232323";
var entered_key_code:String = "";
function PressKey(key:Number)
{
entered_key_code = entered_key_code + key;
// do some Flash stuff here to display the key pressed
// check for correct val
if (curr_idx == 6)
{
if (correct_key_code == entered_key_code)
{
fscommand("DoorUnlocked");
// do some Flash stuff here to show the keypad code was entered correctly.
Key.removeListener(this);
}
else
{
fscommand("DoorLocked");
// do some Flash stuff here to show keypad has been reset to default display.
entered_key_code = "";
curr_idx = 0;
}
}
curr_idx++;
}
onKeyDown = function()
{
var kc:Number = Key.getCode();
if (kc > 48 && kc < 55)
{
var key:Number = kc - 48;
PressKey(key);
}
}
Key.addListener(this);
2. The Flash movie is added as a render texture/material on a keypad skeletal mesh surface in the level, next to the door.
3. A trigger is put next to the keypad, which when activated (touched) by the player, set capture keys values with Set GFX Captured Keys for the keypad SWF specified by OpenGFxMovie in Kismet. (one, two, three, four, five...enter, left, right, up, down, etc.). The same trigger, when untouched, sets capture keys to empty.
4. The fscommand event in Kismet (DoorUnlocked), when received, opens the door by playing a matinee of the door opening. The door closes automatically again after a set time using the reverse of that matinee.
You could instead put most of the AS logic in step 1 in an UnrealScript class, but you would need to have the target keycode stored in a way that is not accessible by players to avoid cheating, or encrypt/decrypt it.
With newer UDK versions, I'd say one possible route would be to create a custom door key code class, that listens for external interface calls. The ActionScript callback might look something like: ExternalInterface.call("OpenDoor", "MyDoorName", CodeEntered) Where CodeEntered is a string value containing the code the player entered. When the UnrealScript class receives the callback, it activates a remote kismet event for the given door. The receiving UnrealScript function might be something like:
function OpenDoor(string DoorName, string CodeReceived)
{
local name EventName
if (CodeReceived == "1234")
{
EventName = name(DoorName); // not sure how to type cast a string value to a name, so this might be wrong.
TriggerRemoteKismetEvent(EventName);
}
}
Then you'd have the function TriggerRemoteKismetEvent have the code necessary to trigger a remote kismet event with the name 'DoorName'. That code would be:
function TriggerRemoteKismetEvent( name EventName )
{
local array<SequenceObject> AllSeqEvents;
local Sequence GameSeq;
local int i;
GameSeq = GetPC().WorldInfo.GetGameSequence();
if (GameSeq != None)
{
GameSeq.FindSeqObjectsByClass(class'SeqEvent_Remot eEvent', true, AllSeqEvents);
// activate them
for (i = 0; i < AllSeqEvents.Length; i++)
{
if(SeqEvent_RemoteEvent(AllSeqEvents[i]).EventName == EventName)
SeqEvent_RemoteEvent(AllSeqEvents[i]).CheckActivate(GetPC().WorldInfo, None);
}
}
}
This event would play the matinee for that door. You just need to decide where to put the logic that tests for a correct code entered - either in Flash, before sending the external interface call, or in UnrealScript, after receiving it.
CloDel Studios
11-24-2010, 05:22 PM
Matt Doyle...
Wow, just wanted to say thanx for you all your help on here. I know you have alot of other things to do, and when ppl ask stuff you dont just say a lil bit about it, you come back with details. Thats just great to see, anyways just wanted to say thanx.
Matt Doyle
11-24-2010, 05:44 PM
My pleasure. I'm not an engineer, and can't always answer the more technical questions - I'm more of a technical artist/game designer. But any way I am able, and when I have time, I will try to help.
joesan
11-25-2010, 02:00 AM
That answer from Matt Doyle is superb, you don't have to make a complete video tutorial on the subjects I mentioned but your detailed scripts are indeed VERY helpful. I'd rather have these kinds of application tutorials (or helps) than "show scores" or "Menu Options" on screen.
Again thanks Matt.
Allar
11-27-2010, 05:41 PM
If anything, I'd like to see more involving render-to-texture goodness.
indygoof
01-31-2011, 03:27 PM
Hi,
to catch up on this old topic, lets say i want to press the keypad buttons with my mouse (the keypad is still in 3d-space, i.e. rendered onto a bsp). Would there be any way the swf would correctly(!) capture the mouse - input?
thx,
Indy
bazmod
03-10-2011, 10:32 AM
Thought i would add a bit more to this old topic - I also am stuck with how to capture some mouse input on a 'render to bsp' object.
Say I had a crane that I wanted to move about by pressing some buttons on a control pad (using the mouse). The crane is just simple matinee stuff so I just need to trigger it after pressing the buttons. I understand all this upto the point of how to go about using the mouse to press buttons - rather than capturing the keyboard?
Anyone got any ideas?
Matt Doyle
03-10-2011, 11:22 AM
First of all, I'd say put a working mouse cursor in your SWF...
http://forums.epicgames.com/showthread.php?t=763518
That's the first step.
bazmod
03-10-2011, 11:43 AM
cool thanks! I can see you've answered my question already in that thread - I'll work through whats in there and see where I get with it :)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.