Announcement

Collapse
No announcement yet.

Is it possible to create new UClass at runtime (after game has been packaged) ?

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

    Is it possible to create new UClass at runtime (after game has been packaged) ?

    My scenario is simple. I have items, which can be customized. Each base item type is separate blueprint. Each item have array of Item Upgrades (UObject based blueprints), which can modify item in various ways.

    Now I store items as UClass (in player inventory). And spawn the when needed.
    But now lets say player will add item upgrades to default item. When player does it, I'd like to save new item as UClass (Blueprint?), for further use, to spawn new item when needed.

    Short version:
    1. Player Pick item -> Item is spawned -> Player add upgrades to item -> I want to save item with upgrades as new UClass, I don't want to serialize spawned item to disk, only save it "blueprint"/
    https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

    #2
    No this isn't possible, but to be honest I think you're also going about it the wrong way. Why save it as a new class at all, why can it not just be an item with an associated upgrade? Create your own spawn function to handle appending the upgrade when you spawn it.

    Comment


      #3
      Construct your class so you have values you can adjust at runtime to well... raise its strenght value or whatever or make a new array from a custom structure where you can add upgrades in stackform
      Free Inventory System (BP AND C++ Version): Clicky Clicky
      Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
      Howto: Create Dragable UMG Windows: Zoom Zoom

      Comment


        #4
        Originally posted by ambershee View Post
        No this isn't possible, but to be honest I think you're also going about it the wrong way. Why save it as a new class at all, why can it not just be an item with an associated upgrade? Create your own spawn function to handle appending the upgrade when you spawn it.
        Right. But how do I determine which upgrade happen to be attached to said item, without saving some data about item in first place ?
        I wanted to use UClasses for it, because they are small and provide CDO for easy access to informations.

        Well, I probably could wrap it into some other class/struct like item info, which would be serialized to disk and which would contain references to item blueprint, upgrades blueprint etc.

        But this would make harder to access information about referenced blueprints CDO, and CDOs are nice for getting information about particular object without constructing it.

        Originally posted by ruohki View Post
        Construct your class so you have values you can adjust at runtime to well... raise its strenght value or whatever or make a new array from a custom structure where you can add upgrades in stackform
        Well it is option, but.. It's not what I want. I don't want set of predefined adjustments per item, as it defeats my idea of customization. The point is to have items with upgrades slots, and each upgrade slot player can add any fitting upgrade. The point with upgrades is they are not flat increases of some numbers, but event handlers. They listen for player actions, and perform another action.
        https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

        Comment


          #5
          Originally posted by iniside View Post
          Well it is option, but.. It's not what I want. I don't want set of predefined adjustments per item, as it defeats my idea of customization. The point is to have items with upgrades slots, and each upgrade slot player can add any fitting upgrade. The point with upgrades is they are not flat increases of some numbers, but event handlers. They listen for player actions, and perform another action.
          Then you have state inherent to your items that needs to be preserved.

          Either store them in your inventory as instances instead of classes, or store the added state separately so you can reapply it whenever you spawn the item.

          Comment


            #6
            Originally posted by iniside View Post
            Right. But how do I determine which upgrade happen to be attached to said item, without saving some data about item in first place ?
            I wanted to use UClasses for it, because they are small and provide CDO for easy access to informations.

            Well, I probably could wrap it into some other class/struct like item info, which would be serialized to disk and which would contain references to item blueprint, upgrades blueprint etc.

            But this would make harder to access information about referenced blueprints CDO, and CDOs are nice for getting information about particular object without constructing it.



            Well it is option, but.. It's not what I want. I don't want set of predefined adjustments per item, as it defeats my idea of customization. The point is to have items with upgrades slots, and each upgrade slot player can add any fitting upgrade. The point with upgrades is they are not flat increases of some numbers, but event handlers. They listen for player actions, and perform another action.
            no you didnt understand. Each array element has for example a str,agi,dex,mana etc all those stacks get summed up in the end. You could add or remove at runtime
            Free Inventory System (BP AND C++ Version): Clicky Clicky
            Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
            Howto: Create Dragable UMG Windows: Zoom Zoom

            Comment

            Working...
            X