Jump to content
Animebryan

Script for Random Generating Dungeons

Recommended Posts

I am not sure what the first one is about, but the other two are because of traps... I forgot to include some code for them. Ooopsie :3

Share this post


Link to post
Share on other sites

the first one happens when in the editor i try to click on the map named  dummy map 

Share this post


Link to post
Share on other sites

Oh right... I forgot to add the empty tilemap dummy map uses... dummy map is empty BTW. It's just needed to make sure the maps are reloaded when changing floors. Anyway, I uploaded a new fixed version on the blog post. :3

Share this post


Link to post
Share on other sites

thank you for that :) ima bit busy with house chores ,lol(read that as its dinner time and its my turn to cook ,lmao ) ill have to look at it later tonight ,again thank you :) 

Share this post


Link to post
Share on other sites

I am happy to help! :D

*sprinkles fairy dust on you*

Share this post


Link to post
Share on other sites

I've figured out how to do a 2 tile high wall in the vanilla version of this script (found at http://petitrare.com/blog/) by modifying the section stating at line 528:

def put_wall_tiles
    for y in (1..@map.height).to_a.reverse
      for x in 0..@map.width
        next unless  floor?(x, y)
        next if floor?(x, y-1)
        @map.data[x, y-1, 0] = @wall_chip_id + 15
      end
    end
    
    for y in (1..@map.height).to_a.reverse
      for x in 0..@map.width
        tile = @map.data[x, y, 0]
        next unless tile == @wall_chip_id + 15
        if floor?(x, y-1)
          put_object_tile(x, y)
          next
        end
        if floor?(x-1, y) || blank?(x-1, y)
          if floor?(x+1, y) || blank?(x+1, y)
            @map.data[x, y, 0] = @wall_chip_id + 15      # Bottom Narrow Wall Tile
            @map.data[x, y-1, 0] = @wall_chip_id + 5     # Upper Narrow Wall Tile
          else
            @map.data[x, y, 0] = @wall_chip_id + 11      # Bottom Left Wall Edge
            @map.data[x, y-1, 0] = @wall_chip_id + 1     # Upper Left Wall Edge
          end
        else
          if floor?(x+1, y) || blank?(x+1, y)
            @map.data[x, y, 0] = @wall_chip_id + 14      # Bottom Right Wall Edge
            @map.data[x, y-1, 0] = @wall_chip_id + 4     # Upper Right Wall Edge
          else
            @map.data[x, y, 0] = @wall_chip_id + 10 # Bottom Middle Wall Tile
            @map.data[x, y-1, 0] = @wall_chip_id + 0 # Upper Middle Wall Tile
          end
        end
      end
    end
  end

Don't if this can be used in KilloZapit's version. I've noticed the modified version is made from version 14 and the latest original version is 18 currently. Is the modified version kept up to date with the original?

 

I also added a def for an entrance that is set at the players starting position of the generated map  event.moveto($game_player.x, $game_player.y) . don't know how to set it to have a second floor entrance linked to the correct player transfer point on floor 1 (the floor 1 exit). Of course this is assuming the random map is being cached.

Share this post


Link to post
Share on other sites

I think the problem with two tile high walls in my version is that I have so many odd things like my cave scripts and pillars, and stuff that might break. I guess I will give it a try some time though. I just don't know if I can make sure walls are always two tiles high and don't ever cut something off

Edited by KilloZapit

Share this post


Link to post
Share on other sites

Fix what? Autotiles? Did you ever try my version at all? It has proper autotiles while the orginal only has fake crappy autotiles that only work properly for walls. It actualy makes a huge diffrence in the detials you can do if you look at my example dungeons in my demo :3

Share this post


Link to post
Share on other sites

Fix what? Autotiles? Did you ever try my version at all? It has proper autotiles while the orginal only has fake crappy autotiles that only work properly for walls. It actualy makes a huge diffrence in the detials you can do if you look at my example dungeons in my demo :3

