I basically would like the script to work how legacyblade specified in the original topic here:
http://forum.chaos-project.com/index.php/topic,4979.0.html or at least to just be able to use a common event for each npc Im gifting to. So far it works correctly when changed into a common event, except when a conditional branch checks to see if the gift variable is equal to the items ID number, then returns the npcs text response to the gift and adds affection points to the affection variable, it only adds the affections points, but delayed. It never displays the text, yet adds the points to the affection variable.
If I gave an NPC an item worth 8 points, when I check the variable, it is 0. Then if I give the npc another 8 point item, the variable is 8. it seems to skip the first item.
If I could get it to at least just show the text, I would be happy enough.
The demo is still available on that topic, and I'll post the demo's script here.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#
# Weapon Specific Skills Script by TerreAqua
# Version: 1.0
# Date: 11/15/09
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#
#===============================================================================
# Information
#-------------------------------------------------------------------------------
#
# This script allows the player to give gifts to NPCs.
#===============================================================================
GIFT_GIVING_TAG = 17 # Element check to use on items to signify a gift
GIFT_ID = 1 # Variable to store the given gift
#===============================================================================
# Credits:
# Aqua (aka TerreAqua) for making this.
# happyman for requesting it.
# Blizzard for a little name checking help.
# Starrodkirby86 for just being him. :)
#===============================================================================
#===============================================================================
# This work is protected by the following license:
# #-----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #-----------------------------------------------------------------------------
#===============================================================================
#==============================================================================
# ** Window_Gift_Giving
#------------------------------------------------------------------------------
# This window displays items in possession.
#==============================================================================
class Window_Gift_Giving < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(170, 140, 300, 192)
@column_max = 1
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add item
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item.id)
if item.is_a?(RPG::Item) &&
$data_items[item.id].element_set.include?(GIFT_GIVING_TAG)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 200, y, 16, 32, ":", 1)
self.contents.draw_text(x + 216, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
i = $game_map.map.events[$gift_recipient[1]].name
text = "What would you like to give to #{i}?"
@help_window.set_text(text)
end
end
class Game_Event
attr_reader :name
def name
@name = event.name
end
end
class Game_Map
attr_reader :map
end
if $DUMMY_ELEMENTS != nil
$DUMMY_ELEMENTS |= GIFT_GIVING_TAG.to_a
else
$DUMMY_ELEMENTS = GIFT_GIVING_TAG.to_a.clone
end
class Game_Battler
#--------------------------------------------------------------------------
# * Fix Elements
#--------------------------------------------------------------------------
def elements_correct(elements)
multiplier = size = 0
elements.each {|i|
unless $DUMMY_ELEMENTS.include?(i)
multiplier += self.element_rate(i)
size += 1
end}
return (size == 0 ? 100 : multiplier/size)
end
end
#==============================================================================
# ** Scene_Gift_Giving
#------------------------------------------------------------------------------
# This class performs item screen processing.
#==============================================================================
class Scene_Gift_Giving
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
$game_variables[GIFT_ID] = 0
# Make help window, item window
@back = Spriteset_Map.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@item_window = Window_Gift_Giving.new
@item_window.back_opacity = 160
# Associate help window
@item_window.help_window = @help_window
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@back.dispose if @back != nil
@help_window.dispose
@item_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@help_window.update
@item_window.update
# If item window is active: call update_item
if @item_window.active
update_item
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Reset Variable
$game_variables[GIFT_ID] = 0
# Call Gift Processing
i = $gift_recipient
$game_self_switches[[i[0], i[1], 'A']] = true
$game_map.need_refresh = true
# Switch to menu screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the item window
@item = @item_window.item
# If not a use item
unless @item.is_a?(RPG::Item)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If it can't be used
unless $data_items[@item.id].element_set.include?(GIFT_GIVING_TAG)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Call Gift Processing
$game_variables[GIFT_ID] = @item.id
i = $gift_recipient
$game_self_switches[[i[0], i[1], 'A']] = true
$game_map.need_refresh = true
# Decrease used items by 1
$game_party.lose_item(@item.id, 1)
# Draw item window item
@item_window.draw_item(@item_window.index)
# Switch to map screen
$scene = Scene_Map.new
return
end
return
end
end
thanks very much in advance, and sorry if this is the wrong place to post this, its hard to decide where to place this request/problem when its both event and script related.