Le deal à ne pas rater :
Réassort du coffret Pokémon 151 Électhor-ex : où l’acheter ?
Voir le deal

Aller en bas
Djidane
Djidane
Membre

Nombre de messages : 1444
Age : 30
Localisation : Paris
Distinction : Héritier d'Alexdream (mais on l'aime quand même).
Lèche cul professionnel
et il aime ça!!!
Date d'inscription : 30/12/2008

Changement de méthode d'activation . Empty Changement de méthode d'activation .

Dim 2 Mai 2010 - 17:19
Salut à tous et à toutes !



Ma demande : J'aimerais que la méthode d'activation de ce script soit changer : Il s'agit du script d'effet lumière

Code:
=begin
                              Thomas Edison VX

Version: 0.1
Author: BulletXt (bulletxt@gmail.com)
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 - Medium steady white light.
 GROUND2 - Medium white light with slight flicker.
 GROUND3 - Small steady red light.
 GROUND4 - Medium steady green light.
 GROUND5 - Medium steady blu light.
 FIRE - Large red light with a slight flicker.
 LIGHT - Small steady white light.
 LIGHT2 - X-Large steady white light.
 LIGHT3 - Small white light with slight flicker.
 TORCH - X-Large red light with a heavy flicker.
 TORCH2 - X-Large red light with a sleight flicker.
 TORCH3 - Large white light with a slight flicker.

You can make a specific light type turn off/on by turning
one of the following switches id ON/off. By default, the switches are off so
the lights will show. Of course, turning all switches to ON will make all
light types go off.

=end

#id switch that if ON turns off FIRE mode lights
#applies only to light mode: FIRE
FIRE = 87
#id switch that if ON turns off LIGHT mode lights
#applies to light mode: LIGHT, LIGHT2, LIGHT3
LIGHT = 86
#id switch that if ON turns off GROUND mode lights
#applies to light mode: GROUND, GROUND2, GROUND3, GROUND4, GROUND5
GROUND = 85
#id switch that if ON turns off TORCH mode lights
#applies to light mode: TORCH, TORCH2, TORCH3
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 = 11

=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 == ["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

  #close def
   end
#close class   
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


Explications :

Ce script produit un effet lumière par image nommer Le . Il faut insèrer un commentaire dans un évent à règler en processus parallèle . Le problème c'est que le script active l'effet lumière uniquement quand on arrive sur la map . J'entend par là que si je veut activé l'effet lumière par intérrupteur quand je le désire , je suis obliger de changer de map et revenir pour le voir !

J'en conclus que le script est programmé de façon à activer l'effet quand on arrive sur la map . Je désire que le code fesant celà soit modifié de façon à pouvoir fonctionné comme je le désire (expliquer dans le paragraphe précèdent)


Voilà , merci d'avance pour votre aide et vos réponse Wink !


Dernière édition par Djidane le Mer 12 Mai 2010 - 16:39, édité 1 fois
Skillo
Skillo
Staffeux retraité

Nombre de messages : 526
Age : 35
Localisation : Rennes
Distinction : J'aime ce gars :P
(by Coco')
Scripteur apprenti, futur Berka !
(par Tretian)
Membre anonyme de la communauté, caché derrière son PC
(???)
super prof de script
[Dudu']
Résident permanent de la Chat Box
[Autoproclamé]
Adepte du XDDD [Yak' Very Happy]
Fanatique hystérique de Raymond le français [Un connu]
Date d'inscription : 19/01/2008

Changement de méthode d'activation . Empty Re: Changement de méthode d'activation .

Jeu 6 Mai 2010 - 23:45
J'ai déjà essayer d'y touché à ce script et j'ai pas réussi à changer la méthode d'activation parce que l'affichage des lumières est créer en même temps que les couche de ta map et du coup faudrait tout le temps actualiser ta map pour que le script puisse vérifie toutes les lampes.
Par contre j'ai trouvé un truc tout bête pour éteindre les lampes individuellement:
1) tu crées ton évent de lampe allumé avec les commentaires qu'il faut
2) sur une autre page tu met ta lampe éteinte et aucun commentaire
3) là est la subtilité je presume que tu sais manier les interrupteur locaux ou pas et bien juste apres l'avoir activé/desactivé pour que t'as lampe s'éteigne/s'allume en changeant de page, il suffit de rajouter le script $scene= Scene_Map.new

Quelques screens pour que tu comprennes mieux:
Spoiler:
Normalement il y a un tout petit temps de latence mais ça s'intègre bien dans l'action enfin tu verras.
Djidane
Djidane
Membre

Nombre de messages : 1444
Age : 30
Localisation : Paris
Distinction : Héritier d'Alexdream (mais on l'aime quand même).
Lèche cul professionnel
et il aime ça!!!
Date d'inscription : 30/12/2008

Changement de méthode d'activation . Empty Re: Changement de méthode d'activation .

Mer 12 Mai 2010 - 16:22
Hmmmmm , une actualisation de la map par appel de script ... C'est une idée bien pensée et je te remercie de m'en avoir fait part !

Je test , normalement il y aura pas de problème mais on sais jamais ! Une fois celà fait je marquerai [résolu]

Merci bien Wink
Coco'
Coco'
Staffeux retraité

Nombre de messages : 6578
Age : 30
Localisation : Nord/Douai
Distinction : EL DICTATOR COCO'
Coco-Dieu en puissance

Changement de méthode d'activation . Magikarpe Grand gourou suppléant de la secte des MAGIKARP
Leader charismatique des 2beStaffieux

N°1 du forum
Président, vice-présidents et membres honoraires de la cour suprême du forum
Président de l'association des grosses distinctions CMB
Date d'inscription : 02/07/2008
https://www.rpgmakervx-fr.com

Changement de méthode d'activation . Empty Re: Changement de méthode d'activation .

Lun 28 Juin 2010 - 13:10
Dudu'
Dudu'
Staffeux retraité

Nombre de messages : 2060
Age : 33
Distinction : Apprenti KGB-boy en avenir
[Coco' Smile]
Hamsterphile de service ^^
[Balby' le Fake]
Grand prof de la MA
[Skillo]
Ce grand programmateur, mon coeur, ma vie ! [Hamu']
Date d'inscription : 22/06/2009

Changement de méthode d'activation . Empty Re: Changement de méthode d'activation .

Mer 1 Sep 2010 - 23:15
toujours pas de réponse
je considère que c'est résolu et comme c'est pas marqué tu gagne un averto
Contenu sponsorisé

Changement de méthode d'activation . Empty Re: Changement de méthode d'activation .

Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum