Jump to content
Rpg²S Forum
  • 0

Scene_quest di netplay


Andre4e
 Share

Question

Mi rivolgo a quelli + esperti..io utlizzo rpg maker online con netplay

Qui però c'è uno script, lo script delle missione

 

 

 

 

 

 

 

#==============================================================================

# ** Scene_Quest

#------------------------------------------------------------------------------

# MOSTRA TUTTE LE MISSIONI IN CORSO

# NON CAMBIARE LA POSIZIONE DI QUESTO SCRIPT!

# DEVE SEMPRE RIMANERE PRIMA DEGLI HUD

#==============================================================================

 

 

class Scene_Quest

def main

Network::Main.set_pl_online_status("Offline")

@window_header = Window_Questlog_Header.new

@window_titles = Window_Questlog_Titles.new

description = ""

picture = ""

if $game_system.questlog.count > 0

description = $game_system.questlog.quests[0].description

picture = $game_system.questlog.quests[0].picture

end

@window_description = Window_Questlog_Description.new(

description, picture)

@index = @window_titles.index

@spriteset = Sprite.new

@spriteset.bitmap = RPG::Cache.title(User_Edit::Sfondo)

 

Graphics.transition

loop do

Graphics.update

Input.update

update

if $scene != self

break

end

end

Graphics.freeze

@window_header.dispose

@window_titles.dispose

@window_description.dispose

@spriteset.dispose

end

#--------------------------------------------------------------------------

def update

@window_titles.update

if Input.trigger?(Input::B)

$game_system.se_play($data_system.cancel_se)

$scene = Scene_Map.new

return

end

if @index != @window_titles.index

@index = @window_titles.index

@window_description.description = $game_system.questlog.quests[

@window_titles.index].description

@window_description.picture = $game_system.questlog.quests[

@window_titles.index].picture

@window_description.refresh

end

end

end

#=============

class Quest

attr_reader :title

attr_reader :description

attr_reader :icon

attr_reader :picture

attr_accessor :enabled

def initialize(title, description="Nessuna descrizione disponibile", icon="040-Item09", picture="NoImage")

@title = title

@description = description

@icon = icon

@picture = picture

@enabled = true

end

end

#============

class Questlog

attr_reader :quests

def initialize

@quests = []

end

#-----------

def add(quest, description="Nessuna descrizione disponibile", icon="040-Item09", picture="NoImage")

return add(Quest.new(quest, description, icon, picture)) unless

quest.is_a?(Quest)

i = index(quest.title)

return @quests = quest if i != nil

#@quests.push(quest) # Quest wird unten eingefügt

@quests.unshift(quest) # Quest wird oben eingefügt

end

#-----------

def remove(title)

@quests.delete_if{ |quest| quest.title == title}

end

#-----------

def enable(title)

set_enabled(title, true)

end

#-----------

def disable(title)

set_enabled(title, false)

end

#-----------

def set_enabled(title, enabled)

@quests.each do |quest|

quest.enabled = enabled if quest.title == title

end

end

#-----------

def count

return @quests.length

end

#------------

def index(title)

for i in 0..@quests.length - 1

return i if @quests.title == title

end

return nil

end

#------------

def Questlog.add(title, description="Nessuna descrizione disponibile", icon="040-Item09", picture="NoImage")

$game_system.questlog.add(title, description, icon, picture)

end

#------------

def Questlog.remove(title)

$game_system.questlog.remove(title)

end

#------------

def Questlog.enable(title)

$game_system.questlog.enable(title)

end

#------------

def Questlog.disable(title)

$game_system.questlog.disable(title)

end

#------------

def Questlog.set_enabled(title)

$game_system.questlog.set_enabled(title)

end

end

#=============

 

class Window_Questlog_Description < Window_Base

attr_accessor :description

attr_accessor :picture

def initialize(description, picture)

super(275, 92, 300, 360)

self.contents = Bitmap.new(width-32, height-32)

self.contents.font.name = $defaultfonttype

self.contents.font.size = $defaultfontsize

@description = description

@picture = picture

refresh

end

#-----------

def refresh

self.contents.clear

if (@picture != nil) && (not @picture == "")

bitmap = RPG::Cache.picture(@picture)

rect = bitmap.rect

self.contents.blt(width/2-rect.width/2-16, 0, bitmap, rect, 255)

self.contents.draw_formatted_text(

4, rect.height, 270, 328-rect.height, @description)

else

self.contents.draw_formatted_text(4, 0, 270, 328, @description)

