I was on the Art Request page before and I was thinking.... "We sure need something like this for scripting and GUI, it'll be helpful..." So I came up with the Brilliant Idea of this page. Basically, it has the same rules as the art request page, put a Talkbox with your name and request, and someone can take the offer and help you with it...
Example Format:[]
|
REQUESTS:[]
Tree type 2[]
I know I probably post here too much ;P, but I was trying to make a different shape of tree, and couldnt figure out the coding. Is there a simpler way to make a tree like this? (The stone is for a different leaf type) I have CS2 2-0.10.6b-universal
- requested by Surrealistic Wolf
Ice Ring[]
I was trying to make a ring that when right clicked, replaces water under the player and water touching the sides (3x3) with ice. It does not have to be 3x3 if that is too hard, but everything I have tried does not work. My script so far is:
var py = player.getPositionY; var px = player.getPositionX; var pz = player.getPositionZ; world.setBlockId(px, py, pz, 79);
I have CS2 2-0.10.6b-universal
- requested by Surrealistic Wolf
Completed(CS2):[]
Side Checking Script[]
Um, I think that this script would be very useful to many people, so...
A script that checks if a certain block is touching another block and preforms an action if it returns true.
There are many uses for this, and I think they should make a function for it. Thanks!
- requested by Surrealistic Wolf
|
isTouchingBlock.js
function isTouchingBlock(idToFind, metaToFind) { if(metaToFind === undefined) metaToFind = 0; if(idToFind == world.getBlockId(position.x, position.y-1, position.z)) if(metaToFind == world.getMetaId(position.x, position.y-1, position.z)) return true; if(idToFind == world.getBlockId(position.x, position.y+1, position.z)) if(metaToFind == world.getMetaId(position.x, position.y+1, position.z)) return true; if(idToFind == world.getBlockId(position.x, position.y, position.z-1)) if(metaToFind == world.getMetaId(position.x, position.y, position.z-1)) return true; if(idToFind == world.getBlockId(position.x, position.y, position.z+1)) if(metaToFind == world.getMetaId(position.x, position.y, position.z+1)) return true; if(idToFind == world.getBlockId(position.x-1, position.y, position.z)) if(metaToFind == world.getMetaId(position.x-1, position.y, position.z)) return true; if(idToFind == world.getBlockId(position.x+1, position.y, position.z)) if(metaToFind == world.getMetaId(position.x+1, position.y, position.z)) return true; // if none are true return false; }
usage
// simple examples: // checks if touching yellow wool onActivated[0] = "mod.loadScript('isTouchingBlock.js'); if(isTouchingBlock(35, 4)) { /*do fun stuff*/ }"; //checks if touching a diamond block onPlacedByPlayer[0] = "mod.loadScript('isTouchingBlock.js'); if(isTouchingBlock(57)) {player.sendMessage('You haz diamonds?!?');}";
Completed(CS1):[]
Contents hidden to reduce page size. Contents include: Equivalent Exchange tool, Winebarrel script, Magic Hoe A.K.A. alchemy stick, Spreading Plant, Sword of Fire, and Randomly Generated Structures. Click the word "show" below to see all CS1 completed requests
Equivalent Exchange tool script[]
does anybody know the Equivalent Exhange² mod? This mod brings tools, that can mine a whole ore of, for example, iron with just a rightclick on it. Would it be possible to write a script that you can use for tools, that has this function? by Xamf11 in World comments.
|
First, this goes into your item file for your tool.
rightclickair = "customstuff.loadScript('EEpick.script');
Next is the code for EEpick.script.
var x = player.getPositionX(); var y = player.getPositionY(); var z = player.getPositionZ(); var direction = player.getLookingSide(); var myOres = new Array(16,15,14,21,73,74,56); var havefuel = false; var foundore = false; var i; for(i=0;i<=35;i++) { if(player.getItemId(i) == 331) { havefuel = true; break; } } if(havefuel == true) { switch(direction) { case 0: z += 4; CuboidOreCheck(); break; case 1: x -= 4; CuboidOreCheck(); break; case 2: z -= 4; CuboidOreCheck(); break; case 3: x += 4; CuboidOreCheck(); break; } if(foundore == true) { player.removeFromInventory(331, 1, 0); } else { player.sendMessage("No ores found."); } } else { player.sendMessage("No redstone dust in inventory."); } function CuboidOreCheck() { var xc; var yc; var zc; x-=3; z-=3; y-=3; for(xc=0;xc<7;xc++) { for(zc=0;zc<7;zc++) { for(yc=0;yc<7;yc++) { OreCheck(); y++; } z++; y-=7; } x++; z-=7; } } function OreCheck() { for(var orecheck = 0; orecheck < myOres.length; orecheck++) { var currentBlock = world.getBlockId(x, y, z); if(currentBlock == myOres[orecheck]) { switch(currentBlock) { case 16: world.setBlockIdAndMetadata(x, y, z, 0, 0); player.dropItem(263, 1, 0); foundore = true; break; case 15: world.setBlockIdAndMetadata(x, y, z, 0, 0); player.dropItem(15, 1, 0); foundore = true; break; case 14: world.setBlockIdAndMetadata(x, y, z, 0, 0); player.dropItem(14, 1, 0); foundore = true; break; case 21: world.setBlockIdAndMetadata(x, y, z, 0, 0); player.dropItem(351, Math.floor(Math.random()*5+4), 6); foundore = true; break; case 73: case 74: world.setBlockIdAndMetadata(x, y, z, 0, 0); player.dropItem(331, Math.floor(Math.random()*2+4), 0); foundore = true; break; case 56: world.setBlockIdAndMetadata(x, y, z, 0, 0); player.dropItem(264, 1, 0); foundore = true; break; } } } }
Request extracted from Normal (block type) comments.
Hi again ;)
I make a winebarrel :
name = "Weinfass"; id = 175; texturefile = "Mod.png"; textureindex=8; textureindexnorth=10; textureindexsouth=10; textureindextop=8; textureindexeast=10; textureindexwest=10; type = "normal"; stepsound="wood"; material="wood"; iddropped=8007,8004; quantitydropped="10","1"; damagevalues=5; opacity=10;
All good, but on my Server there was a unvisible Block, after placing the Barrel . How can i remove it ? And second Item dont drop (8004). Can u help me, if i want to fill with rightcklick a bottle, what should i write ? (so after 10 filled bottle the barrel droped in to a empty barrel.
Thanks alot for helping me :)
ng
Joe Garret
|
Changes to the .block file.
damagevalues = 9; iddropped=8004; damagedropped=0; quantitydropped="1"; textureindex1 = 8; textureindextop1 = 8; textureindexnorth1 = 10; textureindexsouth1 = 10; textureindexeast1 = 10; textureindexwest1 = 10; iddropped1 = 8004; damagedropped1 = 0; quantitydropped1 = "1"; textureindex2 = 8; textureindextop2 = 8; textureindexnorth2 = 10; textureindexsouth2 = 10; textureindexeast2 = 10; textureindexwest2 = 10; iddropped2 = 8004; damagedropped2 = 0; quantitydropped2 = "1"; textureindex3 = 8; textureindextop3 = 8; textureindexnorth3 = 10; textureindexsouth3 = 10; textureindexeast3 = 10; textureindexwest3 = 10; iddropped3 = 8004; damagedropped3 = 0; quantitydropped3 = "1"; textureindex4 = 8; textureindextop4 = 8; textureindexnorth4 = 10; textureindexsouth4 = 10; textureindexeast4 = 10; textureindexwest4 = 10; iddropped4 = 8004; damagedropped4 = 0; quantitydropped4 = "1"; textureindex5 = 8; textureindextop5 = 8; textureindexnorth5 = 10; textureindexsouth5 = 10; textureindexeast5 = 10; textureindexwest5 = 10; iddropped5 = 8004; damagedropped5 = 0; quantitydropped5 = "1"; textureindex6 = 8; textureindextop6 = 8; textureindexnorth6 = 10; textureindexsouth6 = 10; textureindexeast6 = 10; textureindexwest6 = 10; iddropped6 = 8004; damagedropped6 = 0; quantitydropped6 = "1"; textureindex7 = 8; textureindextop7 = 8; textureindexnorth7 = 10; textureindexsouth7 = 10; textureindexeast7 = 10; textureindexwest7 = 10; iddropped7 = 8004; damagedropped7 = 0; quantitydropped7 = "1"; textureindex8 = 8; textureindextop8 = 8; textureindexnorth8 = 10; textureindexsouth8 = 10; textureindexeast8 = 10; textureindexwest8 = 10; iddropped8 = 8004; damagedropped8 = 0; quantitydropped8 = "1"; textureindex9 = 8; textureindextop9 = 8; textureindexnorth9 = 10; textureindexsouth9 = 10; textureindexeast9 = 10; textureindexwest9 = 10; iddropped9 = 8004; damagedropped9 = 0; quantitydropped9 = "1"; rightclicked = "customstuff.loadScript('barreldrain.script');"; rightclicked1 = "customstuff.loadScript('barreldrain.script');"; rightclicked2 = "customstuff.loadScript('barreldrain.script');"; rightclicked3 = "customstuff.loadScript('barreldrain.script');"; rightclicked4 = "customstuff.loadScript('barreldrain.script');"; rightclicked5 = "customstuff.loadScript('barreldrain.script');"; rightclicked6 = "customstuff.loadScript('barreldrain.script');"; rightclicked7 = "customstuff.loadScript('barreldrain.script');"; rightclicked8 = "customstuff.loadScript('barreldrain.script');"; rightclicked9 = "customstuff.loadScript('barreldrain.script');"; destroyed = "world.spawnItem(origin, 8007, 10, 0);"; destroyed1 = "world.spawnItem(origin, 8007, 9, 0);"; destroyed2 = "world.spawnItem(origin, 8007, 8, 0);"; destroyed3 = "world.spawnItem(origin, 8007, 7, 0);"; destroyed4 = "world.spawnItem(origin, 8007, 6, 0);"; destroyed5 = "world.spawnItem(origin, 8007, 5, 0);"; destroyed6 = "world.spawnItem(origin, 8007, 4, 0);"; destroyed7 = "world.spawnItem(origin, 8007, 3, 0);"; destroyed8 = "world.spawnItem(origin, 8007, 2, 0);"; destroyed9 = "world.spawnItem(origin, 8007, 1, 0);";
In the barreldrain.script file:
if(player.getItemId(player.getCurrentSlot()) == 374) { var nDam = 1 + world.getBlockDamage(origin); player.removeFromInventory(374, 1, 0); player.addToInventory(8007, 1, 0); if(nDam == 10) { world.setBlockIdAndMetadata(origin, 0, 0); world.spawnItem(origin, 8004, 1, 0); } else { world.setBlockMetadata(origin, nDam); } }
i need some help with a new script for a "magic hoe" what i want it to do is if i click on an iron block to will change the iron block to a diamond block for a cost of 1 gold ingot and damages the hoe by 1. can you give me the script for that?
|
rightclick event for the hoe:
rightclick = "if(world.getBlockId(origin) == 42){customstuff.loadScript('MagicHoe.script');}";
MagicHoe.script file contents:
for(i=0;i<=35;i++) { if(player.getItemId(i) == 266) { world.setBlockId(origin, 57); player.removeFromInventory(266, 1, 0); player.damageItem(player.getCurrentSlot(), 1); break; } else if(i == 35) { player.sendMessage("Need 1 gold ingot.") } }
Spreading Plant[]
|
|
First, you need to setup the plant's block file and probably a .item file, if you don't already know how to do these, go to the [plants] page to figure it out. I will post just the update events of the block file here. This block assumes you are using damagevalues = 7 to allow 8 stages of growth.
update = "customstuff.loadScript('plantgrowth.script');"; update1 = "customstuff.loadScript('plantgrowth.script');"; update2 = "customstuff.loadScript('plantgrowth.script');"; update3 = "customstuff.loadScript('plantgrowth.script');"; update4 = "customstuff.loadScript('plantgrowth.script');"; update5 = "customstuff.loadScript('plantgrowth.script');"; update6 = "customstuff.loadScript('plantgrowth.script');"; update7 = "customstuff.loadScript('cube3x3plant.script');";
After you finish with the .block file, you need to setup the two .script files. The first one called plantgrowth.script will look like this.
var plantAge = world.getBlockDamage(origin); origin.y--; if(world.getBlockId(origin) != 2 && world.getBlockId(origin) != 3 && world.getBlockId(origin) != cube3x3plantid) { origin.y++; world.harvestBlock(origin); } else { origin.y++; if(Math.floor(Math.random()*100) < 20) { plantAge++; world.setBlockMetadata(origin, plantAge); } }
Finally, here is the code for the cube3x3plant.script file.
var cube3x3plantid = world.getBlockId(origin); var plantAge = world.getBlockDamage(origin); origin.y--; if(world.getBlockId(origin) != 2 && world.getBlockId(origin) != 3 && world.getBlockId(origin) != cube3x3plantid) { origin.y++; world.harvestBlock(origin); } else { origin.y++; var currentblock; var aboveavailable = true; var westavailable = true; var northavailable = true; var eastavailable = true; var southavailable = true; origin.y++; if(world.getBlockId(origin) != 0) { aboveavailable = false; } origin.y--; origin.x--; if(world.getBlockId(origin) != 0) { westavailable = false; } else { origin.y--; currentblock = world.getBlockId(origin); if(currentblock != 2 && currentblock != 3 && currentblock != cube3x3plantid) { westavailable = false; } origin.y++; } origin.x += 2; if(world.getBlockId(origin) != 0) { eastavailable = false; } else { origin.y--; currentblock = world.getBlockId(origin); if(currentblock != 2 && currentblock != 3 && currentblock != cube3x3plantid) { eastavailable = false; } origin.y++; } origin.x--; origin.z--; if(world.getBlockId(origin) != 0) { northavailable = false; } else { origin.y--; currentblock = world.getBlockId(origin); if(currentblock != 2 && currentblock != 3 && currentblock != cube3x3plantid) { northavailable = false; } origin.y++; } origin.z +=2; if(world.getBlockId(origin) != 0) { southavailable = false; } else { origin.y--; currentblock = world.getBlockId(origin); if(currentblock != 2 && currentblock != 3 && currentblock != cube3x3plantid) { southavailable = false; } origin.y++; } origin.z--; if(aboveavailable && Math.floor(Math.random()*100) < 20) { origin.y--; if(world.getBlockId(origin) == cube3x3plantid) { origin.y--; if(world.getBlockId(origin) != cube3x3plantid) { origin.y += 3; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, cube3x3plantid); } } else { origin.y += 2; } } else { origin.y += 2; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, cube3x3plantid); } origin.y--; } } if(westavailable && Math.floor(Math.random()*100) < 20) { origin.x--; if(world.getBlockId(origin) == cube3x3plantid) { origin.x--; if(world.getBlockId(origin) != cube3x3plantid) { origin.x += 3; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, cube3x3plantid); } } else { origin.x += 2; } } else { origin.x += 2; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, cube3x3plantid); } origin.x--; } } if(northavailable && Math.floor(Math.random()*100) < 20) { origin.z--; if(world.getBlockId(origin) == cube3x3plantid) { origin.z--; if(world.getBlockId(origin) != cube3x3plantid) { origin.z += 3; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, cube3x3plantid); } } else { origin.z += 2; } } else { origin.z += 2; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, cube3x3plantid); } origin.z--; } } if(eastavailable && Math.floor(Math.random()*100) < 40) { origin.x++; if(world.getBlockId(origin) == cube3x3plantid) { origin.x++; if(world.getBlockId(origin) != cube3x3plantid) { origin.x -= 3; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, cube3x3plantid); } } else { origin.x -= 2; } } else { origin.x -= 2; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, cube3x3plantid); } origin.x++; } } if(southavailable && Math.floor(Math.random()*100) < 40) { origin.z++; if(world.getBlockId(origin) == cube3x3plantid) { origin.z++; if(world.getBlockId(origin) != cube3x3plantid) { origin.z -= 3; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, cube3x3plantid); } } else { origin.z -= 2; } } else { origin.z -= 2; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, cube3x3plantid); } origin.z++; } } }
|
|
|
|
|
|
The code for flowerspread.script: var plantid = world.getBlockId(origin); var randx;
var randz; if(Math.floor(Math.random()*1000) < 1) { randx = Math.floor(Math.random()*7-3); randz = Math.floor(Math.random()*7-3); origin.x += randx; origin.z += randz; if(world.getBlockId(origin) == 0) { origin.y--; if(world.getBlockId(origin) == 2 || world.getBlockId(origin) == 3) { origin.y++; world.setBlockId(origin, plantid); } else if(world.getBlockId(origin) == 0); { origin.y--; if(world.getBlockId(origin) == 2 || world.getBlockId(origin) == 3) { origin.y++; world.setBlockId(origin, plantid); } } } else if(world.getBlockId(origin) == 2 || world.getBlockId(origin) == 3) { origin.y++; if(world.getBlockId(origin) == 0) { world.setBlockId(origin, plantid); } } }
|
Sword of Fire[]
|
|
|
Randomly Generated Structures[]
|
|
PyramidStructure.script
var replaceWithAir = true; var height = 5; var width = 9; var length = 9; var blocks = new Array(); for(var i=0;i<height;i++) { blocks[i] = new Array(); } //and now to fill the bottom layer //make sure you have the same length as your length variable blocks[0][0] = new Array(24, 24, 24, 24, 24, 24, 24, 24, 24); blocks[0][1] = new Array(24, 0, 0, 0, 0, 0, 0, 0, 24); blocks[0][2] = new Array(24, 0, 0, 0, 0, 0, 0, 0, 24); blocks[0][3] = new Array(24, 0, 0, 0, 0, 0, 0, 0, 24); blocks[0][4] = new Array(24, 0, 0, 0, 0, 0, 0, 0, 24); blocks[0][5] = new Array(24, 0, 0, 0, 0, 0, 0, 0, 24); blocks[0][6] = new Array(24, 0, 0, 0, 0, 0, 0, 0, 24); blocks[0][7] = new Array(24, 0, 0, 0, 0, 0, 0, 0, 24); blocks[0][8] = new Array(24, 24, 24, 24, 0, 24, 24, 24, 24); //the 2nd layer blocks[1][0] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[1][1] = new Array( 0, 24, 24, 24, 24, 24, 24, 24, 0); blocks[1][2] = new Array( 0, 24, 0, 0, 0, 0, 0, 24, 0); blocks[1][3] = new Array( 0, 24, 0, 0, 0, 0, 0, 24, 0); blocks[1][4] = new Array( 0, 24, 50, 0, 0, 0, 50, 24, 0); blocks[1][5] = new Array( 0, 24, 0, 0, 0, 0, 0, 24, 0); blocks[1][6] = new Array( 0, 24, 0, 0, 0, 0, 0, 24, 0); blocks[1][7] = new Array( 0, 24, 24, 24, 0, 24, 24, 24, 0); blocks[1][8] = new Array( 0, 0, 0, 24, 0, 24, 0, 0, 0); //the 3rd layer blocks[2][0] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[2][1] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[2][2] = new Array( 0, 0, 24, 24, 24, 24, 24, 0, 0); blocks[2][3] = new Array( 0, 0, 24, 0, 0, 0, 24, 0, 0); blocks[2][4] = new Array( 0, 0, 24, 0, 0, 0, 24, 0, 0); blocks[2][5] = new Array( 0, 0, 24, 0, 0, 0, 24, 0, 0); blocks[2][6] = new Array( 0, 0, 24, 24, 24, 24, 24, 0, 0); blocks[2][7] = new Array( 0, 0, 0, 24, 24, 24, 0, 0, 0); blocks[2][8] = new Array( 0, 0, 0, 24, 24, 24, 0, 0, 0); //the 4th layer blocks[3][0] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[3][1] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[3][2] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[3][3] = new Array( 0, 0, 0, 24, 24, 24, 0, 0, 0); blocks[3][4] = new Array( 0, 0, 0, 24, 0, 24, 0, 0, 0); blocks[3][5] = new Array( 0, 0, 0, 24, 24, 24, 0, 0, 0); blocks[3][6] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[3][7] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[3][8] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); //the 5th layer blocks[4][0] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[4][1] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[4][2] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[4][3] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[4][4] = new Array( 0, 0, 0, 0, 24, 0, 0, 0, 0); blocks[4][5] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[4][6] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[4][7] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); blocks[4][8] = new Array( 0, 0, 0, 0, 0, 0, 0, 0, 0); function placeTorch() { if(world.getBlockId(origin.x, origin.y-1, origin.z) != 0) { world.setBlockIdAndMetadata(origin, 50, 5); } else if(world.getBlockId(origin.x-1, origin.y, origin.z) != 0) { world.setBlockIdAndMetadata(origin, 50, 2); } else if(world.getBlockId(origin.x+1, origin.y, origin.z) != 0) { world.setBlockIdAndMetadata(origin, 50, 1); } else if(world.getBlockId(origin.x, origin.y, origin.z-1) != 0) { world.setBlockIdAndMetadata(origin, 50, 4); } else if(world.getBlockId(origin.x, origin.y, origin.z+1) != 0) { world.setBlockIdAndMetadata(origin, 50, 3); } } origin.x -= Math.floor(width/2); origin.z -= Math.floor(length/2); for(var y=0;y<height;y++) { for(var x=0;x<width;x++) { for(var z=0;z<length;z++) { if(!replaceWithAir && world.getBlockId(origin) !=0) { if(blocks[y][x][z] == 50) { placeTorch() } else { world.setBlockId(origin, blocks[y][x][z]); } } else if(replaceWithAir) { if(blocks[y][x][z] == 50) { placeTorch() } else { world.setBlockId(origin, blocks[y][x][z]); } } origin.z++; } origin.z -= length; origin.x++; } origin.x -= width; origin.y++; }
|