idk, i got bad english
but you mean is grow to costum saplings?
function useItem(x,y,z,itemId,blockId,side) {
if(itemId == boneMeal && blockId == yourCostumSaplingId) {
setTile(x,y,z,theWoodId);
setTile(x,y,z,theWoodId); // set the structure with your self
setTile(x,y,z,theWoodId); // set the structure with your self
setTile(x,y,z,theWoodId); // set the structure with your self
setTile(x,y,z,theLeafId); // set the structure with your self
setTile(x,y,z,theLeafId); // set the structure with your self
setTile(x,y,z,theLeafId); // set the structure with your self
setTile(x,y,z,theLeafId); // set the structure with your self
}
}
Hmph, i already made the prewiew thingy for the mod, but this could make 1.0.0 much better.
In the mod i have a small sapling for all 6 tree type.
You guys helped a lot, but i still dont understand the grow by time one.
Questions:
var time=0 //should i write here 0, or other number?
function modtick(//should i write something in here?){
if(saplingset1=true) //sooo, the saplingset1 is the var of the costum block, and the it only grow if the block is the saplin. Am i right? And can i use blockId?
time = 0 //ummm, huh? Whats this code do?
Abaut the way it spawns, i didnt set y=sapling1y, just used this:
setTile(x,y,z,17,0);
setTile(x,y+1,z,17,0);
setTile(x+1,y+2,z+1,18,0);
And i didnt remove the sapling, since it replace it. And it works. So, if i use this spawning type, will the timeing work?
And how can i merge the 2 ways of spawning? ( bonemeal or time)
Also id like to make the sapling look like a real sapling. Now its looks like a block.
//define the variables first:
var sapling1=false; //Know this is a boolean (saves true or false)
var time1=0; //you don´t need to write =0, you can just write var count;, but better do this, so that the Script knows that this is a Integer (number)
var sapling1x=0;
var sapling1y=0;
var sapling1z=0;
var sapling2=false;
var time2=0;
var sapling2x=0;
var sapling2y=0;
var sapling2z=0;
function procCmd(command) {
var cmd = command.split(" ");
var myCommand = "create"; //make /create to do this in the game
if(cmd[0] == myCommand) {
//define here the saplings so that they exist in the game (You mustn´t do this as command)
}
}
function useItem(){ //is called whenever you use a Item, gives you which on what at where and the site
if(itemId==351 && blockId==240){ //351 is the Id of Bonemeal, 240 is Id of your sapling, you may choose another, this means, that this is used whenever you put bonmeal on your sapling, as you know from
Level.destroyBlock(x,y,z,false); //destroy the sapling first
setTile(x,y,z,17); //sets the wood, the Script already knows the x,y,z coordinates from the useItem
setTile(x,y+1,z,17); //sets the second block, one block higher, I don´t know if you can write y+1, try it, DO NOT WRITE 17,0, write 17
//add more blocks here to built your tree (the leaves Id is 18)
}
if(itemId==240){ //We need this, to save the position of your sapling, is called whenever you set one, we need the position later
if(sapling1==false){ //if this sapling don´t exists in the moment
sapling1x=x; //the position of the first sapling
sapling1y=y;
sapling1z=z;
sapling1=true; //Tells the Script that the first sapling exists
}else{ //if the first sapling exists
if(sapling2==false){ //the position of the second sapling
sapling2x=x;
sapling2y=y;
sapling2z=z;
sapling2=true;
} //Add more positions here like I did, but don´t forget to define their variables also
}
}
}
function modTick(){ //at functions, you always write something in to put it in the function, but we don´t need that here, it would just make an error
if(sapling1==true){
time1=time1+1; //the Script does this twenty times per second, if our sapling exists
if(time1==4800){ //After four minutes...
time1=0; //reset the time, otherwise the next sapling would spawn your tree right away
Level.destroyBlock(sapling1x,sapling1y,sapling1z,false); //destroys the sapling, we need the saved coordinates the first time
sapling1=false; //tell the Script that the sapling does not exists anymore
count=count-1; //Also count back
setTile(sapling1x,sapling1y,sapling1z,17); //builts the first block of the tree, if you just use x,y,z, the tree would be somewhere, but not where you want it
setTile(sapling1x,sapling1y+1,sapling1z,17); //the second block, one block higher
//Add more blocks here (the leaves Id is 18)
}
}
if(sapling2==true){ //Do this for the sapling sapling also
time2=time2+1;
if(time2==4800){ //You can use another time, if you want
time2=0;
Level.destroyBlock(sapling2x,sapling2y,sapling2z,false);
sapling2=false;
count=count-1;
setTile(sapling2x,sapling2y,sapling2z,17);
setTile(sapling2x,sapling2y+1,sapling2z,17);
//Add more blocks here (the leaves Id is 18)
}
}
}
function leaveGame(){ //is called when you close a world
ModPE.saveData(sapling1, time1, sapling1x, sapling1y, sapling1z, sapling2, sapling2x, sapling2y, sapling2z); //Save the variables for later use when leaving the game, better save it as .txt-file, I give you a link, (now you write something in the () )
}
function newLevel(){ //is called when you open a world
ModPE.readData(sapling1, time1, sapling1x, sapling1y, sapling1z, sapling2, sapling2x, sapling2y, sapling2z); //reads (reloads) the variables
}
but you mean is grow to costum saplings?
function useItem(x,y,z,itemId,blockId,side) {
if(itemId == boneMeal && blockId == yourCostumSaplingId) {
setTile(x,y,z,theWoodId);
setTile(x,y,z,theWoodId); // set the structure with your self
setTile(x,y,z,theWoodId); // set the structure with your self
setTile(x,y,z,theWoodId); // set the structure with your self
setTile(x,y,z,theLeafId); // set the structure with your self
setTile(x,y,z,theLeafId); // set the structure with your self
setTile(x,y,z,theLeafId); // set the structure with your self
setTile(x,y,z,theLeafId); // set the structure with your self
}
}
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumTo grow by time, do this:
function modTick(){ //this functions is a hook function used twenty times a second and the basic for all timersif(saplingset1=true){ //Save in a variable whenever you set a sapling, better use more variables for more saplings at onceif(time==4800){ //After four minutes... (20*60*4)I hope this helps you, if you need more help, Quote this reply.
The IDs of all the blocks: http://minecraft-de.gamepedia.com/Datenwert_(Pocket_Edition)
Sorry, I just now the german site, but the imagines tells all itself.
In the mod i have a small sapling for all 6 tree type.
You guys helped a lot, but i still dont understand the grow by time one.
Questions:
var time=0 //should i write here 0, or other number?
function modtick(//should i write something in here?){
if(saplingset1=true) //sooo, the saplingset1 is the var of the costum block, and the it only grow if the block is the saplin. Am i right? And can i use blockId?
time = 0 //ummm, huh? Whats this code do?
Abaut the way it spawns, i didnt set y=sapling1y, just used this:
setTile(x,y,z,17,0);
setTile(x,y+1,z,17,0);
setTile(x+1,y+2,z+1,18,0);
And i didnt remove the sapling, since it replace it. And it works. So, if i use this spawning type, will the timeing work?
And how can i merge the 2 ways of spawning? ( bonemeal or time)
Also id like to make the sapling look like a real sapling. Now its looks like a block.
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumlink for saving as .txt-file: www.minecraftforum.net/forums/minecraft-pocket-edition/mcpe-mods-tools/mcpe-mod-tool-help-requests/2325998-saving-a-txt-at-a-modpe-script-javascript-on
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumAnd now i understand it (yay)
Anyway ill change the thread name, so if someone else want to know, he/she will find this.
The bonemeal one doesnt looks hard, i think ill add it now, but fir the timed one ill wait till summer.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou read the message I sended you?!?