I have this issue about a regenerating chest mod but I have no idea about what to do so here's the details can't be breakable and doesn't regenerate items when a player is looking in them. Oh and another thing it needs to have certain items of food and it need desno gun items but more rare. Oh also it can have furnaces spawn stuff in there too. P.S. needs to be a js file
You could make the chests get the Items at the times (every day,...) you want, but you also could give the chests random items whenever a Player looks in with useItem, because that's easier.
Well that would be easier but what's the code because i couldn't find it. P.S. I had trouble using the unbreakable chest mod because I want it on every chest and side but how do I put that in the coding
Do you know what arrays are? With those and some loops and modTick() it's easy do fill them every day, you should do that so I think. With function useItem() you can make chest unbreakable, but so you can't open them... You should make the explosion resitance and the time to destroy higher. (If the time to a destroy a chest is 10 minutes nobody destroyes them. If you need help with the every-day-filling I'll write you an example.
Oh since you helped me when I'm done with the entire mod I'm trying to make I'll private message you the download file (I'll try to remeber{sorry if I can't})
You can right away put this in a JavaScript and try it out! You can built something, as huge as you want, destroy it, and tap anywhere a block with a iron-sword, and it will appear again!
I hoped you understand that now
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I have this issue about a regenerating chest mod but I have no idea about what to do so here's the details can't be breakable and doesn't regenerate items when a player is looking in them. Oh and another thing it needs to have certain items of food and it need desno gun items but more rare. Oh also it can have furnaces spawn stuff in there too. P.S. needs to be a js file
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumWhat is chests can't regenerate Items?
Here the Code for making them unbreakable, but you can't look in them with this Script...:
function useItem(x,y,z,itemId,blockId,side){
if(blockId==54){
preventDefault();
}
}
You seem to need muuuch functions, you may look here:
https://github.com/Connor4898/ModPE-Scripts/wiki/ModPE-Scripts-Functions-List
Ok thank you for so much help.
Oh no they have to regenerate items (the chests) and it means that they get random items like food or coal put in them by the mod.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou could make the chests get the Items at the times (every day,...) you want, but you also could give the chests random items whenever a Player looks in with useItem, because that's easier.
Well that would be easier but what's the code because i couldn't find it. P.S. I had trouble using the unbreakable chest mod because I want it on every chest and side but how do I put that in the coding
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumDo you know what arrays are? With those and some loops and modTick() it's easy do fill them every day, you should do that so I think. With function useItem() you can make chest unbreakable, but so you can't open them... You should make the explosion resitance and the time to destroy higher. (If the time to a destroy a chest is 10 minutes nobody destroyes them. If you need help with the every-day-filling I'll write you an example.
It would be helpful if you write an example please (as you can tell I'm new to coding)
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou may know already:
ints
Strings
boolean
float or double
But you can put all this in arrays:
How to define:
var mine = [];
How to use:
Level.setTile(mine[0], mine[1], mine[2], 3);
Each array in Java or C++ starts with 0, not with 1!
You should use them in loops:
var count=0;
var array = [];
while(count<400){
Level.setTile(mine[count], mine[count+1], mine[count+2], mine[count+3]);
count=count+4;
}
This little Script would set 100 blocks which are saved in only one array!
If you want an example for the filling of chests you have to wait some time, but you could try it out now on your own.
Thanks for all the help
Oh since you helped me when I'm done with the entire mod I'm trying to make I'll private message you the download file (I'll try to remeber{sorry if I can't})
Oops I forgot to ask which one of those arrays set the time of mining the block
So far have I done this right?
var mine =[]
Level.setTile(mine[0], mine[1], mine[2], mine[3], mine[4], mine[5], mine[6], mine[7], mine[8], mine[9], mine[10], mine[11], mine[12], mine[13], mine[14], mine[15], mine[16], mine[17], mine[18], mine[20], mine[21], mine[22], mine[23], mine[24], mine[25], mine[26], mine[27], mine[28], mine[30], mine[31], mine [32], mine[35], mine[36]);
var count=0;
var array = [];
while(count<36000){
Level.setTile(mine[count], mine[count+1], mine[count+2], mine[count+3], mine[count+4], mine[count+5], mine[count+6], mine[count+7], mine[count+8], mine[count+9], mine[count+10], mine[count+11], mine[count+12], mine[count+13], mine[count+14], mine[count+15], mine[count+16], mine[count+17], mine[count+18], mine[count+20], mine[count+21], mine[count+22], mine[count+23], mine[count+24], mine[count+25], mine[count+26], mine[count+27], mine[count+28], mine[count+30], mine[count+31], mine [count+32], mine[count+35], mine[count+36]);
count=count+37
}
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumAhh,... no
You can put just 4 numbers in the () of Level.setTile(), x, y, z and the Id.
To do this oftener you need the loop, because it does the Level.setTile() again and again.
I use the while-loop, there are more.
var count=0; //This variable is needed for the loop.
var array = []; //This is the array to save something in.
//I make a bigger example...
function useItem(x, y, z, itemId, blockId, side){//is called whenever you tap a block
if(itemId<256){ //To make sure that we just save blocks
array[count]=x; //saves the x-coordinate we have from the useItem() into the array at the position count (at the beginning count=0)
count++; //is the same as count=count+1;
array[count]=y;
count++;
array[count]=z;
count++;
array[count]=itemId;
count++;//now we have saved the block in the array
}
if(itemId==267){ //whenever we use a iron-sword...
var in=count; //we need to make a new variable with thr count to don't lose the count
while(in>0){ //It does this loop again and again as long as i is bigger then 0
in=in-4; //We saved 4 variables (or informations) about each block
Level.setTile(arra[in], array[in+1], array[in+2], array[in+3]);
}
}
You can right away put this in a JavaScript and try it out! You can built something, as huge as you want, destroy it, and tap anywhere a block with a iron-sword, and it will appear again!
I hoped you understand that now