RPG Creator : créez votre MMORPG ou RPG sans aucune connaissance en programmation
Disponible le 4 Juin !
- Jouez à votre jeu sur tablettes tactiles, Smartphones et navigateurs Web
- Personnalisez vos menus
- Dessinez facilement et rapidement vos cartes
- Créez des actions pour le combat A-RPG
auteur:Adurna version:1.0 date de dernière modification:12.07.2010 screen:v1.0 [url=http://www.servimg.com/image_preview.php?i=127&u=14028484] v1.1 [/url] description: ce system permet au joueur de prendre de note pour ne pas oublier des indice, des idées, des conseille, ect... il est trés simple d'utilisation: par évent->appelle de script :
Actor_note= 1 #index du héros qui sert de "mémoire" Nbr_carac_max = 100 #nombre de caractère max comprit entre 0 et 100
end
class Scene_Note < Scene_Base #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background @actor = $game_actors[Adurna::Actor_note] @edit_window = Window_NoteEdit.new(@actor,Adurna::Nbr_carac_max) @input_window = Window_NoteInput.new end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_menu_background @edit_window.dispose @input_window.dispose end #-------------------------------------------------------------------------- # * Return to Original Screen #-------------------------------------------------------------------------- def return_scene $scene = Scene_Map.new end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_menu_background @edit_window.update @input_window.update if Input.repeat?(Input::B) if @edit_window.index > 0 # Not at the left edge Sound.play_cancel @edit_window.back end elsif Input.trigger?(Input::C) if @input_window.is_decision # If cursor is positioned on [OK] if @edit_window.name == "" # If name is empty @edit_window.restore_default # Return to default name if @edit_window.name == "" Sound.play_buzzer else Sound.play_decision end else Sound.play_decision @actor.name = @edit_window.name # Change actor name return_scene end elsif @input_window.character != "" # If text characters are not empty if @edit_window.index == @edit_window.max_char # at the right edge Sound.play_buzzer else Sound.play_decision @edit_window.add(@input_window.character) # Add text character end end end end end
class Window_NoteEdit < Window_Base
attr_reader :name # name attr_reader :index # cursor position attr_reader :max_char # maximum number of characters #-------------------------------------------------------------------------- # * Object Initialization # actor : actor # max_char : maximum number of characters #-------------------------------------------------------------------------- def initialize(actor, max_char) super(0, 0, 545, 170) @actor = actor @name = actor.name @max_char = max_char name_array = @name.split(//)[0...@max_char] # Fit within max length @name = "" for i in 0...name_array.size @name += name_array[i] end @default_name = @name @index = name_array.size self.active = false refresh update_cursor end #-------------------------------------------------------------------------- # * Return to Default Name #-------------------------------------------------------------------------- def restore_default @name = @default_name @index = @name.split(//).size refresh update_cursor end #-------------------------------------------------------------------------- # * Add Text Character # character : text character to be added #-------------------------------------------------------------------------- def add(character) if @index < @max_char and character != "" @name += character @index += 1 refresh update_cursor end end #-------------------------------------------------------------------------- # * Delete Text Character #-------------------------------------------------------------------------- def back if @index > 0 name_array = @name.split(//) # Delete one character @name = "" for i in 0...name_array.size-1 @name += name_array[i] end @index -= 1 refresh update_cursor end end #-------------------------------------------------------------------------- # * Get rectangle for displaying items # index : item number #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.x = 1212- (@max_char + 1) * 12 + index * 24 rect.y = 0 rect.width = 24 rect.height = WLH return rect end def item_rect2(index) rect2 = Rect.new(0, 0, 0, 0) rect2.x = 732- (@max_char + 1) * 12 + index * 24 rect2.y = 24 rect2.width = 24 rect2.height = WLH return rect2 end def item_rect3(index) rect3 = Rect.new(0, 0, 0, 0) rect3.x = 252- (@max_char + 1) * 12 + index * 24 rect3.y = 48 rect3.width = 24 rect3.height = WLH return rect3 end def item_rect4(index) rect4 = Rect.new(0, 0, 0, 0) rect4.x = -228- (@max_char + 1) * 12 + index * 24 rect4.y = 72 rect4.width = 24 rect4.height = WLH return rect4 end def item_rect5(index) rect5 = Rect.new(0, 0, 0, 0) rect5.x = -708- (@max_char + 1) * 12 + index * 24 rect5.y = 96 rect5.width = 24 rect5.height = WLH return rect5 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear name_array = @name.split(//) for i in 0...@max_char c = name_array[i] c = '_' if c == nil if i<20 self.contents.draw_text(item_rect(i), c, 1) end if i>19 if i<40 self.contents.draw_text(item_rect2(i), c, 1) end end if i>19 if i<60 self.contents.draw_text(item_rect3(i), c, 1) end end if i>59 if i<80 self.contents.draw_text(item_rect4(i), c, 1) end end if i>79 self.contents.draw_text(item_rect5(i), c, 1) end end end #-------------------------------------------------------------------------- # * Update cursor #-------------------------------------------------------------------------- def update_cursor self.cursor_rect = item_rect(@index) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_cursor end end
def character if @index < 133 return TABLE[@mode][@index] else return "" end end
def is_mode_change return (@index == 133) end
def is_decision return (@index == 134) end
def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.x = index % 15 * 32 + index % 15 / 5 * 16 rect.y = index / 15 * WLH rect.width = 32 rect.height = WLH return rect end
def refresh self.contents.clear for i in 0..134 rect = item_rect(i) rect.x += 2 rect.width -= 4 self.contents.draw_text(rect, TABLE[@mode][i], 1) end end
def update_cursor self.cursor_rect = item_rect(@index) end
def cursor_down(wrap) if @index <120 @index += 15 elsif wrap @index -= 120 end end
def cursor_up(wrap) if @index >= 15 @index -= 15 elsif wrap @index += 120 end end
def cursor_right(wrap) if @index % 15 < 14 @index += 1 elsif wrap @index -= 14 end end
def cursor_left(wrap) if @index % 15 > 0 @index -= 1 elsif wrap @index += 14 end end
def cursor_to_decision @index = 134 end #-------------------------------------------------------------------------- # * Move to Next Page #-------------------------------------------------------------------------- def cursor_pagedown @mode = (@mode + 1) % TABLE.size refresh end #-------------------------------------------------------------------------- # * Move to Previous Page #-------------------------------------------------------------------------- def cursor_pageup @mode = (@mode + TABLE.size - 1) % TABLE.size refresh end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super last_mode = @mode last_index = @index if Input.repeat?(Input::DOWN) cursor_down(Input.trigger?(Input::DOWN)) end if Input.repeat?(Input::UP) cursor_up(Input.trigger?(Input::UP)) end if Input.repeat?(Input::RIGHT) cursor_right(Input.trigger?(Input::RIGHT)) end if Input.repeat?(Input::LEFT) cursor_left(Input.trigger?(Input::LEFT)) end if Input.trigger?(Input::A) cursor_to_decision end if Input.trigger?(Input::R) cursor_pagedown end if Input.trigger?(Input::L) cursor_pageup end if Input.trigger?(Input::C) and is_mode_change cursor_pagedown end if @index != last_index or @mode != last_mode Sound.play_cursor end update_cursor end end
Actor_note= 1 Nbr_carac_max = 100 Font = "font_note" end
class Scene_Note < Scene_Base #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background @actor = $game_actors[Adurna::Actor_note] @edit_window = Window_NoteEdit.new(@actor,Adurna::Nbr_carac_max) @edit_window.opacity = 0 @input_window = Window_NoteInput.new @input_window.opacity = 0 @font = Sprite.new @font.bitmap = Cache.picture(Adurna::Font) @font.x =0 @font.y =0 end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super @font.dipose dispose_menu_background @edit_window.dispose @input_window.dispose end #-------------------------------------------------------------------------- # * Return to Original Screen #-------------------------------------------------------------------------- def return_scene $scene = Scene_Map.new end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_menu_background @edit_window.update @input_window.update if Input.repeat?(Input::B) if @edit_window.index > 0 # Not at the left edge Sound.play_cancel @edit_window.back end elsif Input.trigger?(Input::C) if @input_window.is_decision # If cursor is positioned on [OK] if @edit_window.name == "" # If name is empty @edit_window.restore_default # Return to default name if @edit_window.name == "" Sound.play_buzzer else Sound.play_decision end else Sound.play_decision @actor.name = @edit_window.name # Change actor name return_scene end elsif @input_window.character != "" # If text characters are not empty if @edit_window.index == @edit_window.max_char # at the right edge Sound.play_buzzer else Sound.play_decision @edit_window.add(@input_window.character) # Add text character end end end end end
class Window_NoteEdit < Window_Base
attr_reader :name # name attr_reader :index # cursor position attr_reader :max_char # maximum number of characters #-------------------------------------------------------------------------- # * Object Initialization # actor : actor # max_char : maximum number of characters #-------------------------------------------------------------------------- def initialize(actor, max_char) super(0, 0, 545, 170) @actor = actor @name = actor.name @max_char = max_char name_array = @name.split(//)[0...@max_char] # Fit within max length @name = "" for i in 0...name_array.size @name += name_array[i] end @default_name = @name @index = name_array.size self.active = false refresh update_cursor end #-------------------------------------------------------------------------- # * Return to Default Name #-------------------------------------------------------------------------- def restore_default @name = @default_name @index = @name.split(//).size refresh update_cursor end #-------------------------------------------------------------------------- # * Add Text Character # character : text character to be added #-------------------------------------------------------------------------- def add(character) if @index < @max_char and character != "" @name += character @index += 1 refresh update_cursor end end #-------------------------------------------------------------------------- # * Delete Text Character #-------------------------------------------------------------------------- def back if @index > 0 name_array = @name.split(//) # Delete one character @name = "" for i in 0...name_array.size-1 @name += name_array[i] end @index -= 1 refresh update_cursor end end #-------------------------------------------------------------------------- # * Get rectangle for displaying items # index : item number #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.x = 1212- (@max_char + 1) * 12 + index * 24 rect.y = 0 rect.width = 24 rect.height = WLH return rect end def item_rect2(index) rect2 = Rect.new(0, 0, 0, 0) rect2.x = 732- (@max_char + 1) * 12 + index * 24 rect2.y = 24 rect2.width = 24 rect2.height = WLH return rect2 end def item_rect3(index) rect3 = Rect.new(0, 0, 0, 0) rect3.x = 252- (@max_char + 1) * 12 + index * 24 rect3.y = 48 rect3.width = 24 rect3.height = WLH return rect3 end def item_rect4(index) rect4 = Rect.new(0, 0, 0, 0) rect4.x = -228- (@max_char + 1) * 12 + index * 24 rect4.y = 72 rect4.width = 24 rect4.height = WLH return rect4 end def item_rect5(index) rect5 = Rect.new(0, 0, 0, 0) rect5.x = -708- (@max_char + 1) * 12 + index * 24 rect5.y = 96 rect5.width = 24 rect5.height = WLH return rect5 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear name_array = @name.split(//) for i in 0...@max_char c = name_array[i] c = '_' if c == nil if i<20 self.contents.draw_text(item_rect(i), c, 1) end if i>19 if i<40 self.contents.draw_text(item_rect2(i), c, 1) end end if i>19 if i<60 self.contents.draw_text(item_rect3(i), c, 1) end end if i>59 if i<80 self.contents.draw_text(item_rect4(i), c, 1) end end if i>79 self.contents.draw_text(item_rect5(i), c, 1) end end end #-------------------------------------------------------------------------- # * Update cursor #-------------------------------------------------------------------------- def update_cursor self.cursor_rect = item_rect(@index) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_cursor end end
def character if @index < 133 return TABLE[@mode][@index] else return "" end end
def is_mode_change return (@index == 133) end
def is_decision return (@index == 134) end
def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.x = index % 15 * 32 + index % 15 / 5 * 16 rect.y = index / 15 * WLH rect.width = 32 rect.height = WLH return rect end
def refresh self.contents.clear for i in 0..134 rect = item_rect(i) rect.x += 2 rect.width -= 4 self.contents.draw_text(rect, TABLE[@mode][i], 1) end end
def update_cursor self.cursor_rect = item_rect(@index) end
def cursor_down(wrap) if @index <120 @index += 15 elsif wrap @index -= 120 end end
def cursor_up(wrap) if @index >= 15 @index -= 15 elsif wrap @index += 120 end end
def cursor_right(wrap) if @index % 15 < 14 @index += 1 elsif wrap @index -= 14 end end
def cursor_left(wrap) if @index % 15 > 0 @index -= 1 elsif wrap @index += 14 end end
def cursor_to_decision @index = 134 end #-------------------------------------------------------------------------- # * Move to Next Page #-------------------------------------------------------------------------- def cursor_pagedown @mode = (@mode + 1) % TABLE.size refresh end #-------------------------------------------------------------------------- # * Move to Previous Page #-------------------------------------------------------------------------- def cursor_pageup @mode = (@mode + TABLE.size - 1) % TABLE.size refresh end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super last_mode = @mode last_index = @index if Input.repeat?(Input::DOWN) cursor_down(Input.trigger?(Input::DOWN)) end if Input.repeat?(Input::UP) cursor_up(Input.trigger?(Input::UP)) end if Input.repeat?(Input::RIGHT) cursor_right(Input.trigger?(Input::RIGHT)) end if Input.repeat?(Input::LEFT) cursor_left(Input.trigger?(Input::LEFT)) end if Input.trigger?(Input::A) cursor_to_decision end if Input.trigger?(Input::R) cursor_pagedown end if Input.trigger?(Input::L) cursor_pageup end if Input.trigger?(Input::C) and is_mode_change cursor_pagedown end if @index != last_index or @mode != last_mode Sound.play_cursor end update_cursor end end
pour cela il faut un image nommée font_note dans le dossier pictures un grand merci à Mist' qui m'a tiré d'un bon ptit problème!!!
Utilisateurs parcourant actuellement ce forum : Aucun utilisateur inscrit et 2 invités
Vous ne pouvez pas publier de nouveaux sujets dans ce forum Vous ne pouvez pas répondre aux sujets dans ce forum Vous ne pouvez pas éditer vos messages dans ce forum Vous ne pouvez pas supprimer vos messages dans ce forum Vous ne pouvez pas insérer de pièces jointes dans ce forum