end

end

end

#=============

 

class Window_Questlog_Titles < Window_Selectable

def initialize

super(65, 92, 210, 360)

@item_max = $game_system.questlog.count

self.contents = Bitmap.new(width-32, @item_max > 0 ? @item_max*32 : 32)

self.contents.font.name = $defaultfonttype

self.contents.font.size = $defaultfontsize

self.index = 0

@column_max = 1

refresh

end

#-------------

def refresh

self.contents.clear

for i in 0...$game_system.questlog.count

quest = $game_system.questlog.quests

y = i*32

self.contents.font.color = quest.enabled ? normal_color : disabled_color

if (quest.icon != nil) && (not quest.icon == "")

bitmap = RPG::Cache.icon(quest.icon)

opacity = quest.enabled ? 255 : 128

self.contents.blt(4, y+4, bitmap, Rect.new(0, 0, 24, 24), opacity)

self.contents.draw_formatted_text(29, y, 150, 32, quest.title)

else

self.contents.draw_formatted_text(4, y, 150, 32, quest.title)

end

end

end

end

#===========

class Window_Questlog_Header < Window_Base

def initialize

super(65, 28, 510, 64)

self.contents = Bitmap.new(width-32, height-32)

self.contents.font.name = $defaultfonttype

self.contents.font.size = 26

refresh

end

#------------

def refresh

self.contents.clear

self.contents.draw_text(self.contents.rect, "Quest in corso da #{$game_party.actors[0].name}", 1)

end

end

#===========

class Scene_Map

def call_questlog

$game_temp.questlog_calling = false

$game_player.straighten

$scene = Scene_Quest.new

end

end

#===========

class Game_System

attr_reader :questlog

alias init initialize

def initialize

init

@questlog = Questlog.new

end

end

#===========

class Game_Temp

attr_accessor :questlog_calling

alias init initialize

def initialize

init

@questlog_calling = false

end

end

#==============

class Bitmap

def draw_shadow_text(x, y, width, height, str, align=0)

color = font.color.dup

font.color = Color.new(192, 192, 192, 156)

draw_text(x+2, y+2, width, height, str, align)

font.color = color

draw_text(x, y, width, height, str, align)

end

#----------------

def draw_formatted_text(x, y, width, height, str, align=0)

str = str.dup

color = font.color.dup

bold = font.bold

italic = font.italic

size = font.size

name = font.name.dup

#::::::::::

shadow = false

underlined = false

str.gsub!(/<br>/) {"\n"}

str.gsub!(/\\\\/) {"\00"}

str.gsub!(/<b>/) {"\01"}

str.gsub!(/<\/b>/) {"\02"}

str.gsub!(/<i>/) {"\03"}

str.gsub!(/<\/i>/) {"\04"}