So you mean your version can use auto-tiles properly? Like the Red Carpet auto-tile? Can it generate a dungeon with no walls or ceiling tiles? (just floor tiles). No more walking through walls or on top of ceilings anymore?

Edited by Animebryan

Share this post


Link to post
Share on other sites

Yeah, I pretty much totally rewrote a lot of the terrain placement and made a general autotile script that works with every autotile. I also allow maps without walls of any kind and some more special tweaks. Hehe you may want to take a look at some of my demo maps, like the swamp map and the lost fragments map especially if you want to see maps without walls. Also added weird stuff like cave cellular automata for some more dungeon styles.

Share this post


Link to post
Share on other sites

I've tried it & I got to say, I'm pretty impressed. Works a lot better than the older version. But I do have a few problems with it.

 

#1 - I'm having a problem with the 1st map I set up with this. I have a dungeon that changes it's theme every 10 floors. So I have a 'Map A' & a 'Map B' for each theme. I've made a few themes but the Map A of my 1st theme keeps generating these black squares. I haven't left any blank spots in the rows at all (even the object tile is just a floor tile) & both my

Map A & Map B are set up the exact same way yet only the Map A does this. No other map acts like this.

 

#2 - Walls aren't 2 tiles high. Is there any way to set the wall height to 2 tiles?

 

#3 - Chests aren't opening & staying open. You still hear it open & get the item but it never visually opens & you can get infinite items from a single chest. I need to have full control of the chests. Any way to disable the disappearing chest option?

 

#4 - Your document on how to use these scripts wasn't very thorough. It left out the :float_edge option which is necessary to make dungeons without walls, like your Lost Fragments dungeon. Any other options that were left out?

 

I'm planning on making a World Map theme too so I'll test that out to see if it's possible with this script.

 

 

Share this post


Link to post
Share on other sites

I fixed the black squares problem. It seems the script is adding a alt. floor tile even though I didn't put one. I fixed it by adding another floor tile (same one) as an alt. floor tile & it fixed it. There is also an issue with chests & enemies bunching together in small rooms which is BS concidering that my maps keep generating these HUGE rooms with hardly anything in them (it generating rooms that can be measured by screens, 2 screens x 3 screens, etc.)

 

I'm trying to make a world map theme & tried to mix various terrains together but it looked ugly so I'll be making multiple 'world map' themed maps, each one a different theme, like grass & forests, mountains, desert w/cactuses, beach (sand & water w/palm trees), snow fields & even volcanic areas. I'm looking forward to fully utilizing this script but I need you to fix some of those other problems like 2 tile high walls & giving the script user control of chests.

 

Edit: Completely forgot about a script compatibility issue I'm having. I'm using a Custom Damage Floors script which allows me to set custom damage rate for different damage floors, such as; 10 damage for swamps, 30 damage for spikes & 50 damage for lava. It uses region IDs to label the damage floor (damage floor tag still has to be used) & in the script you specify the Map IDs & the Region IDs followed by the damage amount. But when I label damage floors in a random generated dungeon it just give the default damage of 10. I tried it in a normal map & the script functions perfectly, but in a generated dungeon it won't work. I'll post the script here so you can look at it & compare it to your scripts so you can make a compatibility patch. Also, I'm not using every script you had in the demo, just these;

Note field hash

Dungeon Generation

Cave Generation

Autotile Update

Dungeon terrain

Dungeon events

Dungeon Details

dungeon exit paths

event scripts

 

Here's the script:

 

 

