Ogłoszenie 

Uwaga! To forum jest w trybie offline.
Wszelką pomoc uzyskasz pod adresem
forum.ultimateam.pl


Administracja Forum


Poprzedni temat «» Następny temat
Zamknięty przez: Ayene
Czw 11 Sie, 2011 10:15
Skrypt Thomas Edison - problem
Autor Wiadomość
artekwnc 



Preferowany:
RPG Maker XP

Dołączył: 11 Paź 2009
Posty: 110
Wysłany: Sob 23 Lip, 2011 13:21
Skrypt Thomas Edison - problem
Posiadam ten skrypt -
Kod:
=begin
                              Thomas Edison VX

Versja: 0.1
Autor: BulletXt (bulletxt@gmail.com)
Data: 12/06/2009
Tłumaczenie: Marcin (http://www.ultimateam.pl)


WAŻNE: aby ten skrypt działał potrzebujecie obrazka le.png w pliku Graphics/Pictures.
 
Typy światła:
 
 GROUND - średnie białe światło.
 GROUND2 - to co wyżej, lekko migoczące
 GROUND3 - czerwone światło.
 GROUND4 - zielone światło.
 GROUND5 - niebieskie światło.
 FIRE - czerwone światlo, pod ognisko.
 LIGHT - małe białe światło.
 LIGHT2 - duże białe światło.
 LIGHT3 - małe białe światło, słabsze od LIGHT.
 TORCH - czerwone, migoczące.
 TORCH2 - czerwone migoczące.
 TORCH3 - średnie, białe, migoczące.

Należy je umieścić jako komentarz w danym evencie.

=end

  #ID switch'a/przełącznika (jeżeli jest On to światła NIE ma)
  #dla świateł typu: FIRE
  FIRE = 87
  #dla świateł typu: LIGHT, LIGHT2, LIGHT3
  LIGHT = 86
  #dla świateł typu: GROUND, GROUND2, GROUND3, GROUND4, GROUND5
  GROUND = 85
  #dla świateł typu: TORCH, TORCH2, TORCH3
  TORCH = 84


# jeżeli macie skrypt KGC_DayNight. To wystarczy poniższe polecenie zamienić na true.
# ten skrypt musi być umieszczony pod skryptem KDC_DayNight
  ENABLE_KGC_DAY_NIGHT_SCRIPT = false

=begin
poniższa wartość musi być taka sama jak w skrypcie KGC_DayNight wartość "PHASE_VARIABLE"
Domyślnie jest to 11.
=end
  KGC_DAY_NIGHT_SCRIPT_VARIABLE = 11

################################################################################


$bulletxt_day_check = 0

class Spriteset_Map
   
  alias bulletxt_spriteset_map_initalize initialize
  def initialize
    @light_effects = []
    initialize_lights
    bulletxt_spriteset_map_initalize
    update
  end

  alias bulletxt_spriteset_map_dispose dispose
  def dispose
    bulletxt_spriteset_map_dispose
    for effect in @light_effects
        effect.light.dispose
    end
    @light_effects = []
  end
   
  alias bulletxt_spriteset_map_update update
  def update
    bulletxt_spriteset_map_update
    check_day_night if ENABLE_KGC_DAY_NIGHT_SCRIPT
    update_light_effects
  end
 
  def check_day_night
    #jeżeli noc
    if $bulletxt_day_check == 0
      if $game_variables[KGC_DAY_NIGHT_SCRIPT_VARIABLE] == 1
        $scene = Scene_Map.new
        $bulletxt_day_check = 1
      end   
    else
      #jeżeli dzień
      if $game_variables[KGC_DAY_NIGHT_SCRIPT_VARIABLE] == 3
        $game_variables[KGC_DAY_NIGHT_SCRIPT_VARIABLE] = -1
        $scene = Scene_Map.new
        $bulletxt_day_check = 0
      end
    end
  end
 
  def initialize_lights
    for event in $game_map.events.values
      next if event.list == nil
      for i in 0...event.list.size
        if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
          type = "FIRE"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 300 / 100.0
          light_effects.light.zoom_y = 300 / 100.0
          light_effects.light.opacity = 100
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
          type = "LIGHT"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 1
          light_effects.light.zoom_y = 1
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
          type = "LIGHT2"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 6
          light_effects.light.zoom_y = 6
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end

        if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT3"]
          type = "LIGHT3"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 1
          light_effects.light.zoom_y = 1
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end

        if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
          type = "TORCH"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 6
          light_effects.light.zoom_y = 6
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
          type = "TORCH2"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 6
          light_effects.light.zoom_y = 6
          light_effects.light.opacity = 150
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["TORCH3"]
          type = "TORCH3"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 300 / 100.0
          light_effects.light.zoom_y = 300 / 100.0
          light_effects.light.opacity = 100
          @light_effects.push(light_effects)
        end

        if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
          type = "GROUND"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 100
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["GROUND2"]
          type = "GROUND2"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 100
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["GROUND3"]
          type = "GROUND3"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 100
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["GROUND4"]
          type = "GROUND4"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 100
          @light_effects.push(light_effects)
        end
        if event.list[i].code == 108 and event.list[i].parameters == ["GROUND5"]
          type = "GROUND5"
          light_effects = Light_Effect.new(event,type)
          light_effects.light.zoom_x = 2
          light_effects.light.zoom_y = 2
          light_effects.light.opacity = 100
          @light_effects.push(light_effects)
        end
      end
    end
   
    for effect in @light_effects
      case effect.type       
      when "FIRE"
        effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
        effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
        effect.light.tone = Tone.new(255,-100,-255, 0)
        effect.light.blend_type = 1
      when "LIGHT"
        effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
        effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
        effect.light.blend_type = 1
      when "LIGHT2"
        effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
        effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
        effect.light.blend_type = 1
      when "LIGHT3"
        effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
        effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
        effect.light.blend_type = 1
      when "TORCH"
        effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
        effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(255,-100,-255, 0)
        effect.light.blend_type = 1
      when "TORCH2"
        effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
        effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(255,-100,-255, 0)
        effect.light.blend_type = 1
      when "TORCH3"
        effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
        effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
        effect.light.blend_type = 1     
      when "GROUND"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.blend_type = 1
      when "GROUND2"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.blend_type = 1
      when "GROUND3"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(255,-255,-255, 255)
        effect.light.blend_type = 1
      when "GROUND4"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(-255,255,-255, 100)
        effect.light.blend_type = 1
      when "GROUND5"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.tone = Tone.new(-255,255,255, 100)
        effect.light.blend_type = 1
      end
    end
  end
   
  def update_light_effects
    # handle FIRE
    if $game_switches[FIRE]
      for effect in @light_effects
        next if effect.type != "FIRE"
        effect.light.visible = false
      end
    else
      for effect in @light_effects
       next if effect.type != "FIRE"
        effect.light.visible = true
      end
    end

    # handle LIGHT
    if $game_switches[LIGHT]
      for effect in @light_effects
        next if effect.type != "LIGHT" && effect.type != "LIGHT2" && effect.type != "LIGHT3"
        effect.light.visible = false
      end
    else
      for effect in @light_effects
        next if effect.type != "LIGHT" && effect.type != "LIGHT2" && effect.type != "LIGHT3"
        effect.light.visible = true
      end
    end

    # handle GROUND
    if $game_switches[GROUND]
      for effect in @light_effects
        next if effect.type != "GROUND" && effect.type != "GROUND2" && effect.type != "GROUND3" && effect.type != "GROUND4" && effect.type != "GROUND5"
        effect.light.visible = false
      end
    else
      for effect in @light_effects
        next if effect.type != "GROUND" && effect.type != "GROUND2" && effect.type != "GROUND3" && effect.type != "GROUND4" && effect.type != "GROUND5"
        effect.light.visible = true
      end
    end

    # handle TORCH
    if $game_switches[TORCH]
      for effect in @light_effects
        next if effect.type != "TORCH" && effect.type != "TORCH2" && effect.type != "TORCH3"
        effect.light.visible = false
      end
    else
      for effect in @light_effects
        next if effect.type != "TORCH" && effect.type != "TORCH2" && effect.type != "TORCH3"
        effect.light.visible = true
      end
    end

    for effect in @light_effects
      case effect.type
      when "FIRE"
        effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
        effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
        effect.light.opacity = rand(10) + 90   
      when "LIGHT"
        effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
        effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
      when "LIGHT2"
        effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
        effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
      when "LIGHT3"
        effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
        effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
        effect.light.opacity = rand(10) + 90   
      when "TORCH"
        effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
        effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8 + rand(20) - 10
        effect.light.opacity = rand(30) + 70
      when "TORCH2"
        effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
        effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
        effect.light.opacity = rand(10) + 90
      when "TORCH3"
        effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
        effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
        effect.light.opacity = rand(10) + 90   
      when "GROUND"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
      when "GROUND2"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
        effect.light.opacity = rand(10) + 90
      when "GROUND3"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
      when "GROUND4"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
      when "GROUND5"
        effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
        effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
      end
    end
  end
end

class Light_Effect
  attr_accessor :light
  attr_accessor :event
  attr_accessor :type
  attr_accessor :player
 
  def initialize(event, type)
    @light = Sprite.new
    @light.bitmap = RPG::Cache.picture("le.png")
    @light.visible = true
    @light.z = 1000
    @event = event
    @player = player
    @type = type
  end
end



Przerobiony przez Ayene na XP. I mam 2 pytania
- czemu tylko LIGHT działa poprawnie, a reszta jest o pare kratek w innym miejscu?
- jak zrobić aby te światło nie latało za mną, stało w miejscu?
 
 
 
Dr.man 




Preferowany:
RPG Maker XP

Dołączył: 20 Lip 2011
Posty: 3
Wysłany: Sob 23 Lip, 2011 21:52
A nie lepiej zrobić na zdarzeniach?
 
 
artekwnc 



Preferowany:
RPG Maker XP

Dołączył: 11 Paź 2009
Posty: 110
Wysłany: Sob 23 Lip, 2011 22:31
robiłem... ale mam problemy potem z tym...
________________________
Quantino
 
 
 
Wyświetl posty z ostatnich:   
Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Powered by phpBB modified by Przemo © 2003 phpBB Group | Template Klam by Ayene