Announcement

Collapse
No announcement yet.

Custom Kismet Action - Set TextField

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Custom Kismet Action - Set TextField

    After a little research and development, I've put together the first, of what I hope will be many, custom Kismet Actions for controlling your Flash content. This particular Kismet Action allows you to set the contents of a standard Flash textField from Kismet. Enjoy!

    Save this file as: GFxAction_SetTextField.uc in the \Development\Src\GFxUI\Classes\ folder.
    It will show up in Kismet under New Action -> GFx UI -> Set TextField.

    Code:
    class GFxAction_SetTextField extends SequenceAction
        dependson(GFxMoviePlayer);
    
    var GFxMoviePlayer MoviePlayer;
    var GFxObject TextField;
    var GFxClikWidget ClikTextField;
    
    var() string TextFieldPath;
    var() string Text;
    
    var() bool bCLIK;
    
    event Activated()
    {	
        if (bCLIK)
        {
            ClikTextField = GFxClikWidget(MoviePlayer.GetVariableObject(TextFieldPath, class'GFxClikWidget'));
    	ClikTextField.SetString("text", Text);
        }
        else
        {
            TextField = MoviePlayer.GetVariableObject(TextFieldPath);
            TextField.SetString("text", Text);
        }
    }
    
    event bool IsValidLevelSequenceObject() { return true; }
    
    defaultproperties
    {
        ObjName="Set TextField"
        ObjCategory="GFx UI"
    
        VariableLinks(0)=(ExpectedType=class'SeqVar_Object',LinkDesc="Movie Player",bWriteable=false,PropertyName=MoviePlayer)
    }
    • Now, add the new Set TextField event to your Kismet.
    • Put the full path to the textfield in the Text Field Path entry.
    • Put the text you want displayed in the Text entry.
    • If you used a CLIK text field, be sure to enable CLIK by placing a checkmark in the box.
    • Wire Movie Player to the Movie Player object variable connected to the Open GFx Movie node.

      NOTE: If you are changing the textfield of a movie upon 'Success' of that movie opening, you may be required to add a short Delay (New Action->Misc->Delay) between the 'Success' output and the Set TextField input for it to work. A delay of 0.1 should work.

      See image below for an example of a proper setup involving a touched trigger firing off the textField change.



    By p1ut0nium at 2011-03-11

    #2
    Outstanding, thank you sir.

    Comment


      #3
      Matt you are so cool! This has unlimited potential including great easy dialog integration!

      Comment


        #4
        It's not working for me My main issue, I think, is trying to get it to change text on the HUD, like my HUD movie. I'm not sure what I should set as the movie player. Can someone kismet screenshot me an example on how to make it say something on the default scaleform hud? Thanks!

        Comment


          #5
          This isn't going to work for a HUD, or any other SWF created in UnrealScript. This is for SWFs created in Kismet with Open GFx Movie. If you're creating SWFs in UnrealScript, you really don't need this.

          That being said, if you can get a reference to the UnrealScript created SWF/Movie into an empty object variable in Kismet, this will work for it.

          Comment


            #6
            Is there a stock SWF that can be used as an example?

            Comment


              #7
              Setting text fields from UnrealScript is very simple...

              Code:
              var GFxObject MyTextField;
              MyTextField = GetVariableObject("_root.myFlashTextField");
              MyTextField.SetString("text", "boo!");

              Comment


                #8
                I am also having problems with this what should the Text Field Path be? I have tried "_root.speed_tf" like in the pic, but its no dice.
                Thanks.

                Comment


                  #9
                  _root.speed_tf happends to be the path/name of my textField. speed_tf is the instance name, and the textField lives on the _root timeline.

                  I don't know what your path should be, as I haven't seen your Flash file. The path should be whatever the path in Flash is to your textfield. Start with _root (optional) followed by a dot, then the rest of your path. The last part of your path should be the instance name of your textfield. Is your textfield on the root timeline? Or is it nested in other movie clips?

                  Comment


                    #10
                    hi,
                    can anyone explan how i setup the textbox in flash ? and how i get the currect path ? i tried it since 2 days but i dont get it to work... ?

                    is it right to put easily a textfield in flash, set the instancename and thats it ?
                    after this i tried i with _root.instancename as path but it dont works....
                    what am i doing wrong

                    Comment


                      #11
                      What you explained is all there is to it. I'm not sure what your problem is, as I don't know what kind of error your getting.

                      Comment


                        #12
                        i get no errors but the text is not changing

                        Edit : is it possible that u upload a example flash file anywhere ?

                        Comment


                          #13
                          There is a sample Flash file with textfields in the UDK Development/Flash/tutorials/ directory.

                          Comment


                            #14
                            ok thanks at first, i take a look at the examples

                            Edit : ok thanks so much , it works now

                            Comment


                              #15
                              I would like to know how you got it working. I'm really frustrated, because I got no single localization implementation to work and I almost read through the whole Unreal Script Refenrence on UDN! So I was looking for alternatives and found this Kismet actions, but it's no use, the textfields just won't change.
                              I took the "CLIK_tutorial_unskinned.fla" from Development\Flash\CLIK\tutorial and gave the "Main Menu" Text an instance name, I tried others, too. Published for AS 2.0, Flash Player 8, imported the swf file into my package and hooked up the nodes in Kismet as seen on the image, but without the trigger. Instead I connected the 'Success' of the "Open Gfx Movie" (and others, because it failed) with the 'In' of "Set Textfield"/"Set CLIK TextField". As "Text Field Path" I entered "_root.myTextField" (myTextField being the instance name). I guessed I should reference the movie in the object variable, that is commented as "SWF" in the image. But neither PIE, nor the udk.exe got it working. I tried different gametypes for my custom map and, well, I have the feeling I tried everything else!

                              I'm desperate, because I need this for a project I'm supposed to deliver, but failing at such odds and ends.
                              Is this still working with the august 2011 udk?! Does somebody have a working example map and swf that implements it? My last guess is, that the textfields aren't recognized or exported properly to the swf file, because nothing I tried did the trick.

                              Edit: I will now check out the sandbox files and report back if necessary. Big thanks to you, Matthew!

                              Comment

                              Working...
                              X