Guest User

Untitled

a guest
Jul 25th, 2015
235
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Moral_Scriptv1 by Chaphaut
  2.  
  3. #OPTIONS -----------------------------------------------------------------------
  4.  
  5. module Chap_MOR
  6.  
  7. #Change la vitesse à laquelle descend le moral
  8. DECREASE_FACT       =          100                                  
  9. #Mettre 0 pour stopper la chute régulière du morale
  10.  
  11. #Change le nom du moral ( oui je sais morality = moralité ._." )
  12. MORALITY            =         "Morality"                              
  13.  
  14. #Défini le moral de départ
  15. $morality_fact      =         100000  # 100000 = 100%
  16.  
  17. #/!\ NE PAS TOUCHER
  18. $morality           =         ($morality_fact*100)/$morality_fact      
  19. $leave_count_chap   =          0
  20.  
  21. #ID DES HEROS DANS LA BASE DE DONNEE, CHANGEZ SI BESOIN
  22. #                              h1     h2     h3     h4     h5     h6    h7    h8
  23.  
  24. HEROS              =          [1,     2,     3,     4,     5,     6,    7,    8]
  25.  
  26. #CONDITIONS: A QUEL POURCENTAGE DU MORAL DU GROUPE LE HERO QUITTE LE GROUPE, METTRE -1 POUR QUE LE HERO NE QUITTE JAMAIS
  27.  
  28. CONDITIONS         =         [-1 ,   50 ,   50 ,   50 ,   50 ,   50 ,   50,   50]
  29.  
  30. #MESSAGE UN MEMBRE QUITTE: METTRE "none" POUR QU AUCUN MESSAGE N APPARAISSE
  31.                                                               #NE PAS DEPASSER ▼
  32. LINE1M1            = "Vous avez perdu un membre du groupe"
  33.  
  34. #MESSAGE PLUSIEURS MEMBRES QUITTE SIMULTANEMENT: METTRE "none" POUR QU AUCUN MESSAGE N APPARAISSE
  35.                                                               #NE PAS DEPASSER ▼
  36. LINE1M2           =  "Vous avez perdu plusieurs membres du groupe"
  37.  
  38.  
  39. #SON: LE SON JOUER QUAND UN HERO QUITTE LE GROUPE, METTRE "none" POUR NE RIEN JOUER
  40.  
  41. SOUND               =          "Move"
  42.  
  43. #EFFET MUSICAL: L EFFET MUSICAL JOUER QUAND UN HERO QUITTE LE GROUPE, METTRE "none" POUR NE RIEN JOUER
  44.  
  45. MESOUND             =          "Mystery"
  46.  
  47. #SON2: LE SON JOUER QUAND PLUSIEURS HEROS QUITTENT LE GROUPE, METTRE "none" POUR NE RIEN JOUER
  48.  
  49. SOUND2              =          "Move"
  50.  
  51. #EFFET MUSICAL2: L EFFET MUSICAL JOUER QUAND PLUSIEURS HERO QUITTENT LE GROUPE, METTRE "none" POUR NE RIEN JOUER
  52.  
  53. MESOUND2            =          "Mystery"
  54.  
  55.  
  56. #GAMEOVER OPTION: METTRE true SI VOUS VOULEZ QU UNE FOIS LE MORAL A 0 LE GAMEOVER SE LANCE
  57.  
  58. GAMEOVER_CHAP      =        false
  59.  
  60. #BARRE OPTION: AFFICHE LE MORAL SOUS FORME DE BARRE SI true SINON false AFFICHERA EN POURCENTAGE
  61.  
  62. BARRE_CHAP         =        false
  63.  
  64.  
  65. end
  66.  
  67.  
  68.  
  69.  
  70. class Scene_Menu < Scene_MenuBase
  71.  alias morality create_gold_window
  72.   def create_gold_window
  73.     morality
  74.     @morality = Window_Morality.new
  75.     @morality.y = Graphics.height-@gold_window.height-@morality.height
  76.     mid = $morality_fact*255/100000
  77.     right = 255 - mid
  78.     if Chap_MOR::BARRE_CHAP == true
  79.     @left = Color.new(255,0,0)
  80.     @right = Color.new(right,mid,0)
  81.     @barre = Sprite.new
  82.     @barre.z = 250
  83.     @barre.bitmap = Bitmap.new(640, 480)
  84.     @barre.bitmap.gradient_fill_rect(6, (Graphics.height-@morality.height)-10, 148, 15, @left, @right)
  85.     @barre.x = 6
  86.     @barre.ox = 6
  87.     @barre.zoom_x = ($morality_fact.to_f/100000)
  88. #-------------------------------------------------------------------------    
  89.     @reap  = Color.new(0,0,150)
  90.     @barre2 = Sprite.new
  91.     @barre2.z = 249
  92.     @barre2.bitmap = Bitmap.new(640, 480)
  93.     @barre2.bitmap.fill_rect(6, (Graphics.height-@morality.height)-10, 148, 15, @reap)
  94.     @barre2.x = 6
  95.     @barre2.ox = 6
  96.     @barre2.zoom_x = 1
  97.     @barre2.tone = Tone.new(0, 0, 0, 200)
  98.     end
  99.   end
  100.  
  101.  
  102.  
  103. def update
  104.   super
  105.   if scene_changing? && @barre
  106.     @barre.dispose
  107.     @barre2.dispose
  108.   end
  109. end
  110.  
  111.  
  112.  
  113.  
  114. end
  115.  
  116.  
  117. #-------------------------------------------------------------------------
  118. class Window_Morality < Window_Base
  119.  
  120.   def initialize
  121.     super(0,0,window_width,75)
  122.     refresh
  123.   end
  124.   def window_width
  125.     return 160
  126.   end
  127.  
  128.  
  129.  
  130.   def refresh
  131.   if Chap_MOR::BARRE_CHAP == false
  132.     change_color(system_color)
  133.    
  134.     draw_text(15,25,contents_width, line_height,"%" , 1)
  135.     if $morality > 89
  136.   change_color(tp_gauge_color2)
  137.     elsif $morality > 59
  138.   change_color(tp_gauge_color1)
  139.     elsif $morality > 40
  140.   change_color(normal_color)
  141.     elsif $morality > 20
  142.   change_color(hp_gauge_color2)
  143.     elsif $morality > 5
  144.   change_color(hp_gauge_color1)
  145.     elsif $morality > 0 || $morality ==0
  146.   change_color(knockout_color)
  147.     end
  148.    draw_text(0,25,contents_width, line_height,$morality, 1)  
  149.     end
  150.     change_color(system_color)
  151.     draw_text(0,0,contents_width, line_height,Chap_MOR::MORALITY , 1)
  152. #-------------------------------------------------------------------------
  153. #-------------------------------------------------------------------------
  154.   end
  155. end
  156.  
  157. #-------------------------------------------------------------------------
  158.  
  159. class Scene_Map < Scene_Base
  160. alias morality_up update
  161.   def update
  162.     morality_up
  163.     puts"#{$morality}"
  164.     puts"#{$morality_fact}"
  165.     $morality_fact -= Chap_MOR::DECREASE_FACT
  166.     $morality=($morality_fact*100)/100000
  167.    
  168.    
  169.    
  170.     if $morality < 0
  171.     $morality_fact = 0
  172.     $morality = 0
  173.     end
  174.     if $morality > 100
  175.     $morality_fact = 100000
  176.     end #end if
  177.  
  178.     if $game_party.members.include?($game_actors[Chap_MOR::HEROS[0]])&& $morality < Chap_MOR::CONDITIONS[0]
  179.     $game_party.remove_actor(Chap_MOR::HEROS[0])
  180.     puts"ACTOR #{Chap_MOR::HEROS[0]} REMOVED"
  181.     $leave_count_chap += 1
  182.     end
  183.     if $game_party.members.include?($game_actors[Chap_MOR::HEROS[1]])&& $morality < Chap_MOR::CONDITIONS[1]
  184.     $game_party.remove_actor(Chap_MOR::HEROS[1])
  185.     puts"ACTOR #{Chap_MOR::HEROS[1]} REMOVED"
  186.     $leave_count_chap += 1
  187.     end
  188.     if $game_party.members.include?($game_actors[Chap_MOR::HEROS[2]])&& $morality < Chap_MOR::CONDITIONS[2]
  189.     $game_party.remove_actor(Chap_MOR::HEROS[2])
  190.     puts"ACTOR #{Chap_MOR::HEROS[2]} REMOVED"
  191.     $leave_count_chap += 1
  192.     end
  193.     if $game_party.members.include?($game_actors[Chap_MOR::HEROS[3]])&& $morality < Chap_MOR::CONDITIONS[3]
  194.     $game_party.remove_actor(Chap_MOR::HEROS[3])
  195.     puts"ACTOR #{Chap_MOR::HEROS[3]} REMOVED"
  196.     $leave_count_chap += 1
  197.     end
  198.     if $game_party.members.include?($game_actors[Chap_MOR::HEROS[4]])&& $morality < Chap_MOR::CONDITIONS[4]
  199.     $game_party.remove_actor(Chap_MOR::HEROS[4])
  200.     puts"ACTOR #{Chap_MOR::HEROS[4]} REMOVED"
  201.     $leave_count_chap += 1
  202.     end
  203.     if $game_party.members.include?($game_actors[Chap_MOR::HEROS[5]])&& $morality < Chap_MOR::CONDITIONS[5]
  204.     $game_party.remove_actor(Chap_MOR::HEROS[5])
  205.     puts"ACTOR #{Chap_MOR::HEROS[5]} REMOVED"
  206.     $leave_count_chap += 1
  207.     end
  208.     if $game_party.members.include?($game_actors[Chap_MOR::HEROS[6]])&& $morality < Chap_MOR::CONDITIONS[6]
  209.     $game_party.remove_actor(Chap_MOR::HEROS[6])
  210.     puts"ACTOR #{Chap_MOR::HEROS[6]} REMOVED"
  211.     $leave_count_chap += 1
  212.     end
  213.     if $game_party.members.include?($game_actors[Chap_MOR::HEROS[7]])&& $morality < Chap_MOR::CONDITIONS[7]
  214.     $game_party.remove_actor(Chap_MOR::HEROS[7])
  215.     puts"ACTOR #{Chap_MOR::HEROS[7]} REMOVED"
  216.     $leave_count_chap += 1
  217.     end
  218.     if $morality == 0 && Chap_MOR::GAMEOVER_CHAP == true
  219.     SceneManager.goto(Scene_Gameover)
  220.     end
  221.    
  222.   if $leave_count_chap != 0
  223.     if $leave_count_chap == 1
  224.     Audio.me_play('Audio/ME/'+(Chap_MOR::MESOUND),50, 100) if Chap_MOR::MESOUND != "none"
  225.     Audio.se_play('Audio/SE/'+(Chap_MOR::SOUND),50, 100) if Chap_MOR::SOUND != "none"
  226.     end
  227.     if $leave_count_chap >= 2
  228.     Audio.me_play('Audio/ME/'+(Chap_MOR::MESOUND2),50, 100) if Chap_MOR::MESOUND2 != "none"
  229.     Audio.se_play('Audio/SE/'+(Chap_MOR::SOUND2),50, 100) if Chap_MOR::SOUND2 != "none"
  230.     end
  231.     if $leave_count_chap == 1 && Chap_MOR::LINE1M1 !="none"
  232.     SceneManager.call(Scene_Morinfo)
  233.     elsif $leave_count_chap >= 2 && Chap_MOR::LINE1M2 !="none"
  234.     SceneManager.call(Scene_Morinfo)
  235.     else
  236.     $leave_count_chap = 0
  237.     end
  238.   end
  239.    
  240.  
  241.    
  242.   end
  243. end
  244.  
  245. class Scene_Morinfo < Scene_MenuBase
  246.  
  247.   def start
  248.     super
  249.     create_info_window
  250.   end
  251.   def create_info_window
  252.     @morinfo = Window_Morinfo.new
  253.   end
  254.   def update
  255.     super()
  256.     if Input.trigger?(:B) || Input.trigger?(:C)
  257.       @morinfo.close
  258.       SceneManager.return
  259.     end
  260.   end
  261. end
  262.  
  263. class Window_Morinfo < Window_Base
  264.  
  265.   def initialize
  266.   super(0,0,window_width,window_height)
  267.   self.openness = 0
  268.   open
  269.   refresh
  270.   end
  271.   def window_width
  272.     return Graphics.width
  273.   end
  274.  
  275.   def window_height
  276.     return 50
  277.   end
  278.  
  279.   def refresh
  280.    
  281.     self.contents.clear
  282.     draw_text(0,0,contents_width, line_height,Chap_MOR::LINE1M1, 1) if $leave_count_chap == 1
  283.     puts"#{$leave_count_chap}"
  284.     draw_text(0,0,contents_width, line_height,Chap_MOR::LINE1M2, 1) if $leave_count_chap >= 2
  285.     $leave_count_chap = 0
  286.   end
  287.  
  288.  
  289. end
  290.  
  291. module Change_moral
  292.    def add_moral(i)
  293.       $morality_fact += i*1000
  294.    end
  295.    def decrease_moral(i)
  296.       $morality_fact -= i*1000
  297.    end
  298.    def equal_moral(i)
  299.       $morality_fact = i*1000
  300.    end
  301. end
  302.  
  303. class Game_Interpreter
  304.    include Change_moral
  305. end
  306.  
  307.  
  308. class << DataManager
  309.   alias_method :old_make_save_contents, :make_save_contents
  310.   alias_method :old_extract_save_contents, :extract_save_contents
  311.   def make_save_contents
  312.     contents = old_make_save_contents
  313.     contents[:moral] = $morality_fact
  314.     contents
  315.   end
  316.   def extract_save_contents contents
  317.     old_extract_save_contents contents
  318.     $morality_fact=contents[:moral]
  319.   end
  320. end
RAW Paste Data