Announcement

Collapse
No announcement yet.

Generating Random Numbers in Each Instance of a BP Spawned?

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

    Generating Random Numbers in Each Instance of a BP Spawned?

    Super long explanation short. I want to place my weapon pickup blueprint in the world several times and instance of its existence, it generated random values for min and max damage. The random value generation is working, but it spawns every single instance of this blueprint in the level with the exact same randomly generated number.

    I've tried for each loops, tried spawning from an item spawner, but nothing seems to make it be instance-specific I've tried searching but can't find anything on this specific type of circumstances.

    .

    #2
    If you're placing the Weapons manually and not spawning, then do the Random Dmg generation within the Construct Graph. This should cause your random number generator to run each time an instance of your weapon is adjusted.

    Comment


      #3
      Yes that is where the values get generated. Withing the construction script. I also tried making an item spawner that spawns the item as well, and that also generated identical values.

      Comment


        #4
        Construction script is handled before runtime and should be treated like baked code. If you need new variables for every instance, put it on beginplay.

        Comment


          #5
          Thank you guys so much for your help. It was actually even dumber than that. It was generating the random values correctly, my widget was just always only ever reading the highest value for all of them regardless.

          Comment

          Working...
          X