Creating new drops
#1
So I'm having a bit of trouble with new item drops within a plugin.

Whenever I create one, every once in a while a stone block will drop as well, and I can't pick them up. You can see the code here. Am I doing something wrong?
Reply
Thanks given by:
#2
I think the last "else" branch is wrong:
amount = math.random(0,2)
if (amount ~= 0) then
  Pickups:Add(cItem(E_ITEM_POTATO, math.random(0,2)))
This checks the amount, but then uses a new random number for the amount anyway; if that results in a zero, it might misbehave.
Reply
Thanks given by:
#3
Whoops. Thanks for catching that. Just went and fixed it.

The thing is, I'm having the issue with all of them: Wheat, Carrots, and Potatoes.

I've been thinking about it, and it might be due to passing World:SpawnItemPickups an empty cItems instance. Well, except it can spawn along with other items... Hmmm....
Reply
Thanks given by:
#4
Your code is already checking for empty cItems instance. I'm not too sure about the last param to SpawnItemPickups, try setting it to zero for a quick test. Other than that, no idea what could be wrong, seems alright to me.
Reply
Thanks given by:
#5
I tested your code, it works on my side
Reply
Thanks given by:
#6
Yeah, I don't know what was causing it. It stopped happening randomly, and I can't get it to happen again.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)