Jump to content
Rpg²S Forum
  • 0

Ruba nella lista dei comandi principali


Valentino
 Share

Question

Salve a tutti! Avrei bisogno di un aiuto con lo script di Atoa che permette di rubare ai nemici... Praticamente lo script collega ruba a una skill ma io vorrei poterla mettere come comando nella lista principale.

Per adesso sono riuscito a creare il comando nuovo per il personaggio che deve avere ruba ma non riesco a collegare lo script con il comando... C'è qualcuno che è in grado di aiutarmi?

Lo script Ruba:

 

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

========

# Add-On: Skill Steal

# by Atoa

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

# This script was modified to work with SBS XP, it allows you to create

# skill that steal items/gold from enemies

#

# To add the steal effect to an skill, go to the skill extension and add

# the extensio "STEAL".

#

# To add itens to enemies, go to the "module Atoa"

# Enemy_Steal[iD] = {"ITEM" => RATE}

#

# ID = enemy ID

# ITEM = Type and Item ID. must be always show as "xY"

# where:

# x = type of the item

# Y = item ID/amount of money

# x must be "a" for armors, "w" for weapons, "i" for items, "g" for money

# PORCENTAGEM = % of getting the item, an value bettwen 0 and 100, can be decimal

# Ex.: 5.4 = 5,4% rate

#

# Ex.: Enemy_Steal[15] = {"w6" => 22.5, "g900" => 12}

# That means the Enemy ID 15 (Enemy_Drops[15])

# Have 22,5% of droping the Weapon ID 6 ("w6" => 22.5)

# and have 12% of droping 900 Gold ("g900" => 12)

#

# You can only steal one item per steal attempt.

#

# You can add as many items you want to an enemy

#

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

 

 

module Atoa

Enemy_Steal = [] # don't remove/change this line

 

# Enemies can be stolen more than one time?

Multi_Steal = false

# If false, you can steal an enemy only once per battle, even if it

# have more items (like the old FF's)

 

# Base Success Rate

Steal_Rate = 50

# Even if the rate is 100%, that dont't grants 100% of chance of getting an item

# this value changes with the difference bettwen, the user and target's AGI, and

# it still necessary to verify the drop rate of each item

 

# Message if the target has no items

No_Item = "Non possiede niente!"

 

# Message if the steal attempt fail

Steal_Fail = "Mancato!"

 

# Message of Item steal sucess. {item} is the name of the item, you must add it

# to the message, or the item name won't be shown

Steal_Item = "Hai rubato {item}!"

# E.g:

# "Stole {item}" - Stole Potion

# "{item} gained" - Potion gained

 

# Message of gold steal sucess. {gold} is the amount of gold, you must add it

# to the message, or the amount stole won't be shown

# {unit} the money unit, use it only if you want

Steal_Gold = "Hai rubato {gold}{unit}!"

# Exemplos:

# "Stole {gold}{unit}" - Stole 500G

# "Stole {gold} coins" - Stole 500 coins

 

# Add here the enemies ID and the items they have

# Enemy_Steal[Enemy_ID] = {"ITEM" => RATE}

Enemy_Steal[1] = {"g15" => 50}

Enemy_Steal[2] = {"i1" => 22.5, "g9" => 40, "g23" => 20}

Enemy_Steal[3] = {"g21" => 22.5, "g25" => 22.5, "i1" => 12}

Enemy_Steal[4] = {"g83" => 33.2, "g42" => 22.5, "i79" => 12}

Enemy_Steal[5] = {"g75" => 33.2, "g27" => 22.5, "i80" => 21}

Enemy_Steal[6] = {"g120" => 33.2, "g89" => 22.5, "i81" => 19}

Enemy_Steal[7] = {}

Enemy_Steal[8] = {}

Enemy_Steal[9] = {}

Enemy_Steal[10] = {"g352" => 32.2, "g465" => 22.5, "a17" => 34}

Enemy_Steal[11] = {"g352" => 32.2, "g465" => 22.5, "a17" => 12}

Enemy_Steal[12] = {"g212" => 45.2, "g6" => 9, "i82" => 4}

 

end

 

 

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

# RPG::Skill

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

class RPG::Skill

alias atoa_steal_extension extension

def extension

case @id

when 187

return ["STEAL"]

# Add here the skills IDs and the extension of them

end

atoa_steal_extension

end

end

 

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

# Game_Battler

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

class Game_Battler

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

include Atoa

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

def stole_item_set(user)

@steal_flag = true

steal_success = rand(100) < (Steal_Rate + self.steal_attempt) * user.agi / self.agi

self.steal_attempt += 1

return false unless steal_success

return nil if self.steal_items == nil or self.steal_items == []

item_stole = []

self.steal_items.each do |item, steal_rate|

item = item.split('')

if item[0] == "i"

item = item.join

item.slice!("i")

item_stole.push($data_items[item.to_i]) if rand(1000) < (steal_rate * 10).to_i

elsif item[0] == "a"

item = item.join

item.slice!("a")

item_stole.push($data_armors[item.to_i]) if rand(1000) < (steal_rate * 10).to_i

elsif item[0] == "w"

