The Meaning of Life, the Universe, and Everything.
Location:
Auckland
Join Date:
9/20/2014
Posts:
126
Minecraft:
softmage114486
Xbox:
softmage114486
Member Details
Tired of having to reuse this line, Math.floor((Math.random()*100)+1); to get a random number? Then don't! use this function instead, it is a lot shorter and a lot quicker...
function r(i) {
return Math.floor((Math.random()*i)+1);
}
Now whenever you need a random number just use this, r(100); replace 100 with the highest possible number you want to be able to get, here is an example of using it...
if(r(100) < 50) {
//do this
print("too low");
}
else if(r(100) > 51){
//do this instead
print("too high");
}
else {
//do this instead of the other two
print("just right!");
}
or
function useItem(you know all the params ;)) {
if(itemId == 280 && r(100) == 50) {
//some code here
}
}
hope this can help some peoples
Rollback Post to RevisionRollBack
This is my signature..
clicked block quote Hey..How do i turn it off?Help! I'm scared This is my life now...
I think there is a hook for when doors and chests are opened but im not sure how to use it, i think it is more for like, the opening door version of useItem(), what you could do is make like 8 alternitive doors (or how ever many different states there are) using define block but i think thats getting way too complicated
The Meaning of Life, the Universe, and Everything.
Location:
Auckland
Join Date:
9/20/2014
Posts:
126
Minecraft:
softmage114486
Xbox:
softmage114486
Member Details
Yea thats the one, I read about it on connors github thingy but I didnt bother to learn it because I havent needed it yet but crazycard wants to know how to open and close iron doors, like the proper ones, I dont think that is possible yet tho, but it cNan be done using custom blocks
Rollback Post to RevisionRollBack
This is my signature..
clicked block quote Hey..How do i turn it off?Help! I'm scared This is my life now...
Yea thats the one, I read about it on connors github thingy but I didnt bother to learn it because I havent needed it yet but crazycard wants to know how to open and close iron doors, like the proper ones, I dont think that is possible yet tho, but it cNan be done using custom blocks
I think that it´s only changing the Data of a iron door +4 to open and -4 to close.
How to add custom pickaxes with durability and custom mining speed
1. define the item
2. define the crafting recipe
3. use the hook function destroyBlock(x, y, z, side) { }
function destroyBlock(x, y, z, side) {
if(Player.getCarriedItem()==yourId){
//remove the pickaxe from the inventory and give it back with one more damage, if it has a specific damage don´t give it back
}
}
Maybe it is better to use this Hook:
function startDestroyBlock(x, y, z, side){
if(Player.getCarriedItem()==yourId){
//remove the pickaxe from the inventory and give it back with one more damage, if it has a specific damage don´t give it back and destroy the block
}
}
Tired of having to reuse this line, Math.floor((Math.random()*100)+1); to get a random number? Then don't! use this function instead, it is a lot shorter and a lot quicker...
function r(i) {
return Math.floor((Math.random()*i)+1);
}
Now whenever you need a random number just use this, r(100); replace 100 with the highest possible number you want to be able to get, here is an example of using it...
if(r(100) < 50) {
//do this
print("too low");
}
else if(r(100) > 51){
//do this instead
print("too high");
}
else {
//do this instead of the other two
print("just right!");
}
or
function useItem(you know all the params ;)) {
if(itemId == 280 && r(100) == 50) {
//some code here
}
}
hope this can help some peoples
You can use
function blockEventHook(x, y, z, type, data) { }
More for this Hook (but not much) you can read here: http://www.minecraftforum.net/forums/minecraft-pocket-edition/mcpe-mods-tools/mcpe-mod-tool-discussion/1987708-modpe-guide-refrence
I never used it, you´ll have to try how to use it, I would start so:
function blockEventHook(x, y, z, type, data) {
clientMesseage("X: " + x + "\nY: " + y + "\nZ: " + z + "\nType: " + type + "\nData: " + Data);
}
Now open a door and look what happens and you know how to use this Hook!
Yea thats the one, I read about it on connors github thingy but I didnt bother to learn it because I havent needed it yet
but crazycard wants to know how to open and close iron doors, like the proper ones, I dont think that is possible yet tho, but it cNan be done using custom blocks 
I think that it´s only changing the Data of a iron door +4 to open and -4 to close.
My mod keeps crashing the game on startup for some reason and I have a texture pack going along with the mod if that helps
"Its all SHITS and GIGGLES, till someone GIGGLES and SHITS!"

Which Mod?
I will pm you
"Its all SHITS and GIGGLES, till someone GIGGLES and SHITS!"

Texture packs can sometimes cause it to crash, disable the tp and try the mod, if it works then disable the mod and try the tp
1. define the item
2. define the crafting recipe
3. use the hook function destroyBlock(x, y, z, side) { }
function destroyBlock(x, y, z, side) {
if(Player.getCarriedItem()==yourId){
//remove the pickaxe from the inventory and give it back with one more damage, if it has a specific damage don´t give it back
}
}
Maybe it is better to use this Hook:
Maybe this helps you:
http://www.minecraftforum.net/forums/minecraft-pocket-edition/mcpe-mods-tools/mcpe-mod-tool-help-requests/2469614-durability-mcpe-modding
I createt a Mod with durability:
http://www.minecraftforum.net/forums/minecraft-pocket-edition/mcpe-mods-tools/mcpe-mod-tool-help-requests/2469864-pe-torch-gun
I would like to up this question: [HELP] GUI Tutorials and Other Questions
got a few questions about it. right now its all concepts but I've made a few working codes. My priority is the GUI
How do i var all enties get it work on my spring trap?
Not too sure, could be, Entity.get all();
How do I override the blazerod texture using this...
ModPE.overrideTexture("?", "URL");
What is the "?", " images/blaze_rod.png"?
Btw its not that cause I've tried
Or is there any other way of retexturing items without a texture pack?
If you would do it with a texture pack the texture would be in the folder assets/images/items-opaque/
so I think it is
ModPE.overrideTexture("items-opaque/blaze_rod_0", "URL");
(Here´s a list of texture names http://zhuoweizhang.net/mcpetexturenames/)
I'll give it a try, if it doesn't work I will just have to use a texture pack
How do add a potion effect to an Armor? That when you take it off it removes the effect and when you wear it on it adds the effect.
Dunno use the getArmorSlot()?
Can someone give me the mod function for custom armor? If you can that would be helpful if you could type it up.
You have to use getArmorSlot() and modTick().