Announcement

Collapse
No announcement yet.

UI Creation Help: Select and Spawn a Character from a UI Screen in game. Tower Defens

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

    UI Creation Help: Select and Spawn a Character from a UI Screen in game. Tower Defens

    Hello Everyone,

    I am asking for some assistance from the UDK community. I am building a tower Defense game. The only thing I am having a problem with is trying to get a character to spawn in game. I have buildable tiles along a set path that the enemy characters are following. When selecting a buildable tile I have a small screen made in flash pop up were you can select a character to place in spot you had selected. Only I cant figure out what code to write in scaleform for UDK to recognize the actor/pawn I have selected and to place it on the screen. I have looked everywhere for this type of game and scaleform type code and haven't found anything yet. Does anyone have any sample code for me to look at or can anyone give me an idea on how to write this code.

    Thank you for your time. I've been stuck on this one thing for over a month now. I really need to get passed this hump so I can finish this game.

    Dereck.

    #2
    first step is to be able to spawn such a character from an unrealscript function. once you got that done all you need to do is make flash communicate with unrealscript by making it execute that same function from before.
    you can learn how to call an unrealscript function from actionscript code here: http://udn.epicgames.com/Three/Scale...0_ActionScript

    Comment


      #3
      Hello Chosker,

      According to the scaleform technical guide to pass a function from scaleform to unreal the function has to exist in gfxmovieplayer. I don't see any function for spawning characters. Are you suggesting that I have to add a function into gfxmovieplayer for it to work? Honestly I don't think anyone has done a UI that spawns characters cause I haven't found any threads regarding this. My current UI unrealscript file is extending from gfxmovieplayer. I guess I can add a dependson and add a pawn class. Any other ideas?

      Thanks,

      Dereck

      Comment


        #4
        Well I tried to to a dependson (UTPawn) and it cannot find it. My guess is because the gfxmovieplayer.uc is in the gfxUI directory and it cannot see anything in the UTGame directory and or in my custom directory.

        My file starts like this.

        class GFxSubMenu extends GFxMoviePlayer;
        dependson (UTPawn);

        I call this menu in kismit.

        Thanks,

        Dereck

        Comment


          #5
          Well added GFxUI to the config file defaultengine.ini and then i was able to use the dependson command and now I can probably use fuinctions built within UTPawn. If you think I'm heading in the wrong direction please let me know.

          Thanks,

          Dereck

          Comment


            #6
            Hello Everyone,

            Well adding the dependson (UTPawn) didnt work.. So now I'm back to square one. All the GFx files extend to GFxMoviePlayer and GFxMoviePlayer extends object so I'm not sure I can write a function to spawn a character. At least I doubt Unreal will understand it because GFxMoviePlayer wont be able to see the correct files. I did find a file GFxProjectedUI.uc that is the 3d inventory system and there is a section function CreateItemData() that uses weaponsclass and UTpickupFactory classes. Has anyone in the UDK Community ever spawn a character In-game using scaleform UI and if so can you give me some pointers?


            Thanks,

            Dereck

            Comment


              #7
              Hey whats up man, the spawning doesn't have to happen from the hud class itself. From the hud class call a function to access the game info class to spawn your pawn object:

              For example, this is how I spawn objects from the hud:
              SpawnedPlayer = BFPGameOnline(GetPC().WorldInfo.Game).SpawnPreview Player(playerArchetypeName,SpawnLocation,SpawnRota tion);

              Comment


                #8
                Anyways you don't even have to do it that way it's unnecessarily complex, you can just access an fscommand and call a spawn function in kismet

                Comment


                  #9
                  Hello Garner,

                  I created a UI submenu that extends gfxmovieplayer because I am calling this menu in kismit when I left click on a specific object. The menu pops up and has two icons representing two different characters I would like to spawn. I would rather spawn a character using kismit but I'm not sure how to go about it. Click image for larger version

Name:	kismit_tower_defense.jpg
Views:	1
Size:	66.7 KB
ID:	3249169Here is a screen shot of my starting kismit. I was thinking of passing a numbered variable such as character 1 could be the number 1 and then character 2 could be the number two then do a comparison and then use actor x to spawn the character. But when I try to get a variable using get gxfui variable it only lets me get a stringed variable and not a Int variable. So I'm stumped on that process because I can only compare variables that are numbers. Anyone have any ideas. I'm probably over thinking this and scaleform was easy up till this part.

                  Thanks,

                  Dereck

                  Comment


                    #10
                    Mmm, I'm using a public computer, so I can't access the GFxObject codes.

                    Perhaps you can spawn it via HUD wrapper class? They're from Actor family.

                    Comment


                      #11
                      Hello Handepsilon,

                      I thought about that but just thinking about that gives me a headache. I created my level out of tiles. so when the tiles along the path get clicked on the submenu pops up with your choice of which character to choose. So I guess I can write a code within my hud class that onclick calls the submenu class to display the menu. hmm then this is where I get stuck because it will call the submenu class that derives from gfxmovieplayer and wont allow me to spawn a character. Is there a way to write a function that can spawn a character from the hud class when the character selected comes from a nonhud class. I hope that makes sense. I've been spinning my wheels on this for over a month. I guess I can look into rewriting my submenu class to derive from UDKHUD instead of gfxmovieplayer but not too sure how that would work right now. I wish UDK had an easier way to write a good system instead of having to go back and forth between unreal script, action script, and kismit.

                      Thanks

                      Comment


                        #12
                        You can execute a function in UnrealScript from Flash using ExternalInterface.call("SpawnThis", param1, param2, ...param8);

                        Here's a little example of how to spawn an object from a GFxMoviePlayer class. Please bear in mind this is a skeleton example, but it contains what you need to know.

                        Code:
                        class MyHud extends GFxMoviePlayer
                        
                        var WorldInfo    ThisWorld;
                        var SomeSpawnableObject MySpawnedObject; // replace SomeSpawnableObject with the class of the object you are spawning
                        
                        function Init(optional LocalPlayer player)
                        {	
                            super.Init(player);
                        	
                            ThisWorld = GetPC().WorldInfo;
                        
                            Start();
                            Advance(0);
                        }
                        
                        // Call this function from Flash with ExternalInterface.call("SpawnThis", param1, param2, ...param8)
                        
                        function SpawnThis(param1, param2, ...param8)
                        {
                            local vector objectLoc;
                        	
                            objectLoc = vect(0,0,-100);
                            MySpawnedObject = ThisWorld.Spawn(class'SomeSpawnableObject',,,objectLoc);
                        }

                        Comment

                        Working...
                        X