ve been trying to add new items into mcpe and I have been struggling with this function if anyone had a template for this u would be a real life saver.
Thanks in advance:ignore this it has been solved.
New prob.
Need help using two hook functions in a mod, this is the script.
ModPE.setItem(400,6,11,"Divine sword");
function useItem(x,y,z,itemId,blockId,side)
{
if(blockId==49)
{
addItemInventory(400, 1);
}
}
function attackhook(attacker, victim)
{
if(getCarriedItem()==400)
{
setVelY(victim, 5);
You need a semicolon after the ModPE.setItem function. Also, why do you have a capital F in function? Here is a sample script which you can modify and use if you want to.
var i = " "; //Pushes the unnecessary characters of screen
ModPE.setItem(400, 6, 11, i + "Ender Pearl" + i); //Makes a custom item - Ender Pearl
function useItem(x,y,z,itemId,blockId,side)
{
if(itemId==0) //Hand
{
addItemInventory(400,1); //Adds 1 ender pearl to your inventory
}
else if(itemId==400) //Ender Pearl
{
setPosition(getPlayerEnt(),x,y+2,z); //Teleports you to where you tap
}
}
You are probably on an outdated version of BlockLauncher, because in previous versions it used to be x co-ord and then y co-ord. My script is y co-ord then x co-ord, because that is how you are supposed to do it now.
I can see a simple spelling error. You wrote attackhook when it should be attackHook. Remember to always use a capital for each second word of each function. +1 this post if I helped.
Make sure you follow me on twitter! @DarkDiaMiner IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->
To post a comment, please login or register a new account.
Thanks in advance:ignore this it has been solved.
New prob.
Need help using two hook functions in a mod, this is the script.
ModPE.setItem(400,6,11,"Divine sword");
function useItem(x,y,z,itemId,blockId,side)
{
if(blockId==49)
{
addItemInventory(400, 1);
}
}
function attackhook(attacker, victim)
{
if(getCarriedItem()==400)
{
setVelY(victim, 5);
preventDefault ();
}
}
http://www.twitter.com/AuthenticPixel
ModPE.setItem(id,x,y,name)
Function useitem(x,y,z,itemid,blockid,side)
{
If(itemid==0)
var i = " "; //Pushes the unnecessary characters of screen ModPE.setItem(400, 6, 11, i + "Ender Pearl" + i); //Makes a custom item - Ender Pearl function useItem(x,y,z,itemId,blockId,side) { if(itemId==0) //Hand { addItemInventory(400,1); //Adds 1 ender pearl to your inventory } else if(itemId==400) //Ender Pearl { setPosition(getPlayerEnt(),x,y+2,z); //Teleports you to where you tap } }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]
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]
Look.
ModPE.setItem(400,6,11,"Divine sword");
function useItem(x,y,z,itemId,blockId,side)
{
if(blockId==49)
{
addItemInventory(400, 1);
}
}
function attackhook(attacker, victim)
{
if(getCarriedItem()==400)
{
setVelY(victim, 5);
preventDefault ();
}
}
The attack hook part wont work
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]
ModPE.setItem(500,6,11,"Divine Sword"); function useItem(x,y,z,itemId,blockId,side) { if(itemId==0&&blockId==49) { addItemInventory(400,1); } } function attackHook(attacker, victim) { if(getCarriedItem() == 500) { preventDefault(); setVelY(victim,5); } }The ModPE.setItem id should start with 500 and end with 510 it cant be 400.
Edit: It shouldn't be it should be
IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->