Ogłoszenie 

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


Administracja Forum


Poprzedni temat «» Następny temat
Światło
Autor Wiadomość
The Big Master 




Preferowany:
RPG Maker XP

Pomógł: 6 razy
Dołączył: 19 Gru 2012
Posty: 81
Skąd: Masz taki nr. IQ ?
Wysłany: Pią 18 Sty, 2013 15:47
Światło
~ Light Efects ~


Krótki opis:
Dodaje nam światło, na ogniu/latarniach itp.

Autor:
Near Fantastic

Kompatybilność:
RPG Maker XP

Skrypt:
Spoiler:

Kod:
# ? Light Effects
#================================
# ?By: Near Fantastica
#   Date: 28.06.05
#   Version: 3
#================================
#==========INSTRUCTIONS==========

#Najpierw umieść Komentarz "Light Effects"(Bez Cudzysłowia).
#Następnie podaj 2 Komentarz masz do wyboru "Ground", "Fire",
#"Lamppost", "LeftLantern", or "RightLantern".
#================================
class Spriteset_Map
#--------------------------------------------------------------
alias les_spriteset_map_initalize initialize
alias les_spriteset_map_dispose dispose
alias les_spriteset_map_update update
#--------------------------------------------------------------
def initialize
   @light_effects = []
   setup_lights
   les_spriteset_map_initalize
   update
end
#--------------------------------------------------------------
def dispose
   les_spriteset_map_dispose
   for effect in @light_effects
     effect.light.dispose
   end
   @light_effects = []
end
#--------------------------------------------------------------
def update
   les_spriteset_map_update
   update_light_effects
end
#--------------------------------------------------------------
def setup_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 == ["Light Effects"]
         type = event.list[i+1].parameters.to_s
         case type.upcase!
         when "GROUND"
           light_effects = Light_Effect.new(event,type)
           light_effects.light.zoom_x = 200 / 100.0
           light_effects.light.zoom_y = 200 / 100.0
           light_effects.light.opacity = 51
           @light_effects.push(light_effects)
         when "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 = 85
           @light_effects.push(light_effects)
         when "LAMPPOST"
           light_effects = Light_Effect.new(event,"LEFT LAMP POST")
           light_effects.light.opacity = 51
           @light_effects.push(light_effects)
           light_effects = Light_Effect.new(event,"RIGHT LAMP POST")
           light_effects.light.opacity = 51
           @light_effects.push(light_effects)
         when "LEFTLANTERN"
           light_effects = Light_Effect.new(event,type)
           light_effects.light.opacity = 150
           @light_effects.push(light_effects)
         when "RIGHTLANTERN"
           light_effects = Light_Effect.new(event,type)
           light_effects.light.opacity = 150
           @light_effects.push(light_effects)
         end
       end
     end
   end
   for effect in @light_effects
     case effect.type
     when "GROUND"
       effect.light.x = (effect.event.real_x - 200 - $game_map.display_x) / 4
       effect.light.y = (effect.event.real_y - 200 - $game_map.display_y) / 4
     when "FIRE"
       effect.light.x = (effect.event.real_x - 300 - $game_map.display_x) / 4
       effect.light.y = (effect.event.real_y - 300 - $game_map.display_y) / 4
     when "LEFT LAMP POST"
       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 5
       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
     when "RIGHT LAMP POST"
       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 25
       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
     when "LEFTLANTERN"
       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 20
       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5
     when "RIGHTLANTERN"
       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 10
       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5
     end
   end
end
#--------------------------------------------------------------
def update_light_effects
   for effect in @light_effects
     next if not in_range?(effect.event)
     case effect.type
     when "GROUND"
       effect.light.x = (effect.event.real_x - 200 - $game_map.display_x) / 4
       effect.light.y = (effect.event.real_y - 200 - $game_map.display_y) / 4
     when "FIRE"
       effect.light.x = (effect.event.real_x - 300 - $game_map.display_x) / 4
       effect.light.y = (effect.event.real_y - 300 - $game_map.display_y) / 4
     when "LEFT LAMP POST"
       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 5
       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
     when "RIGHT LAMP POST"
       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 25
       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
     when "LEFTLANTERN"
       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 20
       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5
     when "RIGHTLANTERN"
       effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 10
       effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 5
     end
   end
end
#--------------------------------------------------------------
def in_range?(object)
   screne_x = $game_map.display_x
   screne_x -= 256
   screne_y = $game_map.display_y
   screne_y -= 256
   screne_width = $game_map.display_x
   screne_width += 2816
   screne_height = $game_map.display_y
   screne_height += 2176
   return false if object.real_x <= screne_x
   return false if object.real_x >= screne_width
   return false if object.real_y <= screne_y
   return false if object.real_y >= screne_height
   return true
end
end

#================================
# ? Light Effects Class
#================================

class Light_Effect
#--------------------------------------------------------------
attr_accessor :light
attr_accessor :event
attr_accessor :type
#--------------------------------------------------------------
def initialize(event, type)
   @light = Sprite.new
   @light.bitmap = RPG::Cache.picture("LE.PNG")
   @light.visible = true
   @light.z = 1000
   @event = event
   @type = type
