How would i set the item's damage minus a certain amount
I'm using a custom function from donnaldDoesMC:
var j=0;
function setData(amount)
{
j = getCarriedItem();
Entity.setCarriedItem(getPlayerEnt(), j, 1, amount);
}
and I'm trying this:
var j=0;
function setData(amount)
{
j = getCarriedItem();
Entity.setCarriedItem(getPlayerEnt(), j, 1, amount);
}
function destroyBlock(x,y,z,side)
{
var blockId=getTile(x,y,z);
var itemId=Player.getCarriedItem();
if(itemId==278)
{
setData(-3); //this sets it to -3 not decreases the value to the value minus 3.
}
}
This sets it to -3 not decreases the value to the value minus 3.
Is there any way to do this? if so please help!
I'm using a custom function from donnaldDoesMC:
var j=0; function setData(amount) { j = getCarriedItem(); Entity.setCarriedItem(getPlayerEnt(), j, 1, amount); }and I'm trying this:
var j=0; function setData(amount) { j = getCarriedItem(); Entity.setCarriedItem(getPlayerEnt(), j, 1, amount); } function destroyBlock(x,y,z,side) { var blockId=getTile(x,y,z); var itemId=Player.getCarriedItem(); if(itemId==278) { setData(-3); //this sets it to -3 not decreases the value to the value minus 3. } }This sets it to -3 not decreases the value to the value minus 3.
Is there any way to do this? if so please help!
Thanks!
~MattdaveMatt
Thank you! Exactly what i needed!
Well said!
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]