+ DarthVollis 59 Posted June 30, 2014 I have been working on this script all day with no luck. I am using KilloZapit's Modified Saba Khan's Random Dungeon Generator and every time I transfer my player to one of these dungeons the player is in the wall. Can someone help me fix this? #------------------------------------------------------------------------------- # Dungeon Passibility Check # DarthVollis # RPG Maker VX ACE # Version 1.0 #------------------------------------------------------------------------------- # Free For Commercial and Non-Commercial Use. #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # This Area is for the settings of the variables. Change the number to whatever # you need. #------------------------------------------------------------------------------- module PA_DUNGEON_SETTINGS Dungeon_Map_ID = 31 # This is for the desired Map that you want to check # passibility on. Dungeon_X = 29 # This is the X-Coordinate of the Player's Transfer Location. Dungeon_Y = 31 # This is the Y-Coordinate of the Player's Transfer Location. end #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # This Method checks the Passibility of the location on the Map. #------------------------------------------------------------------------------- def Dungeon_Passibility_Check map = load_data(sprintf("Data/Map%03d.rvdata2", $game_variables[PA_DUNGEON_SETTINGS::Dungeon_Map_ID]) return map.passable?($game_variables[PA_DUNGEON_SETTINGS::Dungeon_X], $game_variables[PA_DUNGEON_SETTINGS::Dungeon_Y]) end end Share this post Link to post Share on other sites
Kayzee 4,032 Posted July 1, 2014 Loading a map like that and checking won't work, because the map isn't generated yet. I wish I could figure out exactly what is diffrent in your game that makes the player not automaticly teleport to a floor if they don't start on one. Share this post Link to post Share on other sites
+ DarthVollis 59 Posted July 1, 2014 Okay I got the Random Teleporting done and it checks for passibility. Noe the only problem is that the outside area, the black area, is walkable and the game counts that. Here is the code so far that works. def Dungeon_Passibility_Check(map_id) map = Game_Map.new map_id = $game_variables[31] map.setup(map_id) # <-- your target map ID loop do $game_variables[29] = rand(50) $game_variables[30] = rand(50) break if map.airship_land_ok?($game_variables[29],$game_variables[30]) end $game_player.reserve_transfer($game_variables[31],$game_variables[29],$game_variables[30],2) end Share this post Link to post Share on other sites
Kayzee 4,032 Posted July 2, 2014 But my code checks perticularly for tiles marked in the right zone, and only should spawn the player in rooms. See look in my dungeon events script. The only exception is if you are not in a dungeon, in which it shouldn't generate a map at all! Also that code won't work either. It might work if you replace $game_map's map date with the new map's map data though. Share this post Link to post Share on other sites
+ DarthVollis 59 Posted July 2, 2014 Can you explain that? And you are right still ending up in weird places. Share this post Link to post Share on other sites
Kayzee 4,032 Posted July 2, 2014 $game_player.reserve_transfer sends you to the current $game_map not the Game_map instince you just created. Maybe saying $game_map = map right before calling it would work, But I am not sure how much importent infor is sored in the Game_Map class that is not releated to the current map... you might want to avoid that. Share this post Link to post Share on other sites
TheoAllen 830 Posted July 2, 2014 That's my snippet actually (with a bit modification by him). The purpose of create a new map is just to check passability. Ok, I just tested the snippet with a slight modification def random_transfer(map_id) map = Game_Map.new map.setup(map_id) xpos = 0 ypos = 0 loop do xpos = rand(map.width) ypos = rand(map.height) break if map.airship_land_ok?(xpos,ypos) end $game_player.reserve_transfer(map_id,xpos,ypos,2) end Once you get the passable tile, it will reserve transfer for player. I have similar snipped used in my game. A random relocate when enemy respawn. And I also suffered the same thing. A passable blank map and wall ceiling. So, my solution was to add a new condition check. Let say that player wouldn't gonna be transfered in any area which has terrain tag = 1. Then this modified snippet should works def random_transfer(map_id) map = Game_Map.new map.setup(map_id) xpos = 0 ypos = 0 loop do xpos = rand(map.width) ypos = rand(map.height) break if map.airship_land_ok?(xpos,ypos) && map.terrain_tag(x,y) != 1 end $game_player.reserve_transfer(map_id,xpos,ypos,2) end Hope it helps Share this post Link to post Share on other sites
Kayzee 4,032 Posted July 2, 2014 But that isn't going to work if the map is dynamicly generated. The new map your checking is not the same one your going to go to. Share this post Link to post Share on other sites
TheoAllen 830 Posted July 2, 2014 Oh, sorry. Didn't read Well... can't really help since I don't know how that random dungeon generator works. I only deal with the default script Share this post Link to post Share on other sites
+ Glasses 606 Posted July 2, 2014 Then what about going to a map any coordinate (so it generates) and then checking and transferring to a available tile? Share this post Link to post Share on other sites
+ DarthVollis 59 Posted July 3, 2014 That was the idea. Sorry TheoAllen for not giving you credit. My fault. With KilloZapit's help the problem has been fixed. Thank you guys for all the help! Share this post Link to post Share on other sites
TheoAllen 830 Posted July 3, 2014 ~ Closed since solved ~ Share this post Link to post Share on other sites