Is there anyway for set random items in the chests on the map, but not use hook OnPlayerUsedBlock, etc?
I do not like the way of hunger games plugin.
Thanks, can you give me an example of how to use them?
-- ChestX, ChestY and ChestZ are coords of the chest, obtained elsewhere
cWorld:DoWithChestAt(ChestX, ChestY, ChestZ,
function (a_ChestEntity)
a_ChestEntity:SetSlot(0, 0, cItem(E_BLOCK_GOLD_BLOCK)) -- gold block to upper left slot
a_ChestEntity:SetSlot(1, 0, cItem(E_ITEM_DIAMOND_SWORD, 500)) -- half-broken diamond sword to slot [1, 0]
a_ChestEntity:SetSlot(3, cItem(E_ITEM_BOW)) -- regular bow to slot #3 ([3, 0], fourth slot)
a_ChestEntity:SetSlot(math.random(27), cItem(256 + math.random(50))) -- completely random item to a random slot
end
)
I make the function and obtain the position of .ini for set the items, but this returns the position (in the LOG) and the server crashes... why?
Hmm, I wrote the code wrong, the red "cWorld" in the second line should be "World" instead, a variable that holds a cWorld instance.
I wrote that off the top of my head with no checks whatsoever, so it might need further tweaking.
Yes, it was the "World" now works, thanks again!
EDIT (Last question): There any way that the coordinates do not appear in the log?
I'm afraid you'll have to be more specific. What coordinates, how in log?
When executing the function appears in the log "[00:55:26] x 345 y 64 z 274" for each chest...
I don't think that is a message from the MCS; rather, it's from the plugin itself.