Page 1 of 2
tileRandomizer3
Posted: Mon May 06, 2019 8:51 am
by Emral
Ever worked with a tileset that has multiple options for fill tiles or other shenanigans? Don't feel like placing all those SMB2 LEGOs yourself?
Well...
Download:
https://pastebin.com/wX6ipYAA
Screenshot:
tilerandomizer3 is, shockingly, the third edition of this script. I have archived the old version below for those interested, as with the shift to Version 3, the entire script was rewritten.
Example:
Code: Select all
local tr3 = require("tilerandomizer3")
tr3.registerBlockTransformation(
16,
{15, 17},
0.1
)
tr3.registerBgoTransformation(
53,
{54, 55, 56, 57},
0.8
)
tr3.registerBgoTransformation(
53,
{84, 85, 86, 89, 90, 91, 93, 94, 95, 96},
0.3
)
tr3.registerSizableAsBGO(
130,
53
)
Changelog:
- Fixed a bug with the RNG seed
- Now uses a fixed RNG seed by default
- Redesigned all functions to be easier to use and more flexible
-- Can now register different lists of randomizations with different chances more easily
- Added a new randomization step: Transforming a sizable into a grid of BGOs of an ID (32x32 only). That BGO can then be randomized by the BGO Transformation step.
- If customcamera is loaded, it will be compatible
Old post:
https://drive.google.com/file/d/19g-JMP ... sp=sharing
New in v2:
- Can alter the RNG seed from external code
- NEW: Can register BGOs to be replaced by other BGOs
- NEW: Can register Blocks to have randomized BGOs attached (pseudo-bgos, not real bgos) that move with the block and get hidden with it.
- NEW: Can add chance and pivot to all registrations
- Incompatible with v1
A usage example is included:
Code: Select all
local tr2 = require("tileRandomizer2")
-- Sets the RNG seed. Guaranttes that the randomization is consistent across runs. Change number for different seed.
tr2.rng = RNG(12)
-- Registers block 3 to gain BGOs 1 or 37 at a 50% chance. The BGOs are offset by 32 pixels upwards.
-- Also registers block 272 to gain 84 or 85 at 25% chance. While there is no y-offset, the pivot is set so that this coordinate corresponds to the bottom center of the bgo, and that the block fixation point is the top center of the block.
tr2.registerBlockBGOPairs(
{{3}, {1, 37}, {chance = 0.5, yOffset = -32}},
{{272}, {84, 85}, {chance = 0.25, yOffset = 0, blockpivot = vector(0.5, 0), bgopivot=vector(0.5, 1)}}
)
-- Tells block 16 that it can become any block in the list at a 50% chance
-- Also tells block 3 to transform into block 272.
-- Block transformation happens before BGO registration, meaning the new 272 blocks will get pseudo BGOs as per the above registration.
tr2.registerBlockBlockPairs(
{{16}, {602, 603, 1111, 1112, 1113, 1114}, {chance = 0.5}},
{{3}, {272}, {chance = 0.5}}
)
-- BGO 128 may transform into any of the given IDs at a 75% chance. The pivot is set so that the bottom center is kept the same.
tr2.registerBgoBgoPairs(
{{128}, {84, 85, 127}, {chance = 0.75, pivot = vector(0.5, 1)}}
)
The general pattern is:
Code: Select all
registrationCall(
{first registration},
{second registration},
...
)
And each registration is a table like:
Code: Select all
{{list of object ids to apply this to}, {list of target IDs to transform into/spawn}, {settings table for chance, pivot...}}
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Mon May 06, 2019 2:01 pm
by Eri7
Well damn, i didn't believe this was possible but you just made our lives way, way easier, thanks Enjl.
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Mon May 06, 2019 7:45 pm
by Hoeloe
Enjl wrote: ↑Mon May 06, 2019 8:51 am
Seed, you ask? Oh yeah. This library uses a standalone instance of rng.lua to ensure your level doesn't magically look different on repeat playthroughs.
This is unnecessary. The version of RNG.lua that exists in the maglx3 build lets you generate RNG objects for precisely this purpose.
You don't even need to load any libraries, it's just:
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Mon May 06, 2019 7:48 pm
by Emral
Hoeloe wrote: ↑Mon May 06, 2019 7:45 pm
Enjl wrote: ↑Mon May 06, 2019 8:51 am
Seed, you ask? Oh yeah. This library uses a standalone instance of rng.lua to ensure your level doesn't magically look different on repeat playthroughs.
This is unnecessary. The version of RNG.lua that exists in the maglx3 build lets you generate RNG objects for precisely this purpose.
You don't even need to load any libraries, it's just:
Didn't know about that. I presume this returns the rng object and that object can then be used just like the library itself? myRngObject.irandomEntry, for example.
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Mon May 06, 2019 7:49 pm
by Hoeloe
Enjl wrote: ↑Mon May 06, 2019 7:48 pm
Didn't know about that. I presume this returns the rng object and that object can then be used just like the library itself? myRngObject.irandomEntry, for example.
Yep. It's a useful feature.
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Wed May 08, 2019 9:14 am
by Akromaly
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Wed May 08, 2019 1:03 pm
by Eri7
IIRC he did state he likes watching CarlSagan42 who is mario maker focused youtuber.
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Wed May 08, 2019 11:22 pm
by kr4k1n
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Thu May 09, 2019 8:26 am
by Akromaly
Eureka wrote: ↑Wed May 08, 2019 11:22 pm
Don't we all?
definitely lol
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Sun Nov 29, 2020 1:42 pm
by CatgirlCassie
When I try to use this, I get this error, regardless of which tiles I use. Could just be me being a newbie but I have no idea what this means.

Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Tue Dec 22, 2020 12:38 pm
by Shocken Studios
Harmon wrote: ↑Sun Nov 29, 2020 1:42 pm
When I try to use this, I get this error, regardless of which tiles I use. Could just be me being a newbie but I have no idea what this means.
i also get this
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Tue Dec 22, 2020 12:49 pm
by Emral
Shocken Studios wrote: ↑Tue Dec 22, 2020 12:38 pm
Harmon wrote: ↑Sun Nov 29, 2020 1:42 pm
When I try to use this, I get this error, regardless of which tiles I use. Could just be me being a newbie but I have no idea what this means.
i also get this
Did you load the library?
local tileRandomizer = require("tileRandomizer")
Can't use a library that's not loaded!
Re: tileRandomizer.lua - Rudimentary aestheticizer
Posted: Tue Dec 22, 2020 7:39 pm
by CatgirlCassie
Enjl wrote: ↑Tue Dec 22, 2020 12:49 pm
Shocken Studios wrote: ↑Tue Dec 22, 2020 12:38 pm
Harmon wrote: ↑Sun Nov 29, 2020 1:42 pm
When I try to use this, I get this error, regardless of which tiles I use. Could just be me being a newbie but I have no idea what this means.
i also get this
Did you load the library?
local tileRandomizer = require("tileRandomizer")
Can't use a library that's not loaded!
Ah my mistake lmao, works like a charm. Thanks!
Re: tileRandomizer2 by Enjl
Posted: Wed Dec 30, 2020 4:44 am
by Emral
Updated to version 2.0, a rewrite from scratch that I used in Subzero Heroes:
Download:
https://drive.google.com/file/d/19g-JMP ... sp=sharing
Screenshot:
New in v2:
- Can alter the RNG seed from external code
- NEW: Can register BGOs to be replaced by other BGOs
- NEW: Can register Blocks to have randomized BGOs attached (pseudo-bgos, not real bgos) that move with the block and get hidden with it.
- NEW: Can add chance and pivot to all registrations
- Incompatible with v1
For more info see the first post.
Re: tileRandomizer2 by Enjl
Posted: Wed Dec 30, 2020 10:21 am
by Hoeloe
Now make a blue noise version.
Re: tileRandomizer2 by Enjl
Posted: Thu Jan 07, 2021 10:36 am
by Shocken Studios
i've got a problem

Re: tileRandomizer2 by Enjl
Posted: Thu Jan 07, 2021 10:46 am
by Emral
Replace RNG(...) in line 3 with RNG.new(...)
Re: tileRandomizer2 by Enjl
Posted: Thu Jan 07, 2021 12:23 pm
by Shocken Studios
nowthingsgotworse

Re: tileRandomizer2 by Enjl
Posted: Thu Jan 07, 2021 12:36 pm
by Emral
Ugh I forgot to push one change to this when I first uploaded it it seems.
Change all instances of "ls.rng." to "ls.rng:" in the file.
Re: tileRandomizer2 by Enjl
Posted: Thu Jan 07, 2021 2:55 pm
by Shocken Studios
ITKEEPSHAPPENIN
