Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
phionabrie

Need some help with custom script issue!

Question

As I've been adding and testing scripts to my game, I've encountered two with an error I don't know how to fix.  One of the scripts is the Party Changing System from Leon (http://www.gdunlimited.net/forums/topic/8413-party-changing-system/) the other is an Organized Quest System by KK20 (http://dl.dropbox.com/u/58874459/KK20%20Quest%20System.rar).

Both of the scripts are giving me error  "undefined method 'include?' for nil:NilClass " (line 287 for the PCS; 345 for the OQS)

 

Is this an error that would be caused by something I customized in the configuration or other script?  Or would it be a problem with the scripts themselves?

 

Any help would be greatly appreciated!

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Aaand.... Aluxes didn't have to be -in- the party, he just had to exist..... Scripts working now.  Thanks Bob and Dol !

Share this post


Link to post
Share on other sites
  • 0

1. Do they work by themselves?

2. Do you have any other scripts in your project?

3. I wish "Leon" was around enough to help :(

 

Also do they both have the same error on both scripts? Just different lines? If so, the solution for one should be the same for the other one. I really dont want to download the quest system since it's a RAR. I'm also leaving soon and don't see anything I can help with anyway, sorry :(

Edited by Bob423

Share this post


Link to post
Share on other sites
  • 0

@Bob423  Thanks for the input!

 

To test out your first question I opened a new project and added the scripts one by one.  I was able to add both scripts, along with my others and, aside from a mouse script vs terrain tag issue, they all worked fine.

 

I used the scripts from the new project to replace the ones in my project (custom and default) to make sure there weren't any random code edits somewhere getting in the way.

 

But I still get the errors.  It comes up regarding line287:    "if $game_party.locked.include?(@actor.id)"  as soon as I try selecting 'Party' from the menu.  It comes up regarding line345:  "unless @quests_new.include?(id)"  when I try interacting with the quest starter event.

 

Additionally I get "undefined method 'size' for nil:NilClass" regarding line478:   "quest_rank = QuestData.rank($game_party.quests_completed.size)" if I try to open the quest log from the menu.

 

Is it possible for my events to mess up the scripts?  I'd really rather not have to start the project over, but if I can't get the scripts to work I might have to. :(

 

I've added spoilers with the full scripts if that's helpful.

 

 

#===================================
# Party Changing System by Leon_Westbrooke
# -v 1.2
#----------------------------------------------------------------------
# Instructions: Place above main, but below all other default scripts.
#
# Features:
# -Allows the player to make a party from the minimum to maximum size.
# -Extra members are limitless.
# -You can remove a person from the party and put it into reserve using:
# $game_party.remove_actor_to_party(actor_id)
# -You can remove a person from the reserve if they exist, and them into
# the party:
# $game_party.add_actor_to_party(actor_id)
# -You can lock a character in reserve or active party by using:
# $game_party.locked.push(actor_id)
# -You can set the maximum and minimum number of the party in-game using:
# $game_party.min_size = x
# $game_party.max_size = x
# (NOTE: Do NOT make the max size lower than the minimum size.)
# -Allows you to use the default add/remove actors command.
# (NOTE: If you remove an actor with this method, he is gone from both
# the party and the reserve members.)
#
# Credits:
# This setup uses SephirothSpawn's coding to simplify the cursor's position.
#
#
# Command Quick-list:
# $game_party.remove_actor_from_party(actor_id)
# -Removes an actor from the party, and puts them in reserve.
# $game_party.add_actor_to_party(actor_id)
# -Replaces the last actor in the party with the actor in reserve.
# $game_party.locked.push(actor_id)
# -Locks the actor in place.
# $game_party.min_size = x
# $game_party.max_size = x
# -Sets the minimum and maximum party size.
#
#
# Notes:
# This script rewrites these methods from Game_Party:
# add_actor
# remove_actor
#===================================

#==================================================
# Game_Party
#==================================================
class Game_Party

attr_accessor :party_members
attr_accessor :move
attr_accessor :locked
attr_accessor :min_size
attr_accessor :max_size

alias leon_partyswitch_gameactor_initialize initialize

def initialize
leon_partyswitch_gameactor_initialize
@party_members = []
# Edit :This is to change if an actor is locked or not. To lock them, add
# their id to the array below.
@locked = [1]
@min_size = 1
@max_size = 4
end


def add_actor(actor_id)
actor = $game_actors[actor_id]
if @actors.size < @max_size
unless @actors.include?(actor)
unless @party_members.include?(actor.id)
@actors.push(actor)
$game_player.refresh
end
end
else
unless @party_members.include?(actor.id)
unless @actors.include?(actor)
@party_members.push(actor.id)
$game_player.refresh
end
end
end
end

def remove_actor(actor_id)
@actors.delete($game_actors[actor_id])
@party_members.delete(actor_id)
$game_player.refresh
end

def remove_actor_from_party(actor_id)
if @actors.include?($game_actors[actor_id])
unless @party_members.include?(actor_id)
@party_members.push(actor_id)
@party_members.sort!
end
end
@actors.delete($game_actors[actor_id])
$game_player.refresh
end

def add_actor_to_party(actor_id)
if @party_members.include?(actor_id)
if @actors[@max_size - 1] != nil
@party_members.push(@actors[@max_size - 1].id)
@actors.delete_at(@max_size - 1)
end
@actors.push($game_actors[actor_id])
@party_members.delete(actor_id)
end
end
end
#==================================================
# END Game_Party
#==================================================

#==============================================================================
# ** Window_Selectable
#==============================================================================
class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :cursor_height
#--------------------------------------------------------------------------
# * Alias Initialization
#--------------------------------------------------------------------------
alias custom_int initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
custom_int(x, y, width, height)
@cursor_height = 32
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
# Divide y-coordinate of window contents transfer origin by 1 row
# height of @cursor_height
return self.oy / @cursor_height
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
# If row is less than 0, change it to 0
if row < 0
row = 0
end
# If row exceeds row_max - 1, change it to row_max - 1
if row > row_max - 1
row = row_max - 1
end
# Multiply 1 row height by 32 for y-coordinate of window contents
# transfer origin
self.oy = row * @cursor_height
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
# Subtract a frame height of 32 from the window height, and divide it by
# 1 row height of @cursor_height
return (self.height - 32) / @cursor_height
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.width / @column_max - 32
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * @cursor_height - self.oy
if self.active == true
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, @cursor_height)
end
end
end

#==============================================================================
# ** Window_Command
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# * Unisable Item
# index : item number
#--------------------------------------------------------------------------
def undisable_item(index)
draw_item(index, normal_color)
end
end
#============================================================


#==================================================
# Window_Party_Info
#==================================================
class Window_Party_Info < Window_Base
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end

def refresh
self.contents.clear
self.contents.draw_text(0, 0, 614, 32, "Please make a party of #{$game_party.min_size.to_s} to #{$game_party.max_size.to_s} members.", 1)
end
end
#==================================================
# END Window_Party_Info
#==================================================


#==================================================
# Window_Party_Slots
#==================================================
class Window_Party_Slots < Window_Selectable

def initialize
super(0, 64, 320, 416)
@item_max = 4
self.contents = Bitmap.new(width - 32, height - 32)
self.index = 0
self.active = true
refresh
end

def actors
if @data[index] != nil
return @data[index]
end
end

def refresh
@data = []
if self.contents != nil
self.contents.dispose
self.contents = nil
end
for i in 0...$game_party.actors.size
@data.push($game_party.actors)
end
@item_max = (@data.size + 1)
if @item_max > 0
if @item_max > 4
@item_max = 4
end
self.contents = Bitmap.new(width - 32, row_max * 96)
for i in 0...@item_max
draw_item(i)
end
end
end

def draw_item(index)
@actor = @data[index]
y = index * 96
x = 4
if $game_party.locked.include?(@actor.id)
self.contents.font.color = disabled_color
opacity = 128
else
self.contents.font.color = normal_color
opacity = 255
end
if @actor != nil
self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
draw_actor_hp(@actor, x + 100, y + 32)
draw_actor_sp(@actor, x + 100, y + 64)
bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
facing = 0
src_rect = Rect.new(0, facing * ch, cw, ch)
self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
end
end

def update_cursor_rect
if @index > -1
x = 0
y = index * 96
self.cursor_rect.set(x, y, (self.width - 32), 96)
else
self.cursor_rect.empty
end
end

end
#==================================================
# END Window_Party_Slots
#==================================================


#==================================================
# Window_Party_Extras
#==================================================
class Window_Party_Extras < Window_Selectable
def initialize
super(320, 64, 320, 416)
self.cursor_height = 96
self.contents = Bitmap.new(width - 32, height - 32)
self.index = -1
self.active = false
refresh
end

def actors
if @data != nil
return @data[index]
end
end

def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...$game_party.party_members.size
@data.push($game_actors[$game_party.party_members])
end
@data.push(nil)
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 96)
for i in 0...@item_max
draw_item(i)
end
end
end