end
end


Screeny:
Spoiler:



Dodatkowe informacje:
Skrypt wymaga 2 do poprawnego działania, nieraz należy wejść i wyjść na mapę aby zadziałało. Potrzebuje on też tego obrazku:

Należy go nazwać "LE"
oto i 2 skrypt:
Spoiler:


#=======================================
# ■ class Game_Title
# written by Deke
# Rewiten by Near FantasticaTak to się dzieje, a ja to wyjaśnić bez Scripter. Jest to jeden skrypt set, czyli działa tylko w połączeniu z innym skrypcie. Ten jeden: Kod: [Zaznacz]
#------------------------------------------------------------------------------
#=======================================
class Game_Time

attr_accessor :minute_length

def initialize
@minute_length=0.1 #length of game minute in real seconds
@hour_length= 60.0 #minute in an hour
@day_length=24.0 #hours in a day
@month_length=30.0 #days in a month
@year_length=12.0 #months in a year
@minutes=0 #starting minute count
start_minute=56
add_minutes(start_minute)
start_hour=12 #starting hour count
add_hours(start_hour)
start_day=1 #starting day count
add_days(start_day)
start_month=1 #starting month count
add_months(start_month-1)
start_year=2005 #starting year count
add_years(start_year)
end

def add_minutes(minutes)
@minutes +=minutes
end

def add_hours(hours)
@minutes +=hours*@hour_length
end

def add_days(days)
@minutes += days*@hour_length*@day_length
end

def add_months(months)
@minutes +=months * @hour_length*@day_length*@month_length
end

def add_years(years)
@minutes += years * @hour_length*@day_length*@month_length * @year_length
end


def get_year
minutes=get_total_minutes
year=minutes / @hour_length / @day_length / @month_length / @year_length
return year
end

def get_month
minutes=get_total_minutes
month=minutes / @hour_length / @day_length / @month_length % @year_length + 1
return month
end

def get_day
minutes=get_total_minutes
day=minutes / @hour_length / @day_length % @month_length
return day
end

def get_hour
minutes=get_total_minutes
hour=minutes / @hour_length % @day_length
return hour
end

def get_total_minutes
total_sec=Graphics.frame_count / Graphics.frame_rate
minute=(total_sec/@minute_length+@minutes)
return minute
end

def get_minute
minutes=get_total_minutes % @hour_length
return minutes
end

def get_tone
hour=get_hour.floor
minutes=get_minute + hour*@hour_length
phase_shift=Math::PI*(minutes/(@hour_length*@day_length))
illumination= -150+ 165*Math.sin(phase_shift)
tone=Tone.new(illumination,illumination,illumination,0)
return tone
end

end # of class Game_Time

#=======================================#
# ■ class Window_Time #
# written by Deke #
#------------------------------------------------------------------------------#
#=======================================#
class Window_Time < Window_Base

#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
self.contents.font.name = $defaultfonttype # "Time" window font
self.contents.font.size = $defaultfontsize
refresh
end

#--------------------------------------------------------------------------
def refresh
self.contents.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
@minute=$game_time.get_minute.floor
hour = $game_time.get_hour
pm_flag= hour >=12 ? true : false
hour= hour >= 12 ? hour-12 : hour
day=$game_time.get_day
month=$game_time.get_month
year=$game_time.get_year
if hour.floor==0
text=sprintf("%02d:%02d",12,@minute)
else
text=sprintf("%02d:%02d",hour,@minute)
end
if pm_flag
text += " PM"
else
text += " AM"
end
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, text, 2)
text = sprintf("%02d-%02d-%02d", month, day, year)
self.contents.font.color=system_color
self.contents.draw_text(4,32,120,32,text)
end

#--------------------------------------------------------------------------
def update
if $game_time.get_minute.floor != @minute
refresh
end
end
end # of class

#=======================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Refer setup to Game Temp
#--------------------------------------------------------------------------
alias dns_game_temp_initalize initialize
#--------------------------------------------------------------------------
# ● Refer the Attr
#--------------------------------------------------------------------------
attr_reader :map_infos #Added Lines
attr_reader :outside_array #Added Lines
#--------------------------------------------------------------------------
# ● Refer setup to Scene Map
#--------------------------------------------------------------------------
def initialize
dns_game_temp_initalize
@outside_array = Array.new
@map_infos = load_data("Data/MapInfos.rxdata")
for key in @map_infos.keys
@outside_array[key] = @map_infos[key].name.include?("*")
end
end
end

