Author Topic: Drop system  (Read 1753 times)

Offline Aliss

  • Level 9
  • *
  • Posts: 54
  • Reputation: +1/-1
    • View Profile
Drop system
« on: October 26, 2007, 05:56:53 AM »
I wanna ask someone have some examples from drop system.

Offline Sinzygy

  • Level 28
  • **
  • Posts: 420
  • Reputation: +11/-0
    • View Profile
Re: Drop system
« Reply #1 on: October 26, 2007, 09:27:02 AM »
drop as in falling down a cliff, drag&drop or monster dropping items?

Offline Aliss

  • Level 9
  • *
  • Posts: 54
  • Reputation: +1/-1
    • View Profile
Re: Drop system
« Reply #2 on: October 26, 2007, 09:48:52 AM »
monster dropping items?  Sry my mistake that was  :ah:

I wonna make that monster can drop many diferrent items and ich item has own dropt rate

Offline Sinzygy

  • Level 28
  • **
  • Posts: 420
  • Reputation: +11/-0
    • View Profile
Re: Drop system
« Reply #3 on: October 26, 2007, 11:04:28 AM »
you wanna use a weighted script then. Don't know if this code example will be of much use as far as understanding it goes. I'm at work and we got the store full of customers asking for OS X 10.5 so I can't get into details how to write one. Maybe I'll give it later on a shot.

Offline Aliss

  • Level 9
  • *
  • Posts: 54
  • Reputation: +1/-1
    • View Profile
Re: Drop system
« Reply #4 on: October 27, 2007, 06:24:12 AM »
No i wanna use simple drop method not weighted script.

Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: Drop system
« Reply #5 on: October 27, 2007, 08:01:11 AM »
You need a weighted script to calculate the chance that items drop...

Or, you could give each item a percentage chance at being dropped, and use similar code from your other topic about monsters.

Offline Aliss

  • Level 9
  • *
  • Posts: 54
  • Reputation: +1/-1
    • View Profile
Re: Drop system
« Reply #6 on: October 27, 2007, 08:11:35 AM »
I thinked about to put on ich item drop percentage, but i wanna make  drop more than one item from monster.

In monster table add new row item_drop  an there put in  1,4,7  items id. I dont have idea how extract out from table all items id and after that calculate percentage drop for ich item after that.  -_-

Offline vizion

  • Level 7
  • *
  • Posts: 32
  • Reputation: +1/-0
    • View Profile
    • Riddle Contest of Dooooom
Re: Drop system
« Reply #7 on: October 27, 2007, 01:40:03 PM »
You shouldn't put duplicate information in the same field. That's a bad idea and goes against the most basic of normalization techniques. Ideally, you should have a separate row for each item that the monster drops. I would suggest using one table for your monster and another table for the drops. Your drop table would look something like this:

monster_id
item_id
drop_chance (this could be a number between 1 - 100 to represent a percent)

That at the end of combat all you would need is a simple select query to find all the items a monster drops. Then you could run another function to check to see if the item drops. It would be easy to extend that to account for item drop modifiers like skills and whatever.

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Drop system
« Reply #8 on: December 11, 2007, 03:28:43 PM »
Combine items into groups like Common, Uncommon, Rare.
Combine monsters into treasure quality classes like Poor, Average, Good, Boss
Combine monsters into treasure quantity classes like Few, Normal, Plenty

Poor monster has a 94%/5%/1% drop chance  (Common%/Uncommon%/Rare%)
Average monster has a 88%/10%/2% drop chance
Good monster has a 70%/25%/5% drop chance
Boss monster has a 0%/0%/100% drop chance

Few class monster drops 1-2 items
Normal class monster drops 2-4 items
Plenty class monster drops 4-8 items

You might also make a treasure table to store Unique drops data (for bosses), like a full set of armour after defeating the black knight. But it should be rare (unless you want to make the game till your death :D).


The above might sound a bit complicated but... once you try to edit every single monster by hand you might change your mind :)


As for non weighted system you just add like 5 fields to the monster to store the item id and the drop percentage (so 10 fields total if you want max 5 possible drops).

If you want unlimited item system make it parent/child or prev/next system (so combine the drop table entries into chains with "next_drop_id" field pointing the next drop). The monster table points to the first drop only then.


Or even better, take a look at any C book, it will teach you how to do this and many, many other useful things :)

Offline Aliss

  • Level 9
  • *
  • Posts: 54
  • Reputation: +1/-1
    • View Profile
Re: Drop system
« Reply #9 on: December 11, 2007, 03:49:35 PM »
Thx but its allready to late i made drop system  :)

Offline vizion

  • Level 7
  • *
  • Posts: 32
  • Reputation: +1/-0
    • View Profile
    • Riddle Contest of Dooooom
Re: Drop system
« Reply #10 on: December 11, 2007, 10:44:27 PM »
How did you end up coding it, Aliss? I had thought of a way to do it like you originally described which used the explode() and implode() functions. Just wondering what you did.

Offline Aliss

  • Level 9
  • *
  • Posts: 54
  • Reputation: +1/-1
    • View Profile
Re: Drop system
« Reply #11 on: December 11, 2007, 11:31:00 PM »
I made a new table caling drop and there put a id, item_id, monster_id, and  drop_perc.  after that i made some lines of php code and i have working drop system.   :)

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal