Announcement

Collapse
No announcement yet.

Dialog interaction concept improvement

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

    Dialog interaction concept improvement

    Hi, I recently played with some Scaleform code and ended up with a working Dialog Interaction system.

    http://www.youtube.com/watch?v=b0yKVDb85c4

    But I believe my coding is naive and ineffective.
    In particular, I'd like to use arrays and dynamic buttons, as currently I have static buttons with each button its own code, because each button has a different image associated with it. But I'm pretty sure it has to be another way, and I'd like to use GFx Set/Getvariable somehow

    For example, in Kismet I should be able to use a variable that sets the button position (._x/._y) and/or type, let's say the agreeBtn is Top Right and disagreeBtn is Bottom Right, I should be able to use a counter 0-5 or 1-6 to set the position back in SWF

    Problem is, in my day job I manage networks and I have no programming/artistic training, I just followed some good tutorials from Matt D. from Scaleform, but there are aspects of coding that are out of my current understanding, even though as a logical concept are clear. As in, I know what the better way is, I just don't know how to get there, so to speak

    Any hints?

    Thanks!

    EDIT: the smart version is now here http://www.youtube.com/watch?v=7tePTDoEhWQ

    #2
    Hey, could you teach me how to do that? However I dont want to chose in order to go to the next dialogue. I want mine to be like when you trigger smth, 2 characters start to talk to each other and subtitles will appear. Any idea how to do that ? Any help is much appreciated

    Comment


      #3
      I expect this thread is going to get much more 'do it as a tutorial' requests than actual help.
      I'd say yours is a problem with Actionscript programming. You can change a flash movieclip's position and a textfield's text via Actionscript. Try writing a function in AS that will dynamically set the position, then test it within flash. After that you need to figure out how to pass variables back and forth between Uscript and Flash (if you don't know already), and make Uscript take the calls as to button placement, text, alignment, etc.
      Due to the complexity of this task I'd recommend using Uscript instead of Kismet. I have no idea if Kismet alone would get the job done.

      Comment


        #4
        Look at the Epic Games Scaleform HUD. On the actions layer, it has some code that manages resizing/repositioning of items by calculating resolution changes and moving the items around by calculating a bottom/left/right/top shift.
        Depending on the object (items have an instance name), it gets offset by using bottom/top for the y-axis and left/right for the x-axis.

        So your interaction thingie would be offset using the bottom shift value for the y-axis, and 0 for the x-axis (so it stays centered)

        Now, I'm not the best with Scaleform but this is pretty much what I did myself aswell and so far it works great on res from 800x600 up to 1920x1080.


        For the dynamic part, I'd put the selection thingies in an array in the order you want them to show and then load the strings from somewhere (either through AS or through US and then passing them to AS).
        Set the selectors on 'disabled' on start and enable them when you assign a choice/string to the button.
        To make all the buttons use an instance instead of all there own code, make them all instances of your button object in Flash and change only the image through code. (PSEUDO-CODE!)
        Code:
        topLeftOption.image = topLeftImg
        (when the items get initialized (either in AS, or US))

        Then to do something when it is clicked; add an event listener (either in AS or US) and do whatever it is that needs to be done in there.

        Don't forget to clear the string and to disable it again after a choice has been made. If you only want to trigger a response but end up on the same selection options this won't be necessary, though you could disable the chosen entry but leave the string in to make it clear that the player just used that choice and also preventing him/her from using it again.

        Comment


          #5
          I replied to this few days ago, didn't use Quick Reply but Go Advanced, it said a moderator will do something with the reply and it never apper here?

          Comment


            #6
            Yea I encountered the same issue. I contacted the admins using the 'Contact Us' thingie and got a reply a day or so later.
            Haven't seen it happen since

            Comment


              #7
              OK, I have an update. This weekend I had some time to poke around a bit more and I learned how to create dynamic CLIK buttons
              Now I have another interesting issue

              As we all know, in order for Kismet to do something with the buttons from Flash, I needed to put a tiny delay of 0.1 sec in Kismet.
              Now, the fun part is this:
              I created the dynamic CLIK buttons in Flash
              I added a 0.1 delay in Kismet before using Set_Text action - this is needed because otherwise Kismet doesn't detect the buttons from Flash so it doesn't update any textField
              I added a 0.2 delay back in Flash, because I have a function in Flash that activates a button if the Set_Text text in UDK is different than the default CLIK "Button Label", so this function needs to wait for the Set_Text (0.1 sec) which is required to wait for the buttons to populate from Flash in UDK. Fun stuff, huh? Hope this is clear

              Anyways, my question is: can we have a listener instead of time delays? I think using time delays is not really an elegant solution, especially if I keep adding delays to have a sequential Turing machine between 2 different programs, UDK and Flash, like I'm doing now, UDK waits for Flash which in turn waits for UDK, etc etc

              And second, the same way Set Text in UnrealScript sets the textField back in Flash, I'd like to set another property in UDK, that Flash can read and based on that to figure out which image should pop up when onRollOver is true. I can extend the current GFxAction_SetTextField.uc (from Matt Doyle, thanks Matt!) to add another 'var string' or something but I don't know all the CLIK properties, like textField, that can be manipulated from UDK to Flash.

              Well, let me know. Learning this stuff is a lot of fun, too bad I don't have too much time for it

              thanks!

              Comment


                #8
                update:
                I finally managed to finish this vanity project, using December 2011 version and Scaleform 4 with AS3

                In the past few weekends, I learned some AS3 stuff, which I have to admit works with my brain better than AS2 but also it was easier for me to use AS3 over UnrealScript, no idea why hehehe

                Anyways, all the static issues with the previous version in my dialog concept are done, I use dynamic buttons, dynamic button location, dynamic icon display, everything is handled with minimal effort in Kismet

                the UnrealScript required is really just this
                Code:
                var string btnEvent;
                function ltBtnPressed(string id_as3)
                {
                	btnEvent = "CE " $ "lt" $ id_as3;
                	ConsoleCommand(btnEvent);
                }
                the AS3 script is also pretty easy, my approach to pass all the variables I need in one shot was to set a TEXT in Kismet and use a delimitator ## to split the text in what I need
                AS3 looks something like this

                Code:
                var arrayBtn:Array = [ltBtn, lmBtn, lbBtn, rtBtn, rmBtn, rbBtn]; 
                	for(var i:int = 0; i < arrayBtn.length; i++){
                		var btn:* = arrayBtn[i];
                		var propArr:Array = btn.textField.text.split("##");
                		arrayBtn[i].id = propArr[0];
                		arrayBtn[i].type = propArr[1];
                		arrayBtn[i].label = propArr[2];
                and then I have some conditions and some switch cases, but simple stuff
                The only "brilliant" idea I had was to use a delimitator, there may be other ways, but this works for me just fine

                here you can find an example of the new dialog interaction concept, with new icons, and only few choices, 2 for different branches of Left Middle Button and 2 for different branches of Right Middle Button, only to show an example how the code knows which Matinee to play based on the value found in arrayBtn[i].id

                http://www.youtube.com/watch?v=7tePTDoEhWQ

                Well, that's all, I'm glad I met my own deadline of 12/31/11 and that's all I wanted to do and learn about this dialog interaction concept. Credits should go to all the smart people in UDK and AS forums!

                Comment

                Working...
                X