item = item.join

item.slice!("w")

item_stole.push($data_weapons[item.to_i]) if rand(1000) < (steal_rate * 10).to_i

elsif item[0] == "g"

item = item.join

item.slice!("g")

item_stole.push(item.to_i) if rand(1000) < (steal_rate * 10).to_i

end

end

return false if item_stole == []

self.steal_attempt = 0

stole_item_index = rand(item_stole.size)

item_to_steal = [item_stole[stole_item_index]]

self.steal_items.delete_at(stole_item_index) if Multi_Steal

self.steal_items = [] unless Multi_Steal

return item_to_steal

end

end

 

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

# Game_Enemy

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

class Game_Enemy < Game_Battler

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

include Atoa

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

attr_accessor :steal_items

attr_accessor :steal_flag

attr_accessor :stole_item

attr_accessor :steal_attempt

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

alias initialize_atoa_steal_enemy initialize

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

def initialize(troop_id, member_index)

initialize_atoa_steal_enemy(troop_id, member_index)

@steal_items = Enemy_Steal[@enemy_id].to_a

@stole_item = nil

@steal_flag = false

@steal_attempt = 0

end

end

 

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

# Scene_Battle

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

class Scene_Battle

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

include Atoa

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

def pop_steal_help(obj)

@help_window.set_text(obj, 1)

count = 0

loop do

update_basic

count += 1

break @help_window.visible = false if (Input.trigger?(Input::C) and count > 30) or count == 80

end

end

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

alias atoa_steal_pop_damage pop_damage

def pop_damage(target, obj, action)

if obj.is_a?(RPG::Skill) && obj.extension.include?("STEAL") && ((obj.atk_f == 0 &&

obj.str_f == 0 && obj.dex_f == 0 && obj.agi_f == 0 && obj.int_f == 0) or obj.power == 0)

target.missed = target.evaded = false

target.damage = ""

end

atoa_steal_pop_damage(target, obj, action)

end

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

alias atoa_steal_action_end action_end

def action_end

if @active_battler.current_action.kind == 1

obj = $data_skills[@active_battler.current_action.skill_id]

if obj.extension.include?("STEAL")

@target_battlers.each do |battler|

stole_item = battler.stole_item_set(@active_battler) and battler.is_a?(Game_Enemy)

if battler.is_a?(Game_Enemy) && battler.steal_flag

item_stole = stole_item[0] unless stole_item == false or stole_item == nil

item_stole = nil if stole_item == nil

item_stole = false if stole_item == false or battler.damage == "Errou!"

case item_stole

when nil

text = No_Item

when false

text = Steal_Fail

when Numeric

$game_party.gain_gold(item_stole)

text = Steal_Gold.dup

text.gsub!(/{gold}/i) {"#{item_stole}"}

text.gsub!(/{unit}/i) {"#{$data_system.words.gold}"}

else

case item_stole

when RPG::Item

$game_party.gain_item(item_stole.id, 1)

text = Steal_Item.dup

text.gsub!(/{item}/i) {"#{item_stole.name}"}

when RPG::Weapon

$game_party.gain_weapon(item_stole.id, 1)

text = Steal_Item.dup

text.gsub!(/{item}/i) {"#{item_stole.name}"}

when RPG::Armor

$game_party.gain_armor(item_stole.id, 1)

text = Steal_Item.dup

text.gsub!(/{item}/i) {"#{item_stole.name}"}

end

end

pop_steal_help(text)

battler.steal_flag = false

wait(3)

end

end

end

end

atoa_steal_action_end

end

end

 

 

Lo script per il comando di un solo personaggio (nel caso avesse bisogno di modifiche)

 

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

========

# Add-On: Individual Battle Commands

# by Charlie Lee

# Modified by Atoa, to work with SBS XP

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

# This script was modified to work with SBS XP, but it configuration

# didn't change

#

# Create an new attribute named "CMD *command*", where *command* is the

# name of the command, then add this attribute to an skill.

# EG.:

# "CMD White Magic" will create the command "White Magic"

#

# Remember to add only one command attribute to an skill, and add an

# command attribute to *ALL* skills, or actors won't be able to use it in

# battle.

#

# IMPORTANTE: If you using the Add-On "AABS (ATB System)", put this script

# *bellow* the ATB Add-On.

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

 

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

# Game_Actor

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

class Game_Actor

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

attr_accessor :individual_commands

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

alias ibc_setup_n01 setup

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

def setup(actor_id)

ibc_setup_n01(actor_id)

@individual_commands=[]

end

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

def refresh_commands

@individual_commands=[]

for i in 0...@skills.size

skill = $data_skills[@skills]

if skill != nil

for elem_id in skill.element_set

if $data_system.elements[elem_id][0,3]=="CMD"

if !@individual_commands.include?($data_system.elements[elem_id])

@individual_commands.

push(String.new($data_system.elements[elem_id]))

end

end

end

end

end

for c in @individual_commands

c[0,4]=""

end

end

end

 

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

# Game_Party

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

class Game_Party

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

alias ibc_add_actor_n01 add_actor

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

def add_actor(actor_id)

ibc_add_actor_n01(actor_id)