#=======================================
class Scene_Map
#--------------------------------------------------------------------------
# ● Refer setup to Scene Map
#--------------------------------------------------------------------------
alias dns_scene_map_main main
alias dns_scene_map_update update
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
if $game_temp.outside_array[$game_map.map_id]
tone=$game_time.get_tone
@minute=$game_time.get_minute.floor
$game_screen.start_tone_change(tone, 0)
end
dns_scene_map_main
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
conditional1 =$game_temp.outside_array[$game_map.map_id] and $game_time.get_minute.floor != @minute
conditional2 =$game_temp.outside_array[$game_map.map_id] and @current_id != $game_map.map_id
if conditional1 or conditional2
tone=$game_time.get_tone
$game_screen.start_tone_change(tone, 0)
@minute = $game_time.get_minute.floor
$game_map.need_refresh=true
@current_id=$game_map.map_id
end
if $game_temp.outside_array[$game_map.map_id] == false and @current_id != $game_map.map_id
$game_screen.start_tone_change(Tone.new(0,0,0,0),0)
@current_id=$game_map.map_id
end
dns_scene_map_update
end
end

#======================================================
class Scene_Title
#--------------------------------------------------------------------------
# ● Refer setup to Scene Map
#--------------------------------------------------------------------------
alias dns_scene_title_update update
#--------------------------------------------------------------------------
# ● Refer setup to Scene Map
#--------------------------------------------------------------------------
def update
$game_time=Game_Time.new
#Dubealex Addition (from XRXS) to show Map Name on screen
dns_scene_title_update
end
end

#========================================================
class Scene_Load
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$game_time =Marshal.load(file) #Added Line
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end # of Scene_Load updates

#=======================================================
class Scene_Save
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($game_time,file) # Added Line
end
end # of Scene_Save updates

#========================================================

class Game_Map
#--------------------------------------------------------------------------
# ● Refer the attr
#--------------------------------------------------------------------------
attr_reader :outside
attr_reader :map_id
#--------------------------------------------------------------------------
# ● Outside
#--------------------------------------------------------------------------
def outside
return $game_temp.outside_array[@map_id]
end
end


Małe ustawienia w Zdarzeniu które ma się świecić, najpierw [Jeżeli już jest ustawiony np. ogień] Dajemy Komentarz "Light Effects" potem dajemy 2 w przypadku ognia bd to "Fire"
i to już wszystko
w przypadku ziemi było by to "Ground"
Latarni Ulicznej "Lamppost"
lewa i prawa latarnia różnia się tylko poczatkiem więc będzie:
"<Lewt/Right>Lantern"[bez <>]

[ Dodano: Pią 18 Sty, 2013 15:48 ]
W tych dodatkowych chodzi mi o to że potrzeba drugiego skryptu do poprawnego działania.
________________________
Siema

Gość, Jeżeli ci Pomogłem, możesz mi dać .
_______________________________________________________________
Niestety, padł mi komp z Projektami, więc przez pewien czas niestety nici z Projektów :C
 
 
 
Trzynasty 



Preferowany:
RPG Maker XP

Dołączył: 12 Mar 2013
Posty: 36
Skąd: Jesteś ?
Wysłany: Czw 14 Mar, 2013 19:21
Linijka 43 mi nie działa :/ pewnie przez Polish Version.
 
 
 
ka0909 



Preferowany:
RPG Maker XP

Pomógł: 20 razy
Dołączył: 02 Paź 2010
Posty: 122
Wysłany: Czw 14 Mar, 2013 19:36
A masz może najnowsze biblioteki RGSS? Bo to bardziej ot tego zależy niż od polskiej wersji.
---edit---
Mi działa na polskiej wersji z RGSS102E ;)
________________________
ka0909 <--- Tajemnicze kanumerki
Pomagam w skryptach XP,VX i VX ace.
Napisz priv jeśli potrzebujesz pomocy ;)
 
 
Trzynasty 



Preferowany:
RPG Maker XP

Dołączył: 12 Mar 2013
Posty: 36
Skąd: Jesteś ?
Wysłany: Czw 14 Mar, 2013 21:06
Mam wszystkie istniejące biblioteczki.
 
 
 
ka0909 



Preferowany:
RPG Maker XP

Pomógł: 20 razy
Dołączył: 02 Paź 2010
Posty: 122
Wysłany: Czw 14 Mar, 2013 21:31
Program/gra i tak korzysta tylko z wybranej, która jest wpisana w game.ini wiec tam musisz dokonać zmian na inną biblioteczkę najlepiej RGSS102E lub lepsza. Pamiętaj że przy zapisie gry w programie game.ini się nadpisuje*
________________________
ka0909 <--- Tajemnicze kanumerki
Pomagam w skryptach XP,VX i VX ace.
Napisz priv jeśli potrzebujesz pomocy ;)
 
 
Trzynasty 



Preferowany:
RPG Maker XP

Dołączył: 12 Mar 2013
Posty: 36
Skąd: Jesteś ?
Wysłany: Pią 15 Mar, 2013 16:57
Pozmieniałem troszkę.
Nazwa zdarzenia: S%
Polecenia zdarzenia
<>Komentarz: Light Effects
<>Komentarz: Fire
I działa, dzięki za pomoc. :)
 
 
 
Wyświetl posty z ostatnich:   
Odpowiedz do tematu
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