Announcement

Collapse
No announcement yet.

Pawn Switching, I need it to switch only between my main party members, not the whole map.

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

    Pawn Switching, I need it to switch only between my main party members, not the whole map.

    For the basic Pawn Switch I can press 2 and switch between all my pawns but when I get to the last pawn at the end of the index it stops the switching. But I need the array to continue on to recycle the pawns in its index each time I press the key.

    But there's just one thing with this code which I followed from an online tutorial. Is that if I have other pawns in the game like my enemies and such, the array will just keep on switching through every single pawn that it finds in the map instead of just switching only between just my main party members because I'm doing an RPG Game.

    So I need to know how to modify this code so it only switches between just
    my main party members and not switch between every single pawn it finds in the map. I don't know how to modify the code for doing this, and for some reason I can't make a pawn array element list, it refuses to accept the entries, so can someone tell me what I need to change?

    I need to know how to set the array up so it looks for specific pawns
    in its index, and not the whole kitchen sink.

    [IMG][/IMG]
    Last edited by tozan; 07-03-2017, 11:36 PM.

    #2
    You have two options here, only put variables in the array that are the type that you are looking for, or check the array element you are about to possess if it is the type you want.

    To check if an object is a type of something, you need to cast your object to that type. Drag the wire from the 'Get' node and search for 'CastTo' and select your desired type. Only proceed to possess the indexed pawn if the cast was successful.

    Search for BlueprintCasting in the docs, they have a nice page explaining the process.

    Comment


      #3
      Okay I realized there might be a way easier solution, or I haven't answered your question? Are you looking for a single type of pawn or multiple types but not all?

      If you only have one type, ignore my previous comment and just change the 'GetAllActorsOfClass' node to not look for 'Pawn' but for your type instead.

      Comment


        #4
        It stops at the end of the index because you never set index back to 0 after it reached the max value.
        As Kontur said you are able to posses every pawn in your game because you do not limit the selection of "get all actors of class". If you have a different Blueprint class for your party members use that instead of pawn.

        Regards

        Comment


          #5
          Umm that would be Commander Character as that's the default pawn class I'm using.but i think the issue is that this tutorial code I got from a Side Platformer I don't think is compatible for third person and needs modification but I don't know how to modify the array to make it work for the third person and no I don't know how to reset the index after a certain number has been reached.. I also can't change the pawn type over into Commander Character with this setup for the array because if I do that then the Posess pin node can't no longer link up because the possess node only accepts a pawn pin type.

          My Party members are just duplicates of the commander, they are not
          child blueprints. My commander is a third person character bp.
          But what's going on here is bizzare. The copies of the commander are all behaving strange, all reverse directions in their controls while the commander controls are not affected, so I wonder if duplicating the commander's BP has caused some overlapping issues to pop up in the copies that I made.

          The Party members all seem to have a mind of their own. One continually jumps, the other behaves like a shopping cart on wheels with no anims, the other two are behaving except for wanting to push and shove me off the nav map.



          These are NOT epic skeletons but they are custom made meshes that were AUTO-rigged up with Mixamo autorigger and I'm using the transition rules from the animation Starter Pack Mannequin. But maybe these rules the mannequin uses don't work well with mixamo Animations.



          Plus the Commander dosen't look natural and is all stiff and tight in the shoulders and his mesh looks all puffed up as well like rubber tyre.. I think the Mixamo auto rig didn't weight him properly.
          Last edited by tozan; 07-04-2017, 06:32 PM.

          Comment


            #6
            Im not at my pc so i cant test it myself but. Since Character is derived from pawn you must be able to use posess for it. I did it several times and it worked. Can you show me a picture of the error you get if you change it?
            What type of variable is "Available Characters"
            To set the index back to 0 is easy. Replace the "greater or equal" node wit a "greater" node. Then you can set your current index to 0 in the true branch. It is even easier if you use the modulo node.
            And you must connect your current index variable to the "get node" in the down right corner of your first picture. Otherwise it will always use the first element of your array.

            Regards

            Comment


              #7
              Yeah I just started switching my characters and the errors are popping up with all the characters I switched to.

              [IMG][/IMG]

              And the Error Description:

              Error Blueprint Runtime Error: Accessed None trying to read property CallFunc_GetController_ReturnValue3 from function: 'ExecuteUbergraph_CommanderCharacter' from node: Set Control Rotation in graph: EventGraph in object: CommanderCharacter with description: Accessed None trying to read property CallFunc_GetController_ReturnValue3

              Error Blueprint Runtime Error: Accessed None trying to read property CallFunc_GetController_ReturnValue2 from function: 'ExecuteUbergraph_SkinarPawn' from node: Set Control Rotation in graph: EventGraph in object: SkinarPawn with description: Accessed None trying to read property CallFunc_GetController_ReturnValue2

              ect ect.. for each character.

              The GetAvaliableCharacter Variable is set to Pawn Array.

              I made those changes but.

              If I only have four pawns in the level, then it works to recycling through them and restarts at the beginning pawn which is my commander.

              But if I have got more than four pawns in the level, it just recycles through
              every single pawn in the map before going back again to my commander.

              So the array index for some reason didn't reset.

              [IMG][/IMG]
              Last edited by tozan; 07-05-2017, 08:42 PM.

              Comment


                #8
                Hi [MENTION=103114]tozan[/MENTION],

                I think there might be an easier way to do this - instead of cycling through all the pawns in your level, simply create an array of Pawn references (this will represent your party) and then cycle through the array possessing the pawns there.

                So lets say you have 3 characters in your party - populate the array with the reference to these characters. Then, when you press the "Switch key" call an Event that goes thru the array and possess the next character in line.

                Example:

                Create an integer called CurrentCharacter. This will represent the index in the array of the current possessed character. So make CurrentCharacter = 0 (this represents the first character in your party). Then when you switch characters, increase CurrentCharacter by 1 and then get this index from the array and possess this character - the Index should be 1 (0+1) and this represents your second character, etc.

                Then after you possess your character use a Branch and check the value of CurrentCharacter. If its >= than your max party number (in this case 2 for 3 characters), then set CurrentCharacter = 0. This basically resets the CurrentCharacter so you can cycle indefinitely.

                Does this make sense?

                Hope this helps!
                [WIP] Procedural City Generator | RPG AI
                [MARKETPLACE] Animal Behavior Kit | Space Shooter Template | Procedural Foliage Tool | Procedural Park
                [FREE] Modular Road Tool | Action Platformer Template | Radar BP | Free Birds | Procedural Buildings
                Join our Discord

                Comment


                  #9
                  Is that the Array Element List that you are talking about when you say to Populate the Array with my characters? Just trying to understand how to
                  modify this switch code now to allow me to do this. Unreal Engine was a big
                  jump for me from going from batch programming to programming the
                  game now in Blueprints form. So there is a lot I don't yet know about this engine. I'm also trying to get my Dialog working now in the game as well with the text. I was given the code to get the speaker pictures working with the dialog so Cycling the pictures to match the speaker's text that part of the code is working.

                  But the problem is it cycles starting from row 0 going sequentially all down
                  the data table 1 row at a time. The problem with this is that The dialog for Telos dosen't start at row 0 but the dialog for that planet starts down at row 6,000 or so in the data table, so its gonna cycle the pics correctly to match up the speaker's name but its also going to bring up all the wrong rows of text so
                  instead of bringing up the right lines for Telos, it will bring up all the dialog for the opening start of the game which starts at row 0 in the data table.

                  The solution I believe is to set up another array with an random interger in
                  range node so I can manually set all the ranges where the text is stored
                  in the data row table and just draw that text out to display it. I already have the code for that set up.... I also need to know what the Engine's LIMITS are with box triggers so i know how many of them i can have in a level.

                  Since everything has to be stored in the level blueprint for doing these box triggers, I am soon going to run out of ROOM in the level blueprint...
                  Because I don't know how many box triggers you can have in a map.

                  Unless you professionals know of another way of setting it up because my game has over 20,000 lines of dialog in it, the batch file alone for holding all the dialog
                  is over 206 thousand lines long, containing about 1,400 array lists
                  in it so my project has alot of text in it like Kotor because I have alot of worlds in the game and quite a few party members as well. I think the save system would need to be done as a data table because of needing to keep track of many variables for all the systems.

                  Does anyone know where I can find some nice sci-fi dialog widget windows for displaying my text in? I need to know also how to fit this game inside the confines of Unreal Engine. As Unreal Engine has its limits...The game will have to be modular with its worlds and using simple sprites for the skyboxes and backgrounds. I cannot afford to throw in these huge 50 mile kite demo terrains that take some people days to try to render with tens of millions of triangles and meshes or that would bloat the game all up to hundreds of gigabytes... My machine card can't handle all of that.. The game is large and the dalog can be complex but the building of the 3d worlds needs to be kept simple as I don't know how to level stream yet or do world composition..

                  I'm gonna have to do something also about my commander's rig as well because after Mixamo was done with messing around with his mesh, he looks like a beached whale. I find these Mixamo rigs tend to be unstable or erractic
                  as well when you bring Mixamo Animations into the engine for I did
                  not expect my characters to give me reverse controls when switching
                  over to them.
                  Last edited by tozan; 07-06-2017, 01:44 AM.

                  Comment


                    #10
                    Originally posted by tozan View Post
                    Is that the Array Element List that you are talking about when you say to Populate the Array with my characters? Just trying to understand how to
                    modify this switch code now to allow me to do this. Unreal Engine was a big
                    jump for me from going from batch programming to programming the
                    game now in Blueprints form. So there is a lot I don't yet know about this engine. I'm also trying to get my Dialog working now in the game as well with the text. I was given the code to get the speaker pictures working with the dialog so Cycling the pictures to match the speaker's text that part of the code is working.

                    But the problem is it cycles starting from row 0 going sequentially all down
                    the data table 1 row at a time. The problem with this is that The dialog for Telos dosen't start at row 0 but the dialog for that planet starts down at row 6,000 or so in the data table, so its gonna cycle the pics correctly to match up the speaker's name but its also going to bring up all the wrong rows of text so
                    instead of bringing up the right lines for Telos, it will bring up all the dialog for the opening start of the game which starts at row 0 in the data table.

                    The solution I believe is to set up another array with an random interger in
                    range node so I can manually set all the ranges where the text is stored
                    in the data row table and just draw that text out to display it. I already have the code for that set up.... I also need to know what the Engine's LIMITS are with box triggers so i know how many of them i can have in a level.

                    Since everything has to be stored in the level blueprint for doing these box triggers, I am soon going to run out of ROOM in the level blueprint...
                    Because I don't know how many box triggers you can have in a map.

                    Unless you professionals know of another way of setting it up because my game has over 20,000 lines of dialog in it, the batch file alone for holding all the dialog
                    is over 206 thousand lines long, containing about 1,400 array lists
                    in it so my project has alot of text in it like Kotor because I have alot of worlds in the game and quite a few party members as well. I think the save system would need to be done as a data table because of needing to keep track of many variables for all the systems.

                    Does anyone know where I can find some nice sci-fi dialog widget windows for displaying my text in? I need to know also how to fit this game inside the confines of Unreal Engine. As Unreal Engine has its limits...The game will have to be modular with its worlds and using simple sprites for the skyboxes and backgrounds. I cannot afford to throw in these huge 50 mile kite demo terrains that take some people days to try to render with tens of millions of triangles and meshes or that would bloat the game all up to hundreds of gigabytes... My machine card can't handle all of that.. The game is large and the dalog can be complex but the building of the 3d worlds needs to be kept simple as I don't know how to level stream yet or do world composition..

                    I'm gonna have to do something also about my commander's rig as well because after Mixamo was done with messing around with his mesh, he looks like a beached whale. I find these Mixamo rigs tend to be unstable or erractic
                    as well when you bring Mixamo Animations into the engine for I did
                    not expect my characters to give me reverse controls when switching
                    over to them.
                    Hi Tozan,

                    You will have to create another event that populates (fills) the array. So for example, Create an array of type Pawn and leave it empty. Then on your PlayerBP create a custom event hooked to OnBeginPlay that will populate the array.

                    To populate the array, drag from the array reference and type "Add" -> this will let you enter a Pawn reference on the first index of the array (index 0). So, if you already know that your party consists of (for example): John, Mike, Mary (the names of the 3 characters), then your Custom Event can simply do this:

                    PartyArrayRef -> Add -> John
                    PartyArrayRef -> Add -> Mike
                    PartyArrayRef -> Add -> Mary

                    You can do this on a For Loop from 0 to 2 (3 party members). This needs to happen BEFORE you can switch. Then after the array has been populated with the reference to those 3 characters, you can use your Switch statement from PartyArrayRef[0] -> Possess to PartyArrayRef[1] -> Possess, etc.

                    Im at work, so I dont have access to UE4. I hope my explanation takes you on the right track.


                    EDIT: Ive never done anything close to a proper dialog system for an RPG. However, Ive heard that you can import an excel sheet to a datatable. So, assuming this is the case, create your excel file with all the dialog. The first column should be a DialogID (some unique code). This first column will be the unique key in your datatable.

                    So, for example, when you approach an NPC and it needs to say line (code: 342323). Then simply use the find data table row with this unique key and display the text. You dont need to cycle thru the rows at all. If you want to see something vaguely similar to this, you can check out my latest free project and see how I use my Level_DT data table to link levels together. Look at the Stage Clear event inside the PlayerCharacter Blueprint to see how I search for a row on the table.

                    Download here - https://forums.unrealengine.com/show...the-community!

                    Hope this helps!
                    Last edited by CoquiGames; 07-07-2017, 02:20 PM.
                    [WIP] Procedural City Generator | RPG AI
                    [MARKETPLACE] Animal Behavior Kit | Space Shooter Template | Procedural Foliage Tool | Procedural Park
                    [FREE] Modular Road Tool | Action Platformer Template | Radar BP | Free Birds | Procedural Buildings
                    Join our Discord

                    Comment


                      #11
                      No I didn't have a Dialog ID. Can you show me the proper dialog struct that I'm supposed to have
                      set up because I had this instead in my dialog struct....

                      Speaker, (Text) Text, (text)
                      PortraitID, (integer)
                      Image, (texture 2d)
                      AudioStart Time, (float)
                      AudioFileID, (Integer)
                      Audio File, (Sound Wave)
                      Condition, (String)
                      Camera Flag, (Boolean)
                      FacialAnim, (Anim Sequence)
                      Dialogskip. (Boolean)

                      I started now adding the Picture ID Struct for the Dialog Pics and find I gonna run out of pins in the array soon for the pics.... Because I think you can only have abt 256 or so pins in the array for blueprints... But I have got over 200 characters in my game because of the many systems and I aint even gone a quarter of the way down through my game script yet to dig all my characters out of the script to put into this array and already the array pins are filling up fast even though I don't have all the pics to all my characters yet.

                      Here's The Dialog Picture Array Struct:

                      [IMG][/IMG]

                      I also wanted some of my NPC's to beable to give back a random response that's why I had set it up with a random integer so the array can pick out one row of text within the row range to display. I cycled the text only for NPC's in the game who like to speak their own opinions and thoughts. Like when you greet an NPC and they say to you back at random, Hi how are you, or you step in the trigger again with them and they change their words to, Nice Day, isn't it?. Or the say something else, But if I wanted only the same same text to display, then I would set both the ranges to the same row number. and not cycle it.. So that's how I was trying to set up the dialog. But the triggering of this array in Blueprints is glitchy because I used a sequence node to try to set it up with. So when I first step in the trigger nothing happens, but when I step through it several more times, then the text starts to soon display. So its kinna slow...

                      But that array I been using took a truckload of nodes just to try to read and display a row of text and play the audio file to the text. And I thought well this way will work only for games that use a small amount of dialog, but not like the Kotor Games that have tens of thousands of lines of dialog in it.....

                      [IMG][/IMG]

                      Size of the dialog in the game. (1 Segment is text that's anywhere from 1-3 lines or a paragraph.) So Commander Marston Axle has 8k segments. Storm Transk his sidekick has almost 8k as well. Skynar Ship Pilot has 2k segments. Rex Titans Sun or Rex has 790 segments. Loana Shields has abt 4k of segments. Nosey Nella has 396 segments. William Smith 254 , T6unit (the Droid) has 608 Segments....

                      Project site: http://www.tozan35.weebly.com

                      And the rest of the game characters around 50 or less segments .So its like a Kotor Game with all the text
                      and characters.... I need to find a better droid model as well.
                      Last edited by tozan; 07-09-2017, 02:07 AM.

                      Comment

                      Working...
                      X