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...
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
same also cause it doesnt have all the hooks but you can add them yourself by just putting them in the script start area, I sometimes still use it to test ideas
what does this weapon do, please note that mods in js and possibly addons cannot add lightning bolts like the pc version into mcpe as they are hard coded in to the game
i can make a few lines of code that will replace all the ores with normal stone using js, however you will need to have the mod enabled everytime you load that world or else they will be replaced with update blocks, also any other worlds loaded while having this enabled will have their ores replaced with stone too but i think i might have an idea to stop that from happening, if you want me to do it just pm me
Think of it this way, if we take a regular block, we can move its offset by using the Block.setShape(blockId, x1, y1, z1, x2, y2, z2); function, a normal block is 0, 0, 0, 1, 1, 1, (this replaces x1-z2) this is saying start the block at xyz 0 and finish it at xyz 1, a slab would be, 0,0,0,1,0.5,1 or 0,0,0,1,8/16,1 so it starts at xyz0 and finishes at xz 1 y 0.5, now using this we can change its offset by doing this,
Block.SetShape(blockId, 0, -1, 0, 1, 0, 1); so say we tapped a block at x0,y64,z0, using the block we made, it would be physically placed at x0,y65,z0 but we would see it at y64 becaus although it is a 16*16 block it has been pushed down a block, to break it you would need to break the block at y65, hopefully this can help a bit, like I said its hard to explain
If cubik is a software then I don't know how it would work, this is just straight code, its creating custom blocks that appear to have lost of faces, when really it doesn't it is just forced into the same space, like in the images above, (what you are seeing is three separate blocks forced into one space) so really it is just multiple blocks having different offsets which i used to make them occupy the same block space, its kind of hard to explain it sorry
0
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
0
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
that was for crazycard btw
0
MCA?
0
uh if you know nothing about c++ or js then i suggest you start with js modding first and slowly build up to c++
0
i like your signature, did you make it yourself
?
0
same also cause it doesnt have all the hooks but you can add them yourself by just putting them in the script start area, I sometimes still use it to test ideas
0
what does this weapon do, please note that mods in js and possibly addons cannot add lightning bolts like the pc version into mcpe as they are hard coded in to the game
0
wait so you can modify built in functions and add more parameters...? where have we all been..
0
i can make a few lines of code that will replace all the ores with normal stone using js, however you will need to have the mod enabled everytime you load that world or else they will be replaced with update blocks, also any other worlds loaded while having this enabled will have their ores replaced with stone too but i think i might have an idea to stop that from happening, if you want me to do it just pm me
0
that depends on if he wants it to be 100 c : 1 s, 100 s : 1 g, i understand what you said but not him lol :/
0
ModCraft, its the best app for making js mods for beginners, it is how I learned :3
0
I can make a function for doing all the math and stuff but, i just need a better explanation of what you are meaning sorry :/
0
Think of it this way, if we take a regular block, we can move its offset by using the Block.setShape(blockId, x1, y1, z1, x2, y2, z2); function, a normal block is 0, 0, 0, 1, 1, 1, (this replaces x1-z2) this is saying start the block at xyz 0 and finish it at xyz 1, a slab would be, 0,0,0,1,0.5,1 or 0,0,0,1,8/16,1 so it starts at xyz0 and finishes at xz 1 y 0.5, now using this we can change its offset by doing this,
Block.SetShape(blockId, 0, -1, 0, 1, 0, 1); so say we tapped a block at x0,y64,z0, using the block we made, it would be physically placed at x0,y65,z0 but we would see it at y64 becaus although it is a 16*16 block it has been pushed down a block, to break it you would need to break the block at y65, hopefully this can help a bit, like I said its hard to explain
0
If cubik is a software then I don't know how it would work, this is just straight code, its creating custom blocks that appear to have lost of faces, when really it doesn't it is just forced into the same space, like in the images above, (what you are seeing is three separate blocks forced into one space) so really it is just multiple blocks having different offsets which i used to make them occupy the same block space, its kind of hard to explain it sorry
0
another thing is you dont only need to do it using the y axis you can use x and z i just used y for testing