PDA

View Full Version : [Script] The Blocks Builder



LJ Sonic
April 30th, 2014, 11:47
This is the script used by the Blocks Builder.
If you don't know what it is, you can read the original thread: http://srb2skybase.org/mb/showthread.php?t=2251&p=27631#post27631

You are free to use and even modify it in your own mods.

The Blocks Builder itself is basically a thinker that you activate on level load that will act on a group of FOFs depending on player's actions.
Here we'll try making a 4 * 4 * 4 Blocks Builder.

You have first to create a map where you create a in-level grid where every sector has a different tag:
6791
Numbers are the sector tags. Of course your grid may be bigger, and you may start with another tag, as long as the order is the same.
Note that every sector geometry should be identical, and should be a square.

You have now to create a FOF for each potential block.
You can know how many FOF you'll have to make using this expression:

n = x * y * z * types

where n is the number of FOFs, x-y-z the dimensions of the building slot (ex: 16*16*16 blocks), and types how many different kinds of blocks the player will be able to place. n cannot exeed 32768.

The tags given to the control sectors are irrevelant (at least it is for this script), however there is something very important: the tags of the lines and the indexes of the sectors have to be increased by 1 for each new FOF, the tag starting from the top-left sector tag on the previous grid, and coming back to this value every time it reaches the bottom-right sector tag on the grid.
Sorry if it's not very easy to understand, I'll still try to give you an example:
6790
Here the lines are tagged from 1 to 64, since our grid had 4 * 4 * 4 = 64 blocks, and their indexes numbers are raising from left to right.
Note: as you need many control sectors, it is preferable to create unclosed sectors, with only one line per sector.

Once you made that, just copy-paste the sectors (use Sectors Mode) as until you have a group of line for each kind of block. Don't change their tags, just change their apparence / effect.

Now you just have to create a double-sided linedef executor "BLOCKSBUILDERTHINKER" called on level load. Refer to the header of the script to know how to setup the Blocks Builder thinker.

If you need more examples, you could check the maps from the official Blocks Builder.

Phantom-Blade
April 30th, 2014, 19:08
I might try this out later.

LJ Sonic
May 1st, 2014, 18:12
I'd just like to say that this mod is a script and doesn't feature any map (it's a *.lua file).

Sky
May 1st, 2014, 19:56
It might be a good idea to provide an example map along with the script.

LJ Sonic
May 2nd, 2014, 09:35
You're right, I think I'll do that today.
But I still think it would be more appropriate to move this to Miscellaneous, since the (coming) sample map won't be the point of this thread.