Hello guys! I've decided to end that "series" of tutorials and make another 1! xD Well this 1, what's different is that there isn't a category! It's just the title! Woo! Yeap, today it's about adding Damage to Custom Items. When I say Damage, I mean the 1 attacking the mob, not the Durability. So! Here's the code :
var damage = 4; //Amount of half-hearts as the damage (4 = 2)
function attackHook(attacker, victim){
if(getCarriedItem() == 280){ //Put the id of your item, mine is a stick!
Entity.setHealth(victim, Entity.getHealth(victim) - damage);
}
}
This code is taking the Entity's health and minusing the amount your damage is. That's it for today! Cya!
Rollback Post to RevisionRollBack
It has been FUN modding, but everything has an end. I've quitted modding! Good Luck & Have Fun! ;D
function destroyBlock(x, y, z, side){
if(Player.getCarriedItem()==280){
//Add your damage code here...
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
Just realised this is about the amount of damage the item does not how much durability xD. But durability is VERY useful for a tool. I also know how to use that to make the destroy time on a block change when holding a specifified item
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
This code is taking the Entity's health and minusing the amount your damage is. That's it for today! Cya!
I have a twitter!! Follow me for regular updates on my mods!
https://twitter.com/DamienMiller11
Sorry but I don't understand what you said ! xD
Works well
I have a twitter!! Follow me for regular updates on my mods!
https://twitter.com/DamienMiller11
I have a twitter!! Follow me for regular updates on my mods!
https://twitter.com/DamienMiller11
But most people ALREADY know how to do this.
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]