This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
I need help figuring out weapon attack damage. Pease respond if you know how!
var damage = 10, weaponId = 200l
function attackHook(a,v) {
if(a == getPlayerEnt() && Player.getCarriedItem() == weaponId) {
Entity.setHealth(v,Entity.getHealth(v) - damage);
}
Sorry I tried this but it didn't work
weaponId is your weapon's ID
I figured It out but now I need help fixing the problem that it wont make noise OR make mobs drop their drops! Please can someone help me on this?!
Quote from MysticEnchanterยป I figured It out but now I need help fixing the problem that it wont make noise OR make mobs drop their drops! Please can someone help me on this?!
function attackHook(attcker, victim){
if(Player.getCarriedItem()==700){ preventDefault(); var dmg = 14;
Entity.setHealth(victim, Entity.getHealth(victim) - dmg); } }
Here is the code thanks for the help
.. dont use preventDefault
function attackHook(attacker, victim){
if(Player.getCarriedItem()==700){ var dmg = 14;
If you want the mobs to always drop their drops...
function attackHook(a,v){ if(Player.getCarriedItem==1000){ var dam= 14 var mixed= Entity.getHealth(v)-dam if(mixed>2){ Entity.setHealth(v, mixed); }else{ Entity.setHealth(v, 2); } } }
This will let the mob take the damage until it has 1 heart left (2 half-hearts), then it sets the health to 2, then your item will hit for 2.
This will kill the mob while keeping the drops. Zero breaks the game when using the Entity.sethealth() function.
Have fun!
Seeing this reference here... It fills you with determination!
"Knowlage is Power!"- School House Rock "Codeing is the best power in the world!"- Me
Have fun and code on! Rocket Science: -Mg=(M-R*t)a+R*t(Ve-g)
Create Custom Item
ModPE.setItem(id, "texture", 0, "name", 1) 1if you makeing weapon
Function attackHook(attacker, victim);
if(Player.getCarriedItem == id );
var dmg = How Many Damage It Does){
Entity.setHealth(victim, Entity.getHealth(victim) - dmg);
I Hope I Helped
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI need help figuring out weapon attack damage. Pease respond if you know how!
var damage = 10, weaponId = 200l
function attackHook(a,v) {
if(a == getPlayerEnt() && Player.getCarriedItem() == weaponId) {
Entity.setHealth(v,Entity.getHealth(v) - damage);
}
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumSorry I tried this but it didn't work
weaponId is your weapon's ID
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumI figured It out but now I need help fixing the problem that it wont make noise OR make mobs drop their drops! Please can someone help me on this?!
Code plz.
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumfunction attackHook(attcker, victim){
if(Player.getCarriedItem()==700){
preventDefault();
var dmg = 14;
Entity.setHealth(victim, Entity.getHealth(victim) - dmg);
}
}
Here is the code thanks for the help
.. dont use preventDefault
function attackHook(attacker, victim){
if(Player.getCarriedItem()==700){
var dmg = 14;
Entity.setHealth(victim, Entity.getHealth(victim) - dmg);
}
}
If you want the mobs to always drop their drops...
function attackHook(a,v){ if(Player.getCarriedItem==1000){ var dam= 14 var mixed= Entity.getHealth(v)-dam if(mixed>2){ Entity.setHealth(v, mixed); }else{ Entity.setHealth(v, 2); } } }This will let the mob take the damage until it has 1 heart left (2 half-hearts), then it sets the health to 2, then your item will hit for 2.
This will kill the mob while keeping the drops. Zero breaks the game when using the Entity.sethealth() function.
Have fun!
Seeing this reference here... It fills you with determination!
"Knowlage is Power!"- School House Rock
"Codeing is the best power in the world!"- Me
Have fun and code on!
Rocket Science: -Mg=(M-R*t)a+R*t(Ve-g)
Create Custom Item
ModPE.setItem(id, "texture", 0, "name", 1) 1if you makeing weapon
Function attackHook(attacker, victim);
if(Player.getCarriedItem == id );
var dmg = How Many Damage It Does){
Entity.setHealth(victim, Entity.getHealth(victim) - dmg);
}
}
I Hope I Helped