TeachCraft Lesson 8

Code-Magic Combos

We can also use chat messages to change the action on our bow/arrow or sword!

We can type messages into chat to activate different spells on our arrow. Check out the example on the right, which supports toggling between spells "gold" and "teleport". Run the script, and type either "gold" or "teleport" into chat and then shoot an arrow!

Your Challenge: Create your own superpowers

Your Challenge: Using the concepts from this lesson, craft your own superhero! Add your own powers set of magic powered by python code, and do battle in our PVP worlds with friends!

Ideas:

Booby Traps

Triggered via sword: Spawn TNT, and under the TNT a redstone block. Three second delayed explosion!

Triggered via sword: Spawn a pressure pad, and under the pressure pad a sand block, and under the sand a TNT block, and under the TNT 50 blocks of air. When something walks on the pressure pad, they will fall to their death!

Triggered via sword: Build a wall of bedrock, 3 blocks high and 20 blocks wide to slow down anyone chasing you

Make it so if you type "f" into chat, your code will assume you are falling and will spawn water 10 blocks under you to catch you unharmed

If you type "shield" into chat, make a bedrock shield appear around you which disappears after 5 seconds (being turned back into air)

Just for fun

Make it so right clicking with your sword turns on/off a trail of blocks that constantly spawns under you, following you. Make it so the block ID used for the trail can be changed dynamically by you typing it into chat! Great for flowers, lava, gold, etc.