Download

Possibility with blueprint for random loot from monster.

Hi guys,

I’m currently working on a project but its kind of slow since im not sure about everything about the game yet and slowly learning UE4 ( imo very good engine ) !!
So i wont lie the idea for my project is coming from another game that i’ve played for several years but lately there been so much problem with the game that player are starting to quit.

My question,

I need to create a random loot system for the mob(monster) but not like every other game. lets say for example:

Ex: im using a gun ( named : Y gun ) this gun have ‘‘150’’ of durability, each time i shoot i loose some of that durability lets say 00.10 for that example so i can shoot 1500 shot before i need to
repair the gun if its repairable. but thats not it i also need a certain amount of ammo cell for each shot lets say 199 ammo cell/per shot so each shot cost me a total of 199 ammo + 00.10
durability on the gun.

in this game there is a currency , to repair object you use and buy ammo repair armor etc etc. so in the case of the example lets say the ammo cost is 01,99cent per shot and durability is 00,10cent
it cost 02,09cent per shot to that i would also have to had the dura of the armor but lets say im not wearing one .

How or is it possible to setup random loot from mob with Blueprint only and setting it so some mob give me 01,85$ worth of loot and other give me 02.25$ worth of loot and sometime you get a good one that give you like 10.00$

I cant find alot of video about loot so thats why i post the question here. i do know the basics of UE4 and im not planning to release this game tomorow. i See it as a very long project to develop.

thanks guys if you dont understand let me know its very complicated.

bump !!!

maybe without de number it would be more simple to understand loll

Lets say i have a group of mob(monster) 20-25 of them in front of me , so when i start hunting them i would like that all mob have a different amount of loot between X number and Y number and sometime you hit a rare one that give more compare to the other. maybe i would have to kill a 100 of them before i hit that lucky one. Anyway to do such a BP or should i go with C++ ? i would love to stay away Form C++ the more i can since i know nothing about it and would probably hire someone to help me on the project in that case.

thanks.

Hi Jonathan,

You can do all this in Blueprints. Here’s how I would set it up:

Create a Struct that will define the characteristics of the loot (Name, durability, picture, etc). Use this to create a data table and populate with all your loot
On the mob Blueprint have a function that is called when the mob is killed (call it fnDropLoot).

fnDropLoot does the following: Get a random integer in range (0-100) and then use this random integer to select a datatable row to drop that loot.

For example, say you have 10 items in your table, do a branch that checks the random integer. If its between 0-10, then select X row, if 11-20, then select Y row
Then the row you select will define what loot to drop.

After the loot is spawned, Destroy Actor.

You will need to playtest and tweak values as Im doing this off the top of my head - but this could work :slight_smile:

Hope this helps!

Hi CoquiGames,

Thanks alot indeed its helping me since i was starting with no idea how to do such a thing. Now i think i do :smiley:
like u said it will probably need some tweak to be perfect or atleast working as intended but its the start i needed !!

Thank you so much for this :slight_smile: !!!