Making a vehicle move

77 views
Skip to first unread message

Alexander Pruss

unread,
Jun 20, 2015, 11:02:34 PM6/20/15
to adventures-in-...@googlegroups.com
I want to show the kids whom I will be teaching in next week's minicourse some cool things that can be done with python scripts that can't be done with command blocks. I want some of the things to be stuff that they could and will do themselves -- like the magic bridge -- but I also want to show them some things that will go beyond what they do in the minicourse in order to motivate them to go on.

To that end, I made a moderately complex script to animate any vehicle. The idea is that you stand or fly on, in or near (within five blocks) a vehicle (say, a boat or a car or a plane) you've built in Minecraft. "Vehicle" is pretty loose here. It could be a house in a village, a tree or a big statue. (It's basically defined as a largest connected set of blocks, within a certain limit, and excluding "terrain" blocks like air, water, grass, etc. Diagonal connections are allowed. There is a fairly generous size limit, and it grabs the closest vehicle to you within five units.)  

Then you run vehicle.py, and it makes that object into a moving vehicle that comes along with you -- sort of like the moving bridge, but on a larger scale. It'll be slow if the object is large, but it works well enough for objects about the size of houses in auto-generated villages (full disclosure: I am using PyPy).

By default, the vehicle is super-powerful: it plows a hole through whatever you take it through. You can give an 'n' (for non-destructive) argument to the script to make the vehicle restore behind itself whatever it went through, and a 'b' to make a bubble of air around you.

Building a script like this would be a nice way to introduce sets and dictionaries. There is a fair amount of careful code using sets and dictionaries designed to optimize the animation.

Some blocks, like doors and signs aren't supported for movement and non-destruction.

In theory, the script should run with Juice, the PI, Jam PE, and Jam, but I've only tested with Jam. Running with the 0.30 version of Jam (and using my latest mcpi/* code), some tile entities, such as loaded chests, can be put in a vehicle, and can survive being run over in non-destructive mode. 


Alexander Pruss

unread,
Jun 20, 2015, 11:02:53 PM6/20/15
to adventures-in-...@googlegroups.com

Derek F-C

unread,
Jun 21, 2015, 5:04:20 AM6/21/15
to adventures-in-...@googlegroups.com
Hi Alexander, this is awesome and exciting work.  I'd love to demo your script as well for a very similar purpose in the next couple of weeks.  

I am trying to stick to the Adventures in Minecraft basic setup with Bukkit / Juice, MC 1.6.4, Python 2.7.6 as provided in their downloadable setup environment.  
I tried to use your file, but was getting a series of errors.

Any suggestions for using your script in their suggested environment?  Sorry, I'm a bit of a noob trying to show some kids what is possible at a mini-course, and your work seemed perfect.   
Perhaps I'm having issues as your work is primarily set up for Jam (as opposed to Juice?)?  There are lots of moving pieces, on all of which I'm a bit of a novice...

Many thanks in advance for any suggestions you might be able to share, and for all your efforts.  Best, Derek

 

Alexander Pruss

unread,
Jun 21, 2015, 4:37:41 PM6/21/15
to adventures-in-...@googlegroups.com
Email me the error messages (arpruss at gmail dot com). I tried to make it compatible, but may have left something out.

Alexander Pruss

unread,
Jun 21, 2015, 4:49:19 PM6/21/15
to adventures-in-...@googlegroups.com
Do you have the updated support files from my mcpi folder (and the mc.py convenience file)? I suggest just grabbing all of the python2-scripts.zip from my latest release.

Also, you need to make sure that you have a version of Raspberry Juice that supports player.getRotation(). Otherwise, you'll have to replace mc.player.getRotation() with 0 in the script, and your vehicles won't rotate.

Alexander Pruss

unread,
Jun 22, 2015, 8:39:08 PM6/22/15
to adventures-in-...@googlegroups.com
I used vehicle.py in class today as an example of something the kids would be able to do in the future if they stick with coding past my mini-class. I think it worked quite well as a demo for that purpose.
Reply all
Reply to author
Forward
0 new messages