Hhey I was just thinking the other day on ways to set durability to items and this is what I came up with Iknow there may be better ways but i was just messing around (all the methods below work)
//these are the vars needed
var dur = 0;//the durability var
var gci = getCarriedItem();//gets the current held item
//this is here to test if the var dur ever reaches 5 with is the durability limit before breaking that i have set for this example
function modTick()
{
if(dur==5){
addItemInventory(280, -1)
dur = 0;
}
}
//an example of tapping a block wiht a certain item to lose durability
function useItem(x, y, z, itemId, blockId, side)
{
if(itemId==280&&blockId!=0){//this tests to see if the item is 280(a stick) and if so let the code add one to the var dur
dur = dur+1;//add one to dur
}
}
//an example of tapping a block wiht a certain item to lose durability
function useItem(x, y, z, itemId, blockId, side)
{
var block = getTile(x, y, z);//sees what the block is at the chosen coords
if(itemId==280&&blockId==2){//this tests to see if the item is 280(a stick) and the block is 2(a grass block) and if so let the code add one to the var dur
dur = dur+1;//we add one to dur
}
}
//an example for breaking and block with a certain item to lose durability
function destroyBlock(x, y, z, side)
{
if(gci==280&&block!=0){//we test if the current held item is 280(a stick) and if the block isnt 0(air) is so let the code add one the the dur var
dur = dur+1;//we add one to the dur var
}
}
//an example of breaking a certain block with a certain item to lose durability
function destroyBlock(x, y, z, side)
{
var block = getTile(x, y, z);//sees what the block is at the chosen coords
if(gci==280&&block==2){//we test if the current held item is 280(a stick) and if the block is 2(dirt) and if so let the code add one the the dur var
dur = dur+1;//we add one to the dur var
}
}
You may copy this code and use it or whatever don't care if you use it
Rollback Post to RevisionRollBack
knowing how to CODE is the closest thing to having a superpower.
But does this show the durability in the liitle bar down the bottom
Rollback Post to RevisionRollBack
Please give me an Internet. Please. Pretty Please with sprinkles on top
I have a twitter!! Follow me for regular updates on my mods! https://twitter.com/DamienMiller11
Please give me an Internet. Please. Pretty Please with sprinkles on top
I have a twitter!! Follow me for regular updates on my mods! https://twitter.com/DamienMiller11
You may copy this code and use it or whatever don't care if you use it
Thx
I have a twitter!! Follow me for regular updates on my mods!
https://twitter.com/DamienMiller11
No like I said this isn't the best way to set the durability just a good simple way
I have a twitter!! Follow me for regular updates on my mods!
https://twitter.com/DamienMiller11