enemy Item drops

Get help using Construct 2

Post » Thu Feb 12, 2015 6:14 am

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
B
10
S
1
Posts: 97
Reputation: 700

Post » Thu Feb 12, 2015 7:09 am

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
B
9
S
2
Posts: 80
Reputation: 854

Post » Thu Feb 12, 2015 9:35 am

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
B
12
S
6
G
2
Posts: 99
Reputation: 1,727

Post » Thu Feb 12, 2015 10:13 am

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.
B
4
Posts: 22
Reputation: 244

Post » Thu Feb 12, 2015 7:10 pm

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
B
10
S
1
Posts: 97
Reputation: 700

Post » Thu Feb 12, 2015 7:11 pm

i'll be streamin twitch.tv/gusnation come by and see how my project is coming along
B
10
S
1
Posts: 97
Reputation: 700

Post » Thu Feb 12, 2015 9:02 pm

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?
B
10
S
1
Posts: 97
Reputation: 700

Post » Fri Feb 13, 2015 4:04 am

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
B
10
S
1
Posts: 97
Reputation: 700

Post » Fri Feb 13, 2015 5:12 am

round(random (1, 2)) was missing so its whole numbers so i dont get a 1.23 otherwise 1 isn't 1
B
10
S
1
Posts: 97
Reputation: 700

Post » Fri Feb 13, 2015 5:12 am

ok i got everything working now
B
10
S
1
Posts: 97
Reputation: 700

Next

Return to How do I....?

Who is online

Users browsing this forum: AmpedRobot and 9 guests