collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: Map_Fog_Script  (Gelesen 7957 mal)

Offline Snake

  • Moderator
  • VX-Kenner
  • ***
  • Beiträge: 538
  • Blubb, der Mod den keiner kennt! XD
Map_Fog_Script
« am: Januar 27, 2008, 19:58:24 »
Ein weiteres, cooles Script von DeadlyDan.

Screens:



Spoiler for Hiden:
#==============================================================================
# ¦ DeadlyDan_MapFog by DeadlyDan
#------------------------------------------------------------------------------
#  Allows maps to have fogs like in RPG Maker XP
#==============================================================================
# Usage:
=begin
  
  To initialize a fog for a current map you must:
  
  1) Create a map event and set it to only come on when Self Switch A is on.
  2) Rename it to FOG. (Case sensitive, so it has to be FOG)
  3) Set it to a Parallel Process.
  4) Add for example, the following code into a Script Code event command:
  
  $game_map.fog_name = "fog"               # Filename of fog image located in the Pictures folder
  $game_map.fog_zoom = 300                 # How much to zoom into the fog image
  $game_map.fog_sx = 1                           # The scrolling speed across the x axis
  $game_map.fog_sy = 1                           # The scrolling speed across the y axis
  $game_map.fog_target_opacity = 80    # The opacity of the fog
  $game_map.fog_show                             # Always call this after changing fog variables  
  
  5) Then, add a Control Self Switch after that Script Code, and set it to turn A off.
  
  (Note)
  It is absolutely vital that you put the event name to FOG and set it to a Parallel Proccess and also set it to
  only run when Self-Switch A is on.
  
  Make sure you place this script after all other scripts except for Main.
  
  (Extras)
  You can also use extra commands to change the fog settings, such as the following example:
  
  $game_map.fog_tone = Tone.new ( 100, 0, 0, 0 )
  $game_map.fog_blend_type = 1 # ( 0 = NONE, 1 = ADD, 2 = SUBTRACT )
  
  (Important!)
  When you want to have a map with no fog, do all of the above but instead of seting the fog options and then
  calling $game_map.fog_show, just add a Script Code event command and place in it $game_map.fog_clear.
  
  This will clear the fog settings and the fog will dissapear, every map has to have a fog event in it, else maps
  will keep all other maps fog settings that might be unintentional on the users side.
  
=end

class Game_Temp
  attr_accessor :fog_name
  attr_accessor :fog_opacity
  attr_accessor :fog_target_opacity
  attr_accessor :fog_blend_type
  attr_accessor :fog_zoom
  attr_accessor :fog_sx
  attr_accessor :fog_sy
  attr_accessor :fog_tone
  
  alias original_initialize initialize
  def initialize
    original_initialize
    @fog_name = ""
    @fog_tone = Tone.new ( 0, 0, 0, 0 )
    @fog_opacity = 0
    @fog_target_opacity = 0
    @fog_blend_type = 0
    @fog_zoom = 100
    @fog_sx = 0
    @fog_sy = 0
  end
  
end

class Game_Map
  attr_accessor :fog_name
  attr_accessor :fog_opacity
  attr_accessor :fog_target_opacity
  attr_accessor :fog_blend_type
  attr_accessor :fog_zoom
  attr_accessor :fog_sx
  attr_accessor :fog_sy
  attr_accessor :fog_ox
  attr_accessor :fog_oy
  attr_accessor :fog_tone
  attr_accessor :fog_start_loop
  attr_accessor :fog_eventid
  attr_accessor :fog_visible
  attr_accessor :fog
  
  alias original_initialize initialize
  def initialize
    original_initialize
    @fog = Plane.new ( @viewport1 )
    @fog_ox = 0
    @fog_oy = 0
  end
  
  alias original_setup setup
  def setup ( map_id )
    original_setup ( map_id )
    fog_event
  end

  alias original_update update
  def update
    original_update
    if ( @fog_visible and @fog )
      fog_update
    end
  end  

  def fog_init
      @fog_name = $game_temp.fog_name
      @fog_tone = $game_temp.fog_tone
      @fog_opacity = $game_temp.fog_opacity
      @fog_target_opacity = $game_temp.fog_target_opacity
      @fog_blend_type = $game_temp.fog_blend_type
      @fog_zoom = $game_temp.fog_zoom
      @fog_sx = $game_temp.fog_sx
      @fog_sy = $game_temp.fog_sy
      @fog_tone_target = Tone.new ( 0, 0, 0, 0 )
      @fog_tone_duration = 0
      @fog_opacity_duration = 0
      @fog_opacity_target = 0
      @fog_previous_name = ""
      fog_setup
  end
  
  def fog_setup
    fog_hide
    if ( ( @fog_previous_name != @fog_name ) and ( @fog_name != "" ) )
      @fog.bitmap = Cache.picture ( @fog_name )
      @fog_name_previous = @fog_name
      @fog_opacity = @fog_target_opacity
      @fog.opacity = @fog_opacity
      @fog.blend_type = @fog_blend_type
      @fog.zoom_x = @fog_zoom / 100
      @fog.zoom_y = @fog_zoom / 100
      @fog.ox = @fog_ox
      @fog.oy = @fog_oy
      @fog.tone = @fog_tone
      @fog.z = 99
      @fog_visible = true
    else
       fog_hide
    end
  end
  
  def fog_update
    @fog_ox -= @fog_sx / 8.0
    @fog_oy -= @fog_sy / 8.0

    if ( @fog_tone_duration >= 1 )
      d = @fog_tone_duration
      target = @fog_tone_target
      @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
      @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
      @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
      @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
      @fog_tone_duration -= 1
    end
    if ( @fog_opacity_duration >= 1 )
      d = @fog_opacity_duration
      @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
      @fog_opacity_duration -= 1
    end
    @fog.opacity = @fog_opacity
    @fog.blend_type = @fog_blend_type
    @fog.zoom_x = @fog_zoom / 100
    @fog.zoom_y = @fog_zoom / 100
    @fog.ox = @fog_ox
    @fog.oy = @fog_oy
    @fog.tone = @fog_tone
  end
  
  def fog_show
    fog_init
  end
  
  def fog_hide
    @fog_visible = false
    @fog_opacity = 0
    $game_temp.fog_opacity = 0
  end
  
  def fog_clear
    @fog_visible = false
    @fog_opacity = 0
    $game_temp.fog_opacity = 0
    @fog_target_opacity = 0
    $game_temp.fog_target_opacity = 0
    fog_show
  end
    
  def scroll_up ( distance )
    if ( loop_vertical? )
      @display_y += @map.height * 256 - distance
      @display_y %= @map.height * 256
      @parallax_y -= distance
      @fog_oy -= distance / 8.0
    else
      last_y = @display_y
      @display_y = [@display_y - distance, 0].max
      @parallax_y += @display_y - last_y
      @fog_oy += ( @display_y - last_y ) / 8.0
    end
  end
  
  def scroll_down ( distance )
    if ( loop_vertical? )
      @display_y += distance
      @display_y %= @map.height * 256
      @parallax_y += distance
      @fog_oy += distance / 8.0
    else
      last_y = @display_y
      @display_y = [@display_y + distance, (height - 13) * 256].min
      @parallax_y += @display_y - last_y
      @fog_oy += ( @display_y - last_y ) / 8.0
    end
  end

  def scroll_left ( distance )
    if ( loop_horizontal? )
      @display_x += @map.width * 256 - distance
      @display_x %= @map.width * 256
      @parallax_x -= distance
      @fog_ox -= distance / 8.0
    else
       last_x = @display_x
      @display_x = [@display_x - distance, 0].max
      @parallax_x += @display_x - last_x
      @fog_ox += ( @display_x - last_x ) / 8.0
    end
  end
  
  def scroll_right ( distance )
    if ( loop_horizontal? )
      @display_x += distance
      @display_x %= @map.width * 256
      @parallax_x += distance
      @fog_ox += distance / 8.0
    else
      last_x = @display_x
      @display_x = [@display_x + distance, (width - 17) * 256].min
      @parallax_x += @display_x - last_x
      @fog_ox += ( @display_x - last_x ) / 8.0
    end
  end
  
  def setup_events
    @fog_eventid = 0
    @events = {}
    for i in @map.events.keys
      @events = Game_Event.new(@map_id, @map.events)
      if ( @events.name == "FOG" )
        @fog_eventid = i
      end
    end
    @common_events = {}
    for i in 1...$data_common_events.size
      @common_events = Game_CommonEvent.new(i)
    end
  end
    
  def fog_event
    if ( @fog_eventid != 0 )
      key = @events[@fog_eventid].selfswitch
      $game_self_switches[key] = true
    end
  end

