02 Mar, 2011, thalor wrote in the 1st comment:
Votes: 0
Anyone have any concept ideas or know of any snippets or codebase releases with it in it? No point in reinventing the wheel.

Very much like WoW where the mob has a list of things it can load but each of them have a percentage to load on the mob.

Many tha is for the discussion and/or pointers

Thanks

Thalor
02 Mar, 2011, Rarva.Riendf wrote in the 2nd comment:
Votes: 0
Look for the method that deals with the mob death and put your code there
that would be raw_kill in rom code
Otherwise if it is limited to some mobs, use a death_trigger that would mload the item.
02 Mar, 2011, Barm wrote in the 3rd comment:
Votes: 0
You want weighted randoms. A dead simple approach could be to give each mob a set number of items and then use a function to pick an index. Something like this where each item is half as likely to drop as the one before it:

def pick_five()
r = random.random()
if r > .5:
idx = 0
elif r > .25:
idx = 1
elif r > .125:
idx = 2
elif r > .0625:
idx = 3
else:
idx = 4
return idx

You could add multiple "pick" functions to handle different size/different rarity loot.

I've also seen people build dictionaries that are the size of all weights combined, the key is int(random(size(dict)) and the values are the individual items repeated 'weight' times. It would be fast to lookup but slow to generate dynamically and would use a lot of memory (if you made them unique for every spawned mob).
03 Mar, 2011, quixadhal wrote in the 4th comment:
Votes: 0
Another option is to put your randomized loading code into the place where mobs get cloned and put into the world. Instead of hard-coding orc #2716 to always wield sword #2799, have a chunk of code that selects a random appropriate weapon and loads that up instead. Likewise for other equipment and inventory.

Added benefit is that your mob that has the "good" sword will also be slightly tougher to kill since it will be using it. Also, HATE having random woodland critters drop suits of plate mail that are considerably larger than they are… makes me wonder how exactly they ate it in the first place. That's also easier to avoid in the loading code, rather than having it poof into being at death.
03 Mar, 2011, Rarva.Riendf wrote in the 5th comment:
Votes: 0
quixadhal said:
Also, HATE having random woodland critters drop suits of plate mail that are considerably larger than they are… makes me wonder how exactly they ate it in the first place. That's also easier to avoid in the loading code, rather than having it poof into being at death.

Actually that is veary easy to fix in the death code: do not give gold to non sentient creature that are also tiny as an example.
And for dropping random equipment, dont put it in the corpse anyway, but hidden somewhere as the loot of the creature (that you have to look for, since you could not see it before you kill the mob)
And it allows you to give a sword to a mob like a slime that could not hold it anyway (but digested a victim that was wielding one)
If you do it a load it means people can look at the mob and see what it has…(and then limit you a lot more in what you want to give your mob). What would be the point giving something mob he cannot wear or use in the first place heh.
03 Mar, 2011, thalor wrote in the 6th comment:
Votes: 0
These are all excellent ideas and if/when I get this code in (and workable) I'll post it. I'm thinking I may have to do some sort of SQL integration for it.
03 Mar, 2011, quixadhal wrote in the 7th comment:
Votes: 0
Rarva.Riendf said:
If you do it a load it means people can look at the mob and see what it has…(and then limit you a lot more in what you want to give your mob). What would be the point giving something mob he cannot wear or use in the first place heh.


I agree. I consider this to be an advantage. If you can see the mob has junk gear, and you don't need the experience, why farm them? And yes, why would an orc be carrying around some holy paladin's sword he can't wield and which would probably hurt him every time he touched it? If he DID have such a thing, there must be some story behind it… hmmmm…
04 Mar, 2011, Rarva.Riendf wrote in the 8th comment:
Votes: 0
thalor said:
These are all excellent ideas and if/when I get this code in (and workable) I'll post it. I'm thinking I may have to do some sort of SQL integration for it.


Generating items is the hard part, as you need to power them accordingly. I have one that is 99% done…but the last 1% is the really really hard part: filling parameters that does not OP the items, nor makes them useless…
Random Picks
0.0/8