def draw_item(index)
@actor = @data[index]
y = index * 96
x = 4
if $game_party.locked.include?(@actor.id)
self.contents.font.color = disabled_color
opacity = 128
else
self.contents.font.color = normal_color
opacity = 255
end
if @actor != nil
self.contents.draw_text(x + 100, y, 192, 32, @actor.name)
draw_actor_hp(@actor, x + 100, y + 32)
draw_actor_sp(@actor, x + 100, y + 64)
bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
facing = 0
src_rect = Rect.new(0, facing * ch, cw, ch)
self.contents.blt(x + 24, y + 32, bitmap, src_rect, opacity)
end
end

end
#===================================
# END Window_Party_Extras
#===================================


#===================================
# Scene_Party_Change
#===================================
class Scene_Party_Change
def main

@info_window = Window_Party_Info.new
@slot_window = Window_Party_Slots.new
@extra_window = Window_Party_Extras.new

Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze

@info_window.dispose
@slot_window.dispose
@extra_window.dispose
end

def update
@slot_window.update

if @slot_window.active
update_slot
return
end

if @extra_window.active
update_extra
return
end
end

def update_slot
if Input.trigger?(Input::B)
if $game_party.actors.size >= $game_party.min_size and $game_party.actors.size <= $game_party.max_size
$game_player.refresh
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
else
$game_system.se_play($data_system.buzzer_se)
end
end

