How do I Drop specific Item from Monster

Get help using Construct 2

Post » Wed Mar 01, 2017 5:46 am

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
Image

I will really appreciate your help and thanks you all for your time! :D
B
9
S
1
G
1
Posts: 9
Reputation: 943

Post » Wed Mar 01, 2017 6:24 am

Zarta Can you help me with my problem I have share the CAPX on my post
B
10
S
4
G
2
Posts: 31
Reputation: 1,828

Post » Wed Mar 01, 2017 6:30 am

Zion wrote: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.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
51
S
24
G
30
Posts: 534
Reputation: 19,620

Post » Wed Mar 01, 2017 6:39 am

LaDestitute wrote:
Zion wrote: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
B
9
S
1
G
1
Posts: 9
Reputation: 943

Post » Wed Mar 01, 2017 6:48 am

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.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
51
S
24
G
30
Posts: 534
Reputation: 19,620

Post » Wed Mar 01, 2017 10:43 am

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Mar 01, 2017 6:37 pm


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. :D
B
9
S
1
G
1
Posts: 9
Reputation: 943

Post » Wed Mar 01, 2017 6:53 pm

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 ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Mar 01, 2017 10:07 pm

99Instances2Go wrote: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 :lol: .
B
9
S
1
G
1
Posts: 9
Reputation: 943

Post » Wed Mar 01, 2017 10:48 pm

wteuhhf, that was from @Kyatric 's hand !
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 11 guests