Announcement

Collapse
No announcement yet.

read variables, sort array by variable... between blueprints

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

    read variables, sort array by variable... between blueprints

    Hi guys,
    I have this problem about the variables of my spawned bp-objects in a bp-volume -box collision-.

    Each bp-object have the "rank" -int variable- that i added for sort them but how i share these bp-objects variables with bp-volume?

    Now the volume know the bp-object name and print string (it see bp-objects inside) but variables in bp-object are unusable.

    Variables are exposed and editable, when i play a simulation, by clicking the bp-object spawned i have all variables on the details tab.
    But nothing give me an idea how i can use that for interaction, sorting and more... example:
    name rank points family superobject (set in game)
    box1 3 10 blue
    box2 2 5 blue
    box3 1 10 red
    box4 4 5 red
    box5 8 2 green
    box6 5 0 green
    box7 6 20 yellow
    bp-objects are spawned shuffle for N players, every player have 7 box

    box3,box5,box2,box4,box1,box7,box6

    i want sort them by the rank variable:

    box3,box2,box1,box4,box6,box7,box5

    for starting is good have an hint how to get vars and print them as string, for using them i will study the best way for the use in game.



    thanks and regards

    #2
    hormok You don't have to do anything special, in the volume box BP just do a 'getallactorsofclass' which will give you the other BPs in an array. You can loop through the array and 'see' the variables on each item in the array.

    When you have a single BP during the loop, you can just pull a pin off and access the variables with 'get<variablename>' and 'set<variablename>'.

    Comment


      #3
      ClockworkOcean
      First tnx for the hint.
      i'm very very lame in programming (it's seen) better for create maps for the old unreal games :/
      i put a ss of that i understood of your hint... and i tryed to do with my knowledge (poor)

      Click image for larger version

Name:	Screenshot_20191108_115252.png
Views:	97
Size:	242.5 KB
ID:	1684243
      Now i have the Class id printed on screen as "ActroName_0_C"
      i suppose:
      0 is the number of time actor is repeated on the level/map/screen
      C is Class, type of actor/object was recognized.
      Anyway i can't find any pin to extract for get the variables (rank) of the objects collided with "rank_volume_G5" and reuse for the next step of the routine (sorting by rank)

      On the simulation i have that:

      Click image for larger version

Name:	Screenshot_20191108_120604.png
Views:	88
Size:	42.8 KB
ID:	1684244
      these "constants" (values can't change) and variable (will be set in the flow of the game) are my targets to "read/see/manipulate"!
      Each actor have own specs...
      tnx in advance.

      Comment


        #4
        hormok If you are doing it with a collision volume like that, then you don't event need 'get actors'. Do it like this:

        Attached Files

        Comment


          #5
          ClockworkOcean
          Oh Yes!
          It,s works thank you very much!
          little expansive like routine i suppose...
          i did that:
          Click image for larger version  Name:	Screenshot_20191108_173304.png Views:	0 Size:	293.8 KB ID:	1684389
          May be it can be simplified...
          now i will work about sorting creating an array with the integer filtered with no 0 values.

          tnx again!

          Comment


            #6
            ClockworkOcean
            Uhm! it's a dog bit his own tail!
            Whit this (imho) too expensive routine (it's repeated 40 times linked by the cast failed pins):
            At actor begin overlap event actor touch volume if is casted remove index and insert the actor at index like the variable value, if not casted go to the next cast check...40 times
            Click image for larger version  Name:	routine1x40.png Views:	0 Size:	98.8 KB ID:	1687374‚Äč-----Any hint to have a routine lighter than that? Now only 20% of the routine give me useful informations, 80% is garbage.-----
            how can i obtains the same vars of the actors spawned (20%) in to the volume keeping out of the routine others actors (80%)?

            It can solve the next question in one shot, but for knowledge i add:

            It stores into the array all actors spawned in the correct index like variable index rank and leave "none" other indexes (array have 40 indexes)...:
            Click image for larger version  Name:	array-result.png Views:	0 Size:	61.3 KB ID:	1687375
            the rank is correct but!
            I'm going crazy to remove only "none" indexes from the array, i search, i seen, i read a lot of stuff nothing help me.
            Thanks in advance.

            Comment


              #7
              Bump Up for no resolved problem...
              In my last reply hi ask about a lighter routine to obtain same information from spawned objects in a collision box with overlap event.
              I suppose that:
              The new object is not spawned and the blue print can't have reference to it...with "cast to" node it ask about collision: yes get ref; no skip to next cast.
              But i suppose too the power of the engine it is not limited at "it is here i grab ref"
              for the second question i'm trying a lot of stuff about trasferring data from an array to other array skipping "none" indexes, Finally i Use "Filter Array" node and it clean my array by none indexes and give me the correct rank as stored in the first.
              But i found a singolarity:
              Click image for larger versionName:	rankinatorss.pngViews:	0Size:	360.9 KBID:	1691072
              If i don't use "Delay" node filtering is not correct because routine loose a collision (the first collision occurs 0,5 sec after routine start).
              Can I consider it a bug?
              Anyway i hope my experience can be useful for others...
              The first question in the post still remain a stone in my shoe!
              Anyone know a lighter routine?

              Thank you in advance.

              Comment


                #8
                hormok Sorry! - didn't see all this. You need to '@'

                Also, try Answerhub, there you get an email when people respond, much easier.

                Anyway, I'm looking at what you have here. I think your problem is that you don't need lots of different types of BPs, you only need one kind of BP, which has variables in it.

                Why do they all need to be different?

                If they are all the same ( but just have different values for the variables ) you only need one cast, to check it's the BP, and not the player etc.

                Comment

                Working...
                X