Danno
Formerly Meowth, AKA InnerMobius
- 1,224
- Posts
- 18
- Years
- Age 34
- New England
- Seen Mar 24, 2023
[RMXP] Mystery Dungeon: Annex
THIS DOES NOT USE THE POKEMON ESSENTIALS STARTER KIT.
For those who came to this thread through an external link or banner:
This isn't a hack, it's a game being developed for RPG Maker XP, and will be available to play on Windows computers once completed.
For the simple reason that I suck at scripting, you will no longer be able to choose your Pokemon to play throughout the game as. Instead, you will assume the role of... Wait for it...
Meowth and Squirtle. They were always my team in the first two games. :)
Now, I'm going with a MD/HGSS look to this game, as I'm not using MD Overworlds; they're all from HGSS. This game will contain the first 251 Pokemon, as per my usual tastes... unless I make a sequel or something where I may add the other bajillion into.
This game features an advanced sideview battle system and message system.
Credits:
CrazyNinjaGuy: For some resources from his RMVX MD Starter kit (music mainly)
Reone662: Caterpillar Script
MGCaladtogel: Mode 7
Dargor: Party Scripts
Tatsuya Suou: Battle System
Spriters Resource: Random Sprites
DubeAlex: Advanced Message System
Unkown At the Moment: HGSS Pokemon OW Rips, HGSS Cave Tiles
TEAM
Meowth- Events, mapping, spriting, importing resources
AvatarKris- Events, mapping, spriting, importing resources
SUPPORT BARS
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i27.tinypic.com/2qwn2n8.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i31.tinypic.com/2zg4v2a.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i29.tinypic.com/34hbfbp.png)
BUGS
None yet, fingers crossed!
SCRIPTERS OUT THERE:
I may have found a way to do the actual Mystery Dungeons.... but I need your help, and not even that much help in this case. You see, I've found the script, I just need it to work. It's actually Poccil's "RandomMap" script, which he's seemingly not supporting or hosting anymore. Here's the script for all who care to try using it:
If you could help me get that in the game, I would be much obliged, and of course you would have a place in the credits, or on the team :)
Oi, Oi!
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i28.tinypic.com/sv0175.png)
THIS DOES NOT USE THE POKEMON ESSENTIALS STARTER KIT.
For those who came to this thread through an external link or banner:
This isn't a hack, it's a game being developed for RPG Maker XP, and will be available to play on Windows computers once completed.
For the simple reason that I suck at scripting, you will no longer be able to choose your Pokemon to play throughout the game as. Instead, you will assume the role of... Wait for it...
Meowth and Squirtle. They were always my team in the first two games. :)
Now, I'm going with a MD/HGSS look to this game, as I'm not using MD Overworlds; they're all from HGSS. This game will contain the first 251 Pokemon, as per my usual tastes... unless I make a sequel or something where I may add the other bajillion into.
This game features an advanced sideview battle system and message system.
SCREENSHOTS
Spoiler:
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i27.tinypic.com/34g9ibs.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i31.tinypic.com/2vjtyzt.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i31.tinypic.com/vomzcp.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i32.tinypic.com/5e7kog.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i29.tinypic.com/2d8ggsz.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i26.tinypic.com/2vc822a.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i32.tinypic.com/15x8pdx.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i31.tinypic.com/ajt9mo.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i54.tinypic.com/28btmv9.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i54.tinypic.com/hsmhq8.png)
Credits:
CrazyNinjaGuy: For some resources from his RMVX MD Starter kit (music mainly)
Reone662: Caterpillar Script
MGCaladtogel: Mode 7
Dargor: Party Scripts
Tatsuya Suou: Battle System
Spriters Resource: Random Sprites
DubeAlex: Advanced Message System
Unkown At the Moment: HGSS Pokemon OW Rips, HGSS Cave Tiles
TEAM
Meowth- Events, mapping, spriting, importing resources
AvatarKris- Events, mapping, spriting, importing resources
SUPPORT BARS
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i27.tinypic.com/2qwn2n8.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i31.tinypic.com/2zg4v2a.png)
![[PokeCommunity.com] [RMXP] Mystery Dungeon Game [PokeCommunity.com] [RMXP] Mystery Dungeon Game](https://i29.tinypic.com/34hbfbp.png)
BUGS
None yet, fingers crossed!
SCRIPTERS OUT THERE:
I may have found a way to do the actual Mystery Dungeons.... but I need your help, and not even that much help in this case. You see, I've found the script, I just need it to work. It's actually Poccil's "RandomMap" script, which he's seemingly not supporting or hosting anymore. Here's the script for all who care to try using it:
Spoiler:
=begin
Random Map Script, by "tonbi", adapted by Peter O.
--------------------
Names of random maps have the following syntax:
[MapName],Random,[Type],[ObjCnt],[Connect]
MapName - Name of the map
Type - Map type:
0 - 2 layers, natural
1 - 2 layers, artificial
2 - 2 layers, natural, convex
3 - 2 layers, artificial, convex
4 - 2 layers, natural, hole/land/wall
5 - 2 layers, artificial, hole/land/wall
6 - 2 layers, natural, hole/land/wall
7 - 2 layers, artificial, hole/land/wall
ObjCnt - Density of objects on the map. Generally a number divisible by 100.
Connect - If this is equal to "false", the parts of the generated map can be disjoint.
This setting is optional.
------------------
In addition, the tiles used in the random map must be arranged in a certain way, depending
on the map type; please see the Random Map Sample for details:
https://www.mc.ccnw.ne.jp/sarada/toshi/down/RandomMapSample.exe
------------------
Each event on the map can be marked with these features.
Checkpoint - There will always be ground wherever this event is placed.
Thus, this event can serve to influence the shape of the generated map.
To Use: Name the event "MyEvent,Checkpoint" or use a Comment event
command consisting of the text "Checkpoint". ("MyEvent" is arbitrary.)
Fixed - This event will appear at a ground tile next to where this event is located.
To Use: Name the event "MyEvent,Fixed" or use a Comment event
command consisting of the text "Fixed". ("MyEvent" is arbitrary.)
TotallyFixed - This event will always remain at its position defined on the map.
To Use: Name the event "MyEvent,TotallyFixed" or use a Comment event
command consisting of the text "TotallyFixed". ("MyEvent" is arbitrary.)
WallFixture - Appears attached to a wall. May be followed by a comma and either
1 or 0 (0 means the object takes 1 tile space; 1 means 3 tiles).
To Use: Use a Comment event command consisting of the text "WallFixture,1"
WallFixtureFixed - Appears attached to a wall next to where this event is located.
May be followed by a comma and either 1 or 0 (0 means the object takes 1 tile space;
1 means 3 tiles).
To Use: Use a Comment event command consisting of the text "WallFixture,1"
Events without these features will be placed at a random spot on the generated map.
-------------------
=end
Events.onMapCreate+=proc {|sender, e|
mapID=e[0]
map=e[1]
tileset=e[2]
mapinfo = pbLoadRxData("Data/MapInfos")
next if !mapinfo[mapID]
if mapinfo[mapID].subname == "Random"
if mapinfo[mapID].subname(3)=="" or mapinfo[mapID].subname(3) == nil
p3 = 0
else
p3 = mapinfo[mapID].subname(3).to_i
end
if mapinfo[mapID].subname(4)=="false"
p4 = false
end
if map && tileset
generator=MapGenerator.new(map,tileset.passages,tileset.priorities)
generator.make_random_map(2,mapinfo[mapID].subname(2).to_i,p3,p4)
end
end
}
class MapGenerator
def initialize(map, passages, priorities)
@map=map
@passages=passages
@priorities=priorities
end
def mapBorder
for x in [email protected]
for y in [email protected]
if x<7 || y<6 || x>[email protected] || y>[email protected]
@heightdata[x,y] = 1
end
end
end
end
def make_random_map(wall = 2, type = 0, objcnt = 0, connect = true)
wall = 0 if wall == nil
type = 0 if type == nil
objcnt = 0 if objcnt == nil
unless objcnt.is_a?(Numeric)
objcnt = 0
end
if objcnt < 0
objcnt = 0
end
connect = true if connect != false
@heightdata = Table.new(@map.width,@map.height)
@maskdata = Table.new(@map.width,@map.height)
@oneventdata = Table.new(@map.width,@map.height)
@masksetting = []
@makedata = []
@targettype=0
@chgtype=0
time = -1
for i in [email protected]
for j in [email protected]
time += 1
if time%2000 == 0
Graphics.update
end
@heightdata[i,j] = 0
@maskdata[i,j] = 0
end
end
for i in 0...100
@masksetting = true
end
needposx = []
needposy = []
for i in @map.events.keys.sort
time += 1
if time%200 == 0
Graphics.update
end
if event_settype(i) == 1
if connect == true
needposx.push(@map.events.x)
needposy.push(@map.events.y)
needposx.push(@map.events.x)
needposy.push(@map.events.y)
else
needposx.push(@map.events.x)
needposy.push(@map.events.y)
end
end
end
if connect == true
needposx.shift
needposy.shift
end
loop do
if needposx.size <= 2
needposx.push(rand(@map.width))
needposy.push(rand(@map.height))
else
break
end
end
case type
when 0
@makedata.push([0,1,0])
@makedata.push([5,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,0,-15,4,0])
@makedata.push([1,1,1,1,1])
@makedata.push([6,0,needposx[i*2],needposy[i*2]])
@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,0,1,1,1])
@makedata.push([4,0,1,1,1])
@makedata.push([4,1,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,0])
@makedata.push([2,1,2])
@makedata.push([5,1])
when 1
@makedata.push([0,1,0])
@makedata.push([5,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,0,-6,4,1,10])
@makedata.push([1,1,1,1,1])
@makedata.push([6,0,needposx[i*2],needposy[i*2]])
@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,0,2,3,1])
@makedata.push([4,1,2,2,1])
@makedata.push([4,0,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,0])
@makedata.push([2,1,2])
@makedata.push([5,1])
when 2
@makedata.push([0,1,0])
@makedata.push([5,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,0,-15,4,0])
@makedata.push([1,1,1,1,1])
@makedata.push([6,0,needposx[i*2],needposy[i*2]])
@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,0,2,2,1])
@makedata.push([4,1,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,0])
@makedata.push([2,1,2])
@makedata.push([5,-1])
when 3
@makedata.push([0,1,0])
@makedata.push([5,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,0,-15,4,1,10])
@makedata.push([1,1,1,1,1])
@makedata.push([6,0,needposx[i*2],needposy[i*2]])
@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,0,2,2,1])
@makedata.push([4,1,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,0])
@makedata.push([2,1,2])
@makedata.push([5,-1])
when 4
@makedata.push([0,1,0])
@makedata.push([5,0])
@makedata.push([1,0,0,-1,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,0,-1,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,-1,0,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,0,-1,0,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([4,2,2,2,1])
for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
@makedata.push([1,3,3,8,8])
@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
end
@makedata.push([7,2])
@makedata.push([4,2,1,1,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,1,-8,4,0,5])
@makedata.push([1,1,1,1,1])
@makedata.push([6,1,needposx[i*2],needposy[i*2]])
@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,1,1,1,1])
@makedata.push([4,1,0,1,1])
@makedata.push([2,0,0])
@makedata.push([4,1,1,0,1])
@makedata.push([2,-1,1])
@makedata.push([4,2,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,-1])
@makedata.push([2,1,2])
@makedata.push([5,0])
@makedata.push([2,2,2])
@makedata.push([5,1])
when 5
@makedata.push([0,1,0])
@makedata.push([5,0])
@makedata.push([1,0,0,-1,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,0,-1,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,-1,0,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,0,-1,0,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([4,2,2,2,1])
for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
@makedata.push([1,3,3,8,8])
@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
end
@makedata.push([7,2])
@makedata.push([4,2,1,1,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,1,-8,4,1,5])
@makedata.push([1,1,1,1,1])
@makedata.push([6,1,needposx[i*2],needposy[i*2]])
@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,1,1,1,1])
@makedata.push([4,1,0,1,1])
@makedata.push([2,0,0])
@makedata.push([4,1,1,0,1])
@makedata.push([2,-1,1])
@makedata.push([4,2,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,-1])
@makedata.push([2,1,2])
@makedata.push([5,0])
@makedata.push([2,2,2])
@makedata.push([5,1])
when 6
@makedata.push([0,1,0])
@makedata.push([5,0])
@makedata.push([1,0,0,-1,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,0,-1,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,-1,0,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,0,-1,0,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([4,2,2,2,1])
for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
@makedata.push([1,1,1,3,3])
@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
end
@makedata.push([4,0,2,2,0])
@makedata.push([4,0,1,2,1])
@makedata.push([7,2])
@makedata.push([4,2,1,1,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,1,-15,4,0,5])
@makedata.push([1,1,1,1,1])
@makedata.push([6,1,needposx[i*2],needposy[i*2]])
@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,1,1,1,1])
@makedata.push([4,1,0,1,1])
@makedata.push([2,0,0])
@makedata.push([4,1,1,0,1])
@makedata.push([2,-1,1])
@makedata.push([4,2,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,-1])
@makedata.push([2,1,2])
@makedata.push([5,0])
@makedata.push([2,2,2])
@makedata.push([5,1])
when 7
@makedata.push([0,1,0])
@makedata.push([5,0])
@makedata.push([1,0,0,-1,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,0,-1,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,-1,0,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,0,-1,0,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([4,2,2,2,1])
for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
@makedata.push([1,1,1,3,3])
@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
end
@makedata.push([4,0,2,2,0])
@makedata.push([4,0,1,2,1])
@makedata.push([7,2])
@makedata.push([4,2,1,1,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,1,-15,4,1,5])
@makedata.push([1,1,1,1,1])
@makedata.push([6,1,needposx[i*2],needposy[i*2]])
@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,1,1,1,1])
@makedata.push([4,1,0,1,1])
@makedata.push([2,0,0])
@makedata.push([4,1,1,0,1])
@makedata.push([2,-1,1])
@makedata.push([4,2,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,-1])
@makedata.push([2,1,2])
@makedata.push([5,0])
@makedata.push([2,2,2])
@makedata.push([5,1])
end
for make_stat in @makedata
time += 1
if time%2 == 0
Graphics.update
end
case make_stat[0]
when 0
rndmap_chtarget(make_stat[1],make_stat[2])
when 1
rndmap_setstat(make_stat[1],make_stat[2],make_stat[3],make_stat[4])
when 2
rndmap_chmask(make_stat[1],make_stat[2])
when 3
rndmap_mkroad(make_stat[1],make_stat[2],make_stat[3],make_stat[4],make_stat[5])
when 4
rndmap_plus(make_stat[1],make_stat[2],make_stat[3],make_stat[4])
when 5
rndmap_allchg(make_stat[1])
when 6
rndmap_putpos(make_stat[1],make_stat[2],make_stat[3])
when 7
rndmap_edge(make_stat[1])
end
end
@tilesetting = Table.new(3,40,3)
for i in [0,1,2]
for k in 0...40
for j in [0,1,2]
@tilesetting[j,k,i] = @map.data[j,k,i]
end
end
end
time = 0
for k in [email protected]
for j in [email protected]
time += 1
if time%500 == 0
Graphics.update
end
if @heightdata[j,k] == 1
if @heightdata[j,k+1]==-1
@heightdata[j,k+1] = 0
if @heightdata[j,k+2]==-1 and
@heightdata[j,k+3] == 0
@heightdata[j,k+2] = 0
end
end
end
end
end
time = 0
for k in [email protected]
for j in [email protected]
time += 1
if time%500 == 0
Graphics.update
end
if @heightdata[j,k] == 0
if @heightdata[j,k+1] == -1 or
@heightdata[j,k-1] == -1 or
@heightdata[j+1,k] == -1 or
@heightdata[j-1,k] == -1
set_mapdata2(j,k,0,8)
else
set_mapdata2(j,k,0,0)
end
elsif @heightdata[j,k] == 1
if @heightdata[j,k+1] == -1 or
@heightdata[j,k-1] == -1 or
@heightdata[j+1,k] == -1 or
@heightdata[j-1,k] == -1
set_mapdata2(j,k,0,8)
elsif @heightdata[j,k+1] == 0 or
@heightdata[j,k-1] == 0 or
@heightdata[j+1,k] == 0 or
@heightdata[j-1,k] == 0
set_mapdata2(j,k,0,0)
else
set_mapdata2(j,k,1,4)
end
else
set_mapdata2(j,k,0,8)
end
end
end
time = 0
for k in [email protected]
for j in [email protected]
time += 1
if time%500 == 0
Graphics.update
end
if @heightdata[j,k] == 0
if @heightdata[j,k+1] == -1
if @heightdata[j-1,k] == -1
for i in [0,1,2]
set_mapdata(j,k+i,0,13+i,1)
end
elsif @heightdata[j+1,k] == -1
for i in [0,1,2]
set_mapdata(j,k+i,2,13+i,1)
end
else
for i in [0,1,2]
set_mapdata(j,k+i,1,13+i,1)
end
end
elsif @heightdata[j,k-1] == -1
if @heightdata[j-1,k] == -1 or
(@heightdata[j-1,k] == 1 and
@heightdata[j-1,k-1] == -1)
set_mapdata(j,k,0,11,2)
elsif @heightdata[j+1,k] == -1 or
(@heightdata[j+1,k] == 1 and
@heightdata[j+1,k-1] == -1)
set_mapdata(j,k,2,11,2)
else
set_mapdata(j,k,1,11,2)
end
elsif @heightdata[j-1,k] == -1 or
(@heightdata[j-1,k] == 1 and
@heightdata[j-1,k-1] == -1)
set_mapdata(j,k,0,12,1)
elsif @heightdata[j+1,k] == -1 or
(@heightdata[j+1,k] == 1 and
@heightdata[j+1,k-1] == -1)
set_mapdata(j,k,2,12,1)
elsif @heightdata[j-1,k-1] == -1
set_mapdata(j,k,0,9,1)
elsif @heightdata[j-1,k+1] == -1
set_mapdata(j,k,0,10,1)
elsif @heightdata[j+1,k-1] == -1
set_mapdata(j,k,1,9,1)
elsif @heightdata[j+1,k+1] == -1
set_mapdata(j,k,1,10,1)
end
end
if @heightdata[j,k] == 1 and
@heightdata[j,k-1] != -1
if @heightdata[j,k+1] == -1
if @heightdata[j-1,k] == -1
for i in [0,1,2]
end
elsif @heightdata[j+1,k] == -1
for i in [0,1,2]
end
else
for i in [0,1,2]
end
end
elsif @heightdata[j,k-1] == -1
if @heightdata[j-1,k] == -1
set_mapdata(j,k,0,11,2)
elsif @heightdata[j+1,k] == -1
set_mapdata(j,k,2,11,2)
else
set_mapdata(j,k,1,11,2)
end
elsif @heightdata[j-1,k] == -1
set_mapdata(j,k,0,12,1)
elsif @heightdata[j+1,k] == -1
set_mapdata(j,k,2,12,1)
elsif @heightdata[j-1,k-1] == -1
set_mapdata(j,k,0,9,1)
elsif @heightdata[j-1,k+1] == -1
set_mapdata(j,k,0,10,1)
elsif @heightdata[j+1,k-1] == -1
set_mapdata(j,k,1,9,1)
elsif @heightdata[j+1,k+1] == -1
set_mapdata(j,k,1,10,1)
end
end
end
end
time = 0
for k in [email protected]
for j in [email protected]
time += 1
if time%500 == 0
Graphics.update
end
if @heightdata[j,k] == 1
if @heightdata[j,k+1] == 0 or
@heightdata[j,k+1] == -1
if @heightdata[j-1,k] == 0 or
@heightdata[j-1,k] == -1
set_mapdata(j,k+0,0,5+0,5)
set_mapdata(j,k+1,0,5+1,5)
set_mapdata(j,k+2,0,5+2,4)
if @heightdata[j,k+3] != 0 and
@heightdata[j,k+2] != 1 and
(@heightdata[j,k+2] != 0 or @heightdata[j-1,k+2] != 0)
set_mapdata(j,k+2,0,16,5)
for i in [0,1]
set_mapdata(j,k+3+i,0,14+i,1)
if @heightdata[j,k+3+i] != -1
break
end
end
end
elsif @heightdata[j+1,k] == 0 or
@heightdata[j+1,k] == -1
set_mapdata(j,k+0,2,5+0,5)
set_mapdata(j,k+1,2,5+1,5)
set_mapdata(j,k+2,2,5+2,4)
if @heightdata[j,k+3] != 0 and
@heightdata[j,k+2] != 1 and
(@heightdata[j,k+2] != 0 or @heightdata[j+1,k+2] != 0)
set_mapdata(j,k+2,2,16,5)
for i in [0,1]
set_mapdata(j,k+3+i,2,14+i,1)
if @heightdata[j,k+3+i] != -1
break
end
end
end
else
set_mapdata(j,k+0,1,5+0,5)
set_mapdata(j,k+1,1,5+1,5)
set_mapdata(j,k+2,1,5+2,4)
if @heightdata[j,k+3] != 0 and
@heightdata[j,k+2] != 1
set_mapdata(j,k+2,1,16,5)
for i in [0,1]
set_mapdata(j,k+3+i,1,14+i,1)
if @heightdata[j,k+3+i] != -1
break
end
end
end
end
elsif @heightdata[j,k-1] == 0 or
@heightdata[j,k-1] == -1
if @heightdata[j-1,k] == 0 or
@heightdata[j-1,k] == -1
set_mapdata(j,k,0,3,4)
elsif @heightdata[j+1,k] == 0 or
@heightdata[j+1,k] == -1
set_mapdata(j,k,2,3,4)
else
set_mapdata(j,k,1,3,4)
end
elsif @heightdata[j-1,k] == 0 or
@heightdata[j-1,k] == -1
set_mapdata(j,k,0,4,4)
elsif @heightdata[j+1,k] == 0 or
@heightdata[j+1,k] == -1
set_mapdata(j,k,2,4,4)
elsif @heightdata[j-1,k-1] == 0 or
@heightdata[j-1,k-1] == -1
set_mapdata(j,k,0,1,4)
elsif @heightdata[j-1,k+1] == 0 or
@heightdata[j-1,k+1] == -1
set_mapdata(j,k,0,2,4)
elsif @heightdata[j+1,k-1] == 0 or
@heightdata[j+1,k-1] == -1
set_mapdata(j,k,1,1,4)
elsif @heightdata[j+1,k+1] == 0 or
@heightdata[j+1,k+1] == -1
set_mapdata(j,k,1,2,4)
end
end
end
end
playerpos_reset($game_temp.player_new_x,$game_temp.player_new_y)
@oneventdata[$game_temp.player_new_x,$game_temp.player_new_y] = 1
time = 0
for i in @map.events.keys.sort
time += 1
if time%100 == 0
Graphics.update
end
case event_settype(i)
when 3
@oneventdata[@map.events.x,@map.events.y] = 1
end
end
for i in @map.events.keys.sort
time += 1
if time%100 == 0
Graphics.update
end
case event_settype(i)
when 1
set_defeventpos(i,@map.events.x,@map.events.y)
@oneventdata[@map.events.x,@map.events.y] = 1
end
end
for i in @map.events.keys.sort
time += 1
if time%100 == 0
Graphics.update
end
j = event_settype(i)
case j
when 0
set_defeventpos(i,rand(@map.width-4)+2,rand(@map.width-4)+2)
@oneventdata[@map.events.x,@map.events.y] = 1
when 2
set_defeventpos(i,@map.events.x,@map.events.y)
@oneventdata[@map.events.x,@map.events.y] = 1
when 100..199
set_defeventpos_wall(i,rand(@map.width-4)+2,rand(@map.width-4)+2,j-100)
@oneventdata[@map.events.x,@map.events.y] = 1
@oneventdata[@map.events.x,@map.events.y-1] = 1
for k in 1..(j-100)
@oneventdata[@map.events.x+k,@map.events.y] = 1
@oneventdata[@map.events.x+k,@map.events.y-1] = 1
@oneventdata[@map.events.x-k,@map.events.y] = 1
@oneventdata[@map.events.x-k,@map.events.y-1] = 1
end
when 200..299
set_defeventpos_wall(i,@map.events.x,@map.events.y,j-200)
@oneventdata[@map.events.x,@map.events.y] = 1
@oneventdata[@map.events.x,@map.events.y-1] = 1
for k in 1..(j-200)
@oneventdata[@map.events.x+k,@map.events.y] = 1
@oneventdata[@map.events.x+k,@map.events.y-1] = 1
@oneventdata[@map.events.x-k,@map.events.y] = 1
@oneventdata[@map.events.x-k,@map.events.y-1] = 1
end
end
end
for i in 0...(rand(objcnt)+objcnt/2)
time += 1
if time%500 == 0
Graphics.update
end
j = rand([@map.width,@map.height].max)
k = rand([@map.width,@map.height].max)
case rand(10)
when 0..4
if standable_newtile?(1,0)
if standable?(j,k)
set_mapdata_obj(j,k,1,0,6)
end
else
if standable2?(j,k)
set_mapdata_obj(j,k,1,0,6)
end
end
when 5..7
if standable_newtile?(2,0)
if standable?(j,k)
set_mapdata_obj(j,k,2,0,6)
end
else
if standable2?(j,k)
set_mapdata_obj(j,k,2,0,6)
end
end
when 8..9
if standable2?(j,k)
if @map.data[j,k-1,2]==0 and
(@map.data[j,k,1]==0 or @map.data[j,k,2]==0)
if set_mapdata_obj(j,k,2,2,4)
set_mapdata(j,k-1,2,1,4)
end
end
end
end
end
@heightdata.resize(0,0)
@maskdata.resize(0,0)
@oneventdata.resize(0,0)
@masksetting.clear
@makedata.clear
@tilesetting.resize(0,0,0)
end
def event_settype(i)
if @map.events.subname == "Checkpoint"
return 1
end
if @map.events.subname == "Fixed"
return 2
end
if @map.events.subname == "TotallyFixed"
return 3
end
for j in 0..1000
if @map.events.pages[0].list[j].code != 108
break
end
if @map.events.pages[0].list[j].parameters[0].split(/,/)[0] == "Checkpoint"
return 1
end
if @map.events.pages[0].list[j].parameters[0].split(/,/)[0] == "TotallyFixed"
return 3
end
if @map.events.pages[0].list[j].parameters[0].split(/,/)[0] == "Fixed"
return 2
end
if @map.events.pages[0].list[j].parameters[0].split(/,/)[0] == "WallFixture"
if @map.events.pages[0].list[j].parameters[0].split(/,/)[1] == nil
return 100
else
k = @map.events.pages[0].list[j].parameters[0].split(/,/)[1]
k = k.to_i
return 100+k
end
end
if @map.events.pages[0].list[j].parameters[0].split(/,/)[0] == "WallFixtureFixed"
if @map.events.pages[0].list[j].parameters[0].split(/,/)[1] == nil
return 200
else
k = @map.events.pages[0].list[j].parameters[0].split(/,/)[1]
k = k.to_i
return 200+k
end
end
end
return 0
end
def set_defeventpos(id,x,y)
if standable2?(x,y)
@map.events[id].x=x
@map.events[id].y=y
return
end
for i in 1..([@map.width,@map.height].max)
if standable2?(x,y+i)
@map.events[id].x=x
@map.events[id].y=y+i
return
end
for j in 1..i
if standable2?(x-j,y+i)
@map.events[id].x=x-j
@map.events[id].y=y+i
return
end
if standable2?(x+j,y+i)
@map.events[id].x=x+j
@map.events[id].y=y+i
return
end
if standable2?(x-j,y-i)
@map.events[id].x=x-j
@map.events[id].y=y-i
return
end
if standable2?(x+j,y-i)
@map.events[id].x=x+j
@map.events[id].y=y-i
return
end
end
end
end
def set_defeventpos_wall(id,x,y,p4)
if standable3?(x,y,p4)
@map.events[id].x=x
@map.events[id].y=y
return
end
for i in 1..([@map.width,@map.height].max)
if standable3?(x,y+i,p4)
@map.events[id].x=x
@map.events[id].y=y+i
return
end
for j in 1..i
if standable3?(x-j,y+i,p4)
@map.events[id].x=x-j
@map.events[id].y=y+i
return
end
if standable3?(x+j,y+i,p4)
@map.events[id].x=x+j
@map.events[id].y=y+i
return
end
if standable3?(x-j,y-i,p4)
@map.events[id].x=x-j
@map.events[id].y=y-i
return
end
if standable3?(x+j,y-i,p4)
@map.events[id].x=x+j
@map.events[id].y=y-i
return
end
end
end
end
def playerpos_reset(x,y)
if standable?(x,y)
$game_temp.player_new_x=x
$game_temp.player_new_y=y
return
end
for i in 1..([@map.width,@map.height].max)
if standable?(x,y+i)
$game_temp.player_new_x=x
$game_temp.player_new_y=y+i
return
end
for j in 0..i
if standable?(x-j,y+i)
$game_temp.player_new_x=x-j
$game_temp.player_new_y=y+i
return
end
if standable?(x+j,y+i)
$game_temp.player_new_x=x+j
$game_temp.player_new_y=y+i
return
end
if standable?(x-j,y-i)
$game_temp.player_new_x=x-j
$game_temp.player_new_y=y-i
return
end
if standable?(x+j,y-i)
$game_temp.player_new_x=x+j
$game_temp.player_new_y=y-i
return
end
end
end
end
def standable_newtile?(p1,p2)
for i in [2, 1, 0]
tile_id = @tilesetting[p1, p2, i]
if tile_id == nil
return false
elsif @passages[tile_id] & 0x0f == 0x0f
return false
elsif @priorities[tile_id] == 0
return true
end
end
return true
end
def standable?(p1,p2)
if @heightdata[p1,p2] != 0
return false
end
if @oneventdata[p1,p2] ==1
return false
end
for i in [2, 1, 0]
tile_id = @map.data[p1, p2, i]
if tile_id == nil
return false
elsif @passages[tile_id] & 0x0f == 0x0f
return false
elsif @priorities[tile_id] == 0
return true
end
end
return true
end
def standable2?(p1,p2)
unless standable?(p1,p2)
return false
end
if standable?(p1+1,p2-1) == false or
standable?(p1+1,p2) == false or
standable?(p1+1,p2+1) == false
if standable?(p1-1,p2-1) == false or
standable?(p1-1,p2) == false or
standable?(p1-1,p2+1) == false
if standable?(p1,p2-1) == true and
standable?(p1,p2+1) == true
return false
end
end
end
if standable?(p1+1,p2+1) == false or
standable?(p1,p2+1) == false or
standable?(p1-1,p2+1) == false
if standable?(p1+1,p2-1) == false or
standable?(p1,p2-1) == false or
standable?(p1-1,p2-1) == false
if standable?(p1-1,p2) == true and
standable?(p1+1,p2) == true
return false
end
end
end
if standable?(p1,p2-1) == false and
(standable?(p1-1,p2+1) == false or
standable?(p1,p2+1) == false or
standable?(p1+1,p2+1) == false)
return false
end
if standable?(p1,p2+1) == false and
(standable?(p1-1,p2-1) == false or
standable?(p1+1,p2-1) == false or
standable?(p1+1,p2-1) == false)
return false
end
if standable?(p1-1,p2) == false and
(standable?(p1+1,p2-1) == false or
standable?(p1+1,p2) == false or
standable?(p1+1,p2+1) == false)
return false
end
if standable?(p1+1,p2) == false and
(standable?(p1-1,p2-1) == false or
standable?(p1-1,p2) == false or
standable?(p1-1,p2+1) == false)
return false
end
return true
end
def standable3?(p1,p2,p3)
unless standable?(p1,p2+1)
return false
end
if @oneventdata[p1,p2] == 1 or
@oneventdata[p1,p2-1] == 1 or
@heightdata[p1,p2-2] != 1 or
@heightdata[p1,p2-1] == 1 or
@heightdata[p1,p2+1] != 0
return false
end
for i in 1...p3+1
if@heightdata[p1+i,p2-2] != 1 or
@heightdata[p1+i,p2-1] == 1 or
@heightdata[p1+i,p2+1] != 0
return false
end
if@heightdata[p1-i,p2-2] != 1 or
@heightdata[p1-i,p2-1] == 1 or
@heightdata[p1-i,p2+1] != 0
return false
end
end
for i in 1...p3+1
if @oneventdata[p1+i,p2] == 1 or
@oneventdata[p1+i,p2-1] == 1
return false
end
if @oneventdata[p1-i,p2] == 1 or
@oneventdata[p1-i,p2-1] == 1
return false
end
end
return true
end
def valid?(x, y)
return (x >= 0 and x < @map.width and y >= 0 and y < @map.height)
end
def set_mapdata_obj(p1,p2,p3,p4,p5 = 0)
# checks for:
# X - - - - X - X - - - -
# - O - - O - - O - X O X
# - - X X - - - X - - - -
# where the object would block the way
if (!standable?(p1-1,p2-1)) &&
(!standable?(p1+1,p2+1))
return false
end
if (!standable?(p1+1,p2-1)) &&
(!standable?(p1-1,p2+1))
return false
end
if (!standable?(p1,p2-1)) &&
(!standable?(p1,p2+1))
return false
end
if (!standable?(p1-1,p2)) &&
(!standable?(p1+1,p2))
return false
end
return set_mapdata(p1,p2,p3,p4,p5)
end
def set_mapdata(p1,p2,p3,p4,p5 = 0)
unless self.valid?(p1, p2)
return false
end
if @tilesetting[p3,p4,0] != 0
@map.data[p1,p2,0] = @tilesetting[p3,p4,0]
return true
end
case p5
when 0
if @tilesetting[p3,p4,1] != 0
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
return true
end
if @tilesetting[p3,p4,2] != 0
@map.data[p1,p2,2] = @tilesetting[p3,p4,2]
return true
end
when 1
if @tilesetting[p3,p4,1] != 0
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
return true
end
when 2
if @tilesetting[p3,p4,1] != 0
@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
return true
end
when 3
if @tilesetting[p3,p4,1] != 0
if @map.data[p1,p2,1] != 0
@map.data[p1,p2,2] = @map.data[p1,p2,1]
end
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
return true
end
when 4
if @tilesetting[p3,p4,1] != 0
if @map.data[p1,p2,2] != 0
@map.data[p1,p2,1] = @map.data[p1,p2,2]
end
@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
return true
end
when 5
if @tilesetting[p3,p4,1] != 0
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
return true
end
if @tilesetting[p3,p4,1] != 0
@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
return true
end
when 6
if @map.data[p1,p2,1] == 0
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
return true
elsif @map.data[p1,p2,2] == 0
@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
return true
end
end
return false
end
def set_mapdata2(p1,p2,p3,p4)
@map.data[p1,p2,0] = @tilesetting[p3,p4,0]
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
@map.data[p1,p2,2] = @tilesetting[p3,p4,2]
end
def set_height(p1,p2,p3)
return if p1<0
return if p1>[email protected]
return if p2<0
return if p2>[email protected]
@heightdata[p1,p2]=p3
end
def set_grounddata(p1,p2,p3)
return if p1<0
return if p1>[email protected]
return if p2<0
return if p2>[email protected]
if @masksetting[@maskdata[p1,p2]] == true
if @targettype==0
if @chgtype==0
@heightdata[p1,p2]=p3
elsif @chgtype==1
@heightdata[p1,p2]+=p3
end
elsif @targettype==1
if @chgtype==0
@maskdata[p1,p2]=p3
elsif @chgtype==1
@maskdata[p1,p2]+=p3
end
end
end
end
def rndmap_chtarget(p1,p2)
@targettype=p1
@chgtype=p2
end
def rndmap_setstat(p1,p2,p3,p4)
@minx=p1
@miny=p2
@maxx=p3
@maxy=p4
end
def rndmap_chmask(p1,p2)
if p1>=0
if p2==0
@masksetting[p1]=false
elsif p2 == 1
@masksetting[p1]=true
elsif p2 == 2
for i in 0...100
@masksetting=false
end
@masksetting[p1]=true
end
end
if p1==-1
if p2==0
for i in 0...100
@masksetting=false
end
else
for i in 0...100
@masksetting=true
end
end
end
end
def rndmap_mkroad(p1,p2,p3,p4,p5 = 5)
p5 = 5 if p5 == nil
localdata = Table.new(@map.width,@map.height)
aposx = []
aposy = []
aflag = []
for i in [email protected]
for j in [email protected]
localdata[i,j] = 0
end
end
if p2<0
p2=(p2*-1)*@map.width*@map.height/40/40
end
aposx[0]=@minx
aposy[0]=@miny
aposx[1]=@maxx
aposy[1]=@maxy
if aposx[0]<0
aposx[0][email protected]+aposx[0]
end
if (aposx[0]>=1000) and (aposx[0]<=1100)
aposx[0][email protected]*(aposx[0]-1000)/100
end
if aposy[0]<0
aposy[0][email protected]+aposy[0]
end
if (aposy[0]>=1000) and (aposy[0]<=1100)
aposy[0][email protected]*(aposy[0]-1000)/100
end
if aposx[1]<0
aposx[1][email protected]+aposx[1]
end
if (aposx[1]>=1000) and (aposx[1]<=1100)
aposx[1][email protected]*(aposx[1]-1000)/100
end
if aposy[1]<0
aposy[1][email protected]+aposy[1]
end
if (aposy[1]>=1000) and (aposy[1]<=1100)
aposy[1][email protected]*(aposy[1]-1000)/100
end
if p4==0 or p4==1 or p4==2
if p4 == 2
i4 = rand(2)
end
aflag[0] = true
aflag[1] = false
for i in 2...(p2+2)
aposx = rand(@map.width-p3*2) + p3
aposy = rand(@map.height-p3*2) + p3
aflag = false
end
i3=0
i1=aposx[i3]
i2=aposy[i3]
localdata[i1,i2] = 1
for i in 0...p2+2
i7=5000000
for j in 0...p2+2
if aflag[j] == false
i4 = aposx[j]-i1
i4=i4*-1 if i4 < 0
i5 = aposy[j]-i2
i5=i5*-1 if i5 < 0
if (i4**2+i5**2) <=(p5**2) and j != 1
aflag[j] = true
elsif i7 > (i4**2+i5**2)
i7=(i4**2+i5**2)
i6=j
end
end
end
if p4==0
if aposx[i3] > aposx[i6]
i8 = aposx[i3]
i9 = aposy[i3]
i10 = aposx[i6]
i11 = aposy[i6]
else
i8 = aposx[i6]
i9 = aposy[i6]
i10 = aposx[i3]
i11 = aposy[i3]
end
if i8!=i10
for i in 0..(i8-i10)
localdata[i+i10,(i9-i11)*i/(i8-i10)+i11] = 1
end
end
if aposy[i3] > aposy[i6]
i8 = aposx[i3]
i9 = aposy[i3]
i10 = aposx[i6]
i11 = aposy[i6]
else
i8 = aposx[i6]
i9 = aposy[i6]
i10 = aposx[i3]
i11 = aposy[i3]
end
if i9!=i11
for i in 0..(i9-i11)
localdata[(i8-i10)*i/(i9-i11)+i10,i+i11] = 1
end
end
end
if p4==1
i4 = rand(2)
if i4==0
for i in 0..([aposx[i3]-aposx[i6],aposx[i6]-aposx[i3]].max)
localdata[i+[aposx[i3],aposx[i6]].min,aposy[i3]] = 1
end
for i in 0..([aposy[i3]-aposy[i6],aposy[i6]-aposy[i3]].max)
localdata[aposx[i6],i+[aposy[i3],aposy[i6]].min] = 1
end
else
for i in 0..([aposx[i3]-aposx[i6],aposx[i6]-aposx[i3]].max)
localdata[i+[aposx[i3],aposx[i6]].min,aposy[i6]] = 1
end
for i in 0..([aposy[i3]-aposy[i6],aposy[i6]-aposy[i3]].max)
localdata[aposx[i3],i+[aposy[i3],aposy[i6]].min] = 1
end
end
end
i3=i6
i1=aposx[i3]
i2=aposy[i3]
aflag[i3]=true
if i3==1
break
end
end
end
for i in [email protected]
for j in [email protected]
if localdata[i,j] == 1
set_grounddata(i,j,p1)
end
end
end
end
def rndmap_plus(p1,p2,p3,p4)
localdata = Table.new(@map.width,@map.height)
for i in [email protected]
for j in [email protected]
if @targettype==0
localdata[i,j] = @heightdata[i,j]
elsif @targettype==1
localdata[i,j] = @maskdata[i,j]
end
end
end
if p4 == 0
for i in [email protected]
for j in [email protected]
if p1==localdata[i,j]
for k in 1..p2
set_grounddata(i+k,j,p1)
set_grounddata(i-k,j,p1)
end
for k in 1..p3
set_grounddata(i,j+k,p1)
set_grounddata(i,j-k,p1)
end
end
end
end
elsif p4 == 1
for i in [email protected]
for j in [email protected]
if p1==localdata[i,j]
for k in (i-p2)..(i+p2)
for l in (j-p3)..(j+p3)
set_grounddata(k,l,p1)
end
end
end
end
end
end
end
def rndmap_allchg(p1)
for i in [email protected]
for j in [email protected]
set_grounddata(i,j,p1)
end
end
end
def rndmap_putpos(p1,p2,p3)
i = rand(@maxx-@minx+1)+@minx
j = rand(@maxy-@miny+1)+@miny
for k in (p2-i)..(p2+i)
for l in (p3-j)..(p3+j)
set_grounddata(k,l,p1)
end
end
end
def rndmap_edge(p1)
for i in [email protected]
set_grounddata(i,0,p1)
set_grounddata(i,@map.height-1,p1)
end
for i in [email protected]
set_grounddata(0,i,p1)
set_grounddata(@map.width-1,i,p1)
end
end
end
module RPG
class MapInfo
def name
name = @name.split(/,/)[0]
return name != nil ? name : ''
end
def subname(i = 1)
name = @name.split(/,/)
return name != nil ? name : ""
end
end
end
module RPG
class Event
def name
name = @name.split(/,/)[0]
return name != nil ? name : ''
end
def subname(i = 1)
name = @name.split(/,/)
return name != nil ? name : ""
end
end
end
Random Map Script, by "tonbi", adapted by Peter O.
--------------------
Names of random maps have the following syntax:
[MapName],Random,[Type],[ObjCnt],[Connect]
MapName - Name of the map
Type - Map type:
0 - 2 layers, natural
1 - 2 layers, artificial
2 - 2 layers, natural, convex
3 - 2 layers, artificial, convex
4 - 2 layers, natural, hole/land/wall
5 - 2 layers, artificial, hole/land/wall
6 - 2 layers, natural, hole/land/wall
7 - 2 layers, artificial, hole/land/wall
ObjCnt - Density of objects on the map. Generally a number divisible by 100.
Connect - If this is equal to "false", the parts of the generated map can be disjoint.
This setting is optional.
------------------
In addition, the tiles used in the random map must be arranged in a certain way, depending
on the map type; please see the Random Map Sample for details:
https://www.mc.ccnw.ne.jp/sarada/toshi/down/RandomMapSample.exe
------------------
Each event on the map can be marked with these features.
Checkpoint - There will always be ground wherever this event is placed.
Thus, this event can serve to influence the shape of the generated map.
To Use: Name the event "MyEvent,Checkpoint" or use a Comment event
command consisting of the text "Checkpoint". ("MyEvent" is arbitrary.)
Fixed - This event will appear at a ground tile next to where this event is located.
To Use: Name the event "MyEvent,Fixed" or use a Comment event
command consisting of the text "Fixed". ("MyEvent" is arbitrary.)
TotallyFixed - This event will always remain at its position defined on the map.
To Use: Name the event "MyEvent,TotallyFixed" or use a Comment event
command consisting of the text "TotallyFixed". ("MyEvent" is arbitrary.)
WallFixture - Appears attached to a wall. May be followed by a comma and either
1 or 0 (0 means the object takes 1 tile space; 1 means 3 tiles).
To Use: Use a Comment event command consisting of the text "WallFixture,1"
WallFixtureFixed - Appears attached to a wall next to where this event is located.
May be followed by a comma and either 1 or 0 (0 means the object takes 1 tile space;
1 means 3 tiles).
To Use: Use a Comment event command consisting of the text "WallFixture,1"
Events without these features will be placed at a random spot on the generated map.
-------------------
=end
Events.onMapCreate+=proc {|sender, e|
mapID=e[0]
map=e[1]
tileset=e[2]
mapinfo = pbLoadRxData("Data/MapInfos")
next if !mapinfo[mapID]
if mapinfo[mapID].subname == "Random"
if mapinfo[mapID].subname(3)=="" or mapinfo[mapID].subname(3) == nil
p3 = 0
else
p3 = mapinfo[mapID].subname(3).to_i
end
if mapinfo[mapID].subname(4)=="false"
p4 = false
end
if map && tileset
generator=MapGenerator.new(map,tileset.passages,tileset.priorities)
generator.make_random_map(2,mapinfo[mapID].subname(2).to_i,p3,p4)
end
end
}
class MapGenerator
def initialize(map, passages, priorities)
@map=map
@passages=passages
@priorities=priorities
end
def mapBorder
for x in [email protected]
for y in [email protected]
if x<7 || y<6 || x>[email protected] || y>[email protected]
@heightdata[x,y] = 1
end
end
end
end
def make_random_map(wall = 2, type = 0, objcnt = 0, connect = true)
wall = 0 if wall == nil
type = 0 if type == nil
objcnt = 0 if objcnt == nil
unless objcnt.is_a?(Numeric)
objcnt = 0
end
if objcnt < 0
objcnt = 0
end
connect = true if connect != false
@heightdata = Table.new(@map.width,@map.height)
@maskdata = Table.new(@map.width,@map.height)
@oneventdata = Table.new(@map.width,@map.height)
@masksetting = []
@makedata = []
@targettype=0
@chgtype=0
time = -1
for i in [email protected]
for j in [email protected]
time += 1
if time%2000 == 0
Graphics.update
end
@heightdata[i,j] = 0
@maskdata[i,j] = 0
end
end
for i in 0...100
@masksetting = true
end
needposx = []
needposy = []
for i in @map.events.keys.sort
time += 1
if time%200 == 0
Graphics.update
end
if event_settype(i) == 1
if connect == true
needposx.push(@map.events.x)
needposy.push(@map.events.y)
needposx.push(@map.events.x)
needposy.push(@map.events.y)
else
needposx.push(@map.events.x)
needposy.push(@map.events.y)
end
end
end
if connect == true
needposx.shift
needposy.shift
end
loop do
if needposx.size <= 2
needposx.push(rand(@map.width))
needposy.push(rand(@map.height))
else
break
end
end
case type
when 0
@makedata.push([0,1,0])
@makedata.push([5,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,0,-15,4,0])
@makedata.push([1,1,1,1,1])
@makedata.push([6,0,needposx[i*2],needposy[i*2]])
@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,0,1,1,1])
@makedata.push([4,0,1,1,1])
@makedata.push([4,1,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,0])
@makedata.push([2,1,2])
@makedata.push([5,1])
when 1
@makedata.push([0,1,0])
@makedata.push([5,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,0,-6,4,1,10])
@makedata.push([1,1,1,1,1])
@makedata.push([6,0,needposx[i*2],needposy[i*2]])
@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,0,2,3,1])
@makedata.push([4,1,2,2,1])
@makedata.push([4,0,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,0])
@makedata.push([2,1,2])
@makedata.push([5,1])
when 2
@makedata.push([0,1,0])
@makedata.push([5,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,0,-15,4,0])
@makedata.push([1,1,1,1,1])
@makedata.push([6,0,needposx[i*2],needposy[i*2]])
@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,0,2,2,1])
@makedata.push([4,1,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,0])
@makedata.push([2,1,2])
@makedata.push([5,-1])
when 3
@makedata.push([0,1,0])
@makedata.push([5,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,0,-15,4,1,10])
@makedata.push([1,1,1,1,1])
@makedata.push([6,0,needposx[i*2],needposy[i*2]])
@makedata.push([6,0,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,0,2,2,1])
@makedata.push([4,1,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,0])
@makedata.push([2,1,2])
@makedata.push([5,-1])
when 4
@makedata.push([0,1,0])
@makedata.push([5,0])
@makedata.push([1,0,0,-1,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,0,-1,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,-1,0,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,0,-1,0,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([4,2,2,2,1])
for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
@makedata.push([1,3,3,8,8])
@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
end
@makedata.push([7,2])
@makedata.push([4,2,1,1,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,1,-8,4,0,5])
@makedata.push([1,1,1,1,1])
@makedata.push([6,1,needposx[i*2],needposy[i*2]])
@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,1,1,1,1])
@makedata.push([4,1,0,1,1])
@makedata.push([2,0,0])
@makedata.push([4,1,1,0,1])
@makedata.push([2,-1,1])
@makedata.push([4,2,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,-1])
@makedata.push([2,1,2])
@makedata.push([5,0])
@makedata.push([2,2,2])
@makedata.push([5,1])
when 5
@makedata.push([0,1,0])
@makedata.push([5,0])
@makedata.push([1,0,0,-1,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,0,-1,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,-1,0,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,0,-1,0,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([4,2,2,2,1])
for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
@makedata.push([1,3,3,8,8])
@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
end
@makedata.push([7,2])
@makedata.push([4,2,1,1,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,1,-8,4,1,5])
@makedata.push([1,1,1,1,1])
@makedata.push([6,1,needposx[i*2],needposy[i*2]])
@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,1,1,1,1])
@makedata.push([4,1,0,1,1])
@makedata.push([2,0,0])
@makedata.push([4,1,1,0,1])
@makedata.push([2,-1,1])
@makedata.push([4,2,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,-1])
@makedata.push([2,1,2])
@makedata.push([5,0])
@makedata.push([2,2,2])
@makedata.push([5,1])
when 6
@makedata.push([0,1,0])
@makedata.push([5,0])
@makedata.push([1,0,0,-1,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,0,-1,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,-1,0,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,0,-1,0,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([4,2,2,2,1])
for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
@makedata.push([1,1,1,3,3])
@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
end
@makedata.push([4,0,2,2,0])
@makedata.push([4,0,1,2,1])
@makedata.push([7,2])
@makedata.push([4,2,1,1,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,1,-15,4,0,5])
@makedata.push([1,1,1,1,1])
@makedata.push([6,1,needposx[i*2],needposy[i*2]])
@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,1,1,1,1])
@makedata.push([4,1,0,1,1])
@makedata.push([2,0,0])
@makedata.push([4,1,1,0,1])
@makedata.push([2,-1,1])
@makedata.push([4,2,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,-1])
@makedata.push([2,1,2])
@makedata.push([5,0])
@makedata.push([2,2,2])
@makedata.push([5,1])
when 7
@makedata.push([0,1,0])
@makedata.push([5,0])
@makedata.push([1,0,0,-1,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,0,-1,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,-1,-1,0,-1])
@makedata.push([3,2,-6,1,0])
@makedata.push([1,0,-1,0,0])
@makedata.push([3,2,-6,1,0])
@makedata.push([4,2,2,2,1])
for i in 0...(rand(12*@map.width*@map.height/40/40)+(5*@map.width*@map.height/40/40))
@makedata.push([1,1,1,3,3])
@makedata.push([6,0,rand(@map.width-10)+5,rand(@map.height-10)+5])
end
@makedata.push([4,0,2,2,0])
@makedata.push([4,0,1,2,1])
@makedata.push([7,2])
@makedata.push([4,2,1,1,1])
for i in 0...(needposx.size/2)
@makedata.push([1,needposx[i*2],needposy[i*2],needposx[i*2+1],needposy[i*2+1]])
@makedata.push([3,1,-15,4,1,5])
@makedata.push([1,1,1,1,1])
@makedata.push([6,1,needposx[i*2],needposy[i*2]])
@makedata.push([6,1,needposx[i*2+1],needposy[i*2+1]])
end
@makedata.push([4,1,1,1,1])
@makedata.push([4,1,0,1,1])
@makedata.push([2,0,0])
@makedata.push([4,1,1,0,1])
@makedata.push([2,-1,1])
@makedata.push([4,2,1,1,1])
@makedata.push([0,0,0])
@makedata.push([2,0,2])
@makedata.push([5,-1])
@makedata.push([2,1,2])
@makedata.push([5,0])
@makedata.push([2,2,2])
@makedata.push([5,1])
end
for make_stat in @makedata
time += 1
if time%2 == 0
Graphics.update
end
case make_stat[0]
when 0
rndmap_chtarget(make_stat[1],make_stat[2])
when 1
rndmap_setstat(make_stat[1],make_stat[2],make_stat[3],make_stat[4])
when 2
rndmap_chmask(make_stat[1],make_stat[2])
when 3
rndmap_mkroad(make_stat[1],make_stat[2],make_stat[3],make_stat[4],make_stat[5])
when 4
rndmap_plus(make_stat[1],make_stat[2],make_stat[3],make_stat[4])
when 5
rndmap_allchg(make_stat[1])
when 6
rndmap_putpos(make_stat[1],make_stat[2],make_stat[3])
when 7
rndmap_edge(make_stat[1])
end
end
@tilesetting = Table.new(3,40,3)
for i in [0,1,2]
for k in 0...40
for j in [0,1,2]
@tilesetting[j,k,i] = @map.data[j,k,i]
end
end
end
time = 0
for k in [email protected]
for j in [email protected]
time += 1
if time%500 == 0
Graphics.update
end
if @heightdata[j,k] == 1
if @heightdata[j,k+1]==-1
@heightdata[j,k+1] = 0
if @heightdata[j,k+2]==-1 and
@heightdata[j,k+3] == 0
@heightdata[j,k+2] = 0
end
end
end
end
end
time = 0
for k in [email protected]
for j in [email protected]
time += 1
if time%500 == 0
Graphics.update
end
if @heightdata[j,k] == 0
if @heightdata[j,k+1] == -1 or
@heightdata[j,k-1] == -1 or
@heightdata[j+1,k] == -1 or
@heightdata[j-1,k] == -1
set_mapdata2(j,k,0,8)
else
set_mapdata2(j,k,0,0)
end
elsif @heightdata[j,k] == 1
if @heightdata[j,k+1] == -1 or
@heightdata[j,k-1] == -1 or
@heightdata[j+1,k] == -1 or
@heightdata[j-1,k] == -1
set_mapdata2(j,k,0,8)
elsif @heightdata[j,k+1] == 0 or
@heightdata[j,k-1] == 0 or
@heightdata[j+1,k] == 0 or
@heightdata[j-1,k] == 0
set_mapdata2(j,k,0,0)
else
set_mapdata2(j,k,1,4)
end
else
set_mapdata2(j,k,0,8)
end
end
end
time = 0
for k in [email protected]
for j in [email protected]
time += 1
if time%500 == 0
Graphics.update
end
if @heightdata[j,k] == 0
if @heightdata[j,k+1] == -1
if @heightdata[j-1,k] == -1
for i in [0,1,2]
set_mapdata(j,k+i,0,13+i,1)
end
elsif @heightdata[j+1,k] == -1
for i in [0,1,2]
set_mapdata(j,k+i,2,13+i,1)
end
else
for i in [0,1,2]
set_mapdata(j,k+i,1,13+i,1)
end
end
elsif @heightdata[j,k-1] == -1
if @heightdata[j-1,k] == -1 or
(@heightdata[j-1,k] == 1 and
@heightdata[j-1,k-1] == -1)
set_mapdata(j,k,0,11,2)
elsif @heightdata[j+1,k] == -1 or
(@heightdata[j+1,k] == 1 and
@heightdata[j+1,k-1] == -1)
set_mapdata(j,k,2,11,2)
else
set_mapdata(j,k,1,11,2)
end
elsif @heightdata[j-1,k] == -1 or
(@heightdata[j-1,k] == 1 and
@heightdata[j-1,k-1] == -1)
set_mapdata(j,k,0,12,1)
elsif @heightdata[j+1,k] == -1 or
(@heightdata[j+1,k] == 1 and
@heightdata[j+1,k-1] == -1)
set_mapdata(j,k,2,12,1)
elsif @heightdata[j-1,k-1] == -1
set_mapdata(j,k,0,9,1)
elsif @heightdata[j-1,k+1] == -1
set_mapdata(j,k,0,10,1)
elsif @heightdata[j+1,k-1] == -1
set_mapdata(j,k,1,9,1)
elsif @heightdata[j+1,k+1] == -1
set_mapdata(j,k,1,10,1)
end
end
if @heightdata[j,k] == 1 and
@heightdata[j,k-1] != -1
if @heightdata[j,k+1] == -1
if @heightdata[j-1,k] == -1
for i in [0,1,2]
end
elsif @heightdata[j+1,k] == -1
for i in [0,1,2]
end
else
for i in [0,1,2]
end
end
elsif @heightdata[j,k-1] == -1
if @heightdata[j-1,k] == -1
set_mapdata(j,k,0,11,2)
elsif @heightdata[j+1,k] == -1
set_mapdata(j,k,2,11,2)
else
set_mapdata(j,k,1,11,2)
end
elsif @heightdata[j-1,k] == -1
set_mapdata(j,k,0,12,1)
elsif @heightdata[j+1,k] == -1
set_mapdata(j,k,2,12,1)
elsif @heightdata[j-1,k-1] == -1
set_mapdata(j,k,0,9,1)
elsif @heightdata[j-1,k+1] == -1
set_mapdata(j,k,0,10,1)
elsif @heightdata[j+1,k-1] == -1
set_mapdata(j,k,1,9,1)
elsif @heightdata[j+1,k+1] == -1
set_mapdata(j,k,1,10,1)
end
end
end
end
time = 0
for k in [email protected]
for j in [email protected]
time += 1
if time%500 == 0
Graphics.update
end
if @heightdata[j,k] == 1
if @heightdata[j,k+1] == 0 or
@heightdata[j,k+1] == -1
if @heightdata[j-1,k] == 0 or
@heightdata[j-1,k] == -1
set_mapdata(j,k+0,0,5+0,5)
set_mapdata(j,k+1,0,5+1,5)
set_mapdata(j,k+2,0,5+2,4)
if @heightdata[j,k+3] != 0 and
@heightdata[j,k+2] != 1 and
(@heightdata[j,k+2] != 0 or @heightdata[j-1,k+2] != 0)
set_mapdata(j,k+2,0,16,5)
for i in [0,1]
set_mapdata(j,k+3+i,0,14+i,1)
if @heightdata[j,k+3+i] != -1
break
end
end
end
elsif @heightdata[j+1,k] == 0 or
@heightdata[j+1,k] == -1
set_mapdata(j,k+0,2,5+0,5)
set_mapdata(j,k+1,2,5+1,5)
set_mapdata(j,k+2,2,5+2,4)
if @heightdata[j,k+3] != 0 and
@heightdata[j,k+2] != 1 and
(@heightdata[j,k+2] != 0 or @heightdata[j+1,k+2] != 0)
set_mapdata(j,k+2,2,16,5)
for i in [0,1]
set_mapdata(j,k+3+i,2,14+i,1)
if @heightdata[j,k+3+i] != -1
break
end
end
end
else
set_mapdata(j,k+0,1,5+0,5)
set_mapdata(j,k+1,1,5+1,5)
set_mapdata(j,k+2,1,5+2,4)
if @heightdata[j,k+3] != 0 and
@heightdata[j,k+2] != 1
set_mapdata(j,k+2,1,16,5)
for i in [0,1]
set_mapdata(j,k+3+i,1,14+i,1)
if @heightdata[j,k+3+i] != -1
break
end
end
end
end
elsif @heightdata[j,k-1] == 0 or
@heightdata[j,k-1] == -1
if @heightdata[j-1,k] == 0 or
@heightdata[j-1,k] == -1
set_mapdata(j,k,0,3,4)
elsif @heightdata[j+1,k] == 0 or
@heightdata[j+1,k] == -1
set_mapdata(j,k,2,3,4)
else
set_mapdata(j,k,1,3,4)
end
elsif @heightdata[j-1,k] == 0 or
@heightdata[j-1,k] == -1
set_mapdata(j,k,0,4,4)
elsif @heightdata[j+1,k] == 0 or
@heightdata[j+1,k] == -1
set_mapdata(j,k,2,4,4)
elsif @heightdata[j-1,k-1] == 0 or
@heightdata[j-1,k-1] == -1
set_mapdata(j,k,0,1,4)
elsif @heightdata[j-1,k+1] == 0 or
@heightdata[j-1,k+1] == -1
set_mapdata(j,k,0,2,4)
elsif @heightdata[j+1,k-1] == 0 or
@heightdata[j+1,k-1] == -1
set_mapdata(j,k,1,1,4)
elsif @heightdata[j+1,k+1] == 0 or
@heightdata[j+1,k+1] == -1
set_mapdata(j,k,1,2,4)
end
end
end
end
playerpos_reset($game_temp.player_new_x,$game_temp.player_new_y)
@oneventdata[$game_temp.player_new_x,$game_temp.player_new_y] = 1
time = 0
for i in @map.events.keys.sort
time += 1
if time%100 == 0
Graphics.update
end
case event_settype(i)
when 3
@oneventdata[@map.events.x,@map.events.y] = 1
end
end
for i in @map.events.keys.sort
time += 1
if time%100 == 0
Graphics.update
end
case event_settype(i)
when 1
set_defeventpos(i,@map.events.x,@map.events.y)
@oneventdata[@map.events.x,@map.events.y] = 1
end
end
for i in @map.events.keys.sort
time += 1
if time%100 == 0
Graphics.update
end
j = event_settype(i)
case j
when 0
set_defeventpos(i,rand(@map.width-4)+2,rand(@map.width-4)+2)
@oneventdata[@map.events.x,@map.events.y] = 1
when 2
set_defeventpos(i,@map.events.x,@map.events.y)
@oneventdata[@map.events.x,@map.events.y] = 1
when 100..199
set_defeventpos_wall(i,rand(@map.width-4)+2,rand(@map.width-4)+2,j-100)
@oneventdata[@map.events.x,@map.events.y] = 1
@oneventdata[@map.events.x,@map.events.y-1] = 1
for k in 1..(j-100)
@oneventdata[@map.events.x+k,@map.events.y] = 1
@oneventdata[@map.events.x+k,@map.events.y-1] = 1
@oneventdata[@map.events.x-k,@map.events.y] = 1
@oneventdata[@map.events.x-k,@map.events.y-1] = 1
end
when 200..299
set_defeventpos_wall(i,@map.events.x,@map.events.y,j-200)
@oneventdata[@map.events.x,@map.events.y] = 1
@oneventdata[@map.events.x,@map.events.y-1] = 1
for k in 1..(j-200)
@oneventdata[@map.events.x+k,@map.events.y] = 1
@oneventdata[@map.events.x+k,@map.events.y-1] = 1
@oneventdata[@map.events.x-k,@map.events.y] = 1
@oneventdata[@map.events.x-k,@map.events.y-1] = 1
end
end
end
for i in 0...(rand(objcnt)+objcnt/2)
time += 1
if time%500 == 0
Graphics.update
end
j = rand([@map.width,@map.height].max)
k = rand([@map.width,@map.height].max)
case rand(10)
when 0..4
if standable_newtile?(1,0)
if standable?(j,k)
set_mapdata_obj(j,k,1,0,6)
end
else
if standable2?(j,k)
set_mapdata_obj(j,k,1,0,6)
end
end
when 5..7
if standable_newtile?(2,0)
if standable?(j,k)
set_mapdata_obj(j,k,2,0,6)
end
else
if standable2?(j,k)
set_mapdata_obj(j,k,2,0,6)
end
end
when 8..9
if standable2?(j,k)
if @map.data[j,k-1,2]==0 and
(@map.data[j,k,1]==0 or @map.data[j,k,2]==0)
if set_mapdata_obj(j,k,2,2,4)
set_mapdata(j,k-1,2,1,4)
end
end
end
end
end
@heightdata.resize(0,0)
@maskdata.resize(0,0)
@oneventdata.resize(0,0)
@masksetting.clear
@makedata.clear
@tilesetting.resize(0,0,0)
end
def event_settype(i)
if @map.events.subname == "Checkpoint"
return 1
end
if @map.events.subname == "Fixed"
return 2
end
if @map.events.subname == "TotallyFixed"
return 3
end
for j in 0..1000
if @map.events.pages[0].list[j].code != 108
break
end
if @map.events.pages[0].list[j].parameters[0].split(/,/)[0] == "Checkpoint"
return 1
end
if @map.events.pages[0].list[j].parameters[0].split(/,/)[0] == "TotallyFixed"
return 3
end
if @map.events.pages[0].list[j].parameters[0].split(/,/)[0] == "Fixed"
return 2
end
if @map.events.pages[0].list[j].parameters[0].split(/,/)[0] == "WallFixture"
if @map.events.pages[0].list[j].parameters[0].split(/,/)[1] == nil
return 100
else
k = @map.events.pages[0].list[j].parameters[0].split(/,/)[1]
k = k.to_i
return 100+k
end
end
if @map.events.pages[0].list[j].parameters[0].split(/,/)[0] == "WallFixtureFixed"
if @map.events.pages[0].list[j].parameters[0].split(/,/)[1] == nil
return 200
else
k = @map.events.pages[0].list[j].parameters[0].split(/,/)[1]
k = k.to_i
return 200+k
end
end
end
return 0
end
def set_defeventpos(id,x,y)
if standable2?(x,y)
@map.events[id].x=x
@map.events[id].y=y
return
end
for i in 1..([@map.width,@map.height].max)
if standable2?(x,y+i)
@map.events[id].x=x
@map.events[id].y=y+i
return
end
for j in 1..i
if standable2?(x-j,y+i)
@map.events[id].x=x-j
@map.events[id].y=y+i
return
end
if standable2?(x+j,y+i)
@map.events[id].x=x+j
@map.events[id].y=y+i
return
end
if standable2?(x-j,y-i)
@map.events[id].x=x-j
@map.events[id].y=y-i
return
end
if standable2?(x+j,y-i)
@map.events[id].x=x+j
@map.events[id].y=y-i
return
end
end
end
end
def set_defeventpos_wall(id,x,y,p4)
if standable3?(x,y,p4)
@map.events[id].x=x
@map.events[id].y=y
return
end
for i in 1..([@map.width,@map.height].max)
if standable3?(x,y+i,p4)
@map.events[id].x=x
@map.events[id].y=y+i
return
end
for j in 1..i
if standable3?(x-j,y+i,p4)
@map.events[id].x=x-j
@map.events[id].y=y+i
return
end
if standable3?(x+j,y+i,p4)
@map.events[id].x=x+j
@map.events[id].y=y+i
return
end
if standable3?(x-j,y-i,p4)
@map.events[id].x=x-j
@map.events[id].y=y-i
return
end
if standable3?(x+j,y-i,p4)
@map.events[id].x=x+j
@map.events[id].y=y-i
return
end
end
end
end
def playerpos_reset(x,y)
if standable?(x,y)
$game_temp.player_new_x=x
$game_temp.player_new_y=y
return
end
for i in 1..([@map.width,@map.height].max)
if standable?(x,y+i)
$game_temp.player_new_x=x
$game_temp.player_new_y=y+i
return
end
for j in 0..i
if standable?(x-j,y+i)
$game_temp.player_new_x=x-j
$game_temp.player_new_y=y+i
return
end
if standable?(x+j,y+i)
$game_temp.player_new_x=x+j
$game_temp.player_new_y=y+i
return
end
if standable?(x-j,y-i)
$game_temp.player_new_x=x-j
$game_temp.player_new_y=y-i
return
end
if standable?(x+j,y-i)
$game_temp.player_new_x=x+j
$game_temp.player_new_y=y-i
return
end
end
end
end
def standable_newtile?(p1,p2)
for i in [2, 1, 0]
tile_id = @tilesetting[p1, p2, i]
if tile_id == nil
return false
elsif @passages[tile_id] & 0x0f == 0x0f
return false
elsif @priorities[tile_id] == 0
return true
end
end
return true
end
def standable?(p1,p2)
if @heightdata[p1,p2] != 0
return false
end
if @oneventdata[p1,p2] ==1
return false
end
for i in [2, 1, 0]
tile_id = @map.data[p1, p2, i]
if tile_id == nil
return false
elsif @passages[tile_id] & 0x0f == 0x0f
return false
elsif @priorities[tile_id] == 0
return true
end
end
return true
end
def standable2?(p1,p2)
unless standable?(p1,p2)
return false
end
if standable?(p1+1,p2-1) == false or
standable?(p1+1,p2) == false or
standable?(p1+1,p2+1) == false
if standable?(p1-1,p2-1) == false or
standable?(p1-1,p2) == false or
standable?(p1-1,p2+1) == false
if standable?(p1,p2-1) == true and
standable?(p1,p2+1) == true
return false
end
end
end
if standable?(p1+1,p2+1) == false or
standable?(p1,p2+1) == false or
standable?(p1-1,p2+1) == false
if standable?(p1+1,p2-1) == false or
standable?(p1,p2-1) == false or
standable?(p1-1,p2-1) == false
if standable?(p1-1,p2) == true and
standable?(p1+1,p2) == true
return false
end
end
end
if standable?(p1,p2-1) == false and
(standable?(p1-1,p2+1) == false or
standable?(p1,p2+1) == false or
standable?(p1+1,p2+1) == false)
return false
end
if standable?(p1,p2+1) == false and
(standable?(p1-1,p2-1) == false or
standable?(p1+1,p2-1) == false or
standable?(p1+1,p2-1) == false)
return false
end
if standable?(p1-1,p2) == false and
(standable?(p1+1,p2-1) == false or
standable?(p1+1,p2) == false or
standable?(p1+1,p2+1) == false)
return false
end
if standable?(p1+1,p2) == false and
(standable?(p1-1,p2-1) == false or
standable?(p1-1,p2) == false or
standable?(p1-1,p2+1) == false)
return false
end
return true
end
def standable3?(p1,p2,p3)
unless standable?(p1,p2+1)
return false
end
if @oneventdata[p1,p2] == 1 or
@oneventdata[p1,p2-1] == 1 or
@heightdata[p1,p2-2] != 1 or
@heightdata[p1,p2-1] == 1 or
@heightdata[p1,p2+1] != 0
return false
end
for i in 1...p3+1
if@heightdata[p1+i,p2-2] != 1 or
@heightdata[p1+i,p2-1] == 1 or
@heightdata[p1+i,p2+1] != 0
return false
end
if@heightdata[p1-i,p2-2] != 1 or
@heightdata[p1-i,p2-1] == 1 or
@heightdata[p1-i,p2+1] != 0
return false
end
end
for i in 1...p3+1
if @oneventdata[p1+i,p2] == 1 or
@oneventdata[p1+i,p2-1] == 1
return false
end
if @oneventdata[p1-i,p2] == 1 or
@oneventdata[p1-i,p2-1] == 1
return false
end
end
return true
end
def valid?(x, y)
return (x >= 0 and x < @map.width and y >= 0 and y < @map.height)
end
def set_mapdata_obj(p1,p2,p3,p4,p5 = 0)
# checks for:
# X - - - - X - X - - - -
# - O - - O - - O - X O X
# - - X X - - - X - - - -
# where the object would block the way
if (!standable?(p1-1,p2-1)) &&
(!standable?(p1+1,p2+1))
return false
end
if (!standable?(p1+1,p2-1)) &&
(!standable?(p1-1,p2+1))
return false
end
if (!standable?(p1,p2-1)) &&
(!standable?(p1,p2+1))
return false
end
if (!standable?(p1-1,p2)) &&
(!standable?(p1+1,p2))
return false
end
return set_mapdata(p1,p2,p3,p4,p5)
end
def set_mapdata(p1,p2,p3,p4,p5 = 0)
unless self.valid?(p1, p2)
return false
end
if @tilesetting[p3,p4,0] != 0
@map.data[p1,p2,0] = @tilesetting[p3,p4,0]
return true
end
case p5
when 0
if @tilesetting[p3,p4,1] != 0
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
return true
end
if @tilesetting[p3,p4,2] != 0
@map.data[p1,p2,2] = @tilesetting[p3,p4,2]
return true
end
when 1
if @tilesetting[p3,p4,1] != 0
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
return true
end
when 2
if @tilesetting[p3,p4,1] != 0
@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
return true
end
when 3
if @tilesetting[p3,p4,1] != 0
if @map.data[p1,p2,1] != 0
@map.data[p1,p2,2] = @map.data[p1,p2,1]
end
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
return true
end
when 4
if @tilesetting[p3,p4,1] != 0
if @map.data[p1,p2,2] != 0
@map.data[p1,p2,1] = @map.data[p1,p2,2]
end
@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
return true
end
when 5
if @tilesetting[p3,p4,1] != 0
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
return true
end
if @tilesetting[p3,p4,1] != 0
@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
return true
end
when 6
if @map.data[p1,p2,1] == 0
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
return true
elsif @map.data[p1,p2,2] == 0
@map.data[p1,p2,2] = @tilesetting[p3,p4,1]
return true
end
end
return false
end
def set_mapdata2(p1,p2,p3,p4)
@map.data[p1,p2,0] = @tilesetting[p3,p4,0]
@map.data[p1,p2,1] = @tilesetting[p3,p4,1]
@map.data[p1,p2,2] = @tilesetting[p3,p4,2]
end
def set_height(p1,p2,p3)
return if p1<0
return if p1>[email protected]
return if p2<0
return if p2>[email protected]
@heightdata[p1,p2]=p3
end
def set_grounddata(p1,p2,p3)
return if p1<0
return if p1>[email protected]
return if p2<0
return if p2>[email protected]
if @masksetting[@maskdata[p1,p2]] == true
if @targettype==0
if @chgtype==0
@heightdata[p1,p2]=p3
elsif @chgtype==1
@heightdata[p1,p2]+=p3
end
elsif @targettype==1
if @chgtype==0
@maskdata[p1,p2]=p3
elsif @chgtype==1
@maskdata[p1,p2]+=p3
end
end
end
end
def rndmap_chtarget(p1,p2)
@targettype=p1
@chgtype=p2
end
def rndmap_setstat(p1,p2,p3,p4)
@minx=p1
@miny=p2
@maxx=p3
@maxy=p4
end
def rndmap_chmask(p1,p2)
if p1>=0
if p2==0
@masksetting[p1]=false
elsif p2 == 1
@masksetting[p1]=true
elsif p2 == 2
for i in 0...100
@masksetting=false
end
@masksetting[p1]=true
end
end
if p1==-1
if p2==0
for i in 0...100
@masksetting=false
end
else
for i in 0...100
@masksetting=true
end
end
end
end
def rndmap_mkroad(p1,p2,p3,p4,p5 = 5)
p5 = 5 if p5 == nil
localdata = Table.new(@map.width,@map.height)
aposx = []
aposy = []
aflag = []
for i in [email protected]
for j in [email protected]
localdata[i,j] = 0
end
end
if p2<0
p2=(p2*-1)*@map.width*@map.height/40/40
end
aposx[0]=@minx
aposy[0]=@miny
aposx[1]=@maxx
aposy[1]=@maxy
if aposx[0]<0
aposx[0][email protected]+aposx[0]
end
if (aposx[0]>=1000) and (aposx[0]<=1100)
aposx[0][email protected]*(aposx[0]-1000)/100
end
if aposy[0]<0
aposy[0][email protected]+aposy[0]
end
if (aposy[0]>=1000) and (aposy[0]<=1100)
aposy[0][email protected]*(aposy[0]-1000)/100
end
if aposx[1]<0
aposx[1][email protected]+aposx[1]
end
if (aposx[1]>=1000) and (aposx[1]<=1100)
aposx[1][email protected]*(aposx[1]-1000)/100
end
if aposy[1]<0
aposy[1][email protected]+aposy[1]
end
if (aposy[1]>=1000) and (aposy[1]<=1100)
aposy[1][email protected]*(aposy[1]-1000)/100
end
if p4==0 or p4==1 or p4==2
if p4 == 2
i4 = rand(2)
end
aflag[0] = true
aflag[1] = false
for i in 2...(p2+2)
aposx = rand(@map.width-p3*2) + p3
aposy = rand(@map.height-p3*2) + p3
aflag = false
end
i3=0
i1=aposx[i3]
i2=aposy[i3]
localdata[i1,i2] = 1
for i in 0...p2+2
i7=5000000
for j in 0...p2+2
if aflag[j] == false
i4 = aposx[j]-i1
i4=i4*-1 if i4 < 0
i5 = aposy[j]-i2
i5=i5*-1 if i5 < 0
if (i4**2+i5**2) <=(p5**2) and j != 1
aflag[j] = true
elsif i7 > (i4**2+i5**2)
i7=(i4**2+i5**2)
i6=j
end
end
end
if p4==0
if aposx[i3] > aposx[i6]
i8 = aposx[i3]
i9 = aposy[i3]
i10 = aposx[i6]
i11 = aposy[i6]
else
i8 = aposx[i6]
i9 = aposy[i6]
i10 = aposx[i3]
i11 = aposy[i3]
end
if i8!=i10
for i in 0..(i8-i10)
localdata[i+i10,(i9-i11)*i/(i8-i10)+i11] = 1
end
end
if aposy[i3] > aposy[i6]
i8 = aposx[i3]
i9 = aposy[i3]
i10 = aposx[i6]
i11 = aposy[i6]
else
i8 = aposx[i6]
i9 = aposy[i6]
i10 = aposx[i3]
i11 = aposy[i3]
end
if i9!=i11
for i in 0..(i9-i11)
localdata[(i8-i10)*i/(i9-i11)+i10,i+i11] = 1
end
end
end
if p4==1
i4 = rand(2)
if i4==0
for i in 0..([aposx[i3]-aposx[i6],aposx[i6]-aposx[i3]].max)
localdata[i+[aposx[i3],aposx[i6]].min,aposy[i3]] = 1
end
for i in 0..([aposy[i3]-aposy[i6],aposy[i6]-aposy[i3]].max)
localdata[aposx[i6],i+[aposy[i3],aposy[i6]].min] = 1
end
else
for i in 0..([aposx[i3]-aposx[i6],aposx[i6]-aposx[i3]].max)
localdata[i+[aposx[i3],aposx[i6]].min,aposy[i6]] = 1
end
for i in 0..([aposy[i3]-aposy[i6],aposy[i6]-aposy[i3]].max)
localdata[aposx[i3],i+[aposy[i3],aposy[i6]].min] = 1
end
end
end
i3=i6
i1=aposx[i3]
i2=aposy[i3]
aflag[i3]=true
if i3==1
break
end
end
end
for i in [email protected]
for j in [email protected]
if localdata[i,j] == 1
set_grounddata(i,j,p1)
end
end
end
end
def rndmap_plus(p1,p2,p3,p4)
localdata = Table.new(@map.width,@map.height)
for i in [email protected]
for j in [email protected]
if @targettype==0
localdata[i,j] = @heightdata[i,j]
elsif @targettype==1
localdata[i,j] = @maskdata[i,j]
end
end
end
if p4 == 0
for i in [email protected]
for j in [email protected]
if p1==localdata[i,j]
for k in 1..p2
set_grounddata(i+k,j,p1)
set_grounddata(i-k,j,p1)
end
for k in 1..p3
set_grounddata(i,j+k,p1)
set_grounddata(i,j-k,p1)
end
end
end
end
elsif p4 == 1
for i in [email protected]
for j in [email protected]
if p1==localdata[i,j]
for k in (i-p2)..(i+p2)
for l in (j-p3)..(j+p3)
set_grounddata(k,l,p1)
end
end
end
end
end
end
end
def rndmap_allchg(p1)
for i in [email protected]
for j in [email protected]
set_grounddata(i,j,p1)
end
end
end
def rndmap_putpos(p1,p2,p3)
i = rand(@maxx-@minx+1)+@minx
j = rand(@maxy-@miny+1)+@miny
for k in (p2-i)..(p2+i)
for l in (p3-j)..(p3+j)
set_grounddata(k,l,p1)
end
end
end
def rndmap_edge(p1)
for i in [email protected]
set_grounddata(i,0,p1)
set_grounddata(i,@map.height-1,p1)
end
for i in [email protected]
set_grounddata(0,i,p1)
set_grounddata(@map.width-1,i,p1)
end
end
end
module RPG
class MapInfo
def name
name = @name.split(/,/)[0]
return name != nil ? name : ''
end
def subname(i = 1)
name = @name.split(/,/)
return name != nil ? name : ""
end
end
end
module RPG
class Event
def name
name = @name.split(/,/)[0]
return name != nil ? name : ''
end
def subname(i = 1)
name = @name.split(/,/)
return name != nil ? name : ""
end
end
end
If you could help me get that in the game, I would be much obliged, and of course you would have a place in the credits, or on the team :)
Last edited: