How do I make a loot table for my game?

0 favourites
  • 11 posts
From the Asset Store
Perfect, complete, easy to use to use, out-of-the-box inventory system
  • I'm making an RPG right now inspired by Realm of the Mad God (and some other things) anyways, I'm doing loot much like in that game where if you kill an enemy it drops a bag, if you walk ontop of the bag, the inventory of the bag appears on your screen and you may drag the items into you inventory, if you step off and back on, the remaining items will of course still be there. The lootbag itself will only actually spawn if the enemy actually dropped any loot to begin with and when all the loot is taken out, the bag disappears. I'm not really sure how to go about doing this with randomized loot and I recognize it will probably take me a bit of a back and fourth conversation to fully understand. It's the last basic I believe I still need for this game so I really do appreciate any help I can get.

    Tagged:

  • Did you already make the main inventory? Which bit are you having trouble with in particular? If you mean that you have none of the above then there's a lot to do here.

  • Did you already make the main inventory? Which bit are you having trouble with in particular? If you mean that you have none of the above then there's a lot to do here.

    I mean, like the game I listed I have the inventory stay on screen the whole time, it's fairly small and only contains a couple items. I just needed help with the actual loot and loot bag generation.

  • I should've asked if you used array for the inventory. Because the loot bag would just be another mini inventory that you generate. You can push random items to the array and they appear in slots the same way they would in an inventory. Deciding if the enemy will drop loot is just a variable like for example set to choose(0,1) if it was a 50% chance.

  • I should've asked if you used array for the inventory. Because the loot bag would just be another mini inventory that you generate. You can push random items to the array and they appear in slots the same way they would in an inventory. Deciding if the enemy will drop loot is just a variable like for example set to choose(0,1) if it was a 50% chance.

    Since the inventory is on screen at all times, I currently have it as just... well... items on screen. They are currently sprites with a handful of variables that you can equip and move around to different inventory slots.

  • If it's that kind of design then for a start you create several of the same slots for the loot bag and spawn a random item to them which I imagine would be setting a random slot.itemname or creating an object on the slot itself, however you have done it earlier. You can copy all logic from the inventory, then you should be able to move items from those slots to your inventory in the same way that you move items around the inventory.

    For the loot you can have all items in an array and pick a random row for example and then create this object or set itemname on the slot, or in a more simple form you can set slot.itemname to choose('sword','armour','potion') for example which picks one at random. Then you expand the logic as you go based on what loot can spawn, if enemy that died=goblin then set loot to choose(A,B,C)).

    To run it for each slot you could give the lootbag slots a variable to differentiate them from the inventory ones and say for each slot, where variable=loot, run the spawn item logic.

  • If it's that kind of design then for a start you create several of the same slots for the loot bag and spawn a random item to them which I imagine would be setting a random slot.itemname or creating an object on the slot itself, however you have done it earlier. You can copy all logic from the inventory, then you should be able to move items from those slots to your inventory in the same way that you move items around the inventory.

    For the loot you can have all items in an array and pick a random row for example and then create this object or set itemname on the slot, or in a more simple form you can set slot.itemname to choose('sword','armour','potion') for example which picks one at random. Then you expand the logic as you go based on what loot can spawn, if enemy that died=goblin then set loot to choose(A,B,C)).

    To run it for each slot you could give the lootbag slots a variable to differentiate them from the inventory ones and say for each slot, where variable=loot, run the spawn item logic.

    ...but how do I make it to where an item gets selected and then it spawn the corresponding sprite based on what get's selected... and also how would I give it probabilities (For Legendaries and such)

    Apologies if I'm sounding dumb, I've just never really used arrays before

  • You wouldn't need to use arrays if you already have the inventory working without as it would be the same logic. For item rarity you could generate a number from 1-100 and if it is 1-10 then you spawn legendary, something like that. For the item selection and spawning, do you have that already with an inventory? You would spawn the items in the same way, create object by name on top of the slot if you are not using arrays.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • here I made a very quick inventory to show you dropbox.com/s/54ze0xrjq2i83ro/lootdrop.c3p

  • here I made a very quick inventory to show you dropbox.com/s/54ze0xrjq2i83ro/lootdrop.c3p

    Sorry, I've gotten around to testing more but like... how would I make it to where if I walk ontop of the loot bag it will show the loot, I can take whatever I want, if I walk off the loot will vanish, and if I walk back ontop it'll be all the remaining loot. Like I guess I now know how to pick the loot to spawn, just not how to lock it behind that.

  • When you walk over any loot bag make slots visible and when you walk away hide them. You can store what items to show as variables on the bag so var1=slot1, var2=slot2. If you take an item you set the var for that slot to empty so when you return to the bag it is not going to show anyway because var=empty.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)