end

class Scene_Map < Scene_Base
  
  alias original_start start
  def start
    original_start
    $game_map.fog_show
    $game_map.fog_event
  end

  alias original_terminate terminate
  def terminate
    original_terminate
    $game_map.fog_hide
  end
  
end

class Game_Player < Game_Character
  
  alias original_perform_transfer perform_transfer
  def perform_transfer
    original_perform_transfer
    $game_map.setup_events
    $game_map.fog_event
    $game_map.fog_show
  end
  
end

class Game_Event < Game_Character

  def name
    return @event.name
  end
  
  def selfswitch
    key = [@map_id, @event.id, 'A']
    return key
  end
  
end

Ihr könnt z.b denn Fog aus dem RTP des XP's nehmen.
Müsst ihn nur demenstprechend umbennen.

Quelle:
http://www.rpgrevolution.com/forums/?showtopic=8337

So muss euer Event aussehen damit es klappt!


Edit von ERZENGEL:
Bessere Alternative ohne Bugs!:
Eine weitere Alternative für Fogs: http://www.rpgrevolution.com/forums/?showtopic=9385
Ich verlinke nur mal, da woratana nicht möchte, dass es außerhalb von RRR gepostet wird, ich hoffe ihr könnt soweit englisch. Ah ja, ich finde alle Lösungen gut, will damit nicht, dass die anderen untergehen, nur kann man sich bei der Auswahl vielleicht besser entscheiden, was das beste für einen persönlich ist.
« Letzte Änderung: Juli 11, 2008, 18:48:15 von ERZENGEL »
Zitat
Snake 23:50

ich lads schnell


Silvanus 23:50

bist ne geile sau
:)

Map_Fog_Script

Dainreth

  • Gast
Map_Fog_Script
« Antwort #1 am: Januar 27, 2008, 20:28:56 »
Sehe schon, du hast schon die Version genommen, in der $game_map.fog_show in der Dokumentation ist, war vorher ja noch nen kleiner Fehler. Allerdings funktioniert das ganze trotz Ersetzen bei mir immer noch nicht, mal sehen was DeadlyDan sagt. Hast dus probiert, Snake?
btw. Wär vielleicht gut, wenn du immer zu nem original-Thread verlinkst für Leute, die damit Probleme haben oder sich bedanken wollen.

Map_Fog_Script

Offline Baur

  • Mr. MACK-Tile
  • ***
  • Beiträge: 272
    • http://
Map_Fog_Script
« Antwort #2 am: Januar 27, 2008, 20:42:42 »
Könnte man schon einsetzen, aber im Moment ist's mir noch zu umständlich, da ja jede Map ein Par-Event braucht, auch die, wo man keinen Fog haben will.

Wär besser, wenn er was mit Comment-Abfrage oder Mapnamen-Endung mache würde.
« Letzte Änderung: Januar 27, 2008, 20:57:16 von Baur »
Formerly known as [size=]Rabu[/size] *g*

PS: In nächster Zeit selten im Forum. RL sucks.

Map_Fog_Script

Dainreth

  • Gast
