Changing Item Drops
#5
Hey,

I checked your code and corrected it. 
I think you want to run the code only if it's a player
Also corrected the item that you want to have as a new pickup.
Here you can find a list of all values http://api-docs.cuberite.org/Globals.html

function OnBlockToPickups(a_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_Pickups)
 -- Check if digger is null or is not a player
 if (a_Digger == nil) or (a_Digger:GetEntityType() ~= cEntity.etPlayer) then
 return false
 end
 
 -- Check if the block is a iron ore
 if (a_BlockType ~= E_BLOCK_IRON_ORE) then
 return true
 end

 -- Clear all defaul pickups
 a_Pickups:Clear();

 -- Add iron ingot
 a_Pickups:Add(cItem(E_ITEM_IRON))
 return true
end


If you mean red lines in the terminal, this can be a error inside of cuberite or something gone wrong in a plugin. If the error is from a plugin it's a stack trace, that contains the plugin name and the line of the error.
In this case I think it was the wrong item type, because it was nil and adding a nil value will cause an error.
Reply
Thanks given by:


Messages In This Thread
Changing Item Drops - by Epsilith - 06-21-2016, 09:36 AM
RE: Changing Item Drops - by PureTryOut - 06-21-2016, 05:26 PM
RE: Changing Item Drops - by xoft - 06-21-2016, 09:38 PM
RE: Changing Item Drops - by Epsilith - 06-22-2016, 01:04 PM
RE: Changing Item Drops - by Seadragon91 - 06-22-2016, 02:25 PM
RE: Changing Item Drops - by Epsilith - 06-22-2016, 04:27 PM
RE: Changing Item Drops - by xoft - 06-22-2016, 04:40 PM
RE: Changing Item Drops - by Epsilith - 06-22-2016, 04:47 PM



Users browsing this thread: 1 Guest(s)