How do I Drop specific Item from Monster

  • Hello guys I have been trying to make a monster drop item upon death so I start designing some tables to use it as reference for my array but while making them I found a problem that I haven't been able to find a proper answer to it

    so after some research I found this page that explain how to make monster drop Link: https://gamedevelopment.tutsplus.com/tutorials/how-to-code-monster-loot-drops--cms-20449 but I seen it have the same issue as what I have. In his table any monster

    can drop any item from the table. Imagine I have a big table of item and kill a LV1 Slime and give a Item that I don't suppose to have yet. and that lead me to this question How can I made a Monster drop random Fixed item upon death following the rarity of the item to drop?

    So I think about a solution of making a Column in the Item table to save the value of a monster Index to drop so it can be read and drop the item but 2 or more monster can share the same item drop which made this solution to be fail

    it have been like a month trying to solve this problem I have been messing with my code and had no luck.

    Table Example:

    My table are more extends but to make it clear I made this as a Example of how my array are done for drop

    I will really appreciate your help and thanks you all for your time!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Zarta Can you help me with my problem I have share the CAPX on my post

  • Zarta Can you help me with my problem I have share the CAPX on my post

    Zion, please do not hijack other people's topics. If you want someone specific to help you, send them a PM.

    Are you doing any looping with the array? Unless you are, a dictionary may be a better choice. I can whip you a small example for a dictionary, when I get some time.

  • > Zarta Can you help me with my problem I have share the CAPX on my post

    >

    Zion, please do not hijack other people's topics. If you want someone specific to help you, send them a PM.

    Are you doing any looping with the array? Unless you are, a dictionary may be a better choice. I can whip you a small example for a dictionary, when I get some time.

    to apply the value to the array I use the condition OnStartLayout and set each value to the Array. which work perfectly don't have to use loop.

    but it would be nice to get to know about dictionary I had never use them before.

    thanks

  • Dictionaries are a whole lot easier to learn, especially if you intend to distribute a project to be modifiable by the enduser, as they're far easier to grasp than arrays.

  • Implemented the tutorial you linked to.

    https://www.dropbox.com/s/hkpgc3twr49l1 ... .capx?dl=0

    this one: https://gamedevelopment.tutsplus.com/tu ... -cms-20449

    Thanks you! for sharing but that is the problem I currently have. monster's onSlay they drop a item but I want monster to drop different item than others EX. Slime can drop {Gold, Juice, Glue} a wolf can drop {Gold, Bone, Skin} but if I follow the tutorial it will drop a random Item from the array list which means that Slime could drop Item as Skin or something I don't want that monster to drop all depend in the Item Rarity.

    I had think about making a and array drop for each monster but that is a poor and bad implementation to the game it will work but I will soak the stack of the memory with so many array's In game.(In my opinion dont know if its 100% true that will fill out my stack and is for mobile devices which use low spec's mobile) Thanks Again. <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • Hmm no. Read the tutorial again.

    In the tutorial (and in the implemented capx) a beast can NOT drop all items, if not allowed to.

    Every beast has a rarity number in its array.

    An item only can get dropped when its own rarity matches the rarity of the beast.

    This way (and gosh that is so nicely done in the tutorial) you can so easily steer which beast can drop what item.

    And they can 'share' to be dropped items.

    The owl can (and will) only drop Equipment.

    You did not see the capx eh ?

  • Hmm no. Read the tutorial again.

    In the tutorial (and in the implemented capx) a beast can NOT drop all items, if not allowed to.

    Every beast has a rarity number in its array.

    An item only can get dropped when its own rarity matches the rarity of the beast.

    This way (and gosh that is so nicely done in the tutorial) you can so easily steer which beast can drop what item.

    And they can 'share' to be dropped items.

    The owl can (and will) only drop Equipment.

    You did not see the capx eh ?

    You where right! thanks you very much. I misunderstood everything ahh finally I can get out of this problem and continue on Big Thanks again xD I will continue studying a little more deeper the topic so I can Implement everything right. Thanks you and Thanks to Kyatric for he's awesome tutorial .

  • wteuhhf, that was from Kyatric 's hand !

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