Announcement

Collapse
No announcement yet.

Get the preview structure

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

    Get the preview structure

    You can directly jump to post 4 if you don't want to read all.

    Hello, i'm new to the dev kit, i'm trying to make my first mod for test purpose, i'm making an industrialforge with some ini options, i got some problems. All settings are in the gameusersetting.ini.

    First is the scale, i found some way to change the scale of the new forge :
    - SetWorldScale3D of the "myRootTransform" component don't change anything.
    - Changing the "scaleFactor" property or using "SetActorScale3D" of the forge's blueprint give the good effect but the scale is not take into account before the placement is done, i want to say the user show the "not modified scale" of the object before he click to place it on the ground (when the object is green). that work perfectly while in the dev kit and in singlePlayer, but not on a server. something about replication is missing or something like that?

    Second is the maxInventoryItems of the forge, when i look at the forge, the good value is set, for exemple (0/200) but when i open it, there is not 200 slot, there is what i entered as value at cook time, if i set this cook value to 1 i can add more than 1 item (saying "2/1" in the inventory and "(2/200)" when look at the forge from outside. [Answer] : add a "forceReplicateNow" node after the modification.

    I use begginPlay to setting up all. I realy need some help.
    Last edited by ElFab; 06-01-2018, 02:51 PM.

    #2
    For the second part, the problem is solved by adding a "forceReplicateNow" node.

    I added a breakpoint on the EventbeginPlay node and it seam that it fire two times, one when using the primalitem and one when placed on ground, i think there is two instances of the object created, and it seam that on dedicated server, the first don't fire the beginPlay event. How can i access to this "before placement" thing and change his size? Or at last how can i see if the event fire ingame, is there something like "printString" but for in-game environment, can i send a chat message?

    [PS edited] for text message : getGameMode=>castToShooterGameMode=>SendServerChatMessage
    Last edited by ElFab; 05-30-2018, 10:43 AM.

    Comment


      #3
      I was right, on a single player game the beginplay event fire twice, but on dedicated it only fire when the structure is placed on the ground, it's why i have this result...

      Now ii'm looking for a way to access the "not yet placed" structure, or activate the event begin play on dedicated like it fire on single player.

      Do someone know something to point me on a direction?

      [Edit] I'm cooking with the event "PreInitComponent" wich fire twice too in the dev kit, i wish it fire twice one dedicated...
      Last edited by ElFab; 05-30-2018, 01:09 PM.

      Comment


        #4
        PreInitComponent is fired once too, and is fire before the object exist, any modification at this event about the object is simply useless and will not affect the object.

        I need help to get the preview object that is shown to the player (maybe only on player side) at placement time.
        Last edited by ElFab; 06-01-2018, 02:52 PM.

        Comment


          #5
          I just bump this thread because i still need help for a way to get the preview structure on dedicated server (maybe on client side).

          Comment


            #6
            the preview structure is an instance of the class itself. there is a bool to differentiate the preview structure from the placed one. I believe it is call `IsPreview`

            so you can do the following nodes

            Event Begin Play -> Branch(IsPreview)

            Comment


              #7
              Thank you for your answer.
              Yes, i have seen this isPreview, but at the "beginPlay" time, on dedicated, i will never have a true at this branch, on single player, i got one time this branch true (when using the object in inventory), and one time this branch false (when the object is placed on the ground), so yes there is two instances of the object created. But on dedicated, the event begginPlay doesn't fire for the "preview structure", here is my problem, i'm now thinking that there is no preview structure on server side (on dedicated), but as we can see it on client side, it exist on client side and it's maybe where i should look at but i have no idea how.
              Last edited by ElFab; 06-15-2018, 07:03 AM.

              Comment


                #8
                You are correct, preview only exists on client


                My Mods | P0k3r's Workshop

                Comment


                  #9
                  ok thank you, and do you know a way to access it on client side? i need to resize it.

                  Comment


                    #10
                    When `isPreview` is True you are already accessing it. that instance of the object that your code is running on IS the preview structure, it's not a different class. You need only gate your code behind a `Branch(IsPreview)` and that code will only run if it is a preview instance, likewise if `IsPreview` is False then it's the actual placed instance of the structure.

                    Comment


                      #11
                      Thank you for your answer but i thing you don't understand my problem or i don't understand your answer. I don't need to know if it is the preview because i just need to do the same thing on the preview than on the placed object and this is what i'm trying to do and this same thing that don't work. I'm using the BegginPlay event and this event fire twice ONLY IN DEV KIT or SINGLE PLAYER. It never fire on dedicated for the preview structure, here is my problem. I'm unable to change anything on the preview structure because this event don't fire for it and i don't know how to access this instance otherwise.

                      Comment

                      Working...
                      X