I'm currently working on a Mod that adds many new crops and food to Minecraft PE. I cant seem to figure out how to make the crops grow with different growth phases that change over a period of time. Any help welcome!
The Meaning of Life, the Universe, and Everything.
Location:
Auckland
Join Date:
9/20/2014
Posts:
126
Minecraft:
softmage114486
Xbox:
softmage114486
Member Details
I've thought of this before but never bothered to do it! But you can do something along the lines of..
function converToTick(seconds){//a function to convert seconds into game ticks!
return seconds *= 20;
}
function modTick(){
var grown = false;
i = 0;
//add some code here like when the seed is placed make placed = true or something... And then
i++;//add 1 to i
while(i != 0){//this is a loop
i++;//keep adding 1 to i
}
if(i >= convertToTick(20)){//if i == our amount of seconds
grown = true;//grown will == true!
}
if(grown == true){
i = 0;//reset the loop!
//code to do more stuffs here
}
}
Now you can edit the seconds to however long you want, then add more code so that when, grown = true; the crops are ready!! If you need more help just pm me
I've thought of this before but never bothered to do it! But you can do something along the lines of..
function converToTick(seconds){//a function to convert seconds into game ticks!
return seconds *= 20;
}
function modTick(){
var grown = false;
i = 0;
//add some code here like when the seed is placed make placed = true or something... And then
i++;//add 1 to i
while(i != 0){//this is a loop
i++;//keep adding 1 to i
}
if(i >= convertToTick(20)){//if i == our amount of seconds
grown = true;//grown will == true!
}
if(grown == true){
i = 0;//reset the loop!
//code to do more stuffs here
}
}
Now you can edit the seconds to however long you want, then add more code so that when, grown = true; the crops are ready!! If you need more help just pm me
I'm currently working on a Mod that adds many new crops and food to Minecraft PE. I cant seem to figure out how to make the crops grow with different growth phases that change over a period of time. Any help welcome!
Is that even possible with ModPEScript? I taught you can only do that with native mods because you need the random ticks for the random growth?
Yeah you can use the ModPE tick function but I'm not sure how to actually put it all together
I've thought of this before but never bothered to do it! But you can do something along the lines of..
function converToTick(seconds){//a function to convert seconds into game ticks!
return seconds *= 20;
}
function modTick(){
var grown = false;
i = 0;
//add some code here like when the seed is placed make placed = true or something... And then
i++;//add 1 to i
while(i != 0){//this is a loop
i++;//keep adding 1 to i
}
if(i >= convertToTick(20)){//if i == our amount of seconds
grown = true;//grown will == true!
}
if(grown == true){
i = 0;//reset the loop!
//code to do more stuffs here
}
}
Now you can edit the seconds to however long you want, then add more code so that when, grown = true; the crops are ready!! If you need more help just pm me
var plantIds = 500;
var plantArr = [];
function useItem(x,y,z,itemId,blockId) {
if(itemId == plantIds) {
plantArr.push({plantId:itemId,timee:1200,xx:x,yy:y,zz:z});
}
}
function modTick() {
if(plantArr.length !== 0) {
for(var tt = 0; tt < plantArr.length; tt++) {
plantArr[tt].timee--;
if(plantArr[tt].time == 600) { // if plant old are 30 sec
// phases 1 here
}
if(plantArr[tt].time == 400) { // if plant old are 20 sec
// phases 2 here
}
if(plantArr[tt].timee == 0) {
//last phases
clientMessage("Your Plant is Harvested");
}
}
}
}
function destroyBlock(x,y,z) {
for(var tt in plantArr) {
if(getTile(x,y,z) == plantArr[tt].plantId && x == plantArr[tt].xx && y == plantArr[tt].yy &&z == plantArr[tt].zz) {
Level.destroyBlock(x,y,z,false);
Level.dropItem(x,y,z,theFruitDrops);
plantArr.splice(i,1);
}
}
}
Use mine if you are want to planting alot of plant, but i dont know work or no :#
Thanks for the help! I'll test it out
No problem! Happy to help, I might actually use this for something too....