#*******************************************************************************
#
# Simple Customizable Damage Floor Script by Fielleux 
#
#*******************************************************************************
# August 14, 2013 => Initial release
#*******************************************************************************
# // Terms Of Use \\
#
# @Free to use for any game, commercial and non-commercial alike
# @For bug fixes post at http://www.rpgmakervxace.net/, will do my best but 
#  can't guarantee anything
# @Won't do compatibility fixes, simply because I'm currently not good enough
# @Please do not delete the header
# @Give credit to Fielleux in your project
#*******************************************************************************
# // Description \\
#
# This allows you to set custom damage to your damage floors so that lava will 
# hurt more than spikes.
#*******************************************************************************
# // Instructions \\
#
# In the editable section you add a line for each region you want to set up.
#You have to use this pattern 
#                [map_id, region_id] => damage
# — map_id being the ID of the map where your damage floor is
# — region_id being the number you tagged your tiles with
# — damage being the damage you want to set for those tiles
#
# For example with [1, 2] => 20 you will inflict 20 HP damage to the party if 
#they walk on region 2 on map 1
#*******************************************************************************
# // Importants Notes For Compatibility Issues \\
#
# This script :
# 		** uses one new module — FLX::DMG_FLR
# 	        ** modifies two classes — Game_Actor & Game_Player
# 		** aliases one method — basic_floor_damage
# 		** overwrites three methods — check_floor_effect ; execute_floor_damage & on_damage_floor?
#*******************************************************************************

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# // Begining of the editable section \\
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

module FLX
  module DMG_FLR
    Floor_damages = { #Do NOT delete
    # You can start writing here, don't forget to use the pattern shown in the
    # Instructions. /!\ If you have multiple lines don't forget to add comas 
    # at the end of each line (except for the last line)
    [:map_id1, :region_id1] => :damage1 ,
    [:map_id2, :region_id2] => :damage2
    } #Do NOT delete
  end
end

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# // End of the safe zone \\
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

class Game_Actor < Game_Battler
  alias flx_basic_floor_damage basic_floor_damage
  
  def check_floor_effect
    @damage_floor_test = $game_player.on_damage_floor?
    execute_floor_damage(@damage_floor_test[1], @damage_floor_test[2]) if @damage_floor_test != false
  end
  
  def execute_floor_damage(map_id, region_id)
    damage = (basic_floor_damage(map_id, region_id) * fdr).to_i
    self.hp -= [damage, max_floor_damage].min
    perform_map_damage_effect if damage > 0
  end
  
  def basic_floor_damage(map_id, region_id)
    floor_damage = FLX::DMG_FLR::Floor_damages[[map_id, region_id]]
    return floor_damage if floor_damage
    flx_basic_floor_damage
  end
end

class Game_Player < Game_Character
  def on_damage_floor?
    return [true, $game_map.map_id, $game_map.region_id(@x, @y)] if $game_map.damage_floor?(@x, @y) && !in_airship?
    return false
  end
end 

 

 

Edited by Animebryan

Share this post


Link to post
Share on other sites

Were you using the blank tile or just the transparent tile for alt floors? There is a difference and I don't think you can't select the blank tiles from the tile selection unfortunately, but you can copy it from the blank areas of the map. I would suggest you make a copy of the a5 dungeon graphic and fill in the blank tile there so you can see the difference. I could possibly add an exception for that tile but I really don't want to, in case people use another tileset.

 

I could try placing objects more evenly I guess, I think smaller rooms just may be more crowded because it chooses rooms randomly so every room has a even chance of being full regardless of size. I could try doing some weird sorting so that it tries to place objects in the bigger rooms first.

 

My script uses regions for stuff, so you can't label tiles with new ids. Every floor tile is id 0 regardless of what ids the tiles have in the editor, walls have 1, objects 2, blank 3, edge 4.... It's kind of the best way for the script to tell what tile is which. Anyway, that sort of thing should really be done with terrain tags, so maybe I will write a new script for you to use them or tileset notetags or something. Honestly though, damage tiles would never be placed in very smart ways, so I wrote a trap script instead, plus my traps hurt enemies too. :3

Edited by KilloZapit

Share this post


Link to post
Share on other sites

I want to comment basically to tell you this is a helluva script, and you do an awesome job on followups to people's questions which is awesome!! :D

Well on to my question though, it appears there is only progression one way in the map exits...I did create an event that allows you to go back to a previous level (randomized of course), but it's not placed at the exit points like your map exits (which is kinda not cool). Is there anyway to set up two exit points?

Share this post


Link to post
Share on other sites

