Hello all , I would like to make things in my game random such as the encounters with quests/missions and the items that spawn to be collected. First I was wondering if there’s any kind of tutorials out there about this cause I couldn’t find anything a d secondly is there any way to do this with only blueprint. Thank you for any assistance you can give.
There are many ways to randomize. Some are better than others depending on what you are doing.
One way would be to use Random Integers nodes to drive Switch on Int or Switch on Enum(normally preferred over switch on int) which leads to varying execution paths.
You can also use Random Integer to pull random indexes from an array, which could give you an int/byte to feed into a switch, give you a random actor to spawn, random vector, etc.
Another way would be to use a series of greater/less than nodes(>, <, etc) that have a Random Int in Range input, that drive branches to choose which execution path to take.
For instance, if a creature is killed it might have a loot table and each item has a % chance to drop. Say you randomly generate a 1-100 int. Your >/< nodes would take that input and route accordingly. 1-5 executes a Rare Sword drop, 6-20 executes a common armor drop, 21-60 executes a vendor trash drop, and 61-100 executes no drop/dead end.
In that case, it would be pretty easy to modify your loot table using a magic find or some other modifier that changes the weight of what each >/< node is looking for.
thank you for your assistance. Any kind of tutorials about how to set up a loot table?
I have not seen a database tutorial of any kind yet.
Keep an eye on: https://wiki.unrealengine.com/Category:Tutorials
I see new stuff added there all the time. There are plenty of youtube videos and other tutorials as well.
However, that isn’t to say you can’t work on loot tables right now.
Like I said, getting % drops on a creature is pretty straightforward. You can do that all in blueprint. A database though is going to help you organize everything and keep it straight.
What you can do is confine each loot table to a single function. If you want the Kobold Minion loot table, you call the Kobold Minion loot function which rolls the dice and gives you whatever Kobolds drop which can be outlined in the same function or referenced by that function. You probably want to put all these functions in some master loot blueprint that all your creatures can call when they die. That way you don’t have to file through a hundred creature blueprints to change all your loot values.
If/when you get a database working, it can just drive the loot variables or even save references to all your loot tables.