Grawel
-
Posts
447 -
Joined
-
Last visited
Content Type
Profiles
Forums
Calendar
Posts posted by Grawel
-
-
Script fantastico Holy ma non so perchè non mi mostra il tipo di equip...(spada,lancia,arco ecc..)
Non l'ho tolto dall'elenco.
L'ho provato anche in nuovo progetto e non mostra il tipo.
-
Ancora nessuno ingrado di darmi una mano?
-
Ciao ragazzi scusate se vi rompo ancora ma ho bisogno ancora di voi per il mio progetto...
Sembrerebbe l'ultimo bug da risolvere...premetto che ho letto la guida di Holy e mi è stata molto utile per sistemare altri bug.Ma con questo non sono riuscito ancora a fare nnt.
Il problema è molto semplice non presenta crash ma un brutto bug nell'immagine dei personaggi del salvataggio.Mi spiego meglio uso questo script per i salvataggi mi serve perche permette di vedere alcune variabili direttamente dal salvataggio. Anche questo script come quello di default mostra le icone dei pg.
Le icone dei pg cambiano in base agli equipaggiamenti dei personaggi grazie ad un alro script (victor script)
lo script di yanfly e quello di victor non sono in coflitto insieme vanno perfettamente.
Lo script è il seguente Yanfly Engine Ace - Ace Save Engine v1.03Premetto che gli ho apportato delle modifice ma non influiscono sulle icone.
#==============================================================================
#
# ?\ Yanfly Engine Ace - Ace Save Engine v1.03
# -- Last Updated: 2012.07.22
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-SaveEngine"] = true
#==============================================================================
# ?\ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.07.22 - Fixed: Location Drawing.
# 2012.01.23 - Anti-crash method added for removed maps.
# 2011.12.26 - Compatibility Update: New Game+
# 2011.12.26 - Started Script and Finished.
#
#==============================================================================
# ?\ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides a new save interface for the player. Along with a new
# interface, the player can also load and delete saves straight from the menu
# itself. This will in turn make the save command from the Main Menu always
# available, but the save option within the new save menu will be enabled
# depending on whether or not it is allowed or disallowed. From the interface,
# the player is given more information regarding the save file including the
# the location the player saved at, the amount of gold available, and any
# variables that you want to show the player as well.
#
#==============================================================================
# ?\ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ?\ Materials/ef?T but above ?\ Main. Remember to save.
#
# For first time installers, be warned that loading this script the first time
# may not display all information in the status window for save files made
# before the installation of this script. To remedy this, just load up the save
# and save the file again.
#
#==============================================================================
# ?\ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YEA
module SAVE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Slot Window Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This section adjusts how the slot window appears on the left side of the
# screen. This also adjusts the maximum number of saves a player can make,
# the way the slot names appear, and the icons used.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
MAX_FILES = 1 # Maximum saves a player can make. Default: 16
SLOT_NAME = "File %s" # How the file slots will be named.
# These are the icons
SAVE_ICON = 133 # Icon used to indicate a save is present.
EMPTY_ICON = 2222 #141 # Icon used to indicate an empty file.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Action Window Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This section adjusts how the action window appears, the sound effect
# played when deleting files, and what appears in the help window above.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
ACTION_LOAD = "Carica" # Text used for loading games.
ACTION_SAVE = "Salva" # Text used for saving games.
ACTION_DELETE = "Cancella" # Text used for deleting games.
DELETE_SOUND = RPG::SE.new("Collapse3", 100, 100) # Sound for deleting.
# These text settings adjust what displays in the help window.
SELECT_HELP = "Selezionare il file."
LOAD_HELP = "Carica il salvataggio"
SAVE_HELP = "Salva i progressi del gioco."
DELETE_HELP = "Cancella tutti i dati dal file selezionato."
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Status Window Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This section adjusts how the status window appears in the middle of the
# screen (that displays the game's data) such as the total playtime, total
# times saved, total gold, the party's current location, and the variables
# to be displayed.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
EMPTY_TEXT = "Non ci sono dati salvati" # Text used when no save data is present.
PLAYTIME = "Tempo: " # Text used for total playtime.
TOTAL_SAVE = "Salvataggi totali: " # Text used to indicate total saves.
TOTAL_GOLD = "Denaro: " # Text used to indicate total gold.
LOCATION = "Luogo: " # Text used to indicate current location.
# These variables will be shown in each of the two columns for those who
# would want to display more information than just what's shown. Input the
# variables into the arrays below to designate what data will be shown.
COLUMN1_VARIABLES = [22, 3, 4]#1,2,3
COLUMN2_VARIABLES = [23, 24, 45]#4,5,6
end # SAVE
end # YEA
#==============================================================================
# ?\ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
#==============================================================================
# ?! Icon
#==============================================================================
module Icon
#--------------------------------------------------------------------------
# self.save_icon
#--------------------------------------------------------------------------
def self.save_icon; return YEA::SAVE::SAVE_ICON; end
#--------------------------------------------------------------------------
# self.empty_icon
#--------------------------------------------------------------------------
def self.empty_icon; return YEA::SAVE::EMPTY_ICON; end
end # Icon
#==============================================================================
# ?! Numeric
#==============================================================================
class Numeric
#--------------------------------------------------------------------------
# new method: group_digits
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
def group; return self.to_s; end
end # $imported["YEA-CoreEngine"]
end # Numeric
#==============================================================================
# ?! DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# overwrite method: savefile_max
#--------------------------------------------------------------------------
def self.savefile_max
return YEA::SAVE::MAX_FILES
end
#--------------------------------------------------------------------------
# overwrite method: self.make_save_header
#--------------------------------------------------------------------------
def self.make_save_header
header = {}
header[:characters] = $game_party.characters_for_savefile
header[:playtime_s] = $game_system.playtime_s
header[:system] = Marshal.load(Marshal.dump($game_system))
header[:timer] = Marshal.load(Marshal.dump($game_timer))
header[:message] = Marshal.load(Marshal.dump($game_message))
header[:switches] = Marshal.load(Marshal.dump($game_switches))
header[:variables] = Marshal.load(Marshal.dump($game_variables))
header[:self_switches] = Marshal.load(Marshal.dump($game_self_switches))
header[:actors] = Marshal.load(Marshal.dump($game_actors))
header[:party] = Marshal.load(Marshal.dump($game_party))
header[:troop] = Marshal.load(Marshal.dump($game_troop))
header[:map] = Marshal.load(Marshal.dump($game_map))
header[:player] = Marshal.load(Marshal.dump($game_player))
header
end
end # DataManager
#==============================================================================
# ?! Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# overwrite method: save_enabled
#--------------------------------------------------------------------------
def save_enabled; return true; end
end # Window_MenuCommand
#==============================================================================
# ?! Window_FileList
#==============================================================================
class Window_FileList < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(dx, dy)
super(dx, dy, 128, Graphics.height - dy)
refresh
activate
select(SceneManager.scene.first_savefile_index)
end
#--------------------------------------------------------------------------
# item_max
#--------------------------------------------------------------------------
def item_max; return DataManager.savefile_max; end
#--------------------------------------------------------------------------
# current_item_enabled?
#--------------------------------------------------------------------------
def current_item_enabled?
header = DataManager.load_header(index)
return false if header.nil? && SceneManager.scene_is?(Scene_Load)
return true
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
header = DataManager.load_header(index)
enabled = !header.nil?
rect = item_rect(index)
rect.width -= 4
draw_icon(save_icon?(header), rect.x, rect.y, enabled)
change_color(normal_color, enabled)
text = sprintf(YEA::SAVE::SLOT_NAME, (index + 1).group)
draw_text(rect.x+24, rect.y, rect.width-24, line_height, text)
end
#--------------------------------------------------------------------------
# save_icon?
#--------------------------------------------------------------------------
def save_icon?(header)
return Icon.empty_icon if header.nil?
return Icon.save_icon
end
end # Window_FileList
#==============================================================================
# ?! Window_FileStatus
#==============================================================================
class Window_FileStatus < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(dx, dy, file_window)
super(dx, dy, Graphics.width - dx, Graphics.height - dy)
@file_window = file_window
@current_index = @file_window.index
refresh
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
return if @file_window.index < 0
return if @current_index == @file_window.index
@current_index = @file_window.index
refresh
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
reset_font_settings
@header = DataManager.load_header(@file_window.index)
if @header.nil?
draw_empty
else
draw_save_contents
end
end
#--------------------------------------------------------------------------
# draw_empty
#--------------------------------------------------------------------------
def draw_empty
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(0, 0, contents.width, contents.height)
contents.fill_rect(rect, colour)
text = YEA::SAVE::EMPTY_TEXT
change_color(system_color)
draw_text(rect, text, 1)
end
#--------------------------------------------------------------------------
# draw_save_slot
#--------------------------------------------------------------------------
def draw_save_slot(dx, dy, dw)
reset_font_settings
change_color(system_color)
text = sprintf(YEA::SAVE::SLOT_NAME, "")
draw_text(dx, dy, dw, line_height, text)
cx = text_size(text).width
change_color(normal_color)
draw_text(dx+cx, dy, dw-cx, line_height, (@file_window.index+1).group)
end
#--------------------------------------------------------------------------
# draw_save_playtime
#--------------------------------------------------------------------------
def draw_save_playtime(dx, dy, dw)
return if @header[:playtime_s].nil?
reset_font_settings
change_color(system_color)
draw_text(dx, dy, dw, line_height, YEA::SAVE::PLAYTIME, 0)
change_color(normal_color)
draw_text(dx, dy, dw, line_height, @header[:playtime_s], 2)
end
#--------------------------------------------------------------------------
# draw_save_total_saves
#--------------------------------------------------------------------------
def draw_save_total_saves(dx, dy, dw)
return if @header[:system].nil?
reset_font_settings
change_color(system_color)
text = YEA::SAVE::TOTAL_SAVE
draw_text(dx, dy, dw, line_height, text)
cx = text_size(text).width
change_color(normal_color)
draw_text(dx+cx, dy, dw-cx, line_height, @header[:system].save_count.group)
end
#--------------------------------------------------------------------------
# draw_save_gold
#--------------------------------------------------------------------------
def draw_save_gold(dx, dy, dw)
return if @header[:party].nil?
reset_font_settings
change_color(system_color)
draw_text(dx, dy, dw, line_height, YEA::SAVE::TOTAL_GOLD)
text = Vocab::currency_unit
draw_text(dx, dy, dw, line_height, text, 2)
cx = text_size(text).width
change_color(normal_color)
text = @header[:party].gold.group
draw_text(dx, dy, dw-cx, line_height, text, 2)
end
#--------------------------------------------------------------------------
# draw_save_location
#--------------------------------------------------------------------------
def draw_save_location(dx, dy, dw)
return if @header[:map].nil?
reset_font_settings
change_color(system_color)
draw_text(dx, dy, dw, line_height, YEA::SAVE::LOCATION)
change_color(normal_color)
cx = text_size(YEA::SAVE::LOCATION).width
return if $data_mapinfos[@header[:map].map_id].nil?
text = @header[:map].display_name
text = $data_mapinfos[@header[:map].map_id].name if text == ""
draw_text(dx+cx, dy, dw-cx, line_height, text)
end
#--------------------------------------------------------------------------
# draw_save_characters
#--------------------------------------------------------------------------
def draw_save_characters(dx, dy)
return if @header[:party].nil?
reset_font_settings
make_font_smaller
dw = (contents.width - dx) / @header[:party].max_battle_members
dx += dw/2
for member in @header[:party].battle_members
next if member.nil?
member = @header[:actors][member.id]
change_color(normal_color)
draw_actor_graphic(member, dx, dy)
text = member.name
draw_text(dx-dw/2, dy, dw, line_height, text, 1)
text = member.level.group
draw_text(dx-dw/2, dy-line_height, dw-4, line_height, text, 2)
cx = text_size(text).width
change_color(system_color)
text = Vocab::level_a
draw_text(dx-dw/2, dy-line_height, dw-cx-4, line_height, text, 2)
dx += dw
end
end
#--------------------------------------------------------------------------
# draw_save_column1
#--------------------------------------------------------------------------
def draw_save_column1(dx, dy, dw)
data = YEA::SAVE::COLUMN1_VARIABLES
draw_column_data(data, dx, dy, dw)
end
#--------------------------------------------------------------------------
# draw_save_column2
#--------------------------------------------------------------------------
def draw_save_column2(dx, dy, dw)
data = YEA::SAVE::COLUMN2_VARIABLES
draw_column_data(data, dx, dy, dw)
end
#--------------------------------------------------------------------------
# draw_column_data
#--------------------------------------------------------------------------
def draw_column_data(data, dx, dy, dw)
return if @header[:variables].nil?
reset_font_settings
for variable_id in data
#### variabile speciale giorno notte
next if $data_system.variables[variable_id].nil?
name = $data_system.variables[variable_id]
value = @header[:variables][variable_id].group
if name=="Stato"
change_color(system_color)
draw_text(dx, dy, dw, line_height, name, 0)
change_color(normal_color)
if value=="1"
draw_text(dx, dy, dw, line_height, "Giorno", 2)
end
if value=="0"
draw_text(dx, dy, dw, line_height, "Notte", 2)
end
if value=="2"
draw_text(dx, dy, dw, line_height, "Sogno", 2)
end
if value=="3"
draw_text(dx, dy, dw, line_height, "Pomeriggio", 2)
end
if value=="4"
draw_text(dx, dy, dw, line_height, "Mattina", 2)
end
end
if name=="Weekday"
change_color(system_color)
draw_text(dx, dy, dw, line_height, name, 0)
change_color(normal_color)
if value=="1"
draw_text(dx, dy, dw, line_height, "Lunedì", 2)
end
if value=="0"
draw_text(dx, dy, dw, line_height, "", 2)
end
if value=="2"
draw_text(dx, dy, dw, line_height, "Martedì", 2)
end
if value=="3"
draw_text(dx, dy, dw, line_height, "Mercoledì", 2)
end
if value=="4"
draw_text(dx, dy, dw, line_height, "Giovedì", 2)
end
if value=="5"
draw_text(dx, dy, dw, line_height, "Venerdì", 2)
end
if value=="6"
draw_text(dx, dy, dw, line_height, "Sabato", 2)
end
if value=="7"
draw_text(dx, dy, dw, line_height, "Domenica", 2)
end
end
if name!="Stato"&&name!=""&&name!="Weekday"
if value!="0"
value = @header[:variables][variable_id].group
change_color(system_color)
draw_text(dx, dy, dw, line_height, name, 0)
change_color(normal_color)
draw_text(dx, dy, dw, line_height, value, 2)
end
end
dy += line_height
#######se si vuole tornare normali sostituire cio che precede con
#next if $data_system.variables[variable_id].nil?
# change_color(system_color)
# name = $data_system.variables[variable_id]
# draw_text(dx, dy, dw, line_height, name, 0)
# value = @header[:variables][variable_id].group
# change_color(normal_color)
# draw_text(dx, dy, dw, line_height, value, 2)
# dy += line_height
#######
end
end
#--------------------------------------------------------------------------
# draw_save_contents
#--------------------------------------------------------------------------
def draw_save_contents
draw_save_slot(4, 0, contents.width/2-8)
draw_save_playtime(contents.width/2+4, 0, contents.width/2-8)
draw_save_total_saves(4, line_height, contents.width/2-8)
draw_save_gold(contents.width/2+4, line_height, contents.width/2-8)
draw_save_location(4, line_height*2, contents.width-8)
draw_save_characters(0, line_height*5 + line_height/3)
draw_save_column1(16, line_height*7, contents.width/2-48)
draw_save_column2(contents.width/2+16, line_height*7, contents.width/2-48)
end
end # Window_FileStatus
#==============================================================================
# ?! Window_FileAction
#==============================================================================
class Window_FileAction < Window_HorzCommand
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(dx, dy, file_window)
@file_window = file_window
super(dx, dy)
deactivate
unselect
end
#--------------------------------------------------------------------------
# window_width
#--------------------------------------------------------------------------
def window_width; Graphics.width - 128; end
#--------------------------------------------------------------------------
# col_max
#--------------------------------------------------------------------------
def col_max; return 3; end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
return if @file_window.index < 0
return if @current_index == @file_window.index
@current_index = @file_window.index
refresh
end
#--------------------------------------------------------------------------
# make_command_list
#--------------------------------------------------------------------------
def make_command_list
@header = DataManager.load_header(@file_window.index)
add_load_command
add_save_command
add_delete_command
end
#--------------------------------------------------------------------------
# add_load_command
#--------------------------------------------------------------------------
def add_load_command
add_command(YEA::SAVE::ACTION_LOAD, :load, load_enabled?)
end
#--------------------------------------------------------------------------
# load_enabled?
#--------------------------------------------------------------------------
def load_enabled?
return false if @header.nil?
return true
end
#--------------------------------------------------------------------------
# add_save_command
#--------------------------------------------------------------------------
def add_save_command
add_command(YEA::SAVE::ACTION_SAVE, :save, save_enabled?)
end
#--------------------------------------------------------------------------
# save_enabled?
#--------------------------------------------------------------------------
def save_enabled?
return false if @header.nil? && SceneManager.scene_is?(Scene_Load)
return false if SceneManager.scene_is?(Scene_Load)
return false if $game_system.save_disabled
return true
end
#--------------------------------------------------------------------------
# add_delete_command
#--------------------------------------------------------------------------
def add_delete_command
add_command(YEA::SAVE::ACTION_DELETE, :delete, delete_enabled?)
end
#--------------------------------------------------------------------------
# delete_enabled?
#--------------------------------------------------------------------------
def delete_enabled?
return false if @header.nil?
return true
end
#--------------------------------------------------------------------------
# update_help
#--------------------------------------------------------------------------
def update_help
case current_symbol
when :load; @help_window.set_text(YEA::SAVE::LOAD_HELP)
when :save; @help_window.set_text(YEA::SAVE::SAVE_HELP)
when :delete; @help_window.set_text(YEA::SAVE::DELETE_HELP)
end
end
end # Window_FileAction
#==============================================================================
# ?! Scene_File
#==============================================================================
class Scene_File < Scene_MenuBase
#--------------------------------------------------------------------------
# overwrite method: start
#--------------------------------------------------------------------------
def start
super
create_all_windows
end
#--------------------------------------------------------------------------
# overwrite method: terminate
#--------------------------------------------------------------------------
def terminate
super
end
#--------------------------------------------------------------------------
# overwrite method: update
#--------------------------------------------------------------------------
def update
super
end
#--------------------------------------------------------------------------
# new method: create_all_windows
#--------------------------------------------------------------------------
def create_all_windows
create_help_window
create_file_window
create_action_window
create_status_window
end
#--------------------------------------------------------------------------
# overwrite method: create_help_window
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_Help.new
@help_window.set_text(YEA::SAVE::SELECT_HELP)
end
#--------------------------------------------------------------------------
# new method: create_file_window
#--------------------------------------------------------------------------
def create_file_window
wy = @help_window.height
@file_window = Window_FileList.new(0, wy)
@file_window.set_handler(:ok, method(:on_file_ok))
@file_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# new method: create_action_window
#--------------------------------------------------------------------------
def create_action_window
wx = @file_window.width
wy = @help_window.height
@action_window = Window_FileAction.new(wx, wy, @file_window)
@action_window.help_window = @help_window
@action_window.set_handler(:cancel, method(:on_action_cancel))
@action_window.set_handler(:load, method(:on_action_load))
@action_window.set_handler(:save, method(:on_action_save))
@action_window.set_handler(:delete, method(:on_action_delete))
end
#--------------------------------------------------------------------------
# new method: create_status_window
#--------------------------------------------------------------------------
def create_status_window
wx = @action_window.x
wy = @action_window.y + @action_window.height
@status_window = Window_FileStatus.new(wx, wy, @file_window)
end
#--------------------------------------------------------------------------
# new method: on_file_ok
#--------------------------------------------------------------------------
def on_file_ok
@action_window.activate
index = SceneManager.scene_is?(Scene_Load) ? 0 : 1
@action_window.select(index)
end
#--------------------------------------------------------------------------
# new method: on_action_cancel
#--------------------------------------------------------------------------
def on_action_cancel
@action_window.unselect
@file_window.activate
@help_window.set_text(YEA::SAVE::SELECT_HELP)
end
#--------------------------------------------------------------------------
# new method: on_action_load
#--------------------------------------------------------------------------
def on_action_load
if DataManager.load_game(@file_window.index)
on_load_success
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# overwrite method: on_load_success
#--------------------------------------------------------------------------
def on_load_success
Sound.play_load
fadeout_all
$game_system.on_after_load
SceneManager.goto(Scene_Map)
end
#--------------------------------------------------------------------------
# new method: on_action_save
#--------------------------------------------------------------------------
def on_action_save
@action_window.activate
if DataManager.save_game(@file_window.index)
on_save_success
refresh_windows
else
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# overwrite method: on_save_success
#--------------------------------------------------------------------------
def on_save_success; Sound.play_save; end
#--------------------------------------------------------------------------
# new method: on_action_delete
#--------------------------------------------------------------------------
def on_action_delete
@action_window.activate
DataManager.delete_save_file(@file_window.index)
on_delete_success
refresh_windows
end
#--------------------------------------------------------------------------
# new method: on_delete_success
#--------------------------------------------------------------------------
def on_delete_success
YEA::SAVE::DELETE_SOUND.play
end
#--------------------------------------------------------------------------
# new method: refresh_windows
#--------------------------------------------------------------------------
def refresh_windows
@file_window.refresh
@action_window.refresh
@status_window.refresh
end
end # Scene_File
#==============================================================================
# ?! Scene_Save
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# overwrite method: on_savefile_ok
#--------------------------------------------------------------------------
def on_savefile_ok; super; end
#--------------------------------------------------------------------------
# overwrite method: on_save_success
#--------------------------------------------------------------------------
def on_save_success; super; end
end # help_window_text
#==============================================================================
# ?! Scene_Load
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# overwrite method: on_savefile_ok
#--------------------------------------------------------------------------
def on_savefile_ok; super; end
#--------------------------------------------------------------------------
# overwrite method: on_load_success
#--------------------------------------------------------------------------
def on_load_success; super; end
end # Scene_Load
#==============================================================================
#
# ?\ End of File
#
#==============================================================================questo script funzionava benissimo.
Di recente ho aggiunto un altro script che mi è molto utile Instance Items di Hime che vi posto qui sotto.
questo script funziona benissimo perfettamente con quello di victor non da problemi (se uso il salvatagio di default le icone dei personaggi sono mostrate corretamente quindi se ho un personaggio che equipaggia un elmo vedro l'elmo sul pg)
A quanto pare però avendo lo script di yanfly qualcosa non va. in quantonon vengono visualizzati le icone corretamente.Es. un pg che dovrebbe essere vestito lo vedo nudo...ma quando carico il gioco il pg è corretamente vestito.
Instance Items di Hime
=begin
#===============================================================================
Title: Instance Items
Author: Hime
Date: Jan 29, 2015
URL: http://himeworks.com/2014/01/07/instance-items/
--------------------------------------------------------------------------------
** Change log
Jan 29, 2015
- requests for weapons, armors, or items will return a clone of the original
arrays in case you try to operate on it
Dec 1, 2014
- moved instance database reloading into "load_game_without_rescue" instead
of "load_game"
Aug 30, 2014
- fixed issue where removing items, including equips, crashed
May 4, 2014
- rather than reloading template database completely, simply drop the
instance objects
Mar 21, 2014
- fixed issue where conditional branch for equip checking doesn't work
Jan 23, 2014
- added support for refreshing note, description, and icon index
Jan 16, 2014
- added support for refreshing price and features
Jan 14, 2014
- added support for "refreshing" names and params
Jan 12, 2014
- disabling instance mode properly works for equips
- fixed issue with equipping
Jan 9, 2014
- instance counts do not explicitly "gain/lose" a template item
- fixed issue where changing equips forcibly was not working correctly
- fixed issue with battle test when item instances were enabled
Jan 7, 2014
- added several setup methods to the Instance Manager
Dec 10, 2013
- compatibility with Core Equip Slots
- Initial release
--------------------------------------------------------------------------------
** Terms of Use
* Free to use in non-commercial projects
* Contact me for commercial use
* No real support. The script is provided as-is
* Will do bug fixes, but no compatibility patches
* Features may be requested but no guarantees, especially if it is non-trivial
* Credits to Hime Works in your project
* Preserve this header
--------------------------------------------------------------------------------
** Description
This script introduces the concept of "instance items". In order to understand
what an instance item is, you need to first understand what a "template item"
is.
All of your database items, weapons, and armors are called "template items".
That is, they serve as templates for in-game items.
An instance item is simply an instance of a template. For example, you design
weapon ID 1 in your database and call it a "Short Sword". This is a template
of a Short Sword; everytime you receive a Short Sword in-game, you receive
a unique "instance" of this template. Two Short Swords in your inventory are
treated as two individual entities that have nothing to do with each other
besides both being based on the Short Sword template.
It is important to note that this script simply provides instance item
functionality. Additional add-ons are required to provide various features
such as equip levels, equip affixes, and so on.
--------------------------------------------------------------------------------
** Installation
In the script editor, place this script below Materials and above Main
You should place this below any equip-related scripts, such as my
Core Equip Slots or Yanfly's Ace Equip Engine.
--------------------------------------------------------------------------------
** Usage
This script is plug and play.
-- Instance Mode --
You can determine what type of objects allow instances or not in the
configuration by changing its "instance mode". For example, you can disable
instances for items so that they stack as normal.
These are the default values I have picked:
Items - false
Weapons - true
Armors - true
Currently, if instance mode is ON for that category of items, all items will
be treated as instances.
-- Event Changes --
The following event commands behave differently if instance mode is on.
When I say "item" I refer to weapons, armors, and items.
- When you gain an item using events, new instances will be added to the
inventory.
- When you lose an item using events, it follows "template discard" rules.
For example, if your event says to "lose 1 short sword", then the engine will
simply look for ANY instance item that is based on the short sword. The same
applies to equips if you include equips.
- When you use the "change equipment" event command, the engine looks for the
first instance of the specified equip.
--------------------------------------------------------------------------------
** Developers
This script serves as a framework for all instance items. Currently, it only
supports item, weapon, and armor instances.
The goal is to allow developers to write their own scripts that require
"unique" items very easily without having to worry about how to actually
implement it.
This script is designed so that you only need to focus on two things
1. The RPG module, which contains the template weapons, armors, and items.
2. the InstanceManager module, which handles everything related to instances.
A simple script would first load note-tags from the RPG objects and store them
with the templates. For example, suppose we want to give all instance weapons
a random attack bonus. We start by defining the max possible bonus a weapon
could receive.
class RPG::Weapon < RPG::EquipItem
def attack_bonus
50
end
end
Now, we make it so that whenever an instance weapon is created, a random bonus
will be applied to its attack. The InstanceManager provides several "setup"
methods available for you, depending on what kind of object you're working
with:
setup_equip_instance(obj) - use this for any equips (weapons or armors)
setup_weapon_instance(obj) - use this only for weapons
setup_armor_instance(obj) - use this only for armors
setup_item_instance(obj) - use this only for items
Since our example is applying a random flat bonus to an instance weapon, we
would alias the weapon setup method.
module InstanceManager
class << self
alias :th_random_weapon_bonus_setup_weapon_instance :setup_weapon_instance
end
def self.setup_weapon_instance(obj)
template_obj = get_template(obj)
th_random_weapon_bonus_setup_weapon_instance(obj)
obj.params[2] += rand(template_obj.attack_bonus)
end
end
Note the use of the `get_template` method in the setup. `obj` is an instance
weapon that we are creating.Our data is stored with the template weapon, so we
need to get it first before we can use it. After you have your template, you
can easily get the data you need to apply to your instance object.
And that's it! Your instance weapon now has a random attack bonus. You can
verify this by adding the same weapon to your inventory multiple times and
checking their parameters in the equip menu.
This is a very simple example, but its goal is to demonstrate how to modify
your instance objects. The rest of the game will just see it as another item
or equip.
-- Shared Data Compatibility --
Because many scripts may modify item information, it is important to write
compatible code.
All RPG items, weapons, and armors support a `refresh` method that will
re-compute a number of variables such as the name or parameters.
For example, to modify the name of an object, you should alias the
`make_name` method, which takes a name and returns a new name.
The order in which the modifications are applied is important, and therefore
you should make it clear what order users should place your script in.
#===============================================================================
=end
$imported = {} if $imported.nil?
$imported["TH_InstanceItems"] = true
#===============================================================================
# ** Configuration
#===============================================================================
module TH
module Instance_Items
# Enables instance mode for each type of object. When instance mode is
# enabled, all objects of that type will be treated as instances
Enable_Items = false
Enable_Weapons = true
Enable_Armors = true
end
end
#===============================================================================
# ** Rest of script
#===============================================================================
#-------------------------------------------------------------------------------
# This module manages all instance and template items.
#-------------------------------------------------------------------------------
module InstanceManager
class << self
attr_accessor :weapons
attr_accessor :armors
attr_accessor :items
attr_reader :template_counts
end
def self.setup
@template_counts = {}
@template_counts[:weapon] = $data_weapons.size
@template_counts[:armor] = $data_armors.size
@template_counts[:item] = $data_items.size
end
#-----------------------------------------------------------------------------
# Stores the instance objects for game saving purpose
#-----------------------------------------------------------------------------
def self.create_game_objects
@weapons = {}
@armors = {}
@items = {}
end
#-----------------------------------------------------------------------------
# Full copy of the template object so we don't have any reference issues
#-----------------------------------------------------------------------------
def self.make_full_copy(obj)
return Marshal.load(Marshal.dump(obj))
end
def self.instance_enabled?(obj)
return TH::Instance_Items::Enable_Items if obj.is_a?(RPG::Item)
return TH::Instance_Items::Enable_Weapons if obj.is_a?(RPG::Weapon)
return TH::Instance_Items::Enable_Armors if obj.is_a?(RPG::Armor)
return false
end
def self.is_template?(obj)
return obj.id >= @template_counts[:item] if obj.is_a?(RPG::Item)
return obj.id >= @template_counts[:weapon] if obj.is_a?(RPG::Weapon)
return obj.id >= @template_counts[:armor] if obj.is_a?(RPG::Armor)
end
#-----------------------------------------------------------------------------
# create an instance from the template. Basically just a full copy.
#-----------------------------------------------------------------------------
def self.make_instance(obj)
new_obj = make_full_copy(obj)
new_obj.template_id = new_obj.id
return new_obj
end
#-----------------------------------------------------------------------------
# Return the database table that the obj belongs in
#-----------------------------------------------------------------------------
def self.get_tables(obj)
return @items, $data_items if obj.is_a?(RPG::Item)
return @weapons, $data_weapons if obj.is_a?(RPG::Weapon)
return @armors, $data_armors if obj.is_a?(RPG::Armor)
end
def self.get_template(obj)
return $data_items[obj.template_id] if obj.is_a?(RPG::Item)
return $data_weapons[obj.template_id] if obj.is_a?(RPG::Weapon)
return $data_armors[obj.template_id] if obj.is_a?(RPG::Armor)
end
#-----------------------------------------------------------------------------
# Returns an instance of the object, assuming it is a valid object, it
# supports instances, and it's not a template
#-----------------------------------------------------------------------------
def self.get_instance(obj)
return obj if obj.nil? || !instance_enabled?(obj) || !obj.is_template?
new_obj = make_instance(obj)
container, table = get_tables(obj)
id = table.size
new_obj.id = id
# Setup the instance object as required
setup_instance(new_obj)
# Add to database and container
container[id] = new_obj
table[id] = new_obj
return new_obj
end
#-----------------------------------------------------------------------------
# Set up our new instance object. This is meant to be aliased
#-----------------------------------------------------------------------------
def self.setup_instance(obj)
setup_equip_instance(obj) if obj.is_a?(RPG::EquipItem)
setup_item_instance(obj) if obj.is_a?(RPG::Item)
end
#-----------------------------------------------------------------------------
# Apply any equip-specific logic. This is meant to be aliased.
# Note the same object is passed to the appropriate setup method depending
# on whether it's a weapon or armor, so be careful not to apply the same
# changes multiple times.
#-----------------------------------------------------------------------------
def self.setup_equip_instance(obj)
setup_weapon_instance(obj) if obj.is_a?(RPG::Weapon)
setup_armor_instance(obj) if obj.is_a?(RPG::Armor)
end
#-----------------------------------------------------------------------------
# Apply any weapon-specific logic. This is meant to be aliased.
#-----------------------------------------------------------------------------
def self.setup_weapon_instance(obj)
end
#-----------------------------------------------------------------------------
# Apply any armor-specific logic. This is meant to be aliased.
#-----------------------------------------------------------------------------
def self.setup_armor_instance(obj)
end
#-----------------------------------------------------------------------------
# Apply any item-specific logic. This is meant to be aliased.
#-----------------------------------------------------------------------------
def self.setup_item_instance(obj)
end
end
module RPG
class BaseItem
# List of all attributes that are shared instance variable
_instance_attr = [:name, :params, :price, :features, :note, :icon_index,
:description]
#---------------------------------------------------------------------------
# Define methods for all shared variables
#---------------------------------------------------------------------------
_instance_refresh = "def refresh"
_instance_attr.each do |ivar|
_instance_refresh << ";refresh_#{ivar}"
eval(
"def refresh_#{ivar}
var = InstanceManager.get_template(self).#{ivar}
@#{ivar} = make_#{ivar}(InstanceManager.make_full_copy(var))
end
def make_#{ivar}(#{ivar})
#{ivar}
end
"
)
end
_instance_refresh << ";end"
eval(_instance_refresh)
end
class Item < UsableItem
attr_accessor :template_id
def is_template?
return self.template_id == self.id
end
def template_id
@template_id = @id unless @template_id
return @template_id
end
end
class EquipItem < BaseItem
attr_accessor :template_id
def is_template?
self.template_id == self.id
end
def template_id
@template_id = @id unless @template_id
return @template_id
end
end
end
module DataManager
class << self
alias :th_instance_items_load_game_without_rescue :load_game_without_rescue
alias :th_instance_items_create_game_objects :create_game_objects
alias :th_instance_items_make_save_contents :make_save_contents
alias :th_instance_items_extract_save_contents :extract_save_contents
end
def self.create_game_objects
th_instance_items_create_game_objects
InstanceManager.create_game_objects
load_instance_database
end
def self.make_save_contents
contents = th_instance_items_make_save_contents
contents[:instance_weapons] = InstanceManager.weapons
contents[:instance_armors] = InstanceManager.armors
contents[:instance_items] = InstanceManager.items
contents
end
def self.extract_save_contents(contents)
th_instance_items_extract_save_contents(contents)
InstanceManager.weapons = contents[:instance_weapons] || []
InstanceManager.armors = contents[:instance_armors] || []
InstanceManager.items = contents[:instance_items] || []
end
def self.load_game_without_rescue(index)
res = th_instance_items_load_game_without_rescue(index)
reload_instance_database
return res
end
#-----------------------------------------------------------------------------
# Merges the instance items into the database
#-----------------------------------------------------------------------------
def self.load_instance_database
InstanceManager.setup
merge_array_data($data_weapons, InstanceManager.weapons)
merge_array_data($data_armors, InstanceManager.armors)
merge_array_data($data_items, InstanceManager.items)
end
def self.reload_instance_database
$data_weapons = $data_weapons[0..InstanceManager.template_counts[:weapon]]
$data_armors = $data_armors[0..InstanceManager.template_counts[:armor]]
$data_items = $data_items[0..InstanceManager.template_counts[:item]]
load_instance_database
end
def self.merge_array_data(arr, hash)
hash.each {|i, val|
arr[i] = val
}
end
end
class Game_Interpreter
alias :th_instance_items_command_111 :command_111
def command_111
result = false
case @params[0]
when 4
actor = $game_actors[@params[1]]
if actor
case @params[2]
when 0 # in party
result = ($game_party.members.include?(actor))
when 1 # name
result = (actor.name == @params[3])
when 2 # Class
result = (actor.class_id == @params[3])
when 3 # Skills
result = (actor.skill_learn?($data_skills[@params[3]]))
when 4 # Weapons
result = (actor.instance_weapons_include?(@params[3]))
when 5 # Armors
result = (actor.instance_armors_include?(@params[3]))
when 6 # States
result = (actor.state?(@params[3]))
end
end
end
@branch[@indent] = result
# none of them passed, so let's check the other conditions
th_instance_items_command_111 if !result
end
end
class Game_Actor < Game_Battler
alias :th_instance_items_init_equips :init_equips
def init_equips(equips)
@equips = Array.new(equip_slots.size) { Game_BaseItem.new }
instance_equips = check_instance_equips(equips)
th_instance_items_init_equips(instance_equips)
end
#-----------------------------------------------------------------------------
# Replace all initial equips with instances
#-----------------------------------------------------------------------------
def check_instance_equips(equips)
new_equips = []
equips.each_with_index do |item_id, i|
etype_id = index_to_etype_id(i)
slot_id = empty_slot(etype_id)
if etype_id == 0
equip = $data_weapons[item_id]
else
equip = $data_armors[item_id]
end
new_equips << InstanceManager.get_instance(equip)
end
return new_equips.collect {|obj| obj ? obj.id : 0}
end
alias :th_instance_items_change_equip :change_equip
def change_equip(slot_id, item)
new_item = item
if item && InstanceManager.instance_enabled?(item) && $game_party.has_item?(item) && item.is_template?
new_item = $game_party.find_instance_item(item)
end
th_instance_items_change_equip(slot_id, new_item)
end
alias :th_instance_items_trade_item_with_party :trade_item_with_party
def trade_item_with_party(new_item, old_item)
if new_item && InstanceManager.instance_enabled?(new_item) && $game_party.has_item?(new_item) && new_item.is_template?
new_item = $game_party.find_instance_item(new_item)
end
th_instance_items_trade_item_with_party(new_item, old_item)
end
#-----------------------------------------------------------------------------
# New.
#-----------------------------------------------------------------------------
def instance_weapons_include?(id)
weapons.any? {|obj| obj.template_id == id }
end
#-----------------------------------------------------------------------------
# New.
#-----------------------------------------------------------------------------
def instance_armors_include?(id)
armors.any? {|obj| obj.template_id == id }
end
end
class Game_Party < Game_Unit
alias :th_instance_items_init_all_items :init_all_items
def init_all_items
th_instance_items_init_all_items
@item_list = []
@weapon_list = []
@armor_list = []
end
#-----------------------------------------------------------------------------
# Overwrite. We already keep a list of weapons
#-----------------------------------------------------------------------------
alias :th_instance_items_weapons :weapons
def weapons
TH::Instance_Items::Enable_Weapons ? @weapon_list.clone : th_instance_items_weapons
end
#-----------------------------------------------------------------------------
# Overwrite.
#-----------------------------------------------------------------------------
alias :th_instance_items_items :items
def items
TH::Instance_Items::Enable_Items ? @item_list.clone : th_instance_items_items
end
#-----------------------------------------------------------------------------
# Overwrite.
#-----------------------------------------------------------------------------
alias :th_instance_items_armors :armors
def armors
TH::Instance_Items::Enable_Armors ? @armor_list.clone : th_instance_items_armors
end
#-----------------------------------------------------------------------------
# Returns true if the item type supports instances
#-----------------------------------------------------------------------------
def instance_enabled?(item)
return InstanceManager.instance_enabled?(item)
end
#-----------------------------------------------------------------------------
# Returns an instance for the given item. If it is already an instance, then
# we just return that. If it's a template, we create a new instance.
#-----------------------------------------------------------------------------
def get_instance(item)
return InstanceManager.get_instance(item)
end
#-----------------------------------------------------------------------------
# Returns the template for the given item
#-----------------------------------------------------------------------------
def get_template(item)
return InstanceManager.get_template(item)
end
#-----------------------------------------------------------------------------
# The gain item method performs various checks on the item that you want to
# add to the inventory. Namely, it checks whether it is a template item or
# an instance item, updates the item counts, and so on.
#-----------------------------------------------------------------------------
alias :th_instance_items_gain_item :gain_item
def gain_item(item, amount, include_equip = false)
# special check for normal items
if !instance_enabled?(item)
th_instance_items_gain_item(item, amount, include_equip)
else
if item
if amount > 0
amount.times do |i|
new_item = get_instance(item)
add_instance_item(new_item)
end
else
amount.abs.times do |i|
item_template = get_template(item)
if item.is_template?
# remove using template rules. If an item was lost, then decrease
# template count by 1.
lose_template_item(item, include_equip)
else
# remove the instance item, and decrease template count by 1
lose_instance_item(item)
end
end
end
else
th_instance_items_gain_item(item, amount, include_equip)
end
end
end
#-----------------------------------------------------------------------------
# New. Returns the appropriate container list
#-----------------------------------------------------------------------------
def item_container_list(item)
return @item_list if item.is_a?(RPG::Item)
return @weapon_list if item.is_a?(RPG::Weapon)
return @armor_list if item.is_a?(RPG::Armor)
end
#-----------------------------------------------------------------------------
# New. Adds the instance item to the appropriate list
#-----------------------------------------------------------------------------
def add_instance_item(item)
container = item_container(item.class)
container[item.template_id] ||= 0
container[item.template_id] += 1
container[item.id] = 1
container_list = item_container_list(item)
container_list.push(item)
end
#-----------------------------------------------------------------------------
# New. Returns an instance item that matches the template. If it doesn't
# exist, returns nil
#-----------------------------------------------------------------------------
def find_instance_item(template_item)
container_list = item_container_list(template_item)
return container_list.find {|obj| obj.template_id == template_item.template_id }
end
#-----------------------------------------------------------------------------
# New. Lose an instance item. Simply delete it from the appropriate container
# list
#-----------------------------------------------------------------------------
def lose_instance_item(item)
container = item_container(item.class)
container[item.template_id] ||= 0
container[item.template_id] -= 1
container[item.id] = 0
container_list = item_container_list(item)
container_list.delete(item)
end
#-----------------------------------------------------------------------------
# New. Lose a template item. This looks for a
#-----------------------------------------------------------------------------
def lose_template_item(item, include_equip)
container_list = item_container_list(item)
item_lost = container_list.find {|obj| obj.template_id == item.template_id }
if item_lost
container = item_container(item.class)
container[item.template_id] ||= 0
container[item.template_id] -= 1
container_list.delete(item_lost)
elsif include_equip
discard_members_template_equip(item, 1)
end
return item_lost
end
#-----------------------------------------------------------------------------
# New. Same as discarding equips, except we follow template discard rules
#-----------------------------------------------------------------------------
def discard_members_template_equip(item, amount)
n = amount
members.each do |actor|
item = actor.equips.find {|obj| obj && obj.template_id == item.template_id }
while n > 0 && item
actor.discard_equip(item)
n -= 1
end
end
end
end
class Window_ItemList < Window_Selectable
alias :th_instance_items_draw_item_number :draw_item_number
def draw_item_number(rect, item)
th_instance_items_draw_item_number(rect, item) if item.is_template?
end
end
#===============================================================================
# Compatibility with Core Equip Slots
#===============================================================================
if $imported["TH_CoreEquipSlots"]
class Game_Actor < Game_Battler
def init_equips(equips)
@equips = Array.new(initial_slots.size) {|i| Game_EquipSlot.new(initial_slots[i]) }
instance_equips = check_instance_equips(equips)
th_instance_items_init_equips(instance_equips)
end
end
endHo fatto svariati test per vedere se era un altro script a fare conflitto ma sembrerebbe siano proprio questi due.
Credo di aver spiegato nel dettaglio il problema, ho bisogno del vostro aiuto.
-
Mi sono dimenticato di scriverlo qui.
Ho risolto il problema. Basta non inviare due volte lo stesso URL, e funziona benissimo.
Ringrazio Holy87 per l'aiuto e la pazienza. -
In che senso Holy dove vuoi che li printo? (intendi mandarli alla pagina php?) e che paramentri vuoi che printo?
-
scusami holy ma se il problema fosse la query non funzionerebbe da browser...non trovi?
non è che potresti fare dei test?o se vuoi ti mando le pagine php per dargli un occhio...ma non credo ci siano errori...
ti mando le pagine php ti prego di dargli un occhio ho davvero bisogno di venire a capo di questo problema
pagina 1 quella che richiamo nello script
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
require "require.php";
if(isset($_GET['get'])){
$string=$_GET['get'];
$parametri = explode('|',$string);
$nome = $parametri[0];
$pass=$parametri[1];
$day=date('c');
$r2 = new Cast($nome,$pass,$day);
$r2->Save();
}
?>pagina 2 contiene le funzioni
class Cast
{
private $id = -1;
private $nome;
private $pass;
private $giorno;
public function __construct($nome, $pass, $giorno)
{
$this->nome = $nome;
$this->pass = $pass;
$this->giorno= $giorno;
}
#funzioni di get
public function getId()
{
return $this->id;
}
public function getNome()
{
return $this->nome;
}
public function getPass()
{
return $this->pass;
}
public function getGiorno()
{
return $this->giorno;
}
#funzioni di set
public function setId($id)
{
$this->id = $id;
}
public function setNome($nome)
{
$this->nome = $nome;
}
public function setPass($pass)
{
$this->pass=$pass;
}
public function setGiorno($giorno)
{
$this->giorno=$giorno;
}
public function Save()
{
global $db;
if ($this->id==-1)
{
if($result=$db->query("insert into utente (nome,pass,giorno) VALUES ('".$this->nome."','".$this->pass."','".$this->giorno."')"))
{
$this->setId($db->insert_id);
$r=$this->getId();
echo($r);
}
}
else
{
if($result=$db->query("update utente set nome='".$this->nome."',pass='".$this->pass."',giorno='".$this->giorno."' where id=".$this->id))
{
}
}
}
public static function GetAll()
{
global $db;
$array=array();
if($result=$db->query("select * from utente"))
{
while($row=$result->fetch_assoc())
{
$p=new album($row["nome"],$row["pass"],$row["giorno"]);
$p->setId($row["id"]);
array_push($array,$p);
}
}
return $array;
}
public static function GetById($id)
{
global $db;
if($result=$db->query("select * from utente where id=$id"))
{
if($row=$result->fetch_assoc())
{
$p=new album($row["nome"],$row["pass"],$row["giorno"]);
$p->setId($id);
return $p;
}
}
}
}
?>pagina 3 collega le 2 è ha il connettore mysqli
$db = new mysqli("localhost","nome_db","password","nome_tab");
require "model_f1.php";
?> -
direttamente nella save corretto?
Scusami ma allora ero io che non avevo capito bene che creavo una scena.
Ho provato e ancora salva solo una volta =(
-
xk scusa come dovrei fare a chiamare la funzione?
ho provato anchefuco=Scene_Prova.new
fuco.started è uguale
dimmi te come dovrei chiamarla
-
L'ho scritto sopra mi sembra comunque rispiego.
Allora ho inserito la chiamata alla funzione in uno script che viene chiamato durante il salvataggio...#--------------------------------------------------------------------------
# ● On Save Sucess
#--------------------------------------------------------------------------
alias mog_advloadbar_on_save_success on_save_success
def on_save_success
mog_advloadbar_on_save_success
$game_temp.loadbar_type = 1
SceneManager.call(Scene_Load_Bar)
#################
$fuco=Scene_Prova.new
$fuco.start
################
end
enda questo punto dovrebbe ogni volta che salvo mandare una richiesta alla pagina php (se ti serve te la posso girare)
la pagina php che sto usando per fare delle prove legge semplicemente i dati che gli arrivano e li salva su un db.successivamente per controllo ho messo una echo che mandava al mio gioco il numero A.I. della riga appena inseria.
fino a qui funziona.
Il problema è che se io salvo ancora dovrebbe fare una seconda richiesta e quindi inserire una nuova riga nel database restituire come riga la successivama oltre a non salvare restituisce stranamente il numero della riga inserita precedentemente.
-
questo l'ho capito...ma sia se la ignoro sia se la prendo la risposta ho il problema.
Mi manda i dati solo una volta
-
Capisco la pagina php non ha comandi di echo quindi in teoria come posso fare? per risolvere il problema?
questa è la funzione on save dello script load bar che ti ho girato sopra. L'ho inserita al suo interno cosi.#--------------------------------------------------------------------------
# ● On Save Sucess
#--------------------------------------------------------------------------
alias mog_advloadbar_on_save_success on_save_success
def on_save_success
mog_advloadbar_on_save_success
$game_temp.loadbar_type = 1
SceneManager.call(Scene_Load_Bar)
#################
$fuco=Scene_Prova.new
$fuco.start
################
end
endla mia paura è il costruttore che forse andrebbe dichiarato globale da qualche altra parte. ho notato che per esempio in visual studio da problemi chiamare un costruttore + volte sullo stesso oggetto senza prima chiuderlo...
P.S. ho provato sia fuco che $fuco
Ho fatto un esperimento tramite ricezione di risposte dalla pagina...Ho messo in echo l'ID della riga inserita nel DB settata come A.I.
A questo punto salvando mi da appunto il numero della riga come ritorno (Primo salvaggio che va a buon fine) che salvo in $game_variables[5]Per farvi capire ti riporto un dato $game_variables[5]= 175
A questo punto per fare dei test e capire dove fosse il problema ho messo un evento che mettesse a "" la variabile
ed ho effetuato un nuovo salvataggio che come di consueto (purtroppo) non ha salvato su db...a sto punto mi aspettavo che $game_variables[5] fosse rimasta vuota...ma con mi grande sorpresa...e malessere $game_variables[5]= 175A sto punto l'unica idea che mi sono fatto del possibile errore è che lo script non fa una nuova richiesta alla pagina...probabilmente perchè la prima è ancora aperta. Questa è una mia idea ti pregherei di controllare...questo problema mi sta facendo impazzire. Grazie mille spero possiate aiutarmi
-
gia provato e da lo stesso problema....non riesco a capire....la pagina php è semplicissima l'ho usata come test..vede se c'è get nel caso scrive su db.
Che tipo di risposta si aspetta?
Come posso evitare che si aspetti una risposta...non è possibile che devo chiudere il gioco per mandare una seconda richiesta
Browser.open("http://www.miosito.com/f1.php?get=#{request}")
questa funziona sempre però non voglio aprire ogni volta una pagina...spero tu posso aiutarmi
-
ff=Scene_Prova.new
ff.startok ci sono riuscito...ho solo un problema...ho fatto vari test e non sempre funziona...il salvataggio va a buon fine non crash ma non fa la richiesta pagina...come mai?
Fatti altri test...non so perche ma fa la richiesta(o per lo meno salva i dati su db) solo una volta.
devo chiudere il gioco riaprirlo e salvare per salvare ancora....cio non ha senso.......... -
di programmazione si è il ruby che non mi entra XD
Nel senso io volevo mettere quello spezzone di codice all'interno del save o della load bar (parte di salvataggio)Pensavo per l'appunto di metterlo li ma non ho capito come fare inserire lo spezzone che mi hai dato.
-
scusami se ti rompo tanto le palle Holy ma anche dopo le ultime prove non sono riuscito.
-
intendevo come dovrei chiamarlo...perche io vorrei chiamarlo mentre salvo....oppure forse ancora meglio durante la load bar di questo script
#=============================================================================== # +++ MOG - Advanced Load Bar (v1.1) +++ #=============================================================================== # By Moghunter # http://www.atelier-rgss.com #=============================================================================== # Apresenta uma barra de carregar entre as cenas de Save e Load. # # O propósito deste Script é apresentar alguns artworks de seu jogo # enquanto o jogador espera a barra de leitura. # #=============================================================================== # Você pode adpatar esse script em alguma outra Scene ou ativar pelo evento. # Basta usar este código. # # SceneManager.call(Scene_Load_Bar) # #============================================================================== # ● Histórico (Version History) #============================================================================== # v 1.1 - Melhoria no sistema de dispose de imagens. #============================================================================== module MOG_LOAD_BAR # Tempo para fazer load.(Segundos) LOAD_DURATION = 1 # Ativar o sistema ao carregar o jogo. ENABLE_LOAD_BAR_FOR_SCENE_LOAD = true # Ativar o sistema ao salvar o jogo. ENABLE_LOAD_BAR_FOR_SCENE_SAVE = true # Definição das imagens que ficarão no plano de fundo. LOAD_BACKGROUND_PICTURES = [ "Background_1", "Background_2", "Background_3", "Background_4", "Background_5", #"Background_6" #"Background_7", "Background_8", #"Background_9", #"Background_10", # ... ] # Ativar ordem aleatória ou sequencial. PICTURE_RANDOM_SELECTION = true # Posição do geral da Hud. LOAD_BAR_POSITION = [30,350] # Posição do medidor. LOAD_BAR_METER_POSITION = [11,27] # Posição do Texto. LOAD_BAR_TEXT_POSITION = [ 10, -3] # Som ao carregar o arquivo. LOAD_SE = "Decision2" # Velocidade da animação do medidor. LOAD_BAR_FLOW_SPEED = 25 # Definição da Cena que será ativada após salvar via menu. # Caso o save seja feito pelo evento, a cena será o Mapa. RETURN_TO_SCENE = Scene_Menu.new(4) # Ativar a animação de levitação do texto. ENABLE_FLOAT_TEXT_ANIMATION = true # Apresentar o sprite do personagem. ENABLE_CHARACTER_SPRITE = true # Ativar barras laterais. ENABLE_STRIPE_SPRITE = true # Velocidade das barras laterais. STRIPE_SPEED = 1 end #============================================================================= # ■ Game_Temp #============================================================================= class Game_Temp attr_accessor :load_bar_pre_index attr_accessor :loadbar_type attr_accessor :load_pre_bgm attr_accessor :load_pre_bgs #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias load_bar_initialize initialize def initialize @load_bar_pre_index = -1 @loadbar_type = 0 load_bar_initialize end end #============================================================================= # ■ Game_System #============================================================================= class Game_System attr_accessor :load_bar_pre_index #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- alias load_bar_initialize initialize def initialize load_bar_initialize @load_bar_pre_index = 0 end #-------------------------------------------------------------------------- # ● BGS Stop #-------------------------------------------------------------------------- def bgs_stop Audio.bgs_stop end end #============================================================================= # ■ Scene Load Bar #============================================================================= class Scene_Load_Bar include MOG_LOAD_BAR #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize execute_dispose @bar_type = $game_temp.loadbar_type @load_duration_max = 60 * LOAD_DURATION @load_duration_max = 60 if @load_duration_max < 60 @load_duration = 0 @pictures = LOAD_BACKGROUND_PICTURES create_background create_layout create_load_bar create_text create_side_strip end #-------------------------------------------------------------------------- # ● Create Background #-------------------------------------------------------------------------- def create_background @background = Sprite.new if PICTURE_RANDOM_SELECTION $game_system.load_bar_pre_index = rand(@pictures.size) no_repeat_picture end image_name = @pictures[$game_system.load_bar_pre_index] image_name = "" if image_name == nil @background.bitmap = Cache.picture(image_name) $game_temp.load_bar_pre_index = $game_system.load_bar_pre_index unless PICTURE_RANDOM_SELECTION $game_system.load_bar_pre_index += 1 $game_system.load_bar_pre_index = 0 if $game_system.load_bar_pre_index > @pictures.size - 1 end end #-------------------------------------------------------------------------- # ● No Repeat Picture #-------------------------------------------------------------------------- def no_repeat_picture if $game_system.load_bar_pre_index == $game_temp.load_bar_pre_index $game_system.load_bar_pre_index += 1 $game_system.load_bar_pre_index = 0 if $game_system.load_bar_pre_index > @pictures.size - 1 end end #-------------------------------------------------------------------------- # ● Create Layout #-------------------------------------------------------------------------- def create_layout @hud = Sprite.new @hud.bitmap = Cache.system("Load_Bar_Layout") @hud.x = LOAD_BAR_POSITION[0] @hud.y = LOAD_BAR_POSITION[1] @hud.z = 10 end #-------------------------------------------------------------------------- # ● Create Side Strip #-------------------------------------------------------------------------- def create_side_strip @stripe1 = Plane.new @stripe2 = Plane.new if @bar_type == 0 @stripe1.bitmap = Cache.system("Load_Bar_Stripe1_L") @stripe2.bitmap = Cache.system("Load_Bar_Stripe2_L") else @stripe1.bitmap = Cache.system("Load_Bar_Stripe1_S") @stripe2.bitmap = Cache.system("Load_Bar_Stripe2_S") end @stripe1.z = 1 @stripe2.z = 1 @stripe1.visible = ENABLE_STRIPE_SPRITE @stripe2.visible = ENABLE_STRIPE_SPRITE end #-------------------------------------------------------------------------- # ● Create Load Bar #-------------------------------------------------------------------------- def create_load_bar @bar_flow = 0 @bar_image = Cache.system("Load_Bar_Meter") @bar_bitmap = Bitmap.new(@bar_image.width,@bar_image.height) @bar_range = @bar_image.width / 3 @bar_width = @bar_range * @load_duration / @load_duration_max @bar_height = @bar_image.height @bar_width_old = @bar_width @bar_src_rect = Rect.new(@bar_flow, 0, @bar_width, @bar_height) @bar_bitmap.blt(0,0, @bar_image, @bar_src_rect) @bar_sprite = Sprite.new @bar_sprite.bitmap = @bar_bitmap @bar_sprite.z = 11 @bar_sprite.x = LOAD_BAR_POSITION[0] + LOAD_BAR_METER_POSITION[0] @bar_sprite.y = LOAD_BAR_POSITION[1] + LOAD_BAR_METER_POSITION[1] update_bar_flow end #-------------------------------------------------------------------------- # ● Create Text #-------------------------------------------------------------------------- def create_text @text_float_time = 0 @text_float_y = 0 @text_image = Cache.system("Load_Bar_Text") @text_bitmap = Bitmap.new(@text_image.width,@text_image.height) @text_width = @text_image.width @text_height = @text_image.height / 2 @text_src_rect = Rect.new(0, @text_height * @bar_type, @text_width, @text_height) @text_bitmap.blt(0,0, @text_image, @text_src_rect) @text_sprite = Sprite.new @text_sprite.bitmap = @text_bitmap @text_fy = LOAD_BAR_POSITION[1] + LOAD_BAR_TEXT_POSITION[1] @text_sprite.x = LOAD_BAR_POSITION[0] + LOAD_BAR_TEXT_POSITION[0] @text_sprite.y = @text_fy @text_sprite.z = 12 end #-------------------------------------------------------------------------- # ● Main #-------------------------------------------------------------------------- def main Graphics.transition execute_loop execute_dispose end #-------------------------------------------------------------------------- # ● Execute Loop #-------------------------------------------------------------------------- def execute_loop loop do update Graphics.update if SceneManager.scene != self break end end end #-------------------------------------------------------------------------- # ● Execute Dispose #-------------------------------------------------------------------------- def execute_dispose return if @hud == nil @hud.bitmap.dispose @hud.dispose @stripe1.bitmap.dispose @stripe1.dispose @stripe2.bitmap.dispose @stripe2.dispose @bar_image.dispose @bar_bitmap.dispose @bar_sprite.bitmap.dispose @bar_sprite.dispose @background.bitmap.dispose @background.dispose @text_image.dispose @text_bitmap.dispose @text_sprite.bitmap.dispose @text_sprite.dispose Graphics.transition Graphics.freeze end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def update update_bar_flow update_bar_duration update_float_text update_slide_stripe end #-------------------------------------------------------------------------- # ● Update Slide Stripe #-------------------------------------------------------------------------- def update_slide_stripe @stripe1.oy += STRIPE_SPEED @stripe2.ox += STRIPE_SPEED end #-------------------------------------------------------------------------- # ● update_float_text #-------------------------------------------------------------------------- def update_float_text return unless ENABLE_FLOAT_TEXT_ANIMATION @text_float_time += 1 case @text_float_time when 1..10 @text_float_y += 1 when 11..20 @text_float_y -= 1 else @text_float_y = 0 @text_float_time = 0 end @text_sprite.y = @text_fy + @text_float_y end #-------------------------------------------------------------------------- # ● Update Bar Flow #-------------------------------------------------------------------------- def update_bar_flow @bar_sprite.bitmap.clear @bar_width = @bar_range * @load_duration / @load_duration_max @bar_width = @bar_range if @load_duration > @load_duration_max @bar_src_rect = Rect.new(@bar_flow, 0,@bar_width, @bar_height) @bar_bitmap.blt(0,0, @bar_image, @bar_src_rect) @bar_flow += LOAD_BAR_FLOW_SPEED if @bar_flow >= @bar_image.width - @bar_range @bar_flow = 0 end end #-------------------------------------------------------------------------- # ● Update Bar Duration #-------------------------------------------------------------------------- def update_bar_duration @load_duration += 1 if @load_duration == @load_duration_max Audio.se_play("Audio/SE/" + LOAD_SE,100,100) rescue nil elsif @load_duration == @load_duration_max + 10 if @bar_type == 0 SceneManager.return $game_system.replay_bgm else SceneManager.return end $game_temp.loadbar_type = false end end end #============================================================================= # ■ Scene Save #============================================================================= class Scene_Save < Scene_File #-------------------------------------------------------------------------- # ● On Save Sucess #-------------------------------------------------------------------------- alias mog_advloadbar_on_save_success on_save_success def on_save_success mog_advloadbar_on_save_success $game_temp.loadbar_type = 1 SceneManager.call(Scene_Load_Bar) end end #============================================================================= # ■ Scene Load #============================================================================= class Scene_Load < Scene_File #-------------------------------------------------------------------------- # ● On Load Success #-------------------------------------------------------------------------- alias mog_advloadbar_on_load_success on_load_success def on_load_success mog_advloadbar_on_load_success $game_system.save_bgm RPG::BGM.stop $game_temp.loadbar_type = 0 SceneManager.call(Scene_Load_Bar) end end $mog_rgss3_advanced_load_bar = trueovviamente nella parte di salvataggio
-
Holy scusa sto cercando di usare quel semplice esempio che mi hai mandato ma non capisco dove devo inserirlo
-
Infatti fino ad ora ho usato quella :)
Non vedo l'ora di mostrarvi il mio gioco...spero possa piacere. -
capito provero a crearlo utilizzando appunto il tuo modulo di supporto se ho bisogno di qualcosa ti chiedo...più che altro non sono ancora molto bravo col ruby. fortunatamente ha qualcosa di c XD
-
per caso hai quello script per vx ace? quello dei messaggi?
Per l'aggiornamento ho fatto cosi anche io...solo che lo fa un programma di interfaccia. -
Sto giocando per curiosita mia a Overdrive è devo dire che mi sta piacendo parecchio....
Praticamente il mio gioco salvera su server come fa il tuo a ogni salvataggio....volevo chiederti una coss come hai fatto a a fare l'aggiornamento quello nella schermata del titolo...perche io l'ho gestito non un aplicazione d'interfaccia che io ho creato...
E un altra cosa...che mi interessa ancora di più che volevo aggiungere anche al mio gioco... i commenti come hai fatto? -
Assoulutamente non è difficile...anzi è gia pronto...quindi holy ti chiedo il tuo modulo universale permette di mandare in post o in get i paramentri alla pagina php come quello di berka per vx??? a me serve per vx ace
-
Ah ho capito...beh il problema sarebbe che aprirebbe una pagina web in teoria no?
Se hostassi la pagina web holy come dovrei fare a passargli le info? -
Credo anche per semplicita Midi....comunque Holy guardando la guida non si distacca molto da Sqlsrv...e poi il resto è semplice. quindi come al solito sei stato utile. unica cosa dove trovo codeste librerie?
Sono cmq curioso di sapere cosa intendi per usare un php come tramite =)

Finestra dei dettagli (Oggetti, skill, equip)
in Scripts RGSS3 (VX-Ace)
Posted
ok Holy gentilissimo fammi sapere perfavore =)