Ok, il mio problema è apparentemente semplice: l'eroe si sveglia in una stanza buia, va verso la finestra (vista da fuori, con tanto di muro esterno) apre le tende e fa entrare un po' di luce, poi va alla seconda finestra e ripete il passaggio precedente. Voledo vedere tutto di fronte, ho fatto i muro esterno visibile, nonostante sia un interno, quindi non posso usare la luminosità dello schermo, perché fuori è logico che la luce ci sia, è dentro che è buio. Quindi ho disegnato una picture della dimensione della stanza tutta nera, e pensavo di farla apparire alla coordinata x,y con opacità, e man mano cambiarla fino a raggiungere 0. Bene, scopro a malincuore che la posizione delle pciture dipende dal POV, e non dalla mappa, quindi penso ad aggiungerla tipo in parallasse come nel VX. Trovo lo script, importo lo script, lo leggo, ci litigo per DUE ORE prima di capire come cappero funziona, lo faccio funzionare e posiziono la picture dove voglio io. Dopodiché cerco inutilmente per un'altra ora di capire come aggiornare lo stato della picture, cambiandole opacità. Qui mi sono impantanato. Non capisco come si fa. @_@ Aiuto?
Questo è lo script:
=begin
Unlimited Graphically Layered Maps v1.0.1 by PK8 Created: 5/16/2012 - 5/18/2012 Modified: 5/19/2012 ────────────────────────────────────────────────────────────────────────────── ■ Table of Contents o Author's Notes - Line 18-28 o Introduction - Line 30-38 o Features - Line 40-47 o Methods Aliased - Line 49-52 o Changelog - Line 54-57 o Thanks - Line 59-64 o How to Set Up - Line 66-104 o How to Use - Line 106-166 ────────────────────────────────────────────────────────────────────────────── ■ Author's Notes Giving maps "unlimited layers" was something I always wanted to see someone script for RPG Maker XP when I was younger, but I was so far from capable of pulling that off. I kind of hate how I'm scripting this 7 years a little too late, but I hope someone enjoys it all the same.
This idea came about right after I was done porting Woratana's Picture Below Characters script to XP/Ace, making a script that allowed pictures to scroll along the map, porting Arevulopapo's Particle Engine to VX and Ace, and attempted to work on my own implementation of Ace's "Shadow Pen" for XP and VX. ────────────────────────────────────────────────────────────────────────────── ■ Introduction This script allows users to add "additional graphical layers" onto various coordinates of certain maps, allowing them to create something closer to "parallax mapping" without having to use an external image editor.
Unfortunately/fortunately (depending on how you look at it), the data that's included with each tile such as priority, passability, terrain, and such doesn't get included here which means you might have to use the map editor as a way to design the base of your map. ────────────────────────────────────────────────────────────────────────────── ■ Features o Place graphics such as tiles, pictures, text, tiles from other tilesets, and rects onto your maps! o They will scroll as if they were a part of your map. (Unless you change their scrolling formula.) o Change certain properties of each graphic you place such as their angle, blend type, bush depth, color, hue, mirror flag, opacity, tone, zoom, & z. o Provides an alternative to the well-known Parallax Mapping technique. ────────────────────────────────────────────────────────────────────────────── ■ Methods Aliased Spriteset_Map.initialize Spriteset_Map.update Spriteset_Map.dispose ────────────────────────────────────────────────────────────────────────────── ■ Changelog (MM/DD/YYYY) v1 (05/18/2012): Initial release. v1.0.1 (05/19/2012): Fixed a bug where changing hues of a particular picture would affect every other picture. ────────────────────────────────────────────────────────────────────────────── ■ Thanks If it wasn't for me porting Woratana's Pictures script to RPG Maker XP and RPG Maker VX Ace, as well as Arevulopapo's Particle Engine over to RPG Maker VX and RPG Maker VX Ace, my old dream of somehow having "unlimited layers," and always hearing about a technique called "Parallax Mapping," I wouldn't have made this script. Thanks, community! ────────────────────────────────────────────────────────────────────────────── ■ How to set up This is my first time attempting to write a decent tutorial, so I hope this helps out just a bit. Setting up additional tiles (and graphics, which is a bit advanced, which we'll get into later) should be for the most part, very easy.
To set up new additional tile graphics for a particular map, you should set it up, like so: Map[map_id] = [] * map_id: A map ID of your choosing. Look at the bottom right corner of the screen to see it. * [] is an array, which we're going to fill up with tiles.
To add your first extra tile, create an array that contains 4 items within the array we have set up. Like this: Map[map_id] = [[tile_id, x, y, attr]] * map_id : A map ID of your choosing. See bottom right corner. * tile_id: The index of the tileset. First tile starts at 0. Autotiles don't count. * x : X-Coordinate of the graphic. It's placed by tile. * y : Y-Coordinate of the graphic. It's placed by tile * attr : It's a hash of additional attributes you can add onto your new graphic. Don't worry about that right now.(It's optional!) * All of these settings are optional and don't need to be included.
Now let's place some tiles: Map[1] = [[1, 2, 2]] * This will place tileset graphic index 1 of the map's current tileset onto map coordinate 2,2.
To add more, add a comma at the end of each item and then add another. Map[1] = [[1, 2, 2], [1, 2, 3, {"hue" => 15}]] * This will add the first tile, and then add another tile with a changed hue onto map coordinate 2,3. You can learn more about attributes by scrolling down to the next section.
Keep in mind that you can add multiple graphics onto the same map coordinate but the graphic that comes later will always have more priority compared to the others, though you could always adjust their z coordinate. ────────────────────────────────────────────────────────────────────────────── ■ How to use Assuming you figured out how to set it up, here's how to really customize it.
Map[map_id] = [ [tile, x, y, {attr => value, attr2 => value2}], [tile, x, y, {attr => value, attr2 => value2}], [tile, x, y, {attr => value, attr2 => value2}] ] * map_id: Map ID * tile : Tile index in map's tileset. * Also allows pictures, tiles from other sets, rects, text, and images. Picture : "filename in pictures directory" Fill : ["fill", width, height, color] width : Width is measured in tiles. height : Height is measured in tiles. color : Set color. Can be an array or color object. array: [red, green, blue, alpha] color: Color.new(red, green, blue, alpha) Text : ["text", string, font, size, bold, italic, color] string : Set text string. font : Set font name(s) Example: ["Arial", "Verdana"] size : Set font size bold : Truth value for bold text. (true/false) italic : Truth value for italicised text. (true/false) color : Set text color. Can be an array or color object. array: [red, green, blue, alpha] color: Color.new(red, green, blue, alpha) * red/green/blue/alpha: 0 - 255 Tileset : ["tileset", id/name, tile] id/name: Set name or ID of another tileset. tile : Tile index from another tileset. * x : X coordinate measured in tiles. * y : Y coordinate measured in tiles. * attr : Extra attributes you can set to the graphic. angle : Set angle of graphic. blend : Set blend type of graphic. (0: Nor, 1: Pos. 2: Neg) bush : Set how much of the lower portion of the graphic would become translucent. color : Set graphic color. hue : Set hue of graphic. mirror : Graphic's mirror flag. opacity : Set opacity to the graphic. (0 - 255) tone : Set tone. Can be an array or tone object. array: [red, green, blue, gray] tone : Tone.new(red, green, blue, gray) * red/green/blue: -255 - 255 * gray: 0 - 255 stretch : Resize the bitmap. ("stretch" => [width, height]) * width : Bitmap's new width. * height: Bitmap's new height. scroll_x : Set a new formula for x-axis scrolling. scroll_y : Set a new formula for y-axis scrolling. * They have to be strings. zoom_x : Resize the sprite's x-axis zoom level. zoom_y : Resize the sprite's y-axis zoom level. * 100 denotes actual pixel size. z : Set z coordinate of the graphic. * Is multiplied by 32.
module PK8 class Unlimited_Graphical_Layers #-------------------------------------------------------------------------- # * Do not modify #-------------------------------------------------------------------------- Map = {} load_data("Data/MapInfos.rxdata").each { |k,v| Map[k] = [] }
#-------------------------------------------------------------------------- # * General Settings #-------------------------------------------------------------------------- By32 = true # X, Y, and Z values will be multiplied by 32 if TRUE.
#============================================================================== # ** Spriteset_Map #------------------------------------------------------------------------------ # This class brings together map screen sprites, tilemaps, etc. # It's used within the Scene_Map class. #==============================================================================
class Spriteset_Map #--------------------------------------------------------------------------- # * Alias Listings #--------------------------------------------------------------------------- unless method_defined?(:pk8_uglm_initialize) alias_method(:pk8_uglm_initialize, :initialize) end unless method_defined?(:pk8_uglm_update) alias_method(:pk8_uglm_update, :update) end unless method_defined?(:pk8_uglm_dispose) (alias_method :pk8_uglm_dispose, :dispose) end #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :uglm #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize pk8_uglm_initialize @uglm, uglm_i = [], 0 if PK8::Unlimited_Graphical_Layers::Map[$game_map.map_id].size > 0 PK8::Unlimited_Graphical_Layers::Map[$game_map.map_id].each { | v | v = v.to_a if !v.is_a?(Array) tile, x, y, attr = v[0], v[1], v[2], v[3] if v.size == 4 tile, x, y, attr = v[0], v[1], v[2], {} if v.size == 3 tile, x, y, attr = v[0], v[1], 0, {} if v.size == 2 tile, x, y, attr = v[0], 0, 0, {} if v.size == 1 tile, x, y, attr = 0, 0, 0, {} if v.size == 0 @uglm[uglm_i] = Sprite_LayeredTile.new(@viewport1, tile, x, y, attr) uglm_i += 1 } end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update pk8_uglm_update @uglm.each { | tile | tile.update } if @uglm != nil end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose pk8_uglm_dispose @uglm.each { | tile | tile.dispose } if @uglm != nil end end
#============================================================================== # ** Sprite_LayeredTile #------------------------------------------------------------------------------ # This sprite is used to display extra tiles. #==============================================================================
class Sprite_LayeredTile < RPG::Sprite #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(viewport, tile_id = 0, x = 0, y = 0, attr = { "hue" => 0, "tone" => Tone.new(0,0,0,0), "color" => Color.new(0,0,0,0), "angle" => 0, "mirror" => false, "zoom_x" => 100.0, "zoom_y" => 100.0, "blend" => 0, "opacity" => 255, "z" => 1, "bush_depth" => 0, "scroll_x" => "$game_map.display_x / 4", "scroll_y" => "$game_map.display_y / 4"}) super(viewport) PK8::Unlimited_Graphical_Layers::By32 == true ? self.x = 32*x : self.x = x PK8::Unlimited_Graphical_Layers::By32 == true ? self.y = 32*y : self.y = y # Default Tile Values self.angle = 0 if !attr.include?("angle") self.blend_type = 0 if !attr.include?("blend") self.bush_depth = 0 if !attr.include?("bush_depth") self.color = Color.new(0,0,0,0) if !attr.include?("color") self.mirror = false if !attr.include?("mirror") self.opacity = 255 if !attr.include?("opacity") self.tone = Tone.new(0,0,0,0) if !attr.include?("tone") self.zoom_x = 1.0 if !attr.include?("zoom_x") self.zoom_y = 1.0 if !attr.include?("zoom_y") self.z = 1*32 if !attr.include?("z") @scroll_x = "$game_map.display_x / 4" if !attr.include?("scroll_x") @scroll_y = "$game_map.display_y / 4" if !attr.include?("scroll_y") hue = 0 if !attr.include?("hue") # Setting attributes to tile. attr.each { | k,v | k = k.downcase if k.is_a?(String) case k when "angle"; self.angle = v when "bush", "bush_depth"; self.bush_depth = v when "blend", "blend_type"; self.blend_type = v when "color" if v.is_a?(Color); self.color = v elsif v.is_a?(Array); self.color = Color.new(*v) end when "hue"; hue = v when "mirror"; self.mirror = v when "opacity"; self.opacity = v when "scroll_x"; @scroll_x = v when "scroll_y"; @scroll_y = v when "tone" if v.is_a?(Tone); self.tone = v elsif v.is_a?(Array); self.tone = Tone.new(*v) end when "zoom_x"; self.zoom_x = v / 100.0 when "zoom_y"; self.zoom_y = v / 100.0 when "z"; self.z = 32*v end } # Tile? Picture? Text? Tiles from other tilesets? if tile_id.is_a?(Integer) self.bitmap=RPG::Cache.tile($game_map.tileset_name,384+tile_id,hue).clone elsif tile_id.is_a?(String) self.bitmap = RPG::Cache.picture(tile_id).clone self.bitmap.hue_change(hue) elsif tile_id.is_a?(Color) self.bitmap = Bitmap.new(32,32) self.bitmap.fill_rect(0, 0, 32, 32, tile_id) self.bitmap.hue_change(hue) elsif tile_id.is_a?(Array) type = tile_id[0].downcase if tile_id.size >= 1 case type when "text", "txt" dfont, dsize = Font.default_name, Font.default_size dbold, ditalic = Font.default_bold, Font.default_italic dcolor = Font.default_color if tile_id.size >= 0 string, font, size, bold, italic = "", dfont, dsize, dbold, ditalic color = dcolor end tile_id[1]!=nil ? string=tile_id[1].to_s: string="" if tile_id.size >= 2 tile_id[2]!=nil ? font = tile_id[2] : font=dfont if tile_id.size >= 3 tile_id[3]!=nil ? size = tile_id[3] : size=dsize if tile_id.size >= 4 tile_id[4]!=nil ? bold = tile_id[4] : bold=dbold if tile_id.size >= 5 tile_id[5]!=nil ? italic =tile_id[5]: italic=ditalic if tile_id.size>=6 if tile_id.size >= 7 if tile_id[6].is_a?(Color); color = tile_id[6] elsif tile_id[6].is_a?(Array); color = Color.new(*tile_id[6]) else; color = dcolor end end self.bitmap = Bitmap.new(320,240) self.bitmap.font.name = font self.bitmap.font.size = size self.bitmap.font.bold = bold self.bitmap.font.italic = italic self.bitmap.font.color = color rect = self.bitmap.text_size(string) self.bitmap.dispose self.bitmap = Bitmap.new(rect.width, rect.height) self.bitmap.font.name = font self.bitmap.font.size = size self.bitmap.font.bold = bold self.bitmap.font.italic = italic self.bitmap.font.color = color self.bitmap.draw_text(0,0,rect.width,rect.height,string,0) self.bitmap.hue_change(hue) when "tileset", "tile" if tile_id.size >= 0 tileset, tile = $game_map.tileset_name, 0 end if tile_id.size >= 2 if tile_id[1].is_a?(String) tileset = tile_id[1] elsif tile_id[1].is_a?(Integer) tileset = $data_tilesets[tile_id[1]].tileset_name end end if tile_id.size >= 3 tile = tile_id[2] + 384 if tile_id[2].is_a?(Integer) end self.bitmap = RPG::Cache.tile(tileset, tile, hue).clone when "fill", "color" if tile_id.size >= 0 width, height, color = 32, 32, Color.new(99, 92, 116, 128) end (width = tile_id[1] if tile_id[1].is_a?(Integer)) if tile_id.size >= 2 (height = tile_id[2] if tile_id[2].is_a?(Integer)) if tile_id.size >= 3 if PK8::Unlimited_Graphical_Layers::By32 == true width, height = 32*width, 32*height end if tile_id.size >= 4 if tile_id[3].is_a?(Color); color = tile_id[3] elsif tile_id[3].is_a?(Array); color = Color.new(*tile_id[3]) end end self.bitmap = Bitmap.new(width,height) self.bitmap.fill_rect(0,0,width,height,color) self.bitmap.hue_change(hue) end end if attr.include?("stretch") if attr["stretch"].size >= 2 if attr["stretch"][0].is_a?(Integer); width = attr["stretch"][0] else; width = self.bitmap.width end if attr["stretch"][1].is_a?(Integer); height = attr["stretch"][1] else; height = self.bitmap.height end old_bitmap = self.bitmap.clone new_bitmap = Bitmap.new(width, height) new_bitmap.stretch_blt(Rect.new(0,0,width,height), old_bitmap, Rect.new(0,0,old_bitmap.width,old_bitmap.height)) self.bitmap = new_bitmap.clone old_bitmap.dispose new_bitmap.dispose end end self.ox, self.oy = eval(@scroll_x), eval(@scroll_y) @olddisplay_x, @olddisplay_y = self.ox, self.oy end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super if @olddisplay_x != eval(@scroll_x) self.ox = eval(@scroll_x) @olddisplay_x = self.ox end if @olddisplay_y != eval(@scroll_y) self.oy = eval(@scroll_y) @olddisplay_y = self.oy end end #-------------------------------------------------------------------------- # * Dispose #-------------------------------------------------------------------------- def dispose; self.bitmap.dispose if self.bitmap.is_a?(Bitmap); super; end end
#============================================================================== # ** Scene_Map #------------------------------------------------------------------------------ # This class performs map screen processing. #==============================================================================
class Scene_Map #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :spriteset
è la picture della mia mappa, ma non capisco come poter aggiornarla mano a mano.
Ho dedotto che il comando Spriteset_Map.update sia il comando da chiamare da dentro alla mappa attraverso evento e script. Ma potrei aver preso, e temo di aver preso un granchio...
Il tutorial all'interno dello script è incomprensibile. E non perché in inglese, per quello non ho problemi, ma il tipo non si sa spiegare (e io non so nulla di script, questo di sicuro conta qualcosa)
Qualche anima pia riesce a spiegarmi SE si può fare e come?
-----------------INIZIO DUBBIO SULLA SOLUZIONE MACCHINOSA MESSA IN ATTO--------------------
Non demordendo, ho disattivato lo script e provato con le picture classiche, ho capito dove sarebbe dovuto comparire lo script nella mappa POV per essere in posizione corretta, settato l'opacità e tutto funziona bene. Però il chara si sposta a sinstra e muove il POV con sé, quindi s'ha da muovere anche la picture.
Scopro quindi le coordinate finali in cui dovrebbe essere e, contemporanemente al chara muovo anche lei... però il disgraziato muove la mappa solo a partire da un certo punto, quindi la sovrapposizione dei movimenti non è perfetta. e si vede la picture muoversi, seppur leggermente. Forse smanettando riesco a risolverlo, ma la domanda è:
Vi viene in mente un modo migliore di approcciare il problema? io sono super arrugginito e magari non ho preso in considerazione una cosa ovvia che non ricordo più...
-----------------FINE DUBBIO SULLA SOLUZIONE MACCHINOSA MESSA IN ATTO--------------------
Ecco tutto. Ho scritto il solito mega-post da niubbo. Vogliate scusarmene...
P.D terzo dubbio che c'entra poco ma già che ci sono chiedo qui: Ho acquistato con lo sconto del forum rmxp 1.0.4, ma la patch Italiana funziona solo con la versione 1.0.2 (che però non è possibile attivare col mio n°serie, perché ai tempi si acquistava tramite altro reseller di enterbrain.
Sarebbe immorale-indecente-degno di ban "attivare" quella versione e metterci la patch ITA, non potendo farlo con la mia?
Romanzi d'avventura per ragazzi/e dai 13 ai 100 anni su Amazon e IBS
Question
Sin
Salve, sono ufficialmente negato con gli script! :D :D
Yeeeee!
-----------------INIZIO DUBBIO SULLO SCRIPT--------------------
Ok, il mio problema è apparentemente semplice:
l'eroe si sveglia in una stanza buia, va verso la finestra (vista da fuori, con tanto di muro esterno) apre le tende e fa entrare un po' di luce, poi va alla seconda finestra e ripete il passaggio precedente.
Voledo vedere tutto di fronte, ho fatto i muro esterno visibile, nonostante sia un interno, quindi non posso usare la luminosità dello schermo, perché fuori è logico che la luce ci sia, è dentro che è buio.
Quindi ho disegnato una picture della dimensione della stanza tutta nera, e pensavo di farla apparire alla coordinata x,y con opacità, e man mano cambiarla fino a raggiungere 0.
Bene, scopro a malincuore che la posizione delle pciture dipende dal POV, e non dalla mappa, quindi penso ad aggiungerla tipo in parallasse come nel VX.
Trovo lo script, importo lo script, lo leggo, ci litigo per DUE ORE prima di capire come cappero funziona, lo faccio funzionare e posiziono la picture dove voglio io.
Dopodiché cerco inutilmente per un'altra ora di capire come aggiornare lo stato della picture, cambiandole opacità.
Qui mi sono impantanato. Non capisco come si fa. @_@
Aiuto?
Questo è lo script:
=begin
Unlimited Graphically Layered Maps v1.0.1
by PK8
Created: 5/16/2012 - 5/18/2012
Modified: 5/19/2012
──────────────────────────────────────────────────────────────────────────────
■ Table of Contents
o Author's Notes - Line 18-28
o Introduction - Line 30-38
o Features - Line 40-47
o Methods Aliased - Line 49-52
o Changelog - Line 54-57
o Thanks - Line 59-64
o How to Set Up - Line 66-104
o How to Use - Line 106-166
──────────────────────────────────────────────────────────────────────────────
■ Author's Notes
Giving maps "unlimited layers" was something I always wanted to see someone
script for RPG Maker XP when I was younger, but I was so far from capable
of pulling that off. I kind of hate how I'm scripting this 7 years a little
too late, but I hope someone enjoys it all the same.
This idea came about right after I was done porting Woratana's Picture
Below Characters script to XP/Ace, making a script that allowed pictures
to scroll along the map, porting Arevulopapo's Particle Engine to VX and Ace,
and attempted to work on my own implementation of Ace's "Shadow Pen" for
XP and VX.
──────────────────────────────────────────────────────────────────────────────
■ Introduction
This script allows users to add "additional graphical layers" onto various
coordinates of certain maps, allowing them to create something closer to
"parallax mapping" without having to use an external image editor.
Unfortunately/fortunately (depending on how you look at it), the data
that's included with each tile such as priority, passability, terrain, and
such doesn't get included here which means you might have to use the map
editor as a way to design the base of your map.
──────────────────────────────────────────────────────────────────────────────
■ Features
o Place graphics such as tiles, pictures, text, tiles from other tilesets,
and rects onto your maps!
o They will scroll as if they were a part of your map. (Unless you change
their scrolling formula.)
o Change certain properties of each graphic you place such as their angle,
blend type, bush depth, color, hue, mirror flag, opacity, tone, zoom, & z.
o Provides an alternative to the well-known Parallax Mapping technique.
──────────────────────────────────────────────────────────────────────────────
■ Methods Aliased
Spriteset_Map.initialize
Spriteset_Map.update
Spriteset_Map.dispose
──────────────────────────────────────────────────────────────────────────────
■ Changelog (MM/DD/YYYY)
v1 (05/18/2012): Initial release.
v1.0.1 (05/19/2012): Fixed a bug where changing hues of a particular picture
would affect every other picture.
──────────────────────────────────────────────────────────────────────────────
■ Thanks
If it wasn't for me porting Woratana's Pictures script to RPG Maker XP
and RPG Maker VX Ace, as well as Arevulopapo's Particle Engine over
to RPG Maker VX and RPG Maker VX Ace, my old dream of somehow having
"unlimited layers," and always hearing about a technique called
"Parallax Mapping," I wouldn't have made this script. Thanks, community!
──────────────────────────────────────────────────────────────────────────────
■ How to set up
This is my first time attempting to write a decent tutorial, so I hope this
helps out just a bit. Setting up additional tiles (and graphics, which is a
bit advanced, which we'll get into later) should be for the most part,
very easy.
To set up new additional tile graphics for a particular map, you should set
it up, like so:
Map[map_id] = []
* map_id: A map ID of your choosing. Look at the bottom right corner of
the screen to see it.
* [] is an array, which we're going to fill up with tiles.
To add your first extra tile, create an array that contains 4 items within
the array we have set up. Like this:
Map[map_id] = [[tile_id, x, y, attr]]
* map_id : A map ID of your choosing. See bottom right corner.
* tile_id: The index of the tileset. First tile starts at 0.
Autotiles don't count.
* x : X-Coordinate of the graphic. It's placed by tile.
* y : Y-Coordinate of the graphic. It's placed by tile
* attr : It's a hash of additional attributes you can add onto your
new graphic. Don't worry about that right now.(It's optional!)
* All of these settings are optional and don't need to be included.
Now let's place some tiles:
Map[1] = [[1, 2, 2]]
* This will place tileset graphic index 1 of the map's current tileset
onto map coordinate 2,2.
To add more, add a comma at the end of each item and then add another.
Map[1] = [[1, 2, 2], [1, 2, 3, {"hue" => 15}]]
* This will add the first tile, and then add another tile with a
changed hue onto map coordinate 2,3. You can learn more about
attributes by scrolling down to the next section.
Keep in mind that you can add multiple graphics onto the same map
coordinate but the graphic that comes later will always have more priority
compared to the others, though you could always adjust their z coordinate.
──────────────────────────────────────────────────────────────────────────────
■ How to use
Assuming you figured out how to set it up, here's how to really
customize it.
Map[map_id] = [
[tile, x, y, {attr => value, attr2 => value2}],
[tile, x, y, {attr => value, attr2 => value2}],
[tile, x, y, {attr => value, attr2 => value2}]
]
* map_id: Map ID
* tile : Tile index in map's tileset.
* Also allows pictures, tiles from other sets, rects, text,
and images.
Picture : "filename in pictures directory"
Fill : ["fill", width, height, color]
width : Width is measured in tiles.
height : Height is measured in tiles.
color : Set color. Can be an array or color object.
array: [red, green, blue, alpha]
color: Color.new(red, green, blue, alpha)
Text : ["text", string, font, size, bold, italic, color]
string : Set text string.
font : Set font name(s) Example: ["Arial", "Verdana"]
size : Set font size
bold : Truth value for bold text. (true/false)
italic : Truth value for italicised text. (true/false)
color : Set text color. Can be an array or color object.
array: [red, green, blue, alpha]
color: Color.new(red, green, blue, alpha)
* red/green/blue/alpha: 0 - 255
Tileset : ["tileset", id/name, tile]
id/name: Set name or ID of another tileset.
tile : Tile index from another tileset.
* x : X coordinate measured in tiles.
* y : Y coordinate measured in tiles.
* attr : Extra attributes you can set to the graphic.
angle : Set angle of graphic.
blend : Set blend type of graphic. (0: Nor, 1: Pos. 2: Neg)
bush : Set how much of the lower portion of the graphic
would become translucent.
color : Set graphic color.
hue : Set hue of graphic.
mirror : Graphic's mirror flag.
opacity : Set opacity to the graphic. (0 - 255)
tone : Set tone. Can be an array or tone object.
array: [red, green, blue, gray]
tone : Tone.new(red, green, blue, gray)
* red/green/blue: -255 - 255
* gray: 0 - 255
stretch : Resize the bitmap. ("stretch" => [width, height])
* width : Bitmap's new width.
* height: Bitmap's new height.
scroll_x : Set a new formula for x-axis scrolling.
scroll_y : Set a new formula for y-axis scrolling.
* They have to be strings.
zoom_x : Resize the sprite's x-axis zoom level.
zoom_y : Resize the sprite's y-axis zoom level.
* 100 denotes actual pixel size.
z : Set z coordinate of the graphic.
* Is multiplied by 32.
=end
#==============================================================================
# ** Configuration
#==============================================================================
module PK8
class Unlimited_Graphical_Layers
#--------------------------------------------------------------------------
# * Do not modify
#--------------------------------------------------------------------------
Map = {}
load_data("Data/MapInfos.rxdata").each { |k,v| Map[k] = [] }
#--------------------------------------------------------------------------
# * General Settings
#--------------------------------------------------------------------------
By32 = true # X, Y, and Z values will be multiplied by 32 if TRUE.
#--------------------------------------------------------------------------
# * Map Settings
#--------------------------------------------------------------------------
# Map ID 1's Extra Tiles
Map[1] = [
[0, 0, 0, {"hue" => 20}],
[0, 1, 0, {"hue" => 40}],
[0, 2, 0, {"hue" => 60}],
[1, 0, 0, {"hue" => 60}],
[1, 1, 0, {"hue" => 40}],
[1, 2, 0, {"hue" => 20}]
]
Map[2] = [
["stanzaoscura", 4, 24, { "z" => 10, "opacity" => 150 }],
]
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
#---------------------------------------------------------------------------
# * Alias Listings
#---------------------------------------------------------------------------
unless method_defined?(:pk8_uglm_initialize)
alias_method(:pk8_uglm_initialize, :initialize)
end
unless method_defined?(:pk8_uglm_update)
alias_method(:pk8_uglm_update, :update)
end
unless method_defined?(:pk8_uglm_dispose)
(alias_method :pk8_uglm_dispose, :dispose)
end
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :uglm
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
pk8_uglm_initialize
@uglm, uglm_i = [], 0
if PK8::Unlimited_Graphical_Layers::Map[$game_map.map_id].size > 0
PK8::Unlimited_Graphical_Layers::Map[$game_map.map_id].each { | v |
v = v.to_a if !v.is_a?(Array)
tile, x, y, attr = v[0], v[1], v[2], v[3] if v.size == 4
tile, x, y, attr = v[0], v[1], v[2], {} if v.size == 3
tile, x, y, attr = v[0], v[1], 0, {} if v.size == 2
tile, x, y, attr = v[0], 0, 0, {} if v.size == 1
tile, x, y, attr = 0, 0, 0, {} if v.size == 0
@uglm[uglm_i] = Sprite_LayeredTile.new(@viewport1, tile, x, y, attr)
uglm_i += 1
}
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
pk8_uglm_update
@uglm.each { | tile | tile.update } if @uglm != nil
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
pk8_uglm_dispose
@uglm.each { | tile | tile.dispose } if @uglm != nil
end
end
#==============================================================================
# ** Sprite_LayeredTile
#------------------------------------------------------------------------------
# This sprite is used to display extra tiles.
#==============================================================================
class Sprite_LayeredTile < RPG::Sprite
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(viewport, tile_id = 0, x = 0, y = 0, attr = { "hue" => 0,
"tone" => Tone.new(0,0,0,0), "color" => Color.new(0,0,0,0), "angle" => 0,
"mirror" => false, "zoom_x" => 100.0, "zoom_y" => 100.0, "blend" => 0,
"opacity" => 255, "z" => 1, "bush_depth" => 0,
"scroll_x" => "$game_map.display_x / 4",
"scroll_y" => "$game_map.display_y / 4"})
super(viewport)
PK8::Unlimited_Graphical_Layers::By32 == true ? self.x = 32*x : self.x = x
PK8::Unlimited_Graphical_Layers::By32 == true ? self.y = 32*y : self.y = y
# Default Tile Values
self.angle = 0 if !attr.include?("angle")
self.blend_type = 0 if !attr.include?("blend")
self.bush_depth = 0 if !attr.include?("bush_depth")
self.color = Color.new(0,0,0,0) if !attr.include?("color")
self.mirror = false if !attr.include?("mirror")
self.opacity = 255 if !attr.include?("opacity")
self.tone = Tone.new(0,0,0,0) if !attr.include?("tone")
self.zoom_x = 1.0 if !attr.include?("zoom_x")
self.zoom_y = 1.0 if !attr.include?("zoom_y")
self.z = 1*32 if !attr.include?("z")
@scroll_x = "$game_map.display_x / 4" if !attr.include?("scroll_x")
@scroll_y = "$game_map.display_y / 4" if !attr.include?("scroll_y")
hue = 0 if !attr.include?("hue")
# Setting attributes to tile.
attr.each { | k,v |
k = k.downcase if k.is_a?(String)
case k
when "angle"; self.angle = v
when "bush", "bush_depth"; self.bush_depth = v
when "blend", "blend_type"; self.blend_type = v
when "color"
if v.is_a?(Color); self.color = v
elsif v.is_a?(Array); self.color = Color.new(*v)
end
when "hue"; hue = v
when "mirror"; self.mirror = v
when "opacity"; self.opacity = v
when "scroll_x"; @scroll_x = v
when "scroll_y"; @scroll_y = v
when "tone"
if v.is_a?(Tone); self.tone = v
elsif v.is_a?(Array); self.tone = Tone.new(*v)
end
when "zoom_x"; self.zoom_x = v / 100.0
when "zoom_y"; self.zoom_y = v / 100.0
when "z"; self.z = 32*v
end
}
# Tile? Picture? Text? Tiles from other tilesets?
if tile_id.is_a?(Integer)
self.bitmap=RPG::Cache.tile($game_map.tileset_name,384+tile_id,hue).clone
elsif tile_id.is_a?(String)
self.bitmap = RPG::Cache.picture(tile_id).clone
self.bitmap.hue_change(hue)
elsif tile_id.is_a?(Color)
self.bitmap = Bitmap.new(32,32)
self.bitmap.fill_rect(0, 0, 32, 32, tile_id)
self.bitmap.hue_change(hue)
elsif tile_id.is_a?(Array)
type = tile_id[0].downcase if tile_id.size >= 1
case type
when "text", "txt"
dfont, dsize = Font.default_name, Font.default_size
dbold, ditalic = Font.default_bold, Font.default_italic
dcolor = Font.default_color
if tile_id.size >= 0
string, font, size, bold, italic = "", dfont, dsize, dbold, ditalic
color = dcolor
end
tile_id[1]!=nil ? string=tile_id[1].to_s: string="" if tile_id.size >= 2
tile_id[2]!=nil ? font = tile_id[2] : font=dfont if tile_id.size >= 3
tile_id[3]!=nil ? size = tile_id[3] : size=dsize if tile_id.size >= 4
tile_id[4]!=nil ? bold = tile_id[4] : bold=dbold if tile_id.size >= 5
tile_id[5]!=nil ? italic =tile_id[5]: italic=ditalic if tile_id.size>=6
if tile_id.size >= 7
if tile_id[6].is_a?(Color); color = tile_id[6]
elsif tile_id[6].is_a?(Array); color = Color.new(*tile_id[6])
else; color = dcolor
end
end
self.bitmap = Bitmap.new(320,240)
self.bitmap.font.name = font
self.bitmap.font.size = size
self.bitmap.font.bold = bold
self.bitmap.font.italic = italic
self.bitmap.font.color = color
rect = self.bitmap.text_size(string)
self.bitmap.dispose
self.bitmap = Bitmap.new(rect.width, rect.height)
self.bitmap.font.name = font
self.bitmap.font.size = size
self.bitmap.font.bold = bold
self.bitmap.font.italic = italic
self.bitmap.font.color = color
self.bitmap.draw_text(0,0,rect.width,rect.height,string,0)
self.bitmap.hue_change(hue)
when "tileset", "tile"
if tile_id.size >= 0
tileset, tile = $game_map.tileset_name, 0
end
if tile_id.size >= 2
if tile_id[1].is_a?(String)
tileset = tile_id[1]
elsif tile_id[1].is_a?(Integer)
tileset = $data_tilesets[tile_id[1]].tileset_name
end
end
if tile_id.size >= 3
tile = tile_id[2] + 384 if tile_id[2].is_a?(Integer)
end
self.bitmap = RPG::Cache.tile(tileset, tile, hue).clone
when "fill", "color"
if tile_id.size >= 0
width, height, color = 32, 32, Color.new(99, 92, 116, 128)
end
(width = tile_id[1] if tile_id[1].is_a?(Integer)) if tile_id.size >= 2
(height = tile_id[2] if tile_id[2].is_a?(Integer)) if tile_id.size >= 3
if PK8::Unlimited_Graphical_Layers::By32 == true
width, height = 32*width, 32*height
end
if tile_id.size >= 4
if tile_id[3].is_a?(Color); color = tile_id[3]
elsif tile_id[3].is_a?(Array); color = Color.new(*tile_id[3])
end
end
self.bitmap = Bitmap.new(width,height)
self.bitmap.fill_rect(0,0,width,height,color)
self.bitmap.hue_change(hue)
end
end
if attr.include?("stretch")
if attr["stretch"].size >= 2
if attr["stretch"][0].is_a?(Integer); width = attr["stretch"][0]
else; width = self.bitmap.width
end
if attr["stretch"][1].is_a?(Integer); height = attr["stretch"][1]
else; height = self.bitmap.height
end
old_bitmap = self.bitmap.clone
new_bitmap = Bitmap.new(width, height)
new_bitmap.stretch_blt(Rect.new(0,0,width,height), old_bitmap,
Rect.new(0,0,old_bitmap.width,old_bitmap.height))
self.bitmap = new_bitmap.clone
old_bitmap.dispose
new_bitmap.dispose
end
end
self.ox, self.oy = eval(@scroll_x), eval(@scroll_y)
@olddisplay_x, @olddisplay_y = self.ox, self.oy
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if @olddisplay_x != eval(@scroll_x)
self.ox = eval(@scroll_x)
@olddisplay_x = self.ox
end
if @olddisplay_y != eval(@scroll_y)
self.oy = eval(@scroll_y)
@olddisplay_y = self.oy
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose; self.bitmap.dispose if self.bitmap.is_a?(Bitmap); super; end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :spriteset
end
quel
Map[2] = [
["stanzaoscura", 4, 24, { "z" => 10, "opacity" => 150 }],
]
è la picture della mia mappa, ma non capisco come poter aggiornarla mano a mano.
Ho dedotto che il comando Spriteset_Map.update sia il comando da chiamare da dentro alla mappa attraverso evento e script. Ma potrei aver preso, e temo di aver preso un granchio...
Il tutorial all'interno dello script è incomprensibile. E non perché in inglese, per quello non ho problemi, ma il tipo non si sa spiegare (e io non so nulla di script, questo di sicuro conta qualcosa)
Qualche anima pia riesce a spiegarmi SE si può fare e come?
-----------------FINE DUBBIO SULLO SCRIPT--------------------
-----------------INIZIO DUBBIO SULLA SOLUZIONE MACCHINOSA MESSA IN ATTO--------------------
Non demordendo, ho disattivato lo script e provato con le picture classiche, ho capito dove sarebbe dovuto comparire lo script nella mappa POV per essere in posizione corretta, settato l'opacità e tutto funziona bene. Però il chara si sposta a sinstra e muove il POV con sé, quindi s'ha da muovere anche la picture.
Scopro quindi le coordinate finali in cui dovrebbe essere e, contemporanemente al chara muovo anche lei... però il disgraziato muove la mappa solo a partire da un certo punto, quindi la sovrapposizione dei movimenti non è perfetta. e si vede la picture muoversi, seppur leggermente. Forse smanettando riesco a risolverlo, ma la domanda è:
Vi viene in mente un modo migliore di approcciare il problema? io sono super arrugginito e magari non ho preso in considerazione una cosa ovvia che non ricordo più...
-----------------FINE DUBBIO SULLA SOLUZIONE MACCHINOSA MESSA IN ATTO--------------------
Ecco tutto. Ho scritto il solito mega-post da niubbo. Vogliate scusarmene...
P.D terzo dubbio che c'entra poco ma già che ci sono chiedo qui: Ho acquistato con lo sconto del forum rmxp 1.0.4, ma la patch Italiana funziona solo con la versione 1.0.2 (che però non è possibile attivare col mio n°serie, perché ai tempi si acquistava tramite altro reseller di enterbrain.
Sarebbe immorale-indecente-degno di ban "attivare" quella versione e metterci la patch ITA, non potendo farlo con la mia?
Romanzi d'avventura per ragazzi/e dai 13 ai 100 anni
Rpg2S Short Game Contest 2:
Link to comment
Share on other sites
15 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now