Quote:
Originally Posted by MysticalDragon
I fixed it, odd issue. But I think it's how stefan tweaked player.triggerclient. I added a null to the end of the triggerclient were it sends the data and it worked.
|
Must be the difference between v5 and v6 then. I should've said it in the first post: some things only work with v6, even though a fix for v5 would be quite simple. I didn't want to focus on old versions though. Also:
Quote:
Originally Posted by MysticalDragon
it would be a lot easier and more modifiable if you would just make your own dropping system, imo. Atlantis has a great dropping system, check it out in the code gallery.
|
You reminded me of some awkward logic/math stuff I did there. Have a look (
item class):
PHP Code:
function onCreated() {
// create a random item, wohoo!
if (this.dItem == NOTHING) {
temp.chances = { 0.4, 0.51, 0.51, 0.51, 0.61, 0.66, 0.68, 0.78, 0.83, 0.85 };
temp.r = random(0, 1);
for (temp.i = 0; i <= chances.size(); i++) {
if (i == 0 && r < chances[0])
this.dItem = 1;
elseif (i == chances.size() && r >= chances[i - 1])
this.dItem = chances.size() + 1;
elseif (r >= chances[i - 1] && r < chances[i])
this.dItem = i + 1;
}
}
Does that make sense? I wonder. It lacks some proper comments. Check the enumeration at the top of that class to see which items it'll distribute with which percentage, and keep in mind that subtracting the value of the
n-1th array element from the value of the
nth array element yields the chance for the
n+1th item. Doesn't make sense? Sorry~