if Input.trigger?(Input::C)
if $game_party.locked.include?(@slot_window.actors.id) == true
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
@slot_window.active = false
@extra_window.active = true
@extra_window.index = 0
end
end
end

def update_extra
@extra_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@slot_window.active = true
@extra_window.active = false
@extra_window.index = -1
end

if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
if $game_party.locked.include?(@extra_window.actors.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @extra_window.actors == nil
if $game_party.actors[@slot_window.index] != nil
$game_party.party_members.push($game_party.actors[@slot_window.index].id)
$game_party.remove_actor_from_party($game_party.actors[@slot_window.index].id)
$game_party.party_members.sort!
@slot_window.refresh
@extra_window.refresh
@slot_window.active = true
@extra_window.active = false
@extra_window.index = -1
else
@slot_window.active = true
@extra_window.active = false
@extra_window.index = -1
end
else
if $game_party.actors[@slot_window.index] != nil
hold = @extra_window.actors
$game_party.party_members.push($game_party.actors[@slot_window.index].id)
$game_party.actors[@slot_window.index] = hold
$game_party.party_members.delete_at(@extra_window.index)
$game_party.party_members.sort!
@slot_window.refresh
@extra_window.refresh
@slot_window.active = true
@extra_window.active = false
@extra_window.index = -1
else
$game_party.actors[@slot_window.index] = @extra_window.actors
$game_party.party_members.delete_at(@extra_window.index)
$game_party.party_members.sort!
@slot_window.refresh
@extra_window.refresh
@slot_window.active = true
@extra_window.active = false
@extra_window.index = -1
end
end
end
end

end

 

 

 

=begin
================================================================================
Organized Quest System
Author: KK20
Version 1.0
--------------------------------------------------------------------------------

This script is a full-fledged quest system that uses pictures to represent the
different types of quests in the User Interface.

Includes:
~ Different page tabs to organize which quests to display (the four tabs
used are 'All', 'New' (not accepted), 'Accepted', and 'Completed'), which
can be accessed by pressing the 'Shift' key.
~ Player rank determined by number of quests completed
~ A window displaying the quest's information when selected
~ Some customizable features

********************************************************************************
* I N S T R U C T I O N S *
********************************************************************************
-----------------
-Getting Started-
-----------------
To call the quest window, use the following in a script call:
> $scene = Scene_Quest.new

To add quests that are available and can be accepted, use the script call:
> Quest.new(quest_id)

To change the quest to being accepted, use the script call:
> Quest.accept(quest_id)

To complete the quest, use the script call:
> Quest.complete(quest_id)
(Doing this will automatically give the rewards to the player--This includes
the items, EXP, and Gold. No need to event that in!
If you still want to use events to reward, this can be configured below.)

######[ NOTE ]################################################################
A quest cannot be accepted if the quest is not currently available. A quest
cannot be completed unless the quest is currently being accepted.
Example: Quest.new(1)
Quest.complete(1)
Result: Quest 1 is still considered "new". The player has completed nothing.
##############################################################################

For conditional branch needs:

To check if the quest is completed, use the script call:
> Quest.complete?(quest_id)
Returns 'true' if the quest is completed, 'false' otherwise.

To check if the quest is currently being accepted, use the script call:
> Quest.accept?(quest_id)
Returns 'true' if the quest is accepted or completed, 'false' otherwise.

To check if the quest can be accepted, use the script call:
> Quest.new?(quest_id)
Returns 'true' if the quest is new, accepted, or completed, 'false' otherwise.

To check how many quests have been completed, use the script call:
> Quest.done
This will return an integer. This script call is exactly the same thing as
'$game_party.quests_completed.size'. If you want to, for example, give a
reward for completing 7 quests, use a 'Conditional Branch', select 'Script' and
type in 'Quest.done >= 7' (without the quotes).

----------
-Controls-
----------
Arrow keys to move the cursor around
'C'/'Enter' to view the quest's information
'X'/'Esc' to close the Scene_Quest
'Shift' to change tabs (All -> New -> Accepted -> Completed -> All)

When the quest's information window is being displayed:
You can still use the Arrow keys to view different quests
'C'/'Enter' and 'Shift' have no use.
'X'/'Esc' to remove the quest's information window

----------
-Graphics-
----------
This script uses images stored in 'Graphics/Pictures' to represent the quests.
The script was written in support for 48 x 48 graphics. Your images must be
of this size (no less, no bigger). To configure what graphics you wish to use,
look below for the configuration.

---------------
-Configuration-
---------------
Located below. All the instructions are there.

================================================================================
Credits:
KK20 -> Making this script
game_guy -> Used his 'Quest Log System' as a basis for this script
Blizzard -> Method to turn a long string into a paragraph
================================================================================
=end
module QuestData
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#@ S T A R T O F C O N F I G U R A T I O N @
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#=============================================================================
# NPCPicture - Set to 'true' if you want the NPC graphic to be displayed in
# the quest's information window. Set to 'false' if you don't
# want to.
#
# HideReward - Hides the rewards in the quest description until the player has
# completed that quest. Set the quest IDs in the array to use this
# feature. Delete the array and put 'true' to apply this to all
# quests. Create an empty array if you do not wish to use this
# feature. An empty array looks like this--> []
#
# RewardOnComplete - Set to 'true' if you want the player to be rewarded at the
# instance of 'Quest.complete(quest_id)'. 'False' otherwise.
#
# ExitScene - Set to the scene you wish to view upon exiting quest scene.
#=============================================================================
NPCPicture = false
HideReward = true
RewardOnComplete = true
ExitScene = Scene_Menu.new(0)
#=============================================================================
# EXPicon - The graphic used when the quest's information window is brought up.
# It represents EXP gained from the quest. Name it the same as it is
# found in 'Graphics/Icons'.
#
# GoldIcon - Same as above. Represents the gold gained from the quest.
#
# ** If you do not want graphics, simply use an empty string ---> ""
# These are ICONS, so the graphics must be 24 x 24.
#=============================================================================
EXPicon = "exp"
GoldIcon = "coins"
#=============================================================================
# NewQuestPic - The picture you want to represent a quest that hasn't been
# accepted. Name it the same as it is in 'Graphics/Pictures'.
#
# AcceptedQuestPic - Same as above. Represents a quest that has been accepted.
#
# CompletedQuestPic - Same as above. Represents a quest that is complete.
#
# Remember: Graphics must be of size 48 x 48.
#=============================================================================
NewQuestPic = "quest_new"
AcceptedQuestPic = "quest_inprogress"
CompletedQuestPic = "quest_complete"

def self.name(id)
case id
#===========================================================================
# Quest Name - The name of the quest.
# Configure:
# when x then return "name"
# x = Quest ID
# name = Quest name. Use "quotes".
#===========================================================================
when 1 then return "Feed Toby"
when 2 then return "Watch Jenna"
when 3 then return "Fetch Mine Report"
end
return ""
end

def self.description(id)
case id
#===========================================================================
# Quest Description - Paragraph of the quest's description. If the description
# is really lengthy, the program will adjust the text into paragraph format.
# You may use '/n' to create a new line -- just make sure to space it away
# from surrounding words. (e.g. "Hello World! /n You Rock!")
# Configure:
# when x then return "description"
# x = Quest ID
# description = Quest's description. Use "quotes". Can be quite lengthy.
#===========================================================================
when 1 then return "Nana wants me to give our lazy barn cat something to eat."
when 2 then return "Jenna needs someone to keep an eye on her while her mom is at work in the mines."
when 3 then return "Mayor Renford needs a production report from the mine."
end
return ""
end

def self.location(id)
case id
#===========================================================================
# Quest Location - Place where the player received the quest.
# Configure:
# when x then return "location"
# x = Quest ID
# location = Map's name. Use "quotes".
#===========================================================================
when 1 then return "Turon Village"
when 2 then return "Turon Village"
when 3 then return "Turon Village"
end
return ""
end

def self.NPC(id)
case id
#===========================================================================
# Quest NPC - The NPC that the player got the quest from. This can be
# displayed in both "string" and/or "picture" format. If using the picture
# format (NPCPicture = true), you must name the NPC the same as the
# image stored in the 'Graphics/Characters' folder. Otherwise, an error
# will occur while running the game.
# Configure:
# when x then return "NPC"
# x = Quest ID
# NPC = Name of the NPC as well as the name of the NPC graphic
#===========================================================================
when 1 .. 2 then return "Nana" # Both of these pictures are located in
when 3 then return "Mayor" # Graphics/Characters, even if they are RTP
end
return nil
end

def self.exp(id)
case id
#===========================================================================
# Quest Experience - The amount of EXP given for completing the quest.
# Configure:
# when x then return EXP
# x = Quest ID
# EXP = Amount of experience (Player EXP)
#===========================================================================
when 1 then return 5
when 2 then return 5
when 3 then return 5
end
return 0
end

def self.gold(id)
case id
#===========================================================================
# Quest Gold - The amount of gold given (or lost) for completing the quest.
# Configure:
# when x then return Gold
# x = Quest ID
# Gold = Amount of gold given/taken. Use a '-' for lost gold (e.g. -500)
#===========================================================================
when 1 then return 0
when 2 then return 0
when 3 then return 0
end
return 0
end

def self.reward(id)
case id
#===========================================================================
# Quest Reward - The items given for completing the quest. The amount of
# different items that can be earned should not be more than 5.
# Configure:
# when x then return [[item_type, item_id, amount], ...] (max size of 5)
# x = Quest ID
# item_type = Type of item. Refer below:
# 1 = Normal Items (potions, key items, medicine, etc.)
# 2 = Weapon
# 3 = Armor
# item_id = Item's ID located in the database
# amount = Number of items given for completion
#===========================================================================
when 1 then return [[]] #
when 2 then return [[]] #
end
return nil
end

def self.rank(value)
case value
#===========================================================================
# Quest Rank - The player's rank in terms of completed quests
# Configure:
# when x then return "rank"
# x = The number of completed quests. Use (x..y) for all values in between x and y
# rank = The rank of the party. Use "quotes".
#===========================================================================
when 1 .. 5 then return "Neophyte"
#when 2 .. 5 then return "Amateur"
end
return "Beginner"
end
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#@ E N D O F C O N F I G U R A T I O N @
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
end

#===============================================================================
module Quest
#Adds the quest under "New", meaning the player has yet to accept it
def self.new(id)
$game_party.add_newquest(id)
end
#Adds the quest under "Accepted", meaning the player is doing the quest
def self.accept(id)
$game_party.accept_quest(id)
end
#Adds the quest under "Completed", meaning the quest is finished. Gives reward.
def self.complete(id)
$game_party.complete(id)
end
#Checks if the quest is completed
def self.complete?(id)
return $game_party.completed?(id)
end
#Checks if the quest is currently accepted
def self.accept?(id)
return $game_party.has_quest?(id)
end
#Checks if the quest is currently unaccepted
def self.new?(id)
return $game_party.has_available?(id)
end
#Returns quests completed
def self.done
return $game_party.quests_completed.size
end

end
#===============================================================================
# Game_Party Class
# : Adds the quest data
#===============================================================================
class Game_Party

attr_accessor :quests_new
attr_accessor :quests_accepted
attr_accessor :quests_completed

alias kk20_initialize_again initialize
def initialize
kk20_initialize_again
@quests_new = []
@quests_accepted = []
@quests_completed = []
end

def add_newquest(id)
unless @quests_new.include?(id)
@quests_new.push(id)
end
end

def accept_quest(id)
unless @quests_accepted.include?(id)
if @quests_new.include?(id)
@quests_new.delete(id)
@quests_accepted.push(id)
end
end
end

def complete(id)
unless @quests_completed.include?(id)
if @quests_accepted.include?(id)
@quests_accepted.delete(id)
@quests_completed.push(id)
if QuestData::RewardOnComplete
$game_party.gain_gold(QuestData.gold(id))
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.cant_get_exp? == false
actor.exp += QuestData.exp(id)
end
end
rewards = QuestData.reward(id)
return if rewards == nil
#~~begin loop~~
for i in 0..rewards.size-1
reward = rewards
case reward[0]
when 1 then $game_party.gain_item(reward[1], reward[2])
when 2 then $game_party.gain_weapon(reward[1], reward[2])
when 3 then $game_party.gain_armor(reward[1], reward[2])
end
end
#~~end loop~~
end
end
end
end

def completed?(id)
return @quests_completed.include?(id)
end

def has_quest?(id)
return (@quests_accepted.include?(id) or @quests_completed.include?(id))
end

def has_available?(id)
return (@quests_new.include?(id) or @quests_accepted.include?(id) or @quests_completed.include?(id))
end

end
#===============================================================================
# Game_System Class
# : Stores quest descriptions into an array
#===============================================================================
class Game_System

attr_accessor :stored_desc

alias kk20_initialize_again initialize
def initialize
kk20_initialize_again
@stored_desc = []
end

end
#===============================================================================
# Window_Base Class
# : Modified method provided by Blizzard
#===============================================================================
class Window_Base < Window

def draw_even_text(x, y, width, height, text, index, align = 0)
if $game_system.stored_desc[index] != nil
new_text = $game_system.stored_desc[index]
else
words = text.split(' ')
if words.size == 1
new_text = words
else
result, current_text = [], words.shift
#loop
words.each_index {|i|
if self.contents.text_size("#{current_text} #{words}").width > width-32 or
words == "/n"
#Checks if '/n' is the current word.
if words == "/n"
result.push(current_text)
current_text = ""
else
result.push(current_text)
current_text = words
end
else
# True if the previous word was '/n'
if current_text == ""
current_text = words
else
current_text = "#{current_text} #{words}"
end
end
#Push the last word in
result.push(current_text) if i >= words.size - 1}
#end loop
new_text = result
$game_system.stored_desc[index] = new_text
end
end
new_text.each_index {|i|
self.contents.draw_text(x, y + i*height, width, height, new_text, align)}
end

end
#*******************************************************************************
#===============================================================================
# Window for displaying the party's rank and number of new/available/completed quests
#===============================================================================
class Window_QuestRank < Window_Base

def initialize
super (0, 0, 640, 64)
self.contents = Bitmap.new(width-32, height-32)
refresh
end

def refresh
self.contents.clear
quest_rank = QuestData.rank($game_party.quests_completed.size)
self.contents.draw_text(0, 0, 640, 32, "#{quest_rank}")

new = sprintf("%5s", $game_party.quests_new.size.to_s)
accepted = sprintf("%5s", $game_party.quests_accepted.size.to_s)
completed = sprintf("%5s", $game_party.quests_completed.size.to_s)
self.contents.draw_text(0, 0, 608, 32, "New:#{new} " +
"In Progress:#{accepted} Completed:#{completed}", 2)
end

end
#===============================================================================
# Window for displaying the quest's ID and title
#===============================================================================
class Window_QuestTitle < Window_Base

#Type determines what window to view (0 = All, 1 = New, 2 = Accepted, 3 = Complete)
def initialize(type=0)
super (0, 64, 640, 64)
self.contents = Bitmap.new(width-32,height-32)
@quest_num = 0
@quest_title = ""
@type = type
refresh
end

#Updates the quest /value/'s ID and name
alias kk20_update_quest update
def update(value)
kk20_update_quest
@quest_num = value
@quest_title = QuestData.name(value)
refresh
end

#Method is called when user shifts the quest tab
def next_page
@type = (@type + 1) % 4
refresh
end

def refresh
self.contents.clear
quest_tab = ""
case @type
when 0 then quest_tab = "ALL"
when 1 then quest_tab = "NEW"
when 2 then quest_tab = "IN PROGRESS"
when 3 then quest_tab = "COMPLETED"
end
quest_number = sprintf("%03d", @quest_num)
if @quest_num != 0 and @quest_num != nil
self.contents.draw_text(0, 0, 640, 32, "No. #{quest_number}")
else
self.contents.draw_text(0, 0, 640, 32, "There are no quests here.")
end
self.contents.draw_text(80, 0, 640, 32, "#{@quest_title}")
self.contents.draw_text(0, 0, 600, 32, "<#{quest_tab}>", 2)
end
end
#===============================================================================
# Window for displaying all the quests as pictures
#===============================================================================
class Window_QuestList < Window_Selectable

#Type determines what window to view (0 = All, 1 = New, 2 = Accepted, 3 = Complete)
def initialize(type=0)
super (0, 128, 640, 352)
@column_max = 5
@type = type
refresh
self.index = 0
end

#For information window
def quest
return @data[self.index]
end

#When the player shifts to next page. Also places cursor to new index if nil.
def next_page
@type = (@type + 1) % 4
refresh
if (@data[self.index] == nil)
self.index = [@data.size-1, 0].max
end
end

def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
case @type
when 0 #all
for i in 0...$game_party.quests_new.size
@data.push($game_party.quests_new)
end
for i in 0...$game_party.quests_accepted.size
@data.push($game_party.quests_accepted)
end
for i in 0...$game_party.quests_completed.size
@data.push($game_party.quests_completed)
end
when 1 #New
for i in 0...$game_party.quests_new.size
@data.push($game_party.quests_new)
end
when 2 #accepted
for i in 0...$game_party.quests_accepted.size
@data.push($game_party.quests_accepted)
end
when 3 #Completed
for i in 0...$game_party.quests_completed.size
@data.push($game_party.quests_completed)
end
end
@data.sort! if @data.size > 1
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 64, row_max * 64)
for i in 0...@item_max
draw_item(i)
end
end
end

