[résolu] Bug avec les effets de lumière
Lun 28 Fév 2011 - 18:58
Bonsoir tout le monde,
Alors, ça fait déjà un petit moment que j'ai ce bug, mais je n'ai pas réussi à le résoudre
J'utilise le "Day and Night temps reel by grifdail selon Vampyr" qui permet de changer le ton de l'écran en fonction de l'heure du jour. Et j'utilise en plus le "Light Effects VX 1.1par Kylock". J'ai fait en sorte que les lumières s'allument automatiquement lorsque la nuit tombe. Alors, ça fonctionne très bien à l'extérieur, mais le bug est arrivé quand j'ai également changé les lumières pour les maps "intérieurs".
Le bug, c'est qu'à l'intérieur, les effets de lumières ne se font qu'à partir de la seconde fois où l'on rentre dans la pièce.
Un problème de rafraîchissement sans doutes, ou bien de priorités.
Je vous donne le script que j'ai modifié pour avoir les changements d'intérieurs :
Je serais super contente si on arrivait à résoudre ce bug.
Merci d'avance
Alors, ça fait déjà un petit moment que j'ai ce bug, mais je n'ai pas réussi à le résoudre
J'utilise le "Day and Night temps reel by grifdail selon Vampyr" qui permet de changer le ton de l'écran en fonction de l'heure du jour. Et j'utilise en plus le "Light Effects VX 1.1par Kylock". J'ai fait en sorte que les lumières s'allument automatiquement lorsque la nuit tombe. Alors, ça fonctionne très bien à l'extérieur, mais le bug est arrivé quand j'ai également changé les lumières pour les maps "intérieurs".
Le bug, c'est qu'à l'intérieur, les effets de lumières ne se font qu'à partir de la seconde fois où l'on rentre dans la pièce.
Un problème de rafraîchissement sans doutes, ou bien de priorités.
Je vous donne le script que j'ai modifié pour avoir les changements d'intérieurs :
- Code:
###ici regle les ton de l'ecrans pour le jour et la nuit
Interieur_Tone = Tone.new(-10 , -10 , -10, 5)
Interieurnuit_Tone = Tone.new(-70 , -70 , -70, 60)
Day_Tone = Tone.new(15, -10, -41, 0)
Afternoon_Tone = Tone.new(0, 0, 0, 0)
Night_Tone = Tone.new(-100, -100, -100, 90)
##########################################
if map_name.include?("EXT")
if $game_variables[Heure] >= 7 and $game_variables[Heure] < 10
$game_switches[11] = true
@screen.start_tone_change(Day_Tone, 1)
$sun.play(9, 120)
elsif $game_variables[Heure] >= 10 and $game_variables[Heure] < 16
$game_switches[11] = true
@screen.start_tone_change(Afternoon_Tone, 1)
$sun.stop
elsif $game_variables[Heure] >= 16 or $game_variables[Heure] < 7
$game_switches[11] = false
@screen.start_tone_change(Night_Tone, 1)
@parallax_name = "etoiles"
@parallax_loop_x = nil
@parallax_loop_y = nil
end
elsif $game_variables[Heure] >= 16 or $game_variables[Heure] < 7
$game_switches[11] = false
@screen.start_tone_change(Interieurnuit_Tone, 1)
else
$game_switches[11] = true
@screen.start_tone_change(Interieur_Tone, 1)
end
end
def trouvelheure
if $game_variables[Heure] >= 7 and $game_variables[Heure] < 10
$game_switches[Jours] =true
$game_switches[Soir] =false
$game_switches[Nuit] =false
elsif $game_variables[Heure] >= 10 and $game_variables[Heure] < 16
$game_switches[Jours] =false
$game_switches[Nuit] =false
$game_switches[Soir] =true
elsif $game_variables[Heure] >= 16 or $game_variables[Heure] < 8
$game_switches[Jours] =false
$game_switches[Soir] =false
$game_switches[Nuit] =true
end
end
def reset_screen_tone
if map_name.include?("EXT")
if $game_variables[Heure] >= 7 and $game_variables[Heure] < 10
$game_switches[11] = true
@screen.start_tone_change(Day_Tone, 1)
elsif $game_variables[Heure] >= 10 and $game_variables[Heure] < 16
$game_switches[11] = true
@screen.start_tone_change(Afternoon_Tone, 1)
elsif $game_variables[Heure] >= 16 or $game_variables[Heure] < 7
$game_switches[11] = false
@screen.start_tone_change(Night_Tone, 1)
end
elsif $game_variables[Heure] >= 16 or $game_variables[Heure] < 7
$game_switches[11] = false
@screen.start_tone_change(Interieurnuit_Tone, 1)
else
$game_switches[11] = true
@screen.start_tone_change(Interieur_Tone, 1)
end
end
Je serais super contente si on arrivait à résoudre ce bug.
Merci d'avance
- GarrukMembre
- Nombre de messages : 1030
Age : 39
Localisation : Evreux 27
Distinction : The Master Show de 2011
Date d'inscription : 13/09/2009
Re: [résolu] Bug avec les effets de lumière
Lun 28 Fév 2011 - 20:28
J'ai regardé vite fait, mais j'aurais eu besoin des deux scripts pour voir ton problème.
Sinon j'ai une question pour le jour et la nuit tu utilises un interrupteur ?
Sinon tu crées deux pages de l'évent de la ressource qui doit faire de la lumière avec un truc du genre.
Sur la page 1
Si interrupteur [Day]
-Lanterne
-normal avec aucun commentaire
Et sur la page 2
Si interrupteur [Night]
-Lanterne
-Commentaire "Light"
Ce n'est qu'une supposition vu que je n'ai pas testé, mais normalement ça devrait marché. =)
Sinon j'ai une question pour le jour et la nuit tu utilises un interrupteur ?
Sinon tu crées deux pages de l'évent de la ressource qui doit faire de la lumière avec un truc du genre.
Sur la page 1
Si interrupteur [Day]
-Lanterne
-normal avec aucun commentaire
Et sur la page 2
Si interrupteur [Night]
-Lanterne
-Commentaire "Light"
Ce n'est qu'une supposition vu que je n'ai pas testé, mais normalement ça devrait marché. =)
Re: [résolu] Bug avec les effets de lumière
Lun 28 Fév 2011 - 22:50
Merci de ta réponse, je vais essayer ta solution tout de suite après.
Je n'utilise les interrupteurs que pour les conditions dans les events parce que l'interrupteur pour l'effet de lumière, je l'ai intégré au code pour le jour et la nuit afin que les lumières s'allument automatiquement quand la nuit tombe. (c'est l'interrupteur 11 que l'on peut voir dans le bout de code donné plus haut).
Par contre, je n'ai pas utilisé les interrupteurs "nuit", "jour" ou "soir" car après essai, ça n'avait pas l'air de fonctionner (dans le script en tous cas).
Je mets déjà le code ici pour les effets de lumières (que je n'ai pas modifié) :
EDIT : Bon, voilà, j'ai essayé avec les interrupteurs "nuit" et "jours", - en fait j'avais déjà essayé avant mais je n'avais pas vu qu'il y avait des numéros déjà attribués pour ces interrupteurs (désolée moi newbee) -, ça fonctionne mais pas complètement. C'est à dire qu'il n'y a que dans la pièce où je commence le jeu que le bug persiste, mais il n'y a plus le bug dans les autres pièces.
Pour ce qui reste du bug, je peux le contourner, merci pour le coup de pouce !
Je n'utilise les interrupteurs que pour les conditions dans les events parce que l'interrupteur pour l'effet de lumière, je l'ai intégré au code pour le jour et la nuit afin que les lumières s'allument automatiquement quand la nuit tombe. (c'est l'interrupteur 11 que l'on peut voir dans le bout de code donné plus haut).
Par contre, je n'ai pas utilisé les interrupteurs "nuit", "jour" ou "soir" car après essai, ça n'avait pas l'air de fonctionner (dans le script en tous cas).
Je mets déjà le code ici pour les effets de lumières (que je n'ai pas modifié) :
- Code:
#==============================================================================
# ■ Light Effects VX 1.1
# 5.21.2008
#------------------------------------------------------------------------------
# Script: Kylock (à l'origine pour RMXP Near Fantastica)
# Tradução por Equipe Gemstone
# Traduit Par Douk => Français => http://rpgmakervx.1fr1.net/
#================================================= =============================
# Pour faire briller un événement, écrire un commentaire: avec un des
# Modes de lumière ci-dessous.
#================================================
# ● des news :
#------------------------------------------------- -----------------------------
# 1,0 - sortie d'origine
# 1,1 - Des nouvelles façons de lumière ajoutée: LIGHT2 TORCHE, TORCH2.
# - Changement de la façon de mélanger le sprite à ajouter (semble un peu mieux).
# - Les Feux d'incendie sont maintenant teinte de rouge.
#================================================= =============================
# ● modes d'éclairage :
#------------------------------------------------- -----------------------------
# GROUND - Moyen-portée et de la lumière blanche.
# FIRE - Le feu rouge varie légèrement.
# LIGHT - Portée courte et à la lumière blanche.
# LIGHT2 - à longue distance et une lumière blanche.
# TORCH - Grosse lumière rouge avec une grande emprise.
# TORCH2 - Grosse lumière qui varie légèrement.
#==============================================================================
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 == ["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 == ["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 == ["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
end
end
for effect in @light_effects
case effect.type
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 "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 "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
end
end
end
def update_light_effects
if $game_switches[11]
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 = (effect.event.real_x - 400 - $game_map.display_x) / 8
effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
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 "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
end
end
end
end
class Light_Effect
attr_accessor :light
attr_accessor :event
attr_accessor :type
def initialize(event, type)
@light = Sprite.new
@light.bitmap = Cache.picture("le.png")
@light.visible = true
@light.z = 1000
@event = event
@type = type
end
end
EDIT : Bon, voilà, j'ai essayé avec les interrupteurs "nuit" et "jours", - en fait j'avais déjà essayé avant mais je n'avais pas vu qu'il y avait des numéros déjà attribués pour ces interrupteurs (désolée moi newbee) -, ça fonctionne mais pas complètement. C'est à dire qu'il n'y a que dans la pièce où je commence le jeu que le bug persiste, mais il n'y a plus le bug dans les autres pièces.
Pour ce qui reste du bug, je peux le contourner, merci pour le coup de pouce !
- GarrukMembre
- Nombre de messages : 1030
Age : 39
Localisation : Evreux 27
Distinction : The Master Show de 2011
Date d'inscription : 13/09/2009
Re: [résolu] Bug avec les effets de lumière
Mar 1 Mar 2011 - 12:24
De rien. =)
Sinon il existe un autre script de lumière qui prend automatiquement le jour et la nuit en compte, mais je ne l'ai plus sous la main. =(
Sinon voici un petit cadeau.
CloudStrife était mon ancien pseudo. ^^
C'est exactement la même version que tu possèdes sauf que je l'ai modifier en reprenait tous les effets de lumière que j'ai trouvé et j'ai fusionné le tous.
Ce qui donne:
-26 Effets de lumières
-Possibilité d'éteindre les lumières à l'aide d'un interrupteur
Pour les interrupteurs regarde au début du script:
Voilà en espèrant qu'il te soit plus utile que l'ancien. xD
Oublie pas le Résolu dans le titre.
Sinon il existe un autre script de lumière qui prend automatiquement le jour et la nuit en compte, mais je ne l'ai plus sous la main. =(
Sinon voici un petit cadeau.
CloudStrife était mon ancien pseudo. ^^
- Spoiler:
- Code:
=begin
Light Effects Version Ultime by CloudStrife/Garruk
Version: 0.1
Author: BulletXt (bulletxt@gmail.com) Kylock and Cloudstrife
Date: 12/06/2009
Script based upon Kylock's (http://www.rpgmakervx.net/index.php?showtopic=2432)
Description:
To make an event glow, put a Comment inside event with one of the following
light modes. When importing this script to a new project, be sure to copy
Graphics/Pictures/le.png to your project.
Light Modes:
GROUND - Le moyen stabilise la lumière blanche.
GROUND2 - Lumière blanche moyenne avec éclat léger.
GROUND3 - Petite lumière rouge stable.
GROUND4 - Le moyen stabilise le feu vert.
GROUND5 - Le moyen stabilise la lumière de blue
GROUND6- Le moyen stabilise la lumière de violet
GROUND7-Le moyen stabilise la lumière de jaune.
FIRE - Lumière rouge, intensité forte
LIGHT - Lumière standard, intensitée petite
# LIGHT2 - Lumière standard, intensitée moyenne
# LIGHT3 - Lumière standard, intensitée forte
TORCH - X-Large lumière rouge avec un lourd éclat.
TORCH2 - X-Large lumière rouge avec un éclat d'habileté.
TORCH3 - Grande lumière blanche avec un éclat léger.
TORCH4 - Lumière Rouge moyenne.
# TORCH1B - Lumiére bleu, intesitée petite, ondule
# TORCH2B - Lumiére bleu, intesitée moyenne, ondule
# TORCH3B - Lumiére bleu, intesitée forte, ondule
# TORCH1V - Lumiére verte, intesitée petite, ondule
# TORCH2V - Lumiére verte, intesitée forte, ondule
# LIGHT1B - Lumière bleu, intensitée petite
# LIGHT2B - Lumière bleu, intensitée moyenne
# LIGHT1V - Lumière verte, intensitée petite
# LIGHT2V - Lumière verte, intensitée moyenne
# OMBRE - Lumière noir
Cette partie permet d'éteindre les lumières à l'aide des interrupteurs.
Chaque interrupteur permet d'éteindre un groupe de lumière comme les LIGHT par exemple
Vous pouvez changer l'ID de l'interrupteur comme bon vous sembles
Bref amusez-vous à éteindre/allumer les lumière de votre projet pour créer des scénes surpuissantes
Modification by CloudStrife (le faux
=end
#ID de l'interrupteur qui permet d'éteindre les lumières de mode de FIRE
#Ne marche seulement pour allumer et éteindre le mode : FIRE
FIRE = 87
#Pareil pour le mode LIGHT
#Eteins et allume les lumière avec les commentaires: LIGHT, LIGHT2, LIGHT3
LIGHT = 86
#On fini avec les GROUND
#Donc: GROUND, GROUND2, GROUND3, GROUND4, GROUND5
GROUND = 85
#Ma après les GROUND il reste les TORCH
#applies to light mode: TORCH, TORCH2, TORCH3 et les autres qui ne sont pas cités
TORCH = 84
# this value can be true or false. If true, it enables compatibility with
# KGC_DayNight script. When it's night, lights will automatically go on, when
# morning comes back lights will go off. If you set this to true, be sure to
# place this script below KGC_DayNight script in the Scripting Editor of VX.
ENABLE_KGC_DAY_NIGHT_SCRIPT = true
=begin
This value must be exactly the same of "PHASE_VARIABLE" setting in KGC_DayNight
script. By default the script sets it to 11.
To make the event light go on/off with DayNight system, set the event page
to be triggered with this variable id and set it to be 1 or above.
=end
KGC_DAY_NIGHT_SCRIPT_VARIABLE = 999
=begin
Tips and tricks:
You can't make a single specific light inside event go on/off if
a condition applies, for example if a switch is ON.
For the moment, you can achieve this by doing
a script call immediatley after you make the condition apply.
If for example the light event must go on if switch 100 is ON, after you turn
on the switch do this call script:
$scene = Scene_Map.new
Be aware that doing this call script will make game freeze
for 30 milliseconds.
################################################################################
=end
$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
#if night
if $bulletxt_day_check == 0
if $game_variables[KGC_DAY_NIGHT_SCRIPT_VARIABLE] == 1
$scene = Scene_Map.new
$bulletxt_day_check = 1
end
else
#if morning
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 == ["TORCH4"]
type = "TORCH4"
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 == ["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
if event.list[i].code == 108 and event.list[i].parameters == ["GROUND6"]
type = "GROUND6"
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 == ["GROUND7"]
type = "GROUND7"
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 == ["TORCH1B"]
type = "TORCH1B"
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 == ["TORCH2B"]
type = "TORCH2B"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 3
light_effects.light.zoom_y = 3
light_effects.light.opacity = 150
@light_effects.push(light_effects)
end
if event.list[i].code == 108 and event.list[i].parameters == ["TORCH3B"]
type = "TORCH3B"
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 == ["TORCH1V"]
type = "TORCH1V"
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 == ["TORCH2V"]
type = "TORCH2V"
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 == ["TORCH1VIO"]
type = "TORCH1VIO"
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 == ["LIGHT1B"]
type = "LIGHT1B"
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 == ["LIGHT2B"]
type = "LIGHT2B"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 3
light_effects.light.zoom_y = 3
light_effects.light.opacity = 150
@light_effects.push(light_effects)
end
if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT1V"]
type = "LIGHT1V"
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 == ["LIGHT2V"]
type = "LIGHT2V"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 3
light_effects.light.zoom_y = 3
light_effects.light.opacity = 150
@light_effects.push(light_effects)
end
if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2VV"]
type = "LIGHT2VV"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 3
light_effects.light.zoom_y = 3
light_effects.light.opacity = 150
@light_effects.push(light_effects)
end
if event.list[i].code == 108 and event.list[i].parameters == ["OMBRE"]
type = "OMBRE"
light_effects = Light_Effect.new(event,type)
light_effects.light.zoom_x = 3
light_effects.light.zoom_y = 3
light_effects.light.opacity = 150
@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 "TORCH4"
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 "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
when "GROUND6"
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(85,-255,85, 255)
effect.light.blend_type = 1
when "GROUND7"
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
#"Tone" indique la couleur
when "TORCH1B"
effect.light.x = (effect.event.real_x - -10 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 100 - $game_map.display_y) / 8
effect.light.tone = Tone.new(-100,-60,200, 0)
effect.light.blend_type = 1
when "TORCH2B"
effect.light.x = (effect.event.real_x - 490 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 650 - $game_map.display_y) / 8
effect.light.tone = Tone.new(-100,-60,200, 0)
effect.light.blend_type = 1
when "TORCH3B"
effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 1400 - $game_map.display_y) / 8
effect.light.tone = Tone.new(-100,-60,200, 0)
effect.light.blend_type = 1
when "TORCH1V"
effect.light.x = (effect.event.real_x - -10 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 100 - $game_map.display_y) / 8
effect.light.tone = Tone.new(-100,100,-100, 0)
effect.light.blend_type = 1
when "TORCH2V"
effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 1400 - $game_map.display_y) / 8
effect.light.tone = Tone.new(-100,100,-100, 0)
effect.light.blend_type = 1
when "TORCH1VIO"
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(80,-100,80, 0)
effect.light.blend_type = 1
when "LIGHT1B"
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.tone = Tone.new(-150,-150,300, 0)
effect.light.blend_type = 1
when "LIGHT2B"
effect.light.x = (effect.event.real_x - 490 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 650 - $game_map.display_y) / 8
effect.light.tone = Tone.new(-150,-150,300, 0)
effect.light.blend_type = 1
when "LIGHT1V"
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.tone = Tone.new(-150,300,-150, 0)
effect.light.blend_type = 1
when "LIGHT2V"
effect.light.x = (effect.event.real_x - 490 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 650 - $game_map.display_y) / 8
effect.light.tone = Tone.new(-150,300,-100, 0)
effect.light.blend_type = 1
when "LIGHT2VV"
effect.light.x = (effect.event.real_x - 490 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 650 - $game_map.display_y) / 8
effect.light.tone = Tone.new(-150,300,10, 0)
effect.light.blend_type = 1
when "OMBRE"
effect.light.x = (effect.event.real_x - 490 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 650 - $game_map.display_y) / 8
effect.light.tone = Tone.new(-255,-255,-255, -255)
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.type != "GROUND6" && effect.type != "GROUND7"
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.type != "GROUND6" && effect.type != "GROUND7"
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.type != "TORCH4"
effect.light.visible = false
end
else
for effect in @light_effects
next if effect.type != "TORCH" && effect.type != "TORCH2" && effect.type != "TORCH3"&& effect.type != "TORCH4"
effect.light.visible = true
end
end
# handle TORCH
if $game_switches[TORCH]
for effect in @light_effects
next if effect.type != "TORCH1B" && effect.type != "TORCH2B" && effect.type != "TORCH3B"&& effect.type != "TORCH1V"
effect.light.visible = false
end
else
for effect in @light_effects
next if effect.type != "TORCH1B" && effect.type != "TORCH2B" && effect.type != "TORCH3B"&& effect.type != "TORCH1V"
effect.light.visible = true
end
end
# handle TORCH
if $game_switches[TORCH]
for effect in @light_effects
next if effect.type != "TORCH2V" && effect.type != "LIGHT1B" && effect.type != "LIGHT2B"&& effect.type != "LIGHT1V"
effect.light.visible = false
end
else
for effect in @light_effects
next if effect.type != "TORCH2V" && effect.type != "LIGHT1B" && effect.type != "LIGHT2B"&& effect.type != "LIGHT1V"
effect.light.visible = true
end
end
# handle TORCH
if $game_switches[TORCH]
for effect in @light_effects
next if effect.type != "LIGHT2V" && effect.type != "OMBRE"
effect.light.visible = false
end
else
for effect in @light_effects
next if effect.type != "LIGHT2V" && effect.type != "OMBRE"
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"TORCH4"
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 "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
when "GROUND6"
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 "GROUND7"
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 "TORCH1B"
effect.light.x = (effect.event.real_x - -10 - $game_map.display_x) / 8 - 20 + rand(6) - 3
effect.light.y = (effect.event.real_y - 100 - $game_map.display_y) / 8 + rand(6) - 3
effect.light.opacity = rand(30) + 70
when "TORCH2B"
effect.light.x = (effect.event.real_x - 490 - $game_map.display_x) / 8 - 20 + rand(20) - 10
effect.light.y = (effect.event.real_y - 650 - $game_map.display_y) / 8 + rand(20) - 10
effect.light.opacity = rand(30) + 70
when "TORCH3B"
effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
effect.light.y = (effect.event.real_y - 1400 - $game_map.display_y) / 8 + rand(20) - 10
effect.light.opacity = rand(30) + 70
when "TORCH1V"
effect.light.x = (effect.event.real_x - -10 - $game_map.display_x) / 8 - 20 + rand(20) - 10
effect.light.y = (effect.event.real_y - 100 - $game_map.display_y) / 8 + rand(20) - 10
effect.light.opacity = rand(30) + 70
when "TORCH2V"
effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20+ + rand(6) - 3
effect.light.y = (effect.event.real_y - 1400 - $game_map.display_y) / 8 + rand(6) - 3
effect.light.opacity = rand(30) + 70
when "TORCH1VIO"
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 "LIGHT1B"
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 "LIGHT2B"
effect.light.x = (effect.event.real_x - 490 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 650 - $game_map.display_y) / 8
when "LIGHT1V"
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 "LIGHT2V"
effect.light.x = (effect.event.real_x - 490 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 650 - $game_map.display_y) / 8
when "LIGHT2VV"
effect.light.x = (effect.event.real_x - 490 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 650 - $game_map.display_y) / 8
when "OMBRE"
effect.light.x = (effect.event.real_x - 490 - $game_map.display_x) / 8 - 20
effect.light.y = (effect.event.real_y - 650 - $game_map.display_y) / 8
end
end
end
end
class Light_Effect
attr_accessor :light
attr_accessor :event
attr_accessor :type
def initialize(event, type)
@light = Sprite.new
@light.bitmap = Cache.picture("le.png")
@light.visible = true
@light.z = 1000
@event = event
@type = type
end
end
C'est exactement la même version que tu possèdes sauf que je l'ai modifier en reprenait tous les effets de lumière que j'ai trouvé et j'ai fusionné le tous.
Ce qui donne:
-26 Effets de lumières
-Possibilité d'éteindre les lumières à l'aide d'un interrupteur
Pour les interrupteurs regarde au début du script:
- Code:
#ID de l'interrupteur qui permet d'éteindre les lumières de mode de FIRE
#Ne marche seulement pour allumer et éteindre le mode : FIRE
FIRE = 87
#Pareil pour le mode LIGHT
#Eteins et allume les lumière avec les commentaires: LIGHT, LIGHT2, LIGHT3
LIGHT = 86
#On fini avec les GROUND
#Donc: GROUND, GROUND2, GROUND3, GROUND4, GROUND5
GROUND = 85
#Ma après les GROUND il reste les TORCH
#applies to light mode: TORCH, TORCH2, TORCH3 et les autres qui ne sont pas cités
TORCH = 84
Voilà en espèrant qu'il te soit plus utile que l'ancien. xD
Oublie pas le Résolu dans le titre.
Re: [résolu] Bug avec les effets de lumière
Mar 1 Mar 2011 - 13:24
J'ai testé, tout est Ok, c'est pour ainsi dire le même système que l'ancien, mais bien enrichi.
Merci beaucoup
Merci beaucoup
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|