Blockland

Blockland

41 ratings
Creating Random Events!
By Zadeon
Now that you've maybe got some of eventing down, read this guide to learn how to make random events with only default bricks!
2
   
Award
Favorite
Favorited
Unfavorite
Getting Started
This guide requires you to have a general knowledge of Blockland's eventing system.

First, we need to create the build or "device" required to create the "randomness" of the events. We have to build this because there is no default "random" event. Create a build as shown:
The colors do not have to be the same, they are just there to help distinguish the bricks. Also, making the top grey piece float is an invisible red brick. BE SURE THIS BRICK'S RAYCASTING IS OFF OR THIS WILL NOT WORK! To turn off raycasting use your wrench on the brick and check the box by raycasting. You can also check rendering and collision too.
First Events
Next, give the top grey brick a name. I named mine "Fire" since it will be firing a projectile. After you do that, create a brick that will be a button the player will click. Give this button a name, I named mine "Button." Give it these events as shown:

In case you don't know what each action does I'll go through it:
  • Input Event: OnActivate: This calls the event when you click the brick.
  • Target: NAMEBRICK: Fire: This targets the named brick "Fire."
  • OutputEvent: spawnprojectile: What will happen to the targeted brick. In this case it will fire a projectile with a velocity of 50 aimed down.
Getting Random with it.
Now you may be wondering, "how is this random?" Well, because of the "fire" brick's size, the projectile will spawn off of it at a random location on it. When the event is called, the brick will fire a projectile from a random point on the brick every time. This is what gives us our random quality.

After completing the events for the button, you can start adding what you want to happen differently to each of the colored bricks that will be hit by the projectile. Since there are four different bricks the projectile could hit in our model, there is a 1/4th chance of each brick being hit. An example of an event for a brick could be this:

The second line is purely for projectiles that don't delete themselves when they hit something (i.e. pong, pinball, horseray. Since we are using gun bullet this isn't required).

Now you could add anything to the other three bricks for something to happen when you click the button. Go crazy!
Advance Events
Now, say, you were making a bot or screen to say something different each time you clicked it. Since the onprojectilehit event itself can't target some things like clients (a single player), we have to work around this to accomplish our desired output.

First, go back to your button brick and give it these events (you can put whatever you want into the text boxes):
The default color for text that appears on-screen is red. Using <color:######>, we can use hex color values to chance the color of the text. FFFFFF is white in this case.

Now, see those check boxes to the far left of each event? Be sure they are all unchecked except for one. DON'T uncheck the first event though. These little check boxes can make events "on or off." Now, go back to each of your colored bricks that are hit by the projectile. In each one, remove the old events and give them this:
The seteventenabled output simply enables or disables events, like checking the box to turn it on or off. To set whether an event is turned on or off, you must either check or uncheck the box beside the text box to enter numbers. When this brick is hit by the projectile, it will "turn off" events 2, 3, and 4 and "turn on" event 1 (event lines start at 0, since our starting event on the button is the spawnprojectile we do not want to mess with it). On the next brick that can be hit with the projectile, give it these events:
The difference with these events is that it will "turn off" events 1, 3, and 4 and "turn on" event 2. On the two other bricks, give them the same lines but with edited values to turn on event 3 or turn on event 4 (BE SURE YOU PUT SPACES BETWEEN EACH NUMBER, THAT IS HOW IT DISTINGUISHES EVENTS FROM EACH OTHER!). Remember, with seteventenabled, it will enable or disable events no matter it's previous state.

With these events, you should have a working button that changes what it displays to a random message with each click. Note that it will change the outcome of the NEXT click, not the current click (though you will still have a random effect).
Closing Thoughts
I hope this guide helps you find out new and wacky events to create. Using this method, you can create tons of randomizing effects! This could include: a race track that changes itself every time the minigame resets, dice that actually change the sides of the faces to represent what number came up, or maybe a random weapon dispenser! Also, you can have as many outputs as you want! Take this build for example:
With 16 different bricks that can be hit, more events can happen! Go wild with your imagination!

One last note: be sure to put the bricks (but not the button/activator) outside of your build so that other players can't mess with it.
26 Comments
Yurt 3 Sep, 2021 @ 1:17pm 
@Cxero "If you don't know now you never will" was a popular catchphrase in this game about 10 years ago
Cxero #StopKillingGames 20 Jul, 2021 @ 1:41pm 
"it's not that difficult to figure out," says the man with thousands of hours of blockland experience. no doubt you've all but forgotten your noob days... no wonder this game died, the community is toxic as hell
Steee 27 Jul, 2016 @ 8:11am 
It's not like it's difficult to figure out.
Zadeon  [author] 27 Jul, 2016 @ 7:49am 
What is there a problem with that? Not many people know about this trick you can do with events to make them randomized.
Steee 27 Jul, 2016 @ 6:59am 
Fucking hell, now there's scripting-esque guides on how to event. Smh
Snepderg 11 Sep, 2015 @ 7:59pm 
ah thank you. the final screenshot is misleading.
Zadeon  [author] 9 Sep, 2015 @ 7:21pm 
Try it in a long line with a 1x12 plate with 1x1 plates below for each "side" of the dice.
Snepderg 9 Sep, 2015 @ 4:29pm 
EDIT: Sorry i figured out that it only fires half way between my 1st row and 2nd row. So that would mean the one in the last screenshot wouldnt work
Snepderg 9 Sep, 2015 @ 4:21pm 
EDIT: It is sort of working. it is only giving me 2 4 and 12.
Snepderg 9 Sep, 2015 @ 3:59pm 
I tried this and it didnt work. It just kept spitting out all my outputs at once. (im making a dice so there are 12)