actor = $game_actors[actor_id]

actor.refresh_commands

end

end

 

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

# Scene_Battle (Parte 3)

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

class Scene_Battle

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

include N01

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

alias ibc_phase3_setup_command_window_n01 phase3_setup_command_window

alias ibc_start_skill_select_n01 start_skill_select

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

def phase3_setup_command_window

ibc_phase3_setup_command_window_n01

@update_skills_commands = Window_Skill2.new(@active_battler)

@update_skills_commands.refresh

@update_skills_commands.update

@update_skills_commands.dispose

@active_battler.refresh_commands

s1 = $data_system.words.attack

s2 = $data_system.words.skill

s3 = $data_system.words.guard

s4 = $data_system.words.item

s5 = @escape_name if @escape_type == 0

if @active_battler.id == 4

s6 = "Ruba"

else

end

if @active_battler.id == 4

@individual_battle_commands=[s1, s6]+@active_battler.individual_commands+[s3, s4]

else

@individual_battle_commands=[s1]+@active_battler.individual_commands+[s3, s4]

end

@individual_battle_commands=[s1]+@active_battler.individual_commands+[s3, s4, s5] if @escape_type == 0

@actor_command_window.dispose

@actor_command_window = Window_Command_IBC.new(160, @individual_battle_commands)

comand_size = (@individual_battle_commands.size >= 5 ? 5 : @individual_battle_commands.size)

@actor_command_window.x = 470

@actor_command_window.opacity = 200

@actor_command_window.y = 247 - 24 * comand_size

@actor_command_window.z = 2001

@actor_command_window.back_opacity = COMMAND_OPACITY

@actor_command_window.index = 0

@actor_command_window.active = true

@actor_command_window.visible = true

@active_battler_window.refresh(@active_battler)

@active_battler_window.y = 184 - 24 * comand_size

@active_battler_window.z = 2002

@active_battler_window.visible = true

end

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

def update_phase3_basic_command

if Input.trigger?(Input::B)

$game_system.se_play($data_system.cancel_se)

phase3_prior_actor

return

end

if Input.trigger?(Input::C)

case @actor_command_window.commands[@actor_command_window.index]

when $data_system.words.attack

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.kind = 0

@active_battler.current_action.basic = 0

start_enemy_select

when $data_system.words.guard

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.kind = 0

@active_battler.current_action.basic = 1

phase3_next_actor

when $data_system.words.item

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.kind = 2

start_item_select

when "Ruba"

$game_system.se_play($data_system.decision_se)

start_enemy_select

when @escape_name

if $game_temp.battle_can_escape == false

$game_system.se_play($data_system.buzzer_se)

return

end

@active_battler_window.visible = false

@actor_command_window.visible = false

for actor in $game_party.actors

actor.atb = 0

actor.cast_action = nil

end

wait(3)

$game_system.se_play($data_system.decision_se)

update_phase2_escape

end

if @active_battler != nil and @active_battler.individual_commands.

include?(@actor_command_window.commands[@actor_command_window.index])

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.kind = 1

@individual_battle_commands_skill_category=@actor_command_window.commands[@actor

_command_window.index]

start_skill_select

end

end

end

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

def start_skill_select

ibc_start_skill_select_n01

@skill_window.dispose

@skill_window = Window_Skill2.new(@active_battler,@individual_battle_commands_skill_category)

@skill_window.help_window = @help_window

end

end

 

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

# * Window_Skill

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

class Window_Skill2 < Window_Selectable

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

def initialize(actor, skill_command_type = "")

if skill_command_type != ""

@skill_command_element_id = $data_system.elements.

index("CMD " + skill_command_type)

else

@skill_command_element_id = -1

end

super(0, 128, 640, 352)

@actor = actor

@column_max = 2

refresh

self.index = 0

if $game_temp.in_battle

self.windowskin = RPG::Cache.windowskin("gameover")

self.y = 320

self.height = 160

self.z = 2000

self.back_opacity = 160

end

end

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

def refresh

if self.contents != nil

self.contents.dispose

self.contents = nil

end

@data = []

for i in 0...@actor.skills.size

skill = $data_skills[@actor.skills]

if skill != nil

if @skill_command_element_id == -1 or skill.element_set.include?(

@skill_command_element_id)

@data.push(skill)

end

end

end

@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

end

 

 

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

# Window_Command

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

class Window_Command_IBC < Window_Selectable

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

attr_accessor :commands

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

def initialize(width, commands)

comand_size = (commands.size >= 5 ? 192 : commands.size * 32 + 32)

super(0, 0, width, comand_size)

@item_max = commands.size

@commands = commands

self.contents = Bitmap.new(width - 32, @item_max * 32)

refresh

self.index = 0

end

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

def refresh

self.contents.clear

for i in 0...@item_max

draw_item(i, normal_color)

end

end

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

def draw_item(index, color)

self.contents.font.color = color

rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)

self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))

self.contents.draw_text(rect, @commands[index])

end

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

def disable_item(index)

draw_item(index, disabled_color)

end

end

 

Grazie davvero a chiunque mi aiuti! :sisi:

Edited by Valentino
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...