Connected Structures (Dungeons)

Started by blackman43 on

Topic category: Help with MCreator software

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Connected Structures (Dungeons)
Thu, 10/24/2019 - 23:02 (edited)

In mods such as Roguelike Dungeons, there are structures which would spawn on the surface and have a staircase somewhere in them which would lead down to a dungeon, how could I go about doing this? I've followed tutorials and learned the basics of creating / spawning in structures for dungeons but I'm just wondering how I could make it so there would be a structure on the ground surface (i.e a house or a tower or something) which would be able to lead to a dungeon in the underground.

Also, I'd like to know how to make dungeons themselves connected, I want to have rooms that are empty, some have a mob spawner, and some have a chest. How would I go about implementing this so that way there is a mix of empty rooms and rooms w/ things in them? (aka a normal dungeon in basically any game) Thanks for your time.

Edited by blackman43 on Thu, 10/24/2019 - 23:02
Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you i've watched that…
Fri, 10/25/2019 - 10:57

Thank you i've watched that video already. I understand that the procedure generates 3 rooms, how would I go about making it so that 2 of the rooms are significantly more likely than the 3rd? My goal is to make it so 2 of the rooms are just rooms while another is a room with a chest, but I don't want the chest room to be as common as the blank rooms, but I still want to make sure that each dungeon has at least 1 everytime it generates.

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So in the If statement, with…
Fri, 10/25/2019 - 11:31

So in the If statement, with 3 options:

if Rand < 0.33

else if Rand < 0.67

else

So this would give every room a 33% chance. You can simply change the proportions to make certain rooms more rare:

if Rand < 0.06

else if Rand < 0.53

else

Which would give the first one a 6% chance, and the other 2 a 47% chance. etc.

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for telling me that,…
Fri, 10/25/2019 - 20:35

Thanks for telling me that, but if the statement is 
if Rand < 0.33
else if Rand < 0.67
else
Then what is the and this gives each room a 33% chance, then what is the "else if Rand < 0.67" assigned to? Like where is that 0.67 going?

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry i meant and this gives…
Fri, 10/25/2019 - 20:36

Sorry i meant and this gives each room a 33% chance, then what is the "else if Rand < 0.67" assigned to? Like where is that 0.67 going?

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you divide 1 by 3 (3…
Fri, 10/25/2019 - 21:06

If you divide 1 by 3 (3 because we have 3 options), you will get 0.3333333 (infinitely)

simply for each test, check for that amount + 1* that amount:

In case of 3 options: (Everything having a 1/3rd of a chance)

if Rand < 1/3*1 (which is the 0.333333333333)

else if Rand < 1/3*2 (which is the 0.66666666666)

else (Which would by 1/3*3 so basically 1)

In case of 5 things: (Everything having a 20% chance)

if Rand < 1/5*1 (being 0.2)

else if Rand < 1/5*2 (being 0.4)

else if Rand < 1/5*3 (being 0.6)

else if Rand < 1/5*4 (being 0.8)

else (being 1/5*5 = 1)

 

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Since random is a number…
Fri, 10/25/2019 - 21:12

Since random is a number between 0 and 1, we know that the number isn't 0.33 or below if we get to the 0.67 else if statement. At this point we check whether random was between 0.33 and 0.67 which is 1 third of 1, thus a 33% chance.

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I noticed in your procedure…
Fri, 10/25/2019 - 21:13

I noticed in your procedure for 3 rooms in a dungeon, you only have 2 instances of "Get Local", by this i mean the code looks like

if Get Local: Rand < 0.33

do  Place at x:

else if Get Local: Rand < 0.67

do Place at x:

else Place at x:

So if I wanted to have 4 rooms (with 1 being pretty rare compared to others since its a loot room) what would the code look like?

 

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Let's say we want 1 special…
Fri, 10/25/2019 - 22:41

Let's say we want 1 special room to have a 7% chance of spawning. That means we subtract 0.06 from 1 = 0.93. The 0.93 we equally divide over the other 3 rooms, thus 0.93/3 = 0.31 for each other room. Thus:

if Rand < 0.31 //(0.31*1)

else if Rand < 0.62 //(0.31*2)

else if Rand < 0.93 //(0.31*3)

else //(the last 0.07, thus 7%)

 

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
*That means we subtract 0.06…
Fri, 10/25/2019 - 22:41

*That means we subtract 0.06 = That means we subtract 0.07. Correction.

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks so much for your help…
Fri, 10/25/2019 - 23:42

Thanks so much for your help and explaining why these things do what they do. Do you know how I could go about setting up an above ground structure with a staircase which would lead to a dungeon?

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In the tutorial video about…
Sat, 10/26/2019 - 01:06

In the tutorial video about structures, you can see that the Y value is mostly left alone in section 1. You can use that y value to create both a staircase AND create vertical dungeons too.

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for your help so far…
Sat, 10/26/2019 - 13:58

Thanks for your help so far but I do have one question.

Why is it that in your original dungeon procedure, you have one structure attached to the if statement "Get Local Rand < 0.33" yet you have two set to else if "Get Local Rand < 0.67"?

If I want to add this separate chest room, would I need to create a new else if statement?

Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
** So far my code looks like…
Sat, 10/26/2019 - 14:01

** So far my code looks like this:

if Get Local Rand < 0.31

do (place structure room1)

else if Get Local Rand < 0.62

do (room2)
else if Get Local Rand < 0.93 

do (room3)

else (chestroom1)

Im trying to make the chestroom have a 7% chance of spawning, so is this correct?