You mean my exit path things? They aren't really set up for two way stuff... even if you put the exit at the entrance, going through it would be buggy. My exit paths would have to be rewritten for that, and some more fiddling with stuff would have to be done to get it to work. Of course there is no reason you have to use exit paths anyway, they are just some stupid fancy feature to make some levels look better. You can just turn them off in the map notes.

 

To be honest I don't understand the point in going backwards to regenerated floors. It's functionally the same as always going forward except you can exit the dungeon easier. One of these days I may make some system to save the dungeons (might be easier then you think) but my exit paths will have to be totally rewritten for that anyway.

Edited by KilloZapit

Share this post


Link to post
Share on other sites

I suppose your right, it's not a necessary thing. Can always just use the warp wing you have to escape, or have an evented gate when you kill a boss or something as such.

Thanks for the response =)

Share this post


Link to post
Share on other sites

Your welcome. :3

Share this post


Link to post
Share on other sites

Um.. those scripts seem to be getting worse for me. It seems events have their direction randomized as well. My chests that I have placed (each are unique, so I'm not using the symbol to mass copy them) start out either partially open or completely open. It's a pain in the ass. I found a workaround but it's repetitive as hell. I have 30 different chest spawn events & will either not produce a chest or becomes 1 of 4 different colored chests based on a variable for each. Each event has about 16 event pages (4 chests with an open & closed page for each then doubled for variances in variable range.) I would have to check off the 'Direction Fix' option under the graphic for every closed chest page. That's 8 closed chest pages per chest event times 30 chest events per map & there's 20 themes divided between the 200 floors & 2 maps per theme. You could do the math but that's alot of corrections that would need to be done to stop the chests from facing a random direction. I was kinda hoping you could stop the scripts from making events face random directions.

 

As for the black squares, I'm certain I left the alt. floor tile spots blank & yet it's counting them as a alt. floor & there for places transparent squares all over the place. I've solved that problem by simply placing an extra copy of the original floor tile into that spot & that fixes it.

 

Another problem is with dungeons that use the :float_edge option. I have maps that don't always place the edge tile properly. Also, in my Sky theme, 1 of the 2 maps (A map & B map) let's me & enemies walk around in the air. It only happens in 1 of the 2 maps & both maps use the exact same tile set, which means they're supposed to have the exact same passibility settings. It's also producing shadows from walls that aren't even there. I could've sworn it didn't do this before.

 

 

In another theme, the scripts keep adding a E tile to the map as a pillar object (without the upper half) even though I never added it to the map. How can a script forcibly add a tile from a tileset to the map when the user never places it to begin with?

 

As you can see, I have my hands full trying to deal with this script & all the weird stuff it keeps throwing at me. Because of this & no progress on my vehicle passibility problem along with something else I have to deal with, I'm planning on taking a 1 or 2 month hiatus from RPG Maker. This thing is stressing me to the point of having a heart attack. While I'm on hiatus I'll still keep checking this site for any help for any of my topics but as hard as it is getting on the internet, all my time will be spent dealing with something else I have to take care of. The psuado-random workaround I was going to use would have been extremely repetitive so I'm glad you never gave up on this. I hope you'll improve these scripts so these errors don't happen anymore & I appreciate everything you done for this.

Edited by Animebryan

Share this post


Link to post
Share on other sites

You can also turn off walk anime to do it, but if you want to disable it, you can search the dungeon events script for "event.turn_random" and delete or comment out that line. I kinda recommend you do what I did and make one or two chests that give you random items though, but that probably involves lotsa scripting unless you want to make long event branches.

 

Well the :float_edge thing looks like your using the transparent tile for walls... it shouldn't place tiles like that otherwise. I really think you need to fill in the a5 graphic to make sure... Currently the only way to select the blank tile is to copy it from somewhere else (with a right click I think). New maps and my demo maps are filled with them. I think I may write a option for it to ignore that tile... I will have to look and make sure what tile number that is though... tile numbers are so weird in ace, it's not really that easy to figure it out.

 

Anyway, I kinda know how you feel about not being able to get what you want, but you really shouldn't let it stress you. If you want my advice, learn to script, at least a bit. It maybe a pain and confusing, but when you have something you really want to do, you can just do it. That or just do what you can and worry about scripts later.

Edited by KilloZapit

Share this post


Link to post
Share on other sites

You can also turn off walk anime to do it, but if you want to disable it, you can search the dungeon events script for "event.turn_random" and delete or comment out that line. I kinda recommend you do what I did and make one or two chests that give you random items though, but that probably involves lotsa scripting unless you want to make long event branches.

 

Well the :float_edge thing looks like your using the transparent tile for walls... it shouldn't place tiles like that otherwise. I really think you need to fill in the a5 graphic to make sure... Currently the only way to select the blank tile is to copy it from somewhere else (with a right click I think). New maps and my demo maps are filled with them. I think I may write a option for it to ignore that tile... I will have to look and make sure what tile number that is though... tile numbers are so weird in ace, it's not really that easy to figure it out.

 

Anyway, I kinda know how you feel about not being able to get what you want, but you really shouldn't let it stress you. If you want my advice, learn to script, at least a bit. It maybe a pain and confusing, but when you have something you really want to do, you can just do it. That or just do what you can and worry about scripts later.

Yeah, learning how to script would be nice but I don't even know where to start. Besides, I don't have internet at home so I don't have the luxury of browsing the internet for a RGSS3 tutorial whenever I want. If only I could find a comprehensive guide to download onto my flash drive & learn it at home.

Share this post


Link to post
Share on other sites

Yeah, learning how to script would be nice but I don't even know where to start. Besides, I don't have internet at home so I don't have the luxury of browsing the internet for a RGSS3 tutorial whenever I want. If only I could find a comprehensive guide to download onto my flash drive & learn it at home.

I don't know of a full guide like that... I tend to use http://www.ruby-doc.org/ and the rpg maker vx ace help file for reffrence, but I don't think that will help someone who dosn't really understand how programing works.

Share this post


Link to post
Share on other sites

Learning how to script really depends on someone's determination how to. I can suggest a few ways to start how to script or learning how to script for yourself. When I was starting, I always spare time to take lessons here:

 

http://www.codecademy.com/tracks/ruby

https://rubymonk.com/

 

You can at least do 6 - 8 of the exercises and think of a way how to make them work. For example, you've learned how printing and passing variable values. Try to make something out of it. Then when you learn about arrays, try to combine this with the one you learned. Gradually, you'll see how you improve in doing coding as you learn new methods, functions and ways to do the things you want.

 

Normally, you can just save the lessons on your flash drive. RGSS3 is Ruby, but not everything in RGSS3 is in Ruby's base language that is because RGSS3 is an API (Application Programming Interface). But Ruby's functions do work in RGSS3.

 

You can go to Tutorials Point for Ruby Tutorials, which, just by right clicking, you can save the web page in your flash drive too.

 

http://www.tutorialspoint.com/ruby/

 

I also have a copy of my own of this book.

 

Now, aren't these just Ruby? How about RGSS3? Few ways to start with RGSS3 is to read the help file. You can also watch DiamondAndPlatinum3's tutorials, trust me, he's the guy that showed me how to code and helped me a lot of times. His videos are a great start to learn how to script for your own.

 

http://www.youtube.com/playlist?list=PLu_gesZsbQQ50g3Y302dN0sq6DuErvcJy

 

If you're wondering how to save them, go to keepvid, there's a way to download the videos. In no time, I was able to learn how to script. It was like just a week, really.

Share this post


Link to post
Share on other sites

It no longer concerns me now. My hard drive died out on me & I lost everything. I still have my 'hoard' of scripts & the installer on my flash drive but until I get another computer or get my laptop fixed, I'm done. Dispite that though, I would like to thank you for all the help you have given me so far. I won't be able to utilize this script now but maybe others will. I'm just glad one of my topics generated something useful for everyone here to use.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted