tileRandomizer2 by Enjl

Share and discuss custom LunaLua code and content packs for SMBX2.
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9129
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

tileRandomizer2 by Enjl

Postby Enjl » Mon May 06, 2019 8:51 am

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://drive.google.com/file/d/19g-JMP ... sp=sharing

Screenshot:
Spoiler: show
Image
Image
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:
Spoiler: show

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...}}
Last edited by Enjl on Wed Dec 30, 2020 4:44 am, edited 2 times in total.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC

User avatar
Eri7
Banned
Posts: 1770
Joined: Sat Jan 28, 2017 4:48 pm
Flair: Good Foundation allows for strong Execution
Contact:

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby Eri7 » Mon May 06, 2019 2:01 pm

Well damn, i didn't believe this was possible but you just made our lives way, way easier, thanks Enjl.

User avatar
Hoeloe
Boomerang Bro
Boomerang Bro
Posts: 1357
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby Hoeloe » 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:

Code: Select all

RNG.new(seed)

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9129
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby Enjl » Mon May 06, 2019 7:48 pm

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:

Code: Select all

RNG.new(seed)
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.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC

User avatar
Hoeloe
Boomerang Bro
Boomerang Bro
Posts: 1357
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby Hoeloe » Mon May 06, 2019 7:49 pm

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.

User avatar
AndrewPixel
Bronze Yoshi Egg
Bronze Yoshi Egg
Posts: 416
Joined: Sun Mar 12, 2017 8:07 am
Contact:

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby AndrewPixel » Wed May 08, 2019 9:14 am

Image
ImageImage

User avatar
Eri7
Banned
Posts: 1770
Joined: Sat Jan 28, 2017 4:48 pm
Flair: Good Foundation allows for strong Execution
Contact:

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby Eri7 » Wed May 08, 2019 1:03 pm

AndrewPixel wrote:
Wed May 08, 2019 9:14 am
Image
IIRC he did state he likes watching CarlSagan42 who is mario maker focused youtuber.

User avatar
Rhosty
Birdo
Birdo
Posts: 2710
Joined: Sun Dec 11, 2016 8:02 pm
Flair: haha koopa shell go bonk
Pronouns: she/her/hers
Contact:

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby Rhosty » Wed May 08, 2019 11:22 pm

AndrewPixel wrote:
Wed May 08, 2019 9:14 am
Image
Don't we all?
Image
Spoiler: show
ImageI have a splatoon fanfic up if you want to check that out, it's not dead, I want to wait and see what Splatoon 3 is like so I can turn this into a Splatoon 3 fanfic.
My Switch friend code: SW-1004-3051-8456 (If you do decide to add me on Switch, pls pm me beforehand, I'll probably end up removing you on accident if I'm unaware of how you got my code)
selective mutism is a nuisance
Image

Image(YT, not dead, just haven't had the time to upload content)

User avatar
AndrewPixel
Bronze Yoshi Egg
Bronze Yoshi Egg
Posts: 416
Joined: Sun Mar 12, 2017 8:07 am
Contact:

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby AndrewPixel » Thu May 09, 2019 8:26 am

Eureka wrote:
Wed May 08, 2019 11:22 pm
AndrewPixel wrote:
Wed May 08, 2019 9:14 am
Image
Don't we all?
definitely lol
ImageImage

User avatar
Harmon
Shy Guy
Shy Guy
Posts: 7
Joined: Wed Nov 25, 2020 8:42 am
Flair: Wahoo
Pronouns: he/him
Contact:

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby Harmon » 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.

Image
signature
Don't use the email attached to my account to contact me.

User avatar
Shocken Studios
Rex
Rex
Posts: 32
Joined: Fri Jul 19, 2019 6:02 pm
Flair: Hi

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby Shocken Studios » 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.

Image
i also get this

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9129
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby Enjl » 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.

Image
i also get this
Did you load the library?
local tileRandomizer = require("tileRandomizer")

Can't use a library that's not loaded!
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC

User avatar
Harmon
Shy Guy
Shy Guy
Posts: 7
Joined: Wed Nov 25, 2020 8:42 am
Flair: Wahoo
Pronouns: he/him
Contact:

Re: tileRandomizer.lua - Rudimentary aestheticizer

Postby Harmon » Tue Dec 22, 2020 7:39 pm

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.

Image
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!
signature
Don't use the email attached to my account to contact me.

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9129
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: tileRandomizer2 by Enjl

Postby Enjl » Wed Dec 30, 2020 4:44 am

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:
Spoiler: show
Image
Image
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.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC

User avatar
Hoeloe
Boomerang Bro
Boomerang Bro
Posts: 1357
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: tileRandomizer2 by Enjl

Postby Hoeloe » Wed Dec 30, 2020 10:21 am

Now make a blue noise version.

User avatar
Shocken Studios
Rex
Rex
Posts: 32
Joined: Fri Jul 19, 2019 6:02 pm
Flair: Hi

Re: tileRandomizer2 by Enjl

Postby Shocken Studios » Thu Jan 07, 2021 10:36 am

i've got a problem
Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9129
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: tileRandomizer2 by Enjl

Postby Enjl » Thu Jan 07, 2021 10:46 am

Shocken Studios wrote:
Thu Jan 07, 2021 10:36 am
i've got a problem
Image
Replace RNG(...) in line 3 with RNG.new(...)
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC

User avatar
Shocken Studios
Rex
Rex
Posts: 32
Joined: Fri Jul 19, 2019 6:02 pm
Flair: Hi

Re: tileRandomizer2 by Enjl

Postby Shocken Studios » Thu Jan 07, 2021 12:23 pm

nowthingsgotworse
Image

Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9129
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: tileRandomizer2 by Enjl

Postby Enjl » Thu Jan 07, 2021 12:36 pm

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.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

Mirror of all my content and collaborations on IPFS: QmZKzVJAsD6dE2tTHEb58XEmsNLzrW2MVsTtW7HWLAAcCC

User avatar
Shocken Studios
Rex
Rex
Posts: 32
Joined: Fri Jul 19, 2019 6:02 pm
Flair: Hi

Re: tileRandomizer2 by Enjl

Postby Shocken Studios » Thu Jan 07, 2021 2:55 pm

ITKEEPSHAPPENIN
Image


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 3 guests