Map_Fog_Script
« Antwort #3 am: Januar 27, 2008, 20:47:17 »
Hm, Rabu hast du schon getestet ob das Skript funktioniert? Irgendwie will das bei mir einfach nicht, kommt leider Gottes jetzt auch keine Fehlermeldung mit dem neuen Code den Deadly oben verwechselt hatte. kommt aber auch kein Fog, wär schön, wenn das mal jemand testen kann, damit ich weiß, wo der Fehler liegt.

Map_Fog_Script

Offline Snake

  • Moderator
  • VX-Kenner
  • ***
  • Beiträge: 538
  • Blubb, der Mod den keiner kennt! XD
Map_Fog_Script
« Antwort #4 am: Januar 27, 2008, 20:50:16 »
Zitat von: Dainreth
Sehe schon, du hast schon die Version genommen, in der $game_map.fog_show in der Dokumentation ist, war vorher ja noch nen kleiner Fehler. Allerdings funktioniert das ganze trotz Ersetzen bei mir immer noch nicht, mal sehen was DeadlyDan sagt. Hast dus probiert, Snake?
btw. Wär vielleicht gut, wenn du immer zu nem original-Thread verlinkst für Leute, die damit Probleme haben oder sich bedanken wollen.



So Quelle hinzugefügt.
Ja ich habs probiert^^
Hab DeadlyDan sogar in MSN geaddet weil er
nen fehler machte... Deswegen hab ich jetzt auch das neue schon drin.
falls es bei dir ned funzt... Dein Event muss EXAKT so aussehen:
(http://b1u3ray.kilu2.de/imgupp/thumbs/900424frgn.jpg)
« Letzte Änderung: Januar 27, 2008, 20:57:12 von Snake »
Zitat
Snake 23:50

ich lads schnell


Silvanus 23:50

bist ne geile sau
:)

Map_Fog_Script

Offline Baur

  • Mr. MACK-Tile
  • ***
  • Beiträge: 272
    • http://
Map_Fog_Script
« Antwort #5 am: Januar 27, 2008, 20:53:34 »
Dainreth, weiss nur das dieses Fog-Event den Namen haben "FOG" haben muss. Wie's Snake im Screenshot hat.

Nicht selbst getestet. mir ist's noch zu umständlich.
« Letzte Änderung: Januar 27, 2008, 20:56:10 von Baur »
Formerly known as [size=]Rabu[/size] *g*

PS: In nächster Zeit selten im Forum. RL sucks.

Map_Fog_Script

Dainreth

  • Gast
Map_Fog_Script
« Antwort #6 am: Januar 27, 2008, 21:07:11 »
Jop, habs auch so, habs auch grad im anderen Forum gepostet und der Screen sieht so aus, weiß nicht, was noch falsch sein könnte. Trotzdem danke an euch beide.

Map_Fog_Script

Offline Snake

  • Moderator
  • VX-Kenner
  • ***
  • Beiträge: 538
  • Blubb, der Mod den keiner kennt! XD
Map_Fog_Script
« Antwort #7 am: Januar 27, 2008, 21:23:30 »
Zitat von: Dainreth
Jop, habs auch so, habs auch grad im anderen Forum gepostet und der Screen sieht so aus, weiß nicht, was noch falsch sein könnte. Trotzdem danke an euch beide.

fast du vielleicht die fog datei ned im Pictures Ordner?
Oder irgendwas falsch benannt?
Zitat
Snake 23:50

ich lads schnell


Silvanus 23:50

bist ne geile sau
:)

Map_Fog_Script

Dainreth

  • Gast
Map_Fog_Script
« Antwort #8 am: Januar 27, 2008, 21:25:25 »
fog ist der, den Deadly gepostet hat importiert in den Picture Ordner, umbenannt habe ich nichts, das ist das komische, was könnte noch falsch benannt sein?

Map_Fog_Script

Offline Snake

  • Moderator
  • VX-Kenner
  • ***
  • Beiträge: 538
  • Blubb, der Mod den keiner kennt! XD
Map_Fog_Script
« Antwort #9 am: Januar 27, 2008, 21:41:50 »
Zitat von: Dainreth
fog ist der, den Deadly gepostet hat importiert in den Picture Ordner, umbenannt habe ich nichts, das ist das komische, was könnte noch falsch benannt sein?

