How do I create a random loot system?

Get help using Construct 2

Post » Mon Jul 14, 2014 9:43 pm

To start off, I need to say I am not an experienced game designer whatsoever. If there's some complex way to go about solving this that I don't know, it's probably because of my own ignorance of concepts of programming and math. I am really familiar with algebra, and I get all basic calculations with variables and such. Just not much more complex things beyond that.

Anyways, I want to try creating a randomized loot system, akin to Diablo or Borderlands. When the enemy dies, the player awarded with an item. That item will have possible types, like a weapon or armor. That weapon or armor will have its own qualities that are randomized, in the form of affixes. Affixes will be any sort of modifier, like a bonus to damage, or resistance, or some key stat.

My objectives are to:
A.Randomly generate items with varying values and stats
B.Allow for weapons and armor that can have a wide array of stats but only randomly selected stats will roll on that item (Limited # of affixes)
C.Create items that can be saved and loaded, without performance hits during creation and loading
D.Allow for unique items and affixes (I.E., named items with own personal trait unique solely to that specific item)

I've been spending a few days thinking of what ways to go about doing this, and I've been searching around the forums as well. I was thinking of making parent objects ("item_weapon," "item_armor," "item_consumable") and creating instances of those with instance variables to contain the affixes. I figured for each one of those items, I could have an instance variable for each possible affix, but I realized that each item would have tons of instance variables because of the sheer amount of possible affixes on them, and it would be difficult to display only the affixes that actually have values. I couldn't see way to (for example) loop through each instance variable for an item and see which ones actually rolled and have a value, and then display only those values in the item description. (if that could actually work somehow, please let me know)

So I'm little bit lost. I guessed another solution might lie in arrays but I'm unsure of how to use arrays for this. So my main questions are:
1.Could my old method work, using instance variables that are all present for that object but only some have value?
2.Could arrays be used in some way?
3.Do I need to learn to script in order to make this work?

(Thank you to anyone who replies, I will happily elaborate if I was too vague or missing any points or information)
Posts: 2
Reputation: 364

Post » Tue Jul 15, 2014 9:51 am

If you need a system that can handle a ton of items like something in the realms of Diablo. I would make files for treasure tables probably using this CSV plugin I would tag the treasure table number/level/tier to the enemy or scale of random tables to choose. For the base item set stat scales and probability value to use magic or improved item and then use similar table for affixes (example tier1 affixes or tier1 shield affixes).

About Diablo 2 loot generator

I don't think there would be much lag at least if the files are on local disk, but if there would you could generate the items when the map loads.

And my answers for the questions.
1. Not the best way. I would make array or dictionary object container for the enemy where to generate the items from external sources.
2. They could not sure you necessarily need to.
3. No.

Not sure if this helped, but there are quite a few ways on doing this and I don't know what is the optimal.
Posts: 517
Reputation: 5,206

Post » Tue Jul 15, 2014 10:01 am

kyatric did this awhile ago I guess it is a great place to start.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
Posts: 1,429
Reputation: 12,708

Post » Tue Jul 15, 2014 2:22 pm

Excellent! Thank you very much to both of you, you helped immensely. Exactly what I was looking for.
Posts: 2
Reputation: 364

Return to How do I....?

Who is online

Users browsing this forum: RobertMKD and 2 guests