I'm assuming you mean to get them on an i-Device. You need to make sure the mod is IOS compatable. Most mods aren't though. You should get an android... you cna patch modpe mods just by importing the .js to Block Launcher. Not sure if it's the same with IOS.
Also, it does so much damage because it's a diamond sword... change the sword ids to get different damages:
Diamond Sword: 276
Gold Sword: 283
Iron Sword: 267
Stone Sword: 272
Wood Sword: 268
And it does work...
How to define health variable?
For the mobs?
mobHealth = Entity.getHealth(victim);
//I just used health for the code I gave you because it's the only health required
var minusHealth = 3; //3 is the amount of half hearts you want to decrease
function attackHook(a,v){
if(Player.getCarriedItem()==sword id){
Entity.setHealth(v,Entity.getHealth(v) - minusHealth);
}
}
Thats the exact same thing I said THE POST RIGHT ABOVE YOURS!!
function attackHook(attacker, victim){
if(getCarriedItem()==276){//checks to see if your holding a diamond sword
health = Entity.getHealth(Entity.getEntityTypeId(victim));//checks the entities health
Entity.setHealth(victim, health - 1);//Add 1 more damage
}
}
Also: you don't need to have a script for every mob...
0
0
stuff?
0
0
0
0
Diamond Sword: 276
Gold Sword: 283
Iron Sword: 267
Stone Sword: 272
Wood Sword: 268
And it does work...
How to define health variable?
For the mobs?
For the player?
0
0
Thats the exact same thing I said THE POST RIGHT ABOVE YOURS!!
0
0
Also: you don't need to have a script for every mob...
0
0
0
0
0
BTW: you also forgot the semicolon