So I basically know a bunch of stuff like plant cycles, ore spawning, and even tools but I don't know how to make my own mobs. Can anyone suggest anything that would teach me to spawn mobs cause it would also be a huge addition to the SuperCraft development
if(time==0){ //if the time is 0 after counting down (if the time was 1 when modTick has been called)
var x=Math.floor(Math.ramdom()*(awayMax-awayMin)+1+awayMin);
var z=Math.floor(Math.ramdom()*(awayMax-awayMin)+1+awayMin);
if(Math.floor(Math.random()*2)==1){ //x and z are positiv but they should have a 50% chance to be negative
x=x*(-1);
}
if(Math.floor(Math.random()*2)==1){
z=z*(-1);
}
//now x and z should be near the player and not anywhere in the world:
x=x+Player.getX();
z=z+Player.getZ();
//Now the heigh (y) is missing
y=128; //a MCPE world is 128 block high
for(var i=0; i<128; i++){
if(Level.getTile(x, y, z)==0){
y--;
}
}
y++;
//Now the mob spawns on a block and don´t falls to it´s death
//---
if(Level.getBrightness(x, y, z)<4){ //if it is dark where the mob should spawn, only for hostile mobs, if the mob isn´t hostile just call the Level.spawnMob()-function
So I basically know a bunch of stuff like plant cycles, ore spawning, and even tools but I don't know how to make my own mobs. Can anyone suggest anything that would teach me to spawn mobs cause it would also be a huge addition to the SuperCraft development
The heck is this for
-
View User Profile
-
View Posts
-
Send Message
Curse Premium(ModPE?)
Hostile Mobs? (Only spawn at dark places.)
Both hostile and passive if hostile is possible
The heck is this for
-
View User Profile
-
View Posts
-
Send Message
Curse Premium//the minimum and maximun time until a mob spawns in ticks (20 ticks = one second)
var timeMin=50;
var timeMax=200;
//the minimum and maximum how far the mob spawns away from the player
var awayMin=15;
var awayMax=128;
//some variables for later
var time=0;
var x=0;
var y=0;
var z=0;
function modTick(){
if(time==0){ //if the time is 0 set a new time until a mob spawns
time=Math.floor(Math.ramdom()*(timeMax-timeMin)+1+timeMin);
}else{ //if the time isn´t 0
time--;
if(time==0){ //if the time is 0 after counting down (if the time was 1 when modTick has been called)
var x=Math.floor(Math.ramdom()*(awayMax-awayMin)+1+awayMin);
var z=Math.floor(Math.ramdom()*(awayMax-awayMin)+1+awayMin);
if(Math.floor(Math.random()*2)==1){ //x and z are positiv but they should have a 50% chance to be negative
x=x*(-1);
}
if(Math.floor(Math.random()*2)==1){
z=z*(-1);
}
//now x and z should be near the player and not anywhere in the world:
x=x+Player.getX();
z=z+Player.getZ();
//Now the heigh (y) is missing
y=128; //a MCPE world is 128 block high
for(var i=0; i<128; i++){
if(Level.getTile(x, y, z)==0){
y--;
}
}
y++;
//Now the mob spawns on a block and don´t falls to it´s death
//---
if(Level.getBrightness(x, y, z)<4){ //if it is dark where the mob should spawn, only for hostile mobs, if the mob isn´t hostile just call the Level.spawnMob()-function
Level.spawnMob(x, y, z, entity-ID, "texture");
}
//---
}
}
}
It says time is not defined,is it supposed to be
var time = 0;
?
The heck is this for
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumDid you defined time as I wrote? If yes you could try to rename time.