So, basically i need some help with //set function like in WorldEdit... Can anyone make it working? I`ve made 2 commands //mpos1 and //mpos2 these are the positions. I need a thing like when you type //set {ID OF THE BLOCK} (with positions selected) it replaces blocks in the terrirory with ID that you typed. My scriot does nothing. Can you edit it? Here`s what I`d done:
var x1 = 0; var y1 = 0; var z1 = 0; var x2 = 0; var y2 = 0; var z2 = 0;
function procCmd(cmd) { var Command = cmd.split(" "); switch(Command[0]) { case "/mpos1": { x1 = getPlayerX(); y1 = getPlayerY() - 1; z1 = getPlayerZ(); preventDefault(); } case "/mpos2": { x2 = getPlayerX(); y2 = getPlayerY() - 1; z2 = getPlayerZ(); preventDefault(); } case "/set": { if(cmd[1] == 0) { clientMessage("Not enough params !"); } var startX = Math.min(x1, x2); var startY = Math.min(y1, y2); var startZ = Math.min(z1, z2); var endX = Math.max(x1, x2); var endY = Math.max(y1, y2); var endZ = Math.max(z1, z2); setCube(x1, y1, z1, x2, y2, z2, parseInt(cmd[1])); } } }
function setCube(startX, startY, startZ, endX, endY, endZ, id, damage) { for(var x = startX;x<=endX;x++) { for(var y = startY;x<=endY;y++) { for(var z = startZ;x<=endZ;z++) { Level.setTile(x, y, z, id, damage); } } } }
function set(startX,startY,startZ,endX,endY,endZ,id,damage){
var smallX = Math.min(startX,endX);
var bigX = Math.max(startX,endX);
var smallY = Math.min(startY,endY);
var bigY = Math.max(startY,endY);
var smallZ = Math.min(startZ,endZ);
var bigZ = Math.max(startZ,endZ);
for(var x = smallX; x <= bigX; x++){
for(var y = smallY; y <= bigY; y++){
for(var z = smallZ; z <= smallZ; z++){
setTile(x,y,z,id,damage);
}
}
}
}
function set(startX,startY,startZ,endX,endY,endZ,id,damage){
var smallX = Math.min(startX,endX);
var bigX = Math.max(startX,endX);
var smallY = Math.min(startY,endY);
var bigY = Math.max(startY,endY);
var smallZ = Math.min(startZ,endZ);
var bigZ = Math.max(startZ,endZ);
for(var x = smallX; x <= bigX; x++){
for(var y = smallY; y <= bigY; y++){
for(var z = smallZ; z <= smallZ; z++){
setTile(x,y,z,id,damage);
}
}
}
}
Awesome! You beat me Lambo. But next time I'll beat you.
Rollback Post to RevisionRollBack
Make sure you follow me on twitter! @DarkDiaMiner IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->
Guys. thx a lot, but actually I didi it by myself! I made it like a big quarry: you set 2 positions and then it digs down to bedrock and everything goes to your inventory! Soon I`ll post a script I am working on!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
var x1 = 0;
var y1 = 0;
var z1 = 0;
var x2 = 0;
var y2 = 0;
var z2 = 0;
function procCmd(cmd)
{
var Command = cmd.split(" ");
switch(Command[0])
{
case "/mpos1":
{
x1 = getPlayerX();
y1 = getPlayerY() - 1;
z1 = getPlayerZ();
preventDefault();
}
case "/mpos2":
{
x2 = getPlayerX();
y2 = getPlayerY() - 1;
z2 = getPlayerZ();
preventDefault();
}
case "/set":
{
if(cmd[1] == 0)
{
clientMessage("Not enough params !");
}
var startX = Math.min(x1, x2);
var startY = Math.min(y1, y2);
var startZ = Math.min(z1, z2);
var endX = Math.max(x1, x2);
var endY = Math.max(y1, y2);
var endZ = Math.max(z1, z2);
setCube(x1, y1, z1, x2, y2, z2, parseInt(cmd[1]));
}
}
}
function setCube(startX, startY, startZ, endX,
endY, endZ, id, damage)
{
for(var x = startX;x<=endX;x++)
{
for(var y = startY;x<=endY;y++)
{
for(var z = startZ;x<=endZ;z++)
{
Level.setTile(x, y, z, id, damage);
}
}
}
}
function set(startX,startY,startZ,endX,endY,endZ,id,damage){ var smallX = Math.min(startX,endX); var bigX = Math.max(startX,endX); var smallY = Math.min(startY,endY); var bigY = Math.max(startY,endY); var smallZ = Math.min(startZ,endZ); var bigZ = Math.max(startZ,endZ); for(var x = smallX; x <= bigX; x++){ for(var y = smallY; y <= bigY; y++){ for(var z = smallZ; z <= smallZ; z++){ setTile(x,y,z,id,damage); } } } }Awesome! You beat me Lambo. But next time I'll beat you.
IF I post a mod download it and give me a +1 if you appreciate.
Make sure you give me a suggestion at my WIP topic darkPE
Make sure you click on that +1 button if I help you! ---------------->