Allora ragazzi, io ho messo questo script nel mio progetto :
# ■ Light Effects XP V.3.2 #================================ # By: Near Fantastica # Date: 28.06.05 # Version: 3 # modified by:SKKY88 # DATE: 06.08.09 # bug risolto=ora le luci non si muovono più su mappe superiori a 20x15 # #================================
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.code == 108 and event.list.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.code == 108 and event.list.parameters == ["FIRE"] type = "FIRE" light_effects = Light_Effect.new(event,type) light_effects.light.zoom_x = 5 light_effects.light.zoom_y = 5 light_effects.light.opacity = 100 @light_effects.push(light_effects) end if event.list.code == 108 and event.list.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.code == 108 and event.list.parameters == ["LIGHT2"] type = "LIGHT2" 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.code == 108 and event.list.parameters == ["TORCH"] type = "TORCH" 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.code == 108 and event.list.parameters == ["TORCH2"] type = "TORCH2" 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 end end for effect in @light_effects case effect.type when "GROUND" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 47 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 47 effect.light.blend_type = 1 when "FIRE" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 144 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 144 effect.light.tone = Tone.new(255,-100,-255, 0) effect.light.blend_type = 1 when "LIGHT" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15 effect.light.blend_type = 1 when "LIGHT2" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15 effect.light.blend_type = 1 when "TORCH" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15 effect.light.tone = Tone.new(255,-100,-255, 0) effect.light.blend_type = 1 when "TORCH2" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 240 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 210 effect.light.tone = Tone.new(255,-100,-255, 0) effect.light.blend_type = 1 end end end def update_light_effects if $game_switches[1] for effect in @light_effects next if effect.type == "FIRE" || effect.type == "TORCH" effect.light.visible = false end else for effect in @light_effects next if effect.type == "FIRE" || effect.type == "TORCH" effect.light.visible = true end end for effect in @light_effects case effect.type when "GROUND" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 45 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 45 when "FIRE" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 144 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 144 effect.light.opacity = rand(10) + 90 when "LIGHT" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15 when "LIGHT2" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15 when "TORCH" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15 effect.light.opacity = rand(30) + 70 when "TORCH2" effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 240 effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 210 effect.light.opacity = rand(10) + 90 end end 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
Ho inserito pure la seguente immagine PNG nella cartella pictures :
Infine ho creato pure i 2 eventi in parallelo delle switch...
Il punto è che quando entro nella mappa dove ho messo i lampioni, e quindi queste luci, non mi si vede na mazza XD
Ho provato pure a spostare lo script in alto e in basso nell'elenco, ma se lo sposto sopra a quelli che ho aggiunto comincia a darmi un errore, mentre se lo tengo come ultimo va bene, a parte il fatto che non vedo l'effetto delle luci...
Question
rizzuccio
Allora ragazzi, io ho messo questo script nel mio progetto :
# ■ Light Effects XP V.3.2
#================================
# By: Near Fantastica
# Date: 28.06.05
# Version: 3
# modified by:SKKY88
# DATE: 06.08.09
# bug risolto=ora le luci non si muovono più su mappe superiori a 20x15
#
#================================
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.code == 108 and event.list.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.code == 108 and event.list.parameters == ["FIRE"]
type = "FIRE"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 5
light_effects.light.zoom_y = 5
light_effects.light.opacity = 100
@light_effects.push(light_effects)
end
if event.list.code == 108 and event.list.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.code == 108 and event.list.parameters == ["LIGHT2"]
type = "LIGHT2"
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.code == 108 and event.list.parameters == ["TORCH"]
type = "TORCH"
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.code == 108 and event.list.parameters == ["TORCH2"]
type = "TORCH2"
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
end
end
for effect in @light_effects
case effect.type
when "GROUND"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 47
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 47
effect.light.blend_type = 1
when "FIRE"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 144
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 144
effect.light.tone = Tone.new(255,-100,-255, 0)
effect.light.blend_type = 1
when "LIGHT"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
effect.light.blend_type = 1
when "LIGHT2"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
effect.light.blend_type = 1
when "TORCH"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
effect.light.tone = Tone.new(255,-100,-255, 0)
effect.light.blend_type = 1
when "TORCH2"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 240
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 210
effect.light.tone = Tone.new(255,-100,-255, 0)
effect.light.blend_type = 1
end
end
end
def update_light_effects
if $game_switches[1]
for effect in @light_effects
next if effect.type == "FIRE" || effect.type == "TORCH"
effect.light.visible = false
end
else
for effect in @light_effects
next if effect.type == "FIRE" || effect.type == "TORCH"
effect.light.visible = true
end
end
for effect in @light_effects
case effect.type
when "GROUND"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 45
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 45
when "FIRE"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 144
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 144
effect.light.opacity = rand(10) + 90
when "LIGHT"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
when "LIGHT2"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
when "TORCH"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 15
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 15
effect.light.opacity = rand(30) + 70
when "TORCH2"
effect.light.x = (-0.25 * $game_map.display_x) + (effect.event.x * 32) - 240
effect.light.y = (-0.25 * $game_map.display_y) + (effect.event.y * 32) - 210
effect.light.opacity = rand(10) + 90
end
end
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
Ho inserito pure la seguente immagine PNG nella cartella pictures :
http://i73.servimg.com/u/f73/16/32/72/82/le10.png
Infine ho creato pure i 2 eventi in parallelo delle switch...
Il punto è che quando entro nella mappa dove ho messo i lampioni, e quindi queste luci, non mi si vede na mazza XD
Ho provato pure a spostare lo script in alto e in basso nell'elenco, ma se lo sposto sopra a quelli che ho aggiunto comincia a darmi un errore, mentre se lo tengo come ultimo va bene, a parte il fatto che non vedo l'effetto delle luci...
Come posso risolvere questo problema ?
Grazie in anticipo =)
http://www.freankexpo.net/signature.php?gid=683.png
Link to comment
Share on other sites
9 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