str.gsub!(/<color=(#?[0-9a-z]+)>/) {"\05[#{$1}]"}

str.gsub!(/<\/color>/) {"\06"}

str.gsub!(/<shadow>/) {"\16"}

str.gsub!(/<\/shadow>/) {"\17"}

str.gsub!(/<small>/) {"\20"}

str.gsub!(/<\/small>/) {"\21"}

str.gsub!(/<big>/) {"\23"}

str.gsub!(/<\/big>/) {"\21"}

str.gsub!(/<size=([0-9]+)>/) {"\24[#{$1}]"}

str.gsub!(/<\/size>/) {"\21"}

str.gsub!(/<font=([A-Za-z0-9\s]+)>/) {"\25[#{$1}]"}

str.gsub!(/<\/font>/) {"\26"}

str.gsub!(/<u>/) {"\27"}

str.gsub!(/<\/u>/) {"\30"}

ix = 0

iy = 0

while ((c = str.slice!(/./m)) != nil)

if c == "\00" # \\

c = "\\"

end

if c == "\01" # <b>

font.bold = true

end

if c == "\02" #</b>

font.bold = false

end

if c == "\03" # <i>

font.italic = true

end

if c == "\04" # </i>

font.italic = false

end

if c == "\05" # <color=xxx>

str.sub!(/\[(#?[0-9a-z]+)\]/, "")

if $1[0] == 35

col = Color.decode($1)

elsif $1.to_i != 0

col = Window_Base.text_color($1.to_i)

else

col = Color.get($1)

end

font.color = col

end

if c == "\06" # </color>

font.color = color

end

if c == "\16" # <shadow>

shadow = true

end

if c == "\17" # </shadow>

shadow = false

end

if c == "\20" # <small>

font.size -= 5

font.size = 1 if font.size < 1

end

if c == "\21" # </small> </big> </size>

font.size = size

end

if c == "\23" # <big>

font.size += 5

end

if c == "\24" # <size=xx>

str.sub!(/\[([0-9]+)\]/, "")

font.size = $1.to_i

font.size = 1 if font.size < 1

end

if c == "\25" # <font=xxx>

str.sub!(/\[([A-Za-z0-9\s]+)\]/, "")

font.name = $1 if Font.exist?($1)

end

if c == "\26" # </font>

font.name = name

end

if c == "\27" # <u>

underlined = true

end

if c == "\30" # </u>

underlined = false

end

if c == "\n"

iy += 18

ix = 0

end

#:::::::::

if shadow

draw_shadow_text(x+ix+4, y+iy, 40, 32, c)

else

draw_text(x+ix+4, y+iy, 40, 32, c)

end

w = text_size©.width

if underlined

fill_rect(x+ix+4, y+iy+text_size("T").height+3, w, 2, font.color)

end

ix += w

end

#::::::::::

font.color = color

font.bold = bold

font.italic = italic

font.size = size

font.name = name

end

end

#==============

class Color

def Color.get(string)

return Color.white if string == "white"

return Color.black if string == "black"

return Color.red if string == "red"

return Color.green if string == "green"

return Color.blue if string == "blue"

return Color.yellow if string == "yellow"

return Color.cyan if string == "cyan"

return Color.magenta if string == "magenta"

return Color.light_gray if string == "light_gray"

return Color.gray if string == "gray"

return Color.dark_gray if string == "dark_gray"

return Color.pink if string == "pink"

return Color.orange if string == "orange"

return Color.white

end

#------------

def Color.decode(hex)

return Color.decode(hex[1..hex.length]) if hex[0] == 35

hex.downcase!

red = hex[0..1].hex

green = hex[2..3].hex

blue = hex[4..5].hex

alpha = hex.length == 8 ? hex[6..7].hex : 255

return Color.new(red, green, blue, alpha)

end

#------------

def Color.white(alpha=255)

return Color.new(255, 255, 255, alpha)

end

#-----------

def Color.black(alpha=255)

return Color.new(0, 0, 0, alpha)

end

#----------

def Color.red(alpha=255)

return Color.new(255, 0, 0, alpha)

end

#----------

def Color.green(alpha=255)

return Color.new(0, 255, 0, alpha)

end

#---------

def Color.blue(alpha=255)

return Color.new(0, 0, 255, alpha)

end

#----------

def Color.yellow(alpha=255)

return Color.new(255, 255, 0, alpha)

end

#----------

def Color.cyan(alpha=255)

return Color.new(0, 255, 255, alpha)

end

#----------

def Color.magenta(alpha=255)

return Color.new(255, 255, 0, alpha)

end

#----------

def Color.light_gray(alpha=255)

return Color.new(192, 192, 192, alpha)

end

#-----------

def Color.gray(alpha=255)

return Color.new(128, 128, 128, alpha)

end

#-----------

def Color.dark_gray(alpha=255)

return Color.new(64, 64, 64, alpha)

end

#-----------

def Color.pink(alpha=255)

return Color.new(255, 175, 175, alpha)

end

#-----------

def Color.orange(alpha=255)

return Color.new(255, 200, 0, alpha)

end

end

#=====================

class Window_Base < Window

def Window_Base.text_color(n)

case n

when 0

return Color.new(255, 255, 255, 255)

when 1

return Color.new(128, 128, 255, 255)

when 2

return Color.new(255, 128, 128, 255)

when 3

return Color.new(128, 255, 128, 255)

when 4

return Color.new(128, 255, 255, 255)

when 5

return Color.new(255, 128, 255, 255)

when 6

return Color.new(255, 255, 128, 255)

when 7

return Color.new(192, 192, 192, 255)

else

return Color.white

end

end

end

 

 

 

 

 

 

 

Mi rivolgo ai più esperti perchè non penso che lo possiate provare

Quindi mi serve qualcuno che capisca subito il problema

 

 

Allora mi da errore alla riga 173 --> @item_max = $game_system.questlog.count

e mi dice che 'count' non è definito

 

 

def initialize

super(65, 92, 210, 360)

@item_max = $game_system.questlog.count

self.contents = Bitmap.new(width-32, @item_max > 0 ? @item_max*32 : 32)

self.contents.font.name = $defaultfonttype

self.contents.font.size = $defaultfontsize

self.index = 0

@column_max = 1

refresh

end

 

 

 

 

Se però andiamo alla riga 109 lo definisce all'interno della class questlog

 

def count

return @quests.length

end

 

questo count praticamente gli serve per sapere il numero delle missioni, forse è sbagliato il .length

ma se da errore xk dice che 'count' non è definito sarà xk è richiamato male con

@item_max = $game_system.questlog.count

 

 

Se riuscite a capire il problema ditemelo!

Grx!

Edited by Andre4e

 

 

http://files.nireblog.com/blogs4/narutozorro9kolas/files/firma-naruto-y-yondaime.gif

 

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Penso che derivi dal caricamento di dati dai salvataggi.

 

Prova inserendo questo snippet come ultimo script aggiuntivo, sopra Main . . .

class Scene_Load < Scene_Filealias giver_nplayqlogfix_scnload_decision on_decision  def on_decision(filename)	giver_nplayqlogfix_scnload_decision(filename)	if $game_system.questlog == nil	  $game_system.questlog = Questlog.new	end  endend

 


SCRIPT RGSS (RPG Maker XP) VINTAGE LIBRARY [2018+]


Breaking (in ogni senso) News: "Treno deraglia per via del seno di Sakurai Aoi . . ." - Info nello spoiler !!

 


http://afantasymachine.altervista.org/_altervista_ht/NOOOOOOOOOilMIOtreninooooo_500.gif


Non riesco a smettere di essere affascinato da immagini come questa . . .

http://anime.vl-vostok.ru/art/photos2011/17/78049800/wall_VladAnime_WWA_1885-1680x1050.jpg


Alcuni wallpapers che faccio ruotare sul mio vecchio PC . . .


http://afantasymachine.altervista.org/_altervista_ht/gits_window.jpg

http://afantasymachine.altervista.org/_altervista_ht/madoka_group01.jpg
http://afantasymachine.altervista.org/_altervista_ht/arisu_picipici_01.jpg
http://afantasymachine.altervista.org/_altervista_ht/phantom_wp01_einzwei.jpg


La parte più spassosa della mia vita è quando gli altri cercano di spiegarmi i miei pensieri . . .


BBCode Testing


Typeface & Size



Link to comment
Share on other sites

  • 0

Dice sempre che undefined method 'count' for Nil:Nilclass

 

e se salvo e poi vado a caricare mi da errore allo script che mi hai dtt tu

 

e dice undefined method 'questlog for #<Game_System:0x7a0c0b0>

 

Vabbè mi sa che torno all rpg maker tradizionale, xk quello online ha troppi problemi!

Questo è solo 1 poi ce ne sono altre 10000

 

 

http://files.nireblog.com/blogs4/narutozorro9kolas/files/firma-naruto-y-yondaime.gif

 

 

Link to comment
Share on other sites

  • 0

L'errore che ti dà vuol dire che quando cerchi di creare Scene_Quest, non è stata ancora eseguita $game_system = Game_System.new.

Io pensavo che non fosse inizializzato solo @questlog, mentre, leggendo il messaggio di errore completo, si tratta dell'intero $game_system . . .

 

Per quello nello snippet, invece si tratta di una disattenzione mia, visto che questlog è un attr_reader, quindi non si può cambiare il suo valore dall'esterno di Game_System.

 


SCRIPT RGSS (RPG Maker XP) VINTAGE LIBRARY [2018+]


Breaking (in ogni senso) News: "Treno deraglia per via del seno di Sakurai Aoi . . ." - Info nello spoiler !!

 


http://afantasymachine.altervista.org/_altervista_ht/NOOOOOOOOOilMIOtreninooooo_500.gif


Non riesco a smettere di essere affascinato da immagini come questa . . .

http://anime.vl-vostok.ru/art/photos2011/17/78049800/wall_VladAnime_WWA_1885-1680x1050.jpg


Alcuni wallpapers che faccio ruotare sul mio vecchio PC . . .


http://afantasymachine.altervista.org/_altervista_ht/gits_window.jpg

http://afantasymachine.altervista.org/_altervista_ht/madoka_group01.jpg
http://afantasymachine.altervista.org/_altervista_ht/arisu_picipici_01.jpg
http://afantasymachine.altervista.org/_altervista_ht/phantom_wp01_einzwei.jpg


La parte più spassosa della mia vita è quando gli altri cercano di spiegarmi i miei pensieri . . .


BBCode Testing


Typeface & Size



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...