enemy Item drops

0 favourites
  • 11 posts
From the Asset Store
320 high-quality cinematic sound effects for trailers and game scenes.
  • making a platform game similar to maple story where you kill an enemy and items get spit out, any idea how to go about making a drop rate and Items spit out of enemy

    so i think on enemy death i want to do this....

    is have an array whether the monster drops or doesn't drop items, have a 2nd array for each individual monsters items , then a 3rd for how many items get spawnd, and 4th array for rarity items. is that too many arrays?

    well... i'm lost on where i need to start so if anyone can shed some light where i begin please leave your skype ID or come to my stream twitch.tv/gusnation i stream from 11-5pm PST time. or Leave steps below

  • Yeah, you can try, just an array for the items.

    Group for monsters who drop, separate group for those who don't.

    then use instance variables for rate of drop/ how many items spawned.

    Instance variables on the items for rarity.

    Hope this helps

  • You can put variable "loot" and "dropRate" inside enemy, it can be a number (which can be set in each type), and on death use conditions:

    if monster.loot = 1

    if rand(100) > monster.dropRate - create loot 1 on monster.x/monster.y

    else

    if monster.loot = 2

    if rand(100) > monster.dropRate - create loot 2 on monster.x/monster.y

    (if drop rate is in percent)

    This would be simplier more crude approach, but I like KISS, especially on huge apps

  • My solution to this wasn't exactly elegant but it works, I have 8 global variables all default value of 0.

    CommonLootDrop, uncommonLootDrop, rareLootDrop, epicLootDrop

    CommonLoot, uncommonLoot, rareLoot, epicLoot

    When a monster dies, roll to see if you got a drop from it. A weak rat for example would be set commonDrop to random (0,100) set uncommonDrop to random (0, 60)

    Then I have events such as "CommonLootDrop > 50, set CommonLoot to choose (1,2,3,4) and then another event that is CommonLoot = 1 + 1 health potion, if CommonLoot = 2, +10 gold, etc etc... Same for the other rarities.

    I have it so you only get 1 drop at most per kill, so I do the loot checks in order of rarest to least rare.

    As an example I kill a big enemy with random (0,60) epic. random(30,80) rare. random(50,100) uncommon.

    It would roll epic, check if over 50, roll rare, check if over 50, roll uncommon, check if over 50.

    So if those random numbers were 40, 65, 99, then it actually would stop at 65 and give me a rare item, never completing the uncommon roll as it's now irrelevant.

  • ok i'm still new to arrays.... ummm do they always randomly choose within the arrays table? or do i have to set something up to "Roll" and randomly choose? but you guys thanks again for tremendous help

    Another thing i'd like to know while we are on this topic is how would i have this item explode out of the enemy when it gets spawnd

    or i guess i could run hit box item shower animation and have it roll on each monster kill and have it on that box.... ok i think i answered my own question..... if you know another way let me know

  • i'll be streamin twitch.tv/gusnation come by and see how my project is coming along

  • Tom i'm trying your method come to my stream to help, or if you can make me a capx file so i can refer to it?

  • ok i figured out the random roll ... i was confused about that system set variable-commonloot with Variable- "(random (1, 2))" in text spot ..... wow cant believe it took me 8 hours to figure this out

    but now i ran into an issue can i get a spawn from something thats getting destroyed? so like my monsters hit box i want the item to spit out at the 0 image point... but ya since its getting destroyed i dont think my image of coin is going to spawn in

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • round(random (1, 2)) was missing so its whole numbers so i dont get a 1.23 otherwise 1 isn't 1

  • ok i got everything working now

  • round(random (1, 2)) was missing so its whole numbers so i dont get a 1.23 otherwise 1 isn't 1

    Hey, choose(1,2) will give you a 50% chance of both numbers and always an integer.

    round(1,2) will round down and not give exact chances you want.

    It's usually better to use choose for this kind of thing because of this

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