This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
if(itemId==465) {//spawning GIANT addItemInventory(465,-1); clientMessage("From now,Runnnn!!!!!"); giant=Level.spawnMob( Player.getX(),Player.getY()+2,Player.getZ() ,32,'mob/giant.png' ); giant; Entity.setHealth(giant, 200); Entity.setRenderType(giant, 11); } } function deathHook (attacker, victim) { if(Entity.getEntityTypeId(giant)) {//Droped Item If you kill a GIANT var random = Math.floor((Math.random()*15)+1); if(random==1) { Level.dropItem(Entity.getX(giant), Entity.getY(giant), Entity.getZ(giant), 1, 265, 24); } else if(random==2||random==3) { Level.dropItem(Entity.getX(giant), Entity.getY(giant), Entity.getZ(giant), 1, 256, 2); } else if(random==4||random==5) { Level.dropItem(Entity.getX(giant), Entity.getY(giant), Entity.getZ(giant), 1, 267, 2); } else if(random>=6&&random<=15) { Level.dropItem(Entity.getX(giant), Entity.getY(giant), Entity.getZ(giant), 1, 41, 1); } } }
Quote from Connor4898 Replace if(Entity.getEntityTypeId(giant)) {//Droped Item If you kill a GIANT with if(victim == giant) { You also need to add var giant; To the beginning of your script
if(Entity.getEntityTypeId(giant)) {//Droped Item If you kill a GIANT
if(victim == giant) {
var giant;
Quote from Donalddoesmc You need var giant; //your code Since basically your script said "giant in function useItem is this mob". Not in any other functions so you need var before all functions.
var giant; //your code
so please help me
this is the crash script
if(itemId==465) {//spawning GIANT addItemInventory(465,-1); clientMessage("From now,Runnnn!!!!!"); giant=Level.spawnMob( Player.getX(),Player.getY()+2,Player.getZ() ,32,'mob/giant.png' ); giant; Entity.setHealth(giant, 200); Entity.setRenderType(giant, 11); } } function deathHook (attacker, victim) { if(Entity.getEntityTypeId(giant)) {//Droped Item If you kill a GIANT var random = Math.floor((Math.random()*15)+1); if(random==1) { Level.dropItem(Entity.getX(giant), Entity.getY(giant), Entity.getZ(giant), 1, 265, 24); } else if(random==2||random==3) { Level.dropItem(Entity.getX(giant), Entity.getY(giant), Entity.getZ(giant), 1, 256, 2); } else if(random==4||random==5) { Level.dropItem(Entity.getX(giant), Entity.getY(giant), Entity.getZ(giant), 1, 267, 2); } else if(random>=6&&random<=15) { Level.dropItem(Entity.getX(giant), Entity.getY(giant), Entity.getZ(giant), 1, 41, 1); } } }(Already use function,useitem,var,etc but still error)
the message error is "giant is not defined in function death hook"
but im already wrote that in function use item
and i dont know var for that
so please tell me how to fix that
thanks,all,all workS! + 1 for you!
ModPE!?