def draw_item(index)
quest_number = @data[index]
if $game_party.quests_new.include?(quest_number)
bitmap = RPG::Cache.picture(QuestData::NewQuestPic)
end
if $game_party.quests_accepted.include?(quest_number)
bitmap = RPG::Cache.picture(QuestData::AcceptedQuestPic)
end
if $game_party.quests_completed.include?(quest_number)
bitmap = RPG::Cache.picture(QuestData::CompletedQuestPic)
end
x = 8 + index % @column_max * (self.width / @column_max)
y = 8 + index / @column_max * 64
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 48, 48), 255)
end
#####################################################
# Modified methods to allow 64x64 selection windows #
#####################################################
def page_row_max
return (self.height) / 64
end

def top_row
return self.oy / 64
end

def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 64
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor coordinates
x = @index % @column_max * (640 / @column_max)
y = @index / @column_max * 64 - self.oy
# Update cursor rectangle
self.cursor_rect.set(x, y, 64, 64)
end
end
#===============================================================================
# Window to display quest's information
#===============================================================================
class Window_QuestInfo < Window_Base

def initialize(quest_id)
super (0, 0, 640, 480)
self.z = 1000
self.contents = Bitmap.new(width-32,height-32)
@quest = quest_id
refresh
end

def update_quest(quest_id)
if @quest != quest_id
@quest = quest_id
refresh
end
end

def refresh
# Titles of important text
self.contents.clear
quest_number = sprintf("%03d", @quest)
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 640, 32, "No. #{quest_number}")
self.contents.draw_text(80, 0, 640, 32, QuestData.name(@quest))
if Quest.complete?(@quest)
self.contents.font.color = Color.new(233, 188, 10)
self.contents.draw_text(0, 0, 600, 32, "-COMPLETED-", 2)
self.contents.font.color = system_color
end
self.contents.draw_text(0, 200, 280, 32, "Requester:")
self.contents.draw_text(0, 360, 280, 32, "Location:")
self.contents.draw_text(320, 200, 280, 32, "Reward(s):")
# Description (Prints "???" if quest is not accepted)
self.contents.font.color = normal_color
self.contents.fill_rect(0, 40, 640, 5, Color.new(24,184,231,128))
self.contents.font.size = 18
if Quest.accept?(@quest)
draw_even_text(0, 58, 640, 18, QuestData.description(@quest), @quest)
else
self.contents.draw_text(275, 103, 640, 18, "? ? ?")
end
self.contents.fill_rect(0, 180, 640, 5, Color.new(24,184,231,128))
self.contents.fill_rect(300, 180, 5, 320, Color.new(24,184,231,128))
# NPC and Location
self.contents.font.size = Font.default_size
if QuestData::NPCPicture and QuestData.NPC(@quest) != nil
bitmap = RPG::Cache.character(QuestData.NPC(@quest), 0)
h = bitmap.height/4
w = bitmap.width/4
self.contents.blt(0, 240, bitmap, Rect.new(0, 0, w, h))
self.contents.draw_text(w+20, h+240, 280, 32, QuestData.NPC(@quest))
else
if QuestData.NPC(@quest) != nil
self.contents.draw_text(20, 240, 280, 32, QuestData.NPC(@quest))
end
end
self.contents.draw_text(20, 400, 280, 32, QuestData.location(@quest))
# Rewards
if !((QuestData::HideReward == true or QuestData::HideReward.include?(@quest)) and !Quest.complete?(@quest))
y = 225
exp_string = ""
if QuestData.exp(@quest) != 0
if QuestData::EXPicon != nil and QuestData::EXPicon != ""
bitmap = RPG::Cache.icon(QuestData::EXPicon)
self.contents.blt(340, y, bitmap, Rect.new(0, 0, 32, 32))
else
exp_string = "EXP"
end
self.contents.draw_text(370, y, 280, 32, QuestData.exp(@quest).to_s + " " + exp_string)
y += 24
end
if QuestData.gold(@quest) != 0
if QuestData::GoldIcon != nil and QuestData::GoldIcon != ""
bitmap = RPG::Cache.icon(QuestData::GoldIcon)
self.contents.blt(340, y, bitmap, Rect.new(0, 0, 32, 32))
end
self.contents.draw_text(370, y, 280, 32, QuestData.gold(@quest).to_s + " Gold")
y += 32
end
if QuestData.reward(@quest) != nil
#~~being loop~~
QuestData.reward(@quest).each_index{|i|
item = QuestData.reward(@quest)
case item[0]
when 1
bitmap = RPG::Cache.icon($data_items[item[1]].icon_name)
self.contents.draw_text(370, y, 280, 32, $data_items[item[1]].name + " x " + item[2].to_s)
when 2
bitmap = RPG::Cache.icon($data_weapons[item[1]].icon_name)
self.contents.draw_text(370, y, 280, 32, $data_weapons[item[1]].name + " x " + item[2].to_s)
when 3
bitmap = RPG::Cache.icon($data_armors[item[1]].icon_name)
self.contents.draw_text(370, y, 280, 32, $data_armors[item[1]].name + " x " + item[2].to_s)
end
self.contents.blt(340, y, bitmap, Rect.new(0, 0, 32, 32))
y += 32}
#~~end loop~~
end
if QuestData.exp(@quest) == 0 and QuestData.gold(@quest) == 0 and QuestData.reward(@quest) == nil
self.contents.draw_text(370, 225, 280, 32, "None")
end
else #If Quest Reward is hidden
self.contents.draw_text(370, 225, 280, 32, "Unknown")
end
end

