Regarding your earlier thought, I "am" trying to raise variables that were already higher than 1.
Yazik Shop Upgrade
RGSSx Script SupportHey Ronin (or whoever else is watching), can I ask for one last change to the script? Strictly for the stat increases (not the variables) I want an option for both one-time purchases and unlimited purchases (if it's impossible to have both, then at least the second).
Basically I want to let characters get a first big-time boost to a stat, and then grind it as much as they want but with lower returns than the first time.
Basically I want to let characters get a first big-time boost to a stat, and then grind it as much as they want but with lower returns than the first time.
So would it be the one stat that you can buy X amount and it gives the big bonus, then after that it gives a small amount?
If I add another piece of data to the stat then it should be doable. specify how many times the stat can be bought before it gets reduced by X amount. (second piece of data)
which would change the stat formulas to
[stat_id, price, :stat, "Description", item index, amount, change on, change by]
[2, 1, :stat, "Raise Atk power", 100, 10, 2, 5]
this would change after the stat has been purchased after 2 times. further purchases would take the amount divided by the change. 10 / 5 = 2. or maybe subtract the amount? that might be easier to work out.
Does that fit your goal?
I'll work on it but I'm on holidays (technically doing house repairs for my mother-in-law)
Code updated below
I can just have it as different "purchases", no need to make it the same item in the shop. I think it would be easier to program to just remove the purchase limit through a "true/false" at the end or something (preferably only checking if it's set to true so I don't have to include unnecessary checks on all the other shop items as well).
Code above updated (I remoted into my computer at home to test)
If this doesn't work for you then let me know.
[2, 1, :stat, "ATK up", 25, 5, true, 2, 3], [3, 1, :stat, "DEF up", 26, 4, false, 0, 0]],
Atk will increase by 5 twice then increase by three (giving two) after that.
Def will increase only once.
If this doesn't work for you then let me know.
[2, 1, :stat, "ATK up", 25, 5, true, 2, 3], [3, 1, :stat, "DEF up", 26, 4, false, 0, 0]],
Atk will increase by 5 twice then increase by three (giving two) after that.
Def will increase only once.
Nice, will test it in a bit, thank you.
It isn't working. I tried the following codes for ATK boost:
The first one can be acquired but does nothing, the second one cannot be acquired at all.
It isn't working. I tried the following codes for ATK boost:
Code:
[3, 1, :stat, "ATK +30", 25, 30, false, 30, 0],
[3, 1, :stat, "ATK +15 (repeatable)", 25, 15, true, 15, 0]
that should be
[2, 1, :stat, "ATK +30", 25, 30, false, 0, 0],
0 -> mhp, 1 -> mmp, 2 -> atk, 3 -> def etc...
[2, 1, :stat, "ATK +15 (repeatable)", 25, 15, true, 0, 0] <- if it never lowers then you can set the 15 to 0.
The examples I gave above worked for me in your project.
You were right, first option works. Second option remains disabled to me (as in, I cannot acquire it from the shop, and it is greyed out).
It's not greyed out for me, but I do see an issue. Let me work on it more.
@Gravemaster
Ok reworked the code. Removed the new variable I previously set and changed how the variable I used before was controlled. Please start a new game and test it out.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Yazik Skill Shop Addon ║ Version: 1.06 ║
# ║ Author: Roninator2 ║ ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function: ║ Date Created ║
# ║ Allow Switches, Variables ╠════════════════════╣
# ║ and Stat changes in shop ║ 06 Jul 2022 ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions: ║
# ║ Input the settings to your preference. read carefully ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates: ║
# ║ 2022 07 06 - Initial Publish ║
# ║ 2022 07 07 - Set switches to only be activated once ║
# ║ Updated instructions ║
# ║ 2022 07 09 - Modified variables to be used only once ║
# ║ 2022 07 18 - Fixed Help Text ║
# ║ 2022 07 20 - Corrected system to have data per actor ║
# ║ 2022 08 25 - Added multi purchase of stats ║
# ║ 2022 08 29 - Reworked code to fix multi purchase ║
# ╚══════════════════════════════════════════════════════════╝
# ╔═════════════════════════════════════╗
# ║ Terms of use: ║
# ║ Free for all uses in RPG Maker ║
# ╚═════════════════════════════════════╝
# ShopDatabase = {
#
# Switch item format : [switch_id, price, :switch, "Description", item index],
# item index for switches and variables and stats is used to pull in
# an item for drawing an icon and making the code happy.
# Variable item format : [var_id, price, :variable, "Description", item index, amount],
# Stat item format : [stat_id, price, :stat, "Description", item index, amount, multi purchase, change by, subtract amount],
# stat amount is how much the stat increases
# Stat_id options are 0, 1, 2, 3, 4, 5, 6, 7
# MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK
# Multi purchase is true or false. False is single purchase
# Change by is the point which further purchases would reduce the amount gained by the subtract amount
class Game_Actor < Game_Battler
attr_accessor :skill_variables
attr_accessor :stat_boost_skill
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
alias r2_skill_var_sw_setup setup
def setup(actor_id)
r2_skill_var_sw_setup(actor_id)
@skill_variables = []
@stat_boost_skill = []
end
end
class Window_ShopSkill < Window_SkillList
def make_item_list
if @actor
skills = []
db = Yazik::SkillShop::ShopDatabase[@actor.id]
for i in 0...db.size
if db[i][2] == :state
state_id = db[i][0]
if @actor.state_addable?(state_id)
state = $data_states[state_id]
skills.push(state)
end
elsif db[i][2] == :switch
switch_id = db[i][0]
switch = [$game_switches[switch_id], $data_items[db[i][4]], :switch]
skills.push(switch)
elsif db[i][2] == :variable
var_id = db[i][0]
@actor.skill_variables[var_id] = false if @actor.skill_variables[var_id] == nil
var = [$game_variables[var_id], $data_items[db[i][4]], :variable, db[i][5], @actor.skill_variables[var_id]]
skills.push(var)
elsif db[i][2] == :stat
@actor.stat_boost_skill[i] = [false,0,db[i][6],db[i][7],db[i][8]] if @actor.stat_boost_skill[i] == nil
stat = [db[i][0], $data_items[db[i][4]], :stat, db[i][5], @actor.stat_boost_skill[i][0]]
skills.push(stat)
else
skill = $data_skills[db[i][0]]
if @actor.added_skill_types.include?(skill.stype_id)
skills.push(skill)
end
end
end
@data = skills
else
@data = []
end
end
def draw_item(index)
data = @data[index]
if data
rect = item_rect(index)
rect.width -= 4
if data.class == RPG::Skill
enabled = @actor.skill_learn?(data)
elsif data.class == RPG::State
enabled = @actor.state?(data.id)
elsif data[2] == :switch
enabled = true if data[0].is_a?(FalseClass)
elsif data[2] == :variable
enabled = true if data[4] == false
elsif data[2] == :stat
enabled = true if data[4] == false
end
draw_skill_icon(index, data, rect.x, rect.y, enabled)
draw_skill_price(rect, index)
end
end
def draw_skill_icon(index, item, x, y, enabled)
return unless item
if item.is_a?(Array)
draw_icon(item[1].icon_index, x, y, enabled)
else
draw_icon(item.icon_index, x, y, enabled)
end
end
end
class Scene_SkillShop < Scene_Skill
def on_item_ok
is_skill = item.class == RPG::Skill
is_state = item.class == RPG::State
is_array = item.class == Array
if (is_skill and [email protected]_learn?(item)) or (is_state and [email protected]?(item.id)) or (is_array)
db = Yazik::SkillShop::ShopDatabase[@actor.id]
price = db[@item_window.index][1]
if db[@item_window.index][2] == :switch
if ($game_switches[db[@item_window.index][0]] == true) ||
(price > $game_actors[@actor.id].skill_point)
Sound.play_buzzer
@item_window.activate
else
@confirm_window.open
@confirm_window.select(0)
@confirm_window.activate
end
elsif db[@item_window.index][2] == :variable
if (@actor.skill_variables[db[@item_window.index][0]] == true) ||
(price > $game_actors[@actor.id].skill_point)
Sound.play_buzzer
@item_window.activate
else
@confirm_window.open
@confirm_window.select(0)
@confirm_window.activate
end
elsif db[@item_window.index][2] == :stat
if (@actor.stat_boost_skill[@item_window.index][0] == true) ||
(price > $game_actors[@actor.id].skill_point) ||
Sound.play_buzzer
@item_window.activate
else
@confirm_window.open
@confirm_window.select(0)
@confirm_window.activate
end
elsif price <= $game_actors[@actor.id].skill_point
@confirm_window.open
@confirm_window.select(0)
@confirm_window.activate
else
Sound.play_buzzer
@item_window.activate
end
else
@item_window.activate
end
end
def buy_item
db = Yazik::SkillShop::ShopDatabase[@actor.id]
if db[@item_window.index][2] == :state
state_id = db[@item_window.index][0]
state_price = db[@item_window.index][1]
$game_actors[@actor.id].skill_point -= state_price
$game_actors[@actor.id].add_state(state_id)
elsif db[@item_window.index][2] == :switch
switch_id = db[@item_window.index][0]
switch_price = db[@item_window.index][1]
$game_actors[@actor.id].skill_point -= switch_price
$game_switches[switch_id] = !$game_switches[switch_id]
elsif db[@item_window.index][2] == :variable
var_id = db[@item_window.index][0]
var_price = db[@item_window.index][1]
var_amount = db[@item_window.index][5]
$game_actors[@actor.id].skill_point -= var_price
$game_actors[@actor.id].skill_variables[db[@item_window.index][0]] = true
$game_variables[var_id] += var_amount
elsif db[@item_window.index][2] == :stat
stat_id = db[@item_window.index][0]
amount = db[@item_window.index][5]
stat_price = db[@item_window.index][1]
$game_actors[@actor.id].stat_boost_skill[@item_window.index][0] = true if ($game_actors[@actor.id].stat_boost_skill[@item_window.index][2] == false)
$game_actors[@actor.id].skill_point -= stat_price
if ($game_actors[@actor.id].stat_boost_skill[@item_window.index][1] >= $game_actors[@actor.id].stat_boost_skill[@item_window.index][3]) &&
($game_actors[@actor.id].stat_boost_skill[@item_window.index][2] == true)
amount = amount - ($game_actors[@actor.id].stat_boost_skill[@item_window.index][4])
($game_actors[@actor.id].stat_boost_skill[@item_window.index][1] += 1)
end
@actor.add_param(stat_id, amount)
else
skill_id = db[@item_window.index][0]
skill_price = db[@item_window.index][1]
$game_actors[@actor.id].skill_point -= skill_price
$game_actors[@actor.id].learn_skill(skill_id)
end
@info_window.refresh
@confirm_window.close
@confirm_window.deactivate
@item_window.refresh
@item_window.activate
end
end
class Window_ShopHelp < Window_Help
def set_item(item)
if item.class == Array
itemn = item[1]
set_name(itemn.name)
else
set_name(item ? item.name : "")
end
if SceneManager.scene_is?(Scene_SkillShop)
if (item) and ((item.class == RPG::State) or (item.class == Array))
set_text(SceneManager.scene.database_item[3])
return
end
end
yazik_ss_set_item(item)
end
end
Thanks, everything works now. Good job.
Hey Ronin, the skillshop is acting up again, not working properly for some party members besides the MC.
At the moment, it is for the character Azar that there are problems (line 113), with the skills that can be purchased not aligning with their icons. The player reports are saying that purchased skills instead give you the previous one, and I doubt it is only a problem for her.
Any help would be appreciated.
Code:
#=======================================================
# Yazik - Skill & State Shop
#=======================================================
$imported = {} if $imported == nil
$imported[:Yazik_Skill_State_Shop] = true
#=======================================================
# Configurations
#=======================================================
module Yazik
module Actor
#--------------------------------------------------
# Script Call:
# 1. Actor's Add Skill Points
# add_skill_points(actor_id, points)
#--------------------------------------------------
# Starting Skill Point (When Actor at Level 1)
StartingSkillPoint = 2
# Skill Point Gain (When Actor Leveled Up)
SkillPointGain = 1
end
module SkillShop
# Command Name in Main Menu
CommandName = 'Temple'
# Command Index in Main Menu
CommandIndex = 1
# Skill Point Symbol
SkillPointSymbol = '\C[16]W\C[0]'
# Total Skill Point Text
TotalSkillPointText = '\C[16]Waves: \C[0]'
# Total Skill Point Text's X & Y position
TotalSkillPointText_X = 216
TotalSkillPointText_Y = 216
# Vocab on Option Window
VocabBuy = 'Acquire'
VocabCancel = 'Cancel'
# Help Window Settings
HelpWindow_Opacity = 0
HelpWindow_LineNumber = 4
# Shop Window Settings
ShopWindow_Opacity = 0
ShopWindow_Column = 4
ShopWindow_X = 0
ShopWindow_Y = 22
ShopWindow_Width = Graphics.width * 3/4
ShopWindow_Height = (6 * 24) + 2 * 12
# Actor's Skill Shop Database
ShopDatabase = {
# actor_id => [[skill_id, price], ..., [skill_id, price]],
#player
1 => [[139, 2], [140, 2], [133, 3], [127, 3], [51, 3], [52, 2], [50, 3], [8, 2], [135, 4], [60, 1], [102, 1], [28, 1], [29, 1], [2, 2], [53, 1], [54, 1],
[55, 1], [56, 1], [57, 1], [44, 1], [124, 1], [97, 1], [92, 1], [75, 4, :state, "Teaches you how to use bows."],
[74, 2, :state, "Teaches you how to use spears."], [88, 4, :state, "Teaches you how to use artifacts."], [112, 1, :state, "Teaches you how to use axes."],
[101, 8, :state, "Doubles maximum magia points (continuously)."], [105, 2, :state, "+2% HP Regen."], [104, 5, :state, "200% Status Recovery Rate"],
[102, 6, :state, "+15% DEF stat"], [68, 4, :state, "Immune to common poisons and venoms."], [4, 4, :state, "+150% TP Charge Rate."],
[110, 3, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."], [125, 4, :state, "Immune to stat debuffs."],
[162, 2, :variable, "Increases rhetorics by 1.", 347, 1], [164, 2, :variable, "Increases Intellect by 1.", 347, 1],
[0, 1, :stat, "HEALTH +40 (repeatable)", 347, 40, true, 0, 0], [1, 1, :stat, "MAGIA +30 (repeatable)", 347, 30, true, 0, 0],
[3, 1, :stat, "DEFENSE +15 (repeatable)", 347, 15, true, 0, 0], [2, 1, :stat, "ATTACK +15 (repeatable)", 347, 15, true, 0, 0],
[6, 1, :stat, "AGILITY +15 (repeatable)", 347, 15, true, 0, 0], [7, 1, :stat, "LUCK +15 (repeatable)", 347, 15, true, 0, 0],
[4, 1, :stat, "SKILL +1 (repeatable)", 347, 1, true, 0, 0], [5, 1, :stat, "AFFINITY +1 (repeatable)", 347, 1, true, 0, 0]],
#3 Bran
3 => [[6, 2], [10, 3], [11, 2], [28, 1], [29, 1], [97, 1], [92, 1], [123, 4, :state, "DEF stat is doubled."], [125, 3, :state, "Immune to stat debuffs."],
[0, 1, :stat, "HEALTH +50 (repeatable)", 347, 50, true, 0, 0], [3, 1, :stat, "DEFENSE +25 (repeatable)", 347, 20, true, 0, 0],
[2, 1, :stat, "ATTACK +25 (repeatable)", 347, 25, true, 0, 0]],
#4 Huiliang
4 => [[137, 2], [60, 1], [28, 1], [29, 1], [97, 1], [92, 1], [125, 5, :state, "Immune to stat debuffs."],
[0, 1, :stat, "HEALTH +20 (repeatable)", 347, 20, true, 0, 0], [5, 1, :stat, "AFFINITY +1 (repeatable)", 347, 1, true, 0, 0]],
#5 Xia
5 => [[156, 3], [146, 1], [147, 2], [166, 1], [133, 1], [108, 2], [145, 2], [170, 1], [51, 1], [52, 1], [141, 4], [139, 1], [140, 1], [44, 1], [92, 1], [42, 3],
[197, 2, :variable, "Boost Cyan Rain's damage by 250.", 344, 250],
[68, 2, :state, "Immune to common poisons and venoms."], [101, 4, :state, "Doubles maximum magia points."], [125, 1, :state, "Immune to stat debuffs."],
[0, 1, :stat, "HEALTH +35 (repeatable)", 347, 35, true, 0, 0], [1, 1, :stat, "MAGIA +25 (repeatable)", 347, 25, true, 0, 0],
[3, 1, :stat, "DEFENSE +12 (repeatable)", 347, 12, true, 0, 0], [2, 1, :stat, "ATTACK +17 (repeatable)", 347, 17, true, 0, 0],
[6, 1, :stat, "AGILITY +17 (repeatable)", 347, 17, true, 0, 0], [7, 1, :stat, "LUCK +15 (repeatable)", 347, 15, true, 0, 0],
[4, 2, :stat, "SKILL +3 (repeatable)", 347, 3, true, 0, 0], [5, 2, :stat, "AFFINITY +3 (repeatable)", 347, 3, true, 0, 0]],
#7 Hana
7 => [[45, 4], [50, 4], [13, 3], [14, 3], [15, 3], [16, 4], [135, 3], [3, 1], [12, 1], [92, 1], [60, 1], [102, 1], [202, 3], [28, 1], [29, 1], [44, 1], [91, 3], [9, 1],
[199, 1, :variable, "Increases Black Rose's damage by 200.", 345, 200], [199, 1, :variable, "Increases Black Rose's damage by another 200.", 345, 200],
[75, 2, :state, "Teaches you how to use bows."], [76, 4, :state, "Teaches you how to use swords."],
[87, 1, :state, "Teaches you how to wear magia clothes."], [68, 2, :state, "Immune to common poisons and venoms."],
[101, 8, :state, "Doubles maximum magia points (continuously)."], [4, 3, :state, "+150% TP Charge Rate."],
[100, 6, :state, "60% Frost Resistance, 10% Agility boost, +2 HP Regen, Immune to State: Hypothermia"], [125, 2, :state, "Immune to stat debuffs."],
[110, 3, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."],
[165, 2, :variable, "Increases deception by 1.", 347, 1], [30, 1, :variable, "Increases MC testosterone by 1.", 347, 1],
[0, 1, :stat, "HEALTH +25 (repeatable)", 347, 25, true, 0, 0], [1, 1, :stat, "MAGIA +35 (repeatable)", 347, 35, true, 0, 0],
[3, 1, :stat, "DEFENSE +10 (repeatable)", 347, 10, true, 0, 0], [2, 1, :stat, "ATTACK +11 (repeatable)", 347, 11, true, 0, 0],
[6, 1, :stat, "AGILITY +20 (repeatable)", 347, 20, true, 0, 0], [7, 1, :stat, "LUCK +20 (repeatable)", 347, 20, true, 0, 0],
[4, 1, :stat, "SKILL +1 (repeatable)", 347, 1, true, 0, 0], [5, 2, :stat, "AFFINITY +3 (repeatable)", 347, 3, true, 0, 0]],
#8 Bloodfang
8 => [[59, 5], [22, 3], [24, 4], [92, 1], [25, 2], [45, 2], [60, 1], [28, 1], [29, 1], [165, 1], [90, 1], [20, 2], [21, 1], [26, 2], [88, 5, :state, "Teaches you how to use artifacts."],
[101, 8, :state, "Doubles maximum magia points (continuously)."], [68, 4, :state, "Immune to common poisons and venoms."],
[4, 5, :state, "+150% TP Charge Rate."], [110, 3, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."],
[125, 3, :state, "Immune to stat debuffs."], [29, 1, :variable, "Increases MC estrogen by 1.", 347, 1], [28, 1, :variable, "Increases perception by 1.", 347, 1],
[0, 1, :stat, "HEALTH +63 (repeatable)", 347, 63, true, 0, 0], [1, 1, :stat, "MAGIA +30 (repeatable)", 347, 30, true, 0, 0],
[3, 1, :stat, "DEFENSE +15 (repeatable)", 347, 15, true, 0, 0], [2, 1, :stat, "ATTACK +20 (repeatable)", 347, 20, true, 0, 0],
[6, 1, :stat, "AGILITY +25 (repeatable)", 347, 25, true, 0, 0], [7, 1, :stat, "LUCK +5 (repeatable)", 347, 5, true, 0, 0],
[4, 1, :stat, "SKILL +1 (repeatable)", 347, 1, true, 0, 0], [5, 1, :stat, "AFFINITY +1 (repeatable)", 347, 1, true, 0, 0]],
#9 Azar
9 => [[81, 2], [82, 3], [84, 4], [56, 3], [59, 4], [52, 1], [60, 1], [92, 1], [90, 1], [191, 2], [193,1], [194, 1], [88, 3], [89, 2], [101, 8, :state, "Doubles maximum magia points (continuously)."],
[4, 2, :state, "+150% TP Charge Rate."], [68, 2, :state, "Immune to common poisons and venoms."], [125, 4, :state, "Immune to stat debuffs."],
[110, 2, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."],
[30, 2, :variable, "Increases MC testosterone by 1.", 347, 1], [163, 2, :variable, "Increases Academics by 1.", 347, 1],
[0, 1, :stat, "HEALTH +15 (repeatable)", 347, 15, true, 0, 0], [1, 1, :stat, "MAGIA +50 (repeatable)", 347, 50, true, 0, 0],
[3, 1, :stat, "DEFENSE +5 (repeatable)", 347, 5, true, 0, 0], [2, 1, :stat, "ATTACK +5 (repeatable)", 347, 5, true, 0, 0],
[6, 1, :stat, "AGILITY +10 (repeatable)", 347, 10, true, 0, 0], [7, 1, :stat, "LUCK +10 (repeatable)", 347, 10, true, 0, 0],
[4, 2, :stat, "SKILL +1 (repeatable)", 347, 1, true, 0, 0], [5, 4, :stat, "AFFINITY +6 (repeatable)", 347, 6, true, 0, 0]],
#10 Tsei
10 => [[52, 1], [71, 10], [74, 8], [76, 9], [60, 1], [28, 1], [29, 1], [97, 1], [92, 1], [101, 8, :state, "Doubles maximum magia points (continuously)."],
[68, 4, :state, "Immune to common poisons and venoms."], [4, 2, :state, "+150% TP Charge Rate."], [125, 5, :state, "Immune to stat debuffs."],
[110, 3, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."]],
#12 Kaliska
12 => [[38, 7], [39, 7], [51, 2], [60, 1], [92, 1], [198, 1, :variable, "Kaliska's Stance now also heals for 250 Fire element.", 348, 250],
[101, 2, :state, "Doubles maximum magia points (continuously)."],
[68, 2, :state, "Immune to common poisons and venoms."], [4, 4, :state, "+150% TP Charge Rate."], [125, 4, :state, "Immune to stat debuffs."],
[110, 2, :state, "Any damage you would receive higher than 90% of your max Health is completely nullified."],
[123, 4, :state, "DEF stat is doubled."], [124, 3, :state, "Kaliska received -60% Light and Dark damage, and also +1 HRG"],
[25, 1, :variable, "Increases karma by 1.", 347, 1],
[0, 1, :stat, "HEALTH +30 (repeatable)", 347, 30, true, 0, 0], [1, 1, :stat, "MAGIA +10 (repeatable)", 347, 10, true, 0, 0],
[3, 1, :stat, "DEFENSE +25 (repeatable)", 347, 25, true, 0, 0], [2, 1, :stat, "ATTACK +22 (repeatable)", 347, 22, true, 0, 0],
[6, 1, :stat, "AGILITY +19 (repeatable)", 347, 19, true, 0, 0], [7, 1, :stat, "LUCK +25 (repeatable)", 347, 25, true, 0, 0],
[4, 3, :stat, "SKILL +4 (repeatable)", 347, 4, true, 0, 0]],
#17 Alliah
17 => [[91, 2], [92, 1], [196, 1, :variable, "Alliah's Clarity restores 15 MP.", 343],[105, 2, :state, "+2% HP Regen."],[68, 2, :state, "Immune to common poisons and venoms."],
[25, -1, :variable, "Lowers karma by 1.", 347, 1],
[0, 2, :stat, "HEALTH +100 (repeatable)", 347, 40, true, 0, 0], [1, 1, :stat, "MAGIA +40 (repeatable)", 347, 40, true, 0, 0],
[3, 1, :stat, "DEFENSE +10 (repeatable)", 347, 10, true, 0, 0], [2, 1, :stat, "ATTACK +15 (repeatable)", 347, 15, true, 0, 0],
[6, 1, :stat, "AGILITY +13 (repeatable)", 347, 13, true, 0, 0], [7, 1, :stat, "LUCK +15 (repeatable)", 347, 15, true, 0, 0],
[4, 1, :stat, "SKILL +1 (repeatable)", 347, 1, true, 0, 0], [5, 1, :stat, "AFFINITY +2 (repeatable)", 347, 2, true, 0, 0]],
#20 Celeste
20 => [[59, 4], [92, 2], [191, 2], [109, 1], [68, 2, :state, "Immune to common poisons and venoms."], [105, 2, :state, "+2% HP Regen."],
[125, 2, :state, "Immune to stat debuffs."],
[0, 3, :stat, "HEALTH +150 (repeatable)", 347, 10, true, 0, 0], [1, 1, :stat, "MAGIA +35 (repeatable)", 347, 35, true, 0, 0],
[3, 1, :stat, "DEFENSE +2 (repeatable)", 347, 2, true, 0, 0], [2, 1, :stat, "ATTACK +3 (repeatable)", 347, 3, true, 0, 0],
[6, 1, :stat, "AGILITY +14 (repeatable)", 347, 14, true, 0, 0], [7, 1, :stat, "LUCK +8 (repeatable)", 347, 8, true, 0, 0],
[4, 1, :stat, "SKILL +2 (repeatable)", 347, 2, true, 0, 0], [5, 1, :stat, "AFFINITY +1 (repeatable)", 347, 1, true, 0, 0]],
#21 Nuala
21 => [[6, 2], [10, 3], [92, 2], [11, 2], [28, 1], [29, 1], [44, 1], [97, 1], [123, 4, :state, "DEF stat is doubled."], [125, 4, :state, "Immune to stat debuffs."]],
}
# Actor's Skill Shop Group Background
# Place background graphic in Graphics/Pictures folder
ShopBackground = {
# actor_id => "Filename",
# Set "" into filename to disable background.
1 => "nl-scare2",
2 => "nl-scare2",
3 => "nl-scare2",
4 => "nl-scare2",
5 => "nl-scare2",
6 => "nl-scare2",
7 => "nl-scare2",
8 => "nl-scare2",
9 => "nl-scare2",
10 => "nl-scare2",
11 => "nl-scare2",
12 => "nl-scare2",
13 => "nl-scare2",
14 => "nl-scare2",
15 => "nl-scare2",
16 => "nl-scare2",
17 => "nl-scare2",
18 => "nl-scare2",
19 => "nl-scare2",
20 => "nl-scare2",
21 => "nl-scare2",
}
end
end
#==============================================================================
# ** Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Addd Skill Points
#--------------------------------------------------------------------------
def add_skill_points(actor_id, points)
$game_actors[actor_id].skill_point += points
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Variables
#--------------------------------------------------------------------------
attr_accessor :skill_point
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
alias :yazik_lsk_setup :setup
def setup(actor_id)
yazik_lsk_setup(actor_id)
if @level > 1
sp = Yazik::Actor::StartingSkillPoint
@skill_point = sp + Yazik::Actor::SkillPointGain * (@level - 1)
else
@skill_point = Yazik::Actor::StartingSkillPoint
end
end
#--------------------------------------------------------------------------
# * Level Up
#--------------------------------------------------------------------------
alias :lune_sk_level_up :level_up
def level_up
lune_sk_level_up
@skill_point += Yazik::Actor::SkillPointGain
end
end
#==============================================================================
# ** Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def insert_command(index, name, symbol, enabled = true, ext = nil)
cmd = {:name=>name, :symbol=>symbol, :enabled=>enabled, :ext=>ext}
@list.insert(index, cmd)
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
alias :yazik_lst_make_command_list :make_command_list
def make_command_list
yazik_lst_make_command_list
cmd_index = Yazik::SkillShop::CommandIndex
cmd_name = Yazik::SkillShop::CommandName
insert_command(cmd_index, cmd_name, :skill_tree, main_commands_enabled)
end
end
#==============================================================================
# ** Window_ShopSkill
#==============================================================================
class Window_ShopSkill < Window_SkillList
#--------------------------------------------------------------------------
# * Variáveis públicas
#--------------------------------------------------------------------------
attr_reader :skill_tree
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, w, h)
super(x, y, w, h)
self.opacity = Yazik::SkillShop::ShopWindow_Opacity
self.contents_opacity = 255
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return Yazik::SkillShop::ShopWindow_Column
end
#--------------------------------------------------------------------------
# * Include in Skill List?
#--------------------------------------------------------------------------
def include?(item)
return item
end
#--------------------------------------------------------------------------
# * Display Skill in Active State?
#--------------------------------------------------------------------------
def enable?(item)
return item
end
#--------------------------------------------------------------------------
# * Create Skill List
#--------------------------------------------------------------------------
def make_item_list
if @actor
skills = []
db = Yazik::SkillShop::ShopDatabase[@actor.id]
for i in 0...db.size
if db[i][2] == :state
state_id = db[i][0]
if @actor.state_addable?(state_id)
state = $data_states[state_id]
skills.push(state)
end
else
skill = $data_skills[db[i][0]]
if @actor.added_skill_types.include?(skill.stype_id)
skills.push(skill)
end
end
end
@data = skills
else
@data = []
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
data = @data[index]
if data
rect = item_rect(index)
rect.width -= 4
enabled = data.class == RPG::Skill ? @actor.skill_learn?(data) : @actor.state?(data.id)
draw_skill_icon(index, data, rect.x, rect.y, enabled)
draw_skill_price(rect, index)
end
end
#--------------------------------------------------------------------------
# * Draw Item Name
#--------------------------------------------------------------------------
def draw_skill_icon(index, item, x, y, enabled)
return unless item
draw_icon(item.icon_index, x, y, enabled)
end
#--------------------------------------------------------------------------
# * Draw Skill Price
#--------------------------------------------------------------------------
def draw_skill_price(rect, index)
db = Yazik::SkillShop::ShopDatabase[@actor.id]
price = db[index][1]
draw_text_ex(rect.x + 24 + 4, rect.y, price.to_s + Yazik::SkillShop::SkillPointSymbol)
end
end
#==============================================================================
# ** Window_ShopHelp
#==============================================================================
class Window_ShopHelp < Window_Help
#--------------------------------------------------------------------------
# * Inicialização
#--------------------------------------------------------------------------
def initialize(line_number = Yazik::SkillShop::HelpWindow_LineNumber)
super(line_number)
self.opacity = Yazik::SkillShop::HelpWindow_Opacity
self.contents_opacity = 255
@item_name = ''
end
#--------------------------------------------------------------------------
# * Clear
#--------------------------------------------------------------------------
alias :yazik_ss_clear :clear
def clear
@item_name = ''
yazik_ss_clear
end
#--------------------------------------------------------------------------
# * Set Name
#--------------------------------------------------------------------------
def set_name(item_name)
if item_name != @item_name
@item_name = item_name
refresh
end
end
#--------------------------------------------------------------------------
# * Set Item
#--------------------------------------------------------------------------
alias :yazik_ss_set_item :set_item
def set_item(item)
set_name(item ? item.name : "")
if SceneManager.scene_is?(Scene_SkillShop)
if (item) and (item.class == RPG::State)
set_text(SceneManager.scene.database_item[3])
return
end
end
yazik_ss_set_item(item)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
change_color(system_color)
draw_text(4, 0, contents_width - 4, line_height, @item_name)
change_color(normal_color)
draw_text_ex(4, line_height, @text)
reset_font_settings
end
end
#==============================================================================
# ** Window_TotalSkillPoint
#==============================================================================
class Window_TotalSkillPoint < Window_Base
#--------------------------------------------------------------------------
# * Inicialização
#--------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, Graphics.height)
@actor = nil
self.z = 200
self.opacity = 0
self.contents_opacity = 255
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Atualização
#--------------------------------------------------------------------------
def refresh
contents.clear
tx = Yazik::SkillShop::TotalSkillPointText_X
ty = Yazik::SkillShop::TotalSkillPointText_Y
txt = Yazik::SkillShop::TotalSkillPointText + @actor.skill_point.to_s
draw_text_ex(tx, ty, txt)
end
end
#==============================================================================
# ** Window_ShopConfirm
#==============================================================================
class Window_ShopConfirm < Window_Command
#--------------------------------------------------------------------------
# * Inicialização do objeto
#--------------------------------------------------------------------------
def initialize
super(0, 0)
self.z = 9999
self.x = (Graphics.width - self.width) / 2
self.y = (Graphics.height - self.height) / 2
self.openness = 0
end
#--------------------------------------------------------------------------
# * Aquisição da largura da janela
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# * Criação da lista de comandos
#--------------------------------------------------------------------------
def make_command_list
add_main_commands
end
#--------------------------------------------------------------------------
# * Get Alignment
#--------------------------------------------------------------------------
def alignment
return 1
end
#--------------------------------------------------------------------------
# * Adição dos comandos principais
#--------------------------------------------------------------------------
def add_main_commands
add_command(Yazik::SkillShop::VocabBuy, :confirm_buy, true)
add_command(Yazik::SkillShop::VocabCancel, :confirm_cancel, true)
end
end
#==============================================================================
# ** Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
alias :yazik_lst_create_command_window :create_command_window
def create_command_window
yazik_lst_create_command_window
@command_window.set_handler(:skill_tree, method(:command_personal))
end
#--------------------------------------------------------------------------
# * [OK] Personal Command
#--------------------------------------------------------------------------
alias :yazik_lst_on_personal_ok :on_personal_ok
def on_personal_ok
case @command_window.current_symbol
when :skill_tree
SceneManager.call(Scene_SkillShop)
else
yazik_lst_on_personal_ok
end
end
end
#==============================================================================
# ** Scene_SkillShop
#==============================================================================
class Scene_SkillShop < Scene_Skill
#--------------------------------------------------------------------------
# * Inicialização do processo
#--------------------------------------------------------------------------
def start
super
# create_actor_window
create_info_window
create_confirm_window
create_background_image
end
#--------------------------------------------------------------------------
# * Remove Default Scene_Skill Windows
#--------------------------------------------------------------------------
def create_command_window; end
def create_status_window; end
#--------------------------------------------------------------------------
# * Create Help Window
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_ShopHelp.new(4)
@help_window.viewport = @viewport
@help_window.x = 0
@help_window.y = Graphics.height - @help_window.height
end
#--------------------------------------------------------------------------
# * Create Item Window
#--------------------------------------------------------------------------
def create_item_window
wx = Yazik::SkillShop::ShopWindow_X
wy = Yazik::SkillShop::ShopWindow_Y
ww = Yazik::SkillShop::ShopWindow_Width
wh = Yazik::SkillShop::ShopWindow_Height
@item_window = Window_ShopSkill.new(wx, wy, ww, wh)
@item_window.actor = @actor
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:return_scene))
@item_window.select(0)
@item_window.activate
end
#--------------------------------------------------------------------------
# * Item [OK]
#--------------------------------------------------------------------------
def on_item_ok
is_skill = item.class == RPG::Skill
is_state = item.class == RPG::State
if (is_skill and [email protected]_learn?(item)) or (is_state and [email protected]?(item.id))
db = Yazik::SkillShop::ShopDatabase[@actor.id]
price = db[@item_window.index][1]
if price <= $game_actors[@actor.id].skill_point
@confirm_window.open
@confirm_window.select(0)
@confirm_window.activate
else
Sound.play_buzzer
@item_window.activate
end
else
@item_window.activate
end
end
#--------------------------------------------------------------------------
# * Criação das Janelas
#--------------------------------------------------------------------------
def create_confirm_window
@confirm_window = Window_ShopConfirm.new
@confirm_window.set_handler(:confirm_buy, method(:buy_item))
@confirm_window.set_handler(:confirm_cancel, method(:activate_shop_window))
@confirm_window.set_handler(:cancel, method(:activate_shop_window))
@confirm_window.close
@confirm_window.deactivate
end
#--------------------------------------------------------------------------
# * Create Info Window
#--------------------------------------------------------------------------
def create_info_window
@info_window = Window_TotalSkillPoint.new
@info_window.actor = @actor
end
#--------------------------------------------------------------------------
# * Activate Shop Window
#--------------------------------------------------------------------------
def activate_shop_window
@confirm_window.close
@confirm_window.deactivate
@item_window.refresh
@item_window.activate
end
#--------------------------------------------------------------------------
# * Create Background Image
#--------------------------------------------------------------------------
def create_background_image
bg = Yazik::SkillShop::ShopBackground[@actor.id]
@background_image = Sprite.new
@background_image.bitmap = Cache.picture(bg)
end
#--------------------------------------------------------------------------
# * Database Item
#--------------------------------------------------------------------------
def database_item
return Yazik::SkillShop::ShopDatabase[@actor.id][@item_window.index]
end
#--------------------------------------------------------------------------
# * Buy Skill or State
#--------------------------------------------------------------------------
def buy_item
db = Yazik::SkillShop::ShopDatabase[@actor.id]
if db[@item_window.index][2] == :state
state_id = db[@item_window.index][0]
state_price = db[@item_window.index][1]
$game_actors[@actor.id].skill_point -= state_price
$game_actors[@actor.id].add_state(state_id)
else
skill_id = db[@item_window.index][0]
skill_price = db[@item_window.index][1]
$game_actors[@actor.id].skill_point -= skill_price
$game_actors[@actor.id].learn_skill(skill_id)
end
@info_window.refresh
@confirm_window.close
@confirm_window.deactivate
@item_window.refresh
@item_window.activate
end
#--------------------------------------------------------------------------
# * Terminate
#--------------------------------------------------------------------------
def terminate
super
@background_image.bitmap.dispose
@background_image.dispose
end
end
At the moment, it is for the character Azar that there are problems (line 113), with the skills that can be purchased not aligning with their icons. The player reports are saying that purchased skills instead give you the previous one, and I doubt it is only a problem for her.
Any help would be appreciated.
It was a mistake you made.
You assigned a skill to the player that they can't learn.
Skill 90 is skills type, actor 9 can't learn skills type, changing it to magias lets it work.
Oh, thanks. Didn't know it could have consequences like that.
Original thread: https://forums.rpgmakerweb.com/threads/yazik-shop-upgrade.149220/