subota_finished_siege

May 28th, 2022
677
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #castle creating function
2. #mimnum length of the walls is 20. if the walls are shorter the stairs won't be generated correctly
3. #the length of the walls has to be EVEN or the corners won't be generated correctly
4. #recommended wall heigh is 4. Only then the creepers can get activated and explode
5. def castleBuilder(wallLength, wallHeight):
6.     wallLengthCopy = wallLength / 2
7.     builder.teleport_to(pos(-5, 0, 5))
8.     builder.set_origin()
9.     builder.mark()
10.     i = 0
11.     #the loop creating 3 layer wall around the player
12.     while i < 3:
13.         j = 0
14.         while j < 4:
15.             builder.move(FORWARD, wallLength)
16.             builder.raise_wall(MOSSY_STONE_BRICKS, wallHeight)
17.             builder.turn(RIGHT_TURN)
18.             j += 1
19.         wallLength += -2
20.         builder.move(RIGHT, 1)
21.         builder.move(FORWARD, 1)
22.         builder.mark()
23.         i += 1
24.     builder.move(UP, wallHeight - 1)
25.     builder.face(WEST)
26.     builder.move(BACK, 15)
27.     builder.mark()
28.     i = 0
29.     #the loop creating stairs
30.     while i < wallHeight - 1:
31.         builder.shift(1, -1, 0)
32.         builder.line(STONE_BRICK_STAIRS)
33.         i += 1
34.     builder.teleport_to_origin()
35.     builder.move(UP, wallHeight)
36.     builder.face(NORTH)
37.     builder.mark()
38.     i = 0
39.     #the loop creating corners
40.     while i < 4:
41.         j = 0
42.         while j < wallLengthCopy:
43.             builder.place(SEA_LANTERN)
44.             builder.move(FORWARD, 2)
45.             j += 1
46.         builder.turn(RIGHT_TURN)
47.         i += 1
48. player.on_chat("castle", castleBuilder)
49.
50. def inventory():
51.     #creating the array according to the template, specyfying what we want to get and how many units
53.     #the loop giving the items to the player. step of 2
54.     for i in range(0,len(itemsArray),2):
55.         #adding the items, getting data from the array
56.         mobs.give(mobs.target(NEAREST_PLAYER), itemsArray[i], itemsArray[i+1])
57.
58. player.on_chat("inventory", inventory)
59.
61. def horseSpawn():
62.     mobs.spawn(HORSE, pos(1, 0, 0))
65.     #horse armour
66.     mobs.give(mobs.target(NEAREST_PLAYER), IRON_HORSE_ARMOR, 1)
67. player.on_chat("horse", horseSpawn)
68.
69. def enchantedBow():
70.     #maximum damage
71.     mobs.enchant(mobs.target(NEAREST_PLAYER), "Power", 5)
72.     #fire arrows
73.     mobs.enchant(mobs.target(NEAREST_PLAYER), "Flame", 1)
74. player.on_chat("bow", enchantedBow)
75.