end
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# The actual quest scene
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
class Scene_Quest

def main
#Creates the windows
@quests_rank = Window_QuestRank.new
@quests_title = Window_QuestTitle.new(0)
@quests_list = Window_QuestList.new(0)
@quests_title.update(@quests_list.quest)
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@quests_rank.dispose
@quests_title.dispose
@quests_list.dispose
end
#------------------------------------------------------------
def update
@quests_rank.update
@quests_title.update(@quests_list.quest)
@quests_list.update

if @quest_info != nil
@quest_info.update_quest(@quests_list.quest)
end

if @quests_list.active
update_quests
return
end
end
#------------------------------------------------------------
def update_quests
if Input.trigger?(Input::B)
#If quest information is not displayed
if @quest_info == nil
$game_system.se_play($data_system.cancel_se)
$scene = QuestData::ExitScene
return
else #If quest info is displayed
$game_system.se_play($data_system.cancel_se)
@quest_info.dispose
@quest_info = nil
return
end
end
if Input.trigger?(Input::C)
#Works only if quest info isn't displayed
if @quest_info == nil and @quests_list.quest != nil
$game_system.se_play($data_system.decision_se)
@quest_info = Window_QuestInfo.new(@quests_list.quest)
end
return
end
#Pressing shift opens quest info
if Input.trigger?(Input::SHIFT) and @quest_info == nil
$game_system.se_play($data_system.equip_se)
@quests_title.next_page
@quests_list.next_page
return
end

end
end

 

Share this post


Link to post
Share on other sites
  • 0

It seems like there may be something you need to do to use the scripts that you're missing. How exactly are you calling the scripts in game?

and try using this party changer script instead: http://forum.chaos-project.com/index.php?topic=116.0

Unless you prefer Liz's

 

And the quest script works perfectly if it's called from an event?

It may have something to do with how it's being called

i.e. What you added to the menu script to add the new option(s) in.

Share this post


Link to post
Share on other sites
  • 0

basically the errors you are getting are telling you that they are trying to call information that doesn't seem to exist. Either you deleted a character or something and now the party scripts can't find that person, or in the party script it's requesting a member of the party that no longer exists.

 

same with the quest script. It's trying to get information that no longer exists.

Share this post


Link to post
Share on other sites
  • 0

~sigh~  As soon as I put Aluxes back as the starting party, they worked perfectly.  I'll try the other party switcher to see if that works better.  I'll also scour the quest script for where it has anything about the initial party :P

 

 

 

 

-edited because it wasn't dependent on the full party

Edited by phionabrie

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...