Hmm...
Kannst du ma bitte n Screen von deinem Event machen?
Evtl. haste doch was falsch gemacht^^
Oder du hast was falsches in deiner Scriptbox...
Versuch ma das:
$game_temp.fog_name = "fog"
$game_temp.fog_zoom = 300                
$game_temp.fog_sx = 1              
$game_temp.fog_sy = 1                        
$game_temp.fog_target_opacity = 80    
$game_map.fog_show
Zitat
Snake 23:50

ich lads schnell


Silvanus 23:50

bist ne geile sau
:)

Map_Fog_Script

Talyana Meriweather Rahl

  • Gast
Map_Fog_Script
« Antwort #10 am: Januar 27, 2008, 21:49:23 »
Was ist denn ein Fog?? |D

Map_Fog_Script

Offline Goldenboss

  • Mr. MACK-Tile
  • ***
  • Beiträge: 251
    • http://www.goldenboss.de
Map_Fog_Script
« Antwort #11 am: Januar 27, 2008, 21:51:32 »
Fog = Mist = Nebel ;)

Map_Fog_Script

Offline Snake

  • Moderator
  • VX-Kenner
  • ***
  • Beiträge: 538
  • Blubb, der Mod den keiner kennt! XD
Map_Fog_Script
« Antwort #12 am: Januar 27, 2008, 21:52:00 »
Zitat von: Talyana Meriweather Rahl
Was ist denn ein Fog?? |D

Fog = Nebel
Siehst du ja an denn beiden Screen ganz oben.
Damit kannst du eben z.b Nebel rufen.

EDIT:
zu langsam... Ich sollte aufhören das immernoch zu
umschreiben xDD
« Letzte Änderung: Januar 27, 2008, 21:52:34 von Snake »
Zitat
Snake 23:50

ich lads schnell


Silvanus 23:50

bist ne geile sau
:)

Map_Fog_Script

Talyana Meriweather Rahl

  • Gast
Map_Fog_Script
« Antwort #13 am: Januar 27, 2008, 23:07:34 »
Ich finde der untere Screen sieht garnicht wie ein Nebel aus sondern mehr wie so Schatten von Bäume die den Himmel vedecken deswegen war ich etwas irritiert sorry|D

Map_Fog_Script

Offline Snake

  • Moderator
  • VX-Kenner
  • ***
  • Beiträge: 538
  • Blubb, der Mod den keiner kennt! XD
Map_Fog_Script
« Antwort #14 am: Januar 27, 2008, 23:22:26 »
Zitat von: Talyana Meriweather Rahl
Ich finde der untere Screen sieht garnicht wie ein Nebel aus sondern mehr wie so Schatten von Bäume die den Himmel vedecken deswegen war ich etwas irritiert sorry|D


Ja klar das soll das auich darstellen^^
Aber im XP gabs das ja auch schon... Lief auch unter Fogs.
Im grunde genommen kannst du damit alles anzeigen lassen was du willst.
Sogar wolken!
(http://b1u3ray.kilu2.de/imgupp/thumbs/659911Wolken^^.jpg)

Du musst nur die passenden Fogs importieren und
das Script dementsprechend umbennen (also das Call Event)
Zitat
Snake 23:50

ich lads schnell


Silvanus 23:50

bist ne geile sau
:)

 


 Bild des Monats

rooftop party

Views: 3585
By: papilion

 Umfrage

  • Wer soll das BdM gewinnen?
  • Dot Kandidat 1
  • 3 (25%)
  • Dot Kandidat 2
  • 1 (8%)
  • Dot Kandidat 3
  • 2 (16%)
  • Dot Kandidat 4
  • 0 (0%)
  • Dot Kandidat 5
  • 6 (50%)
  • Stimmen insgesamt: 12
  • View Topic

 Schnellsuche





SimplePortal 2.3.3 © 2008-2010, SimplePortal