Is there a quick hack or snippet to chain the ID number of weapons or armor to a list of common events and allow "use item" to function with equipment?
Like in Final Fantasy I, you could use certain high level weapons as magical items, like a staff of healing.
I suppose you could run a common event (parallel process) that checks if you have the weapon in question that says:
Conditional Branch: [ACTOR] is weapon/armor [THE THING] equipped
Add Skill: [ACTOR] - [THE SKILL YOU WANT]
Else
Remove Skill [ACTOR] - [THE SKILL YOU WANT]
End Branch
and just have the skill you want do your healing or whatever. Should probably work, and you could just edit and add for more actors and weapons/armors. No script needed.
At least, I think that's what you wanted. VX or XP?
XP, though I'm aware common events sitting in the background slow down the processing. That's a clever way of putting in new skills though. I think I'll have to watch some FFI play on youtube to get an idea of how it's set up. I just have a feeling a snippet or hash can handle it.
I downloaded an emulator and checked out FF4, and they use item by starting at the item menu, and then pressing 'up' while in combat. This loads a tiny one line window with your two hand held options, presumably shield and sword (which reminds me to add an option for people so shield can become second weapon/double attack/parry), they have left-right window selectability and when "confirmed" go to target menu, like any other item. This sounds like a fun challenge.
So I created this piece
#===================================================================
# Battle Item: Weapon & Shield as Magic Devices
#===================================================================
class Battle_Item < Window_Selectable
def initialize
super(0, 0, 640, 96)
self.contents = Bitmap.new(width-32, height-32)
self.back_opacity = 160
refresh
self.index = 0
@column_max = 2
self.active = true
end #end initialize
def refresh
self.contents.clear
@item_max = 2
#-----------------------------------------------------------------
#Place holder for getting actor weapons & shield
#-----------------------------------------------------------------
temp_wpn = "weapon"
temp_shd = "shield"
self.contents.font.color = text_color(7)
self.contents.draw_text(0, 0, 200, 32, temp_shd.to_s)
self.contents.draw_text(256, 0, 200, 32, temp_shd.to_s)
end #end refresh
#-----------------------------------------------------------------
# * Cursor Rectangle Update
#-----------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
x = @index * 42 -4
y = -4
self.cursor_rect.set(x, y+4, 96, 32)
end
end
end #end Battle Item
as a template holder, but I haven't figured out how to integrate it with RPG Maker's Native Window_Item and Scene_Item. I'm not sure where to stick this stuff
@battle_item=Battle_Item.new
@battle_item.z=300
@battle_item.active = false
@battle_item.visible = false
So I can get it to appear when pressing the "UP" arrow key while in item menu during battle.
Quote from: shintashi on February 25, 2011, 12:57:09 AM
XP, though I'm aware common events sitting in the background slow down the processing.
Barely. They are very, VERY useful and don't slow it down much. If you set it to a trigger switch then it will only slow down certain bits, yeah?
I ain't a scripter either so don't ask me.
So I got the window to appear without blinking out of existence by sticking
@battle_item=Battle_Item.new
@battle_item.z=300
@battle_item.active = false
@battle_item.visible = true
below " if $game_temp.in_battle" in Window_Item.
The Following is the result.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg560.imageshack.us%2Fimg560%2F5609%2Fbattleitem.jpg&hash=c6617ab88e5298c43c9f84302821b90a1f797259)
Clearly I didn't do this right, but I can't figure out where the space/enter/arrow input keys are being accessed in window_item when active. I tried putting
p "woot"
after about a dozen different sections of
$game_system.se_play($data_system.cancel_se)
inside Scene_Item, but nothing popped up. In other words, I don't know in which class the input keys for items accessed in battle are coming from, I just know they aren't coming from Scene_Item or Window_Item
Window_Item and your Battle_Item are both sub-classes of Window_Selectable, so the input keys should be the same as the ones for Window_Selectable, unless they are changed anywhere within those class.
Quote from: cozziekuns on February 27, 2011, 05:15:51 PM
Window_Item and your Battle_Item are both sub-classes of Window_Selectable, so the input keys should be the same as the ones for Window_Selectable, unless they are changed anywhere within those class.
How can I change the the input keys in Window_Item so that
if in battle...
and
if the current indexed item is in the top row (presumably 0,1, or 2)
then
load Battle_Item, make Battle_Item visible, make Battle_Item active
and
deactivate Item_Window's Active status and Index?
Basically, if these things can be done, then the whole idea can work.
I dumped this stuff in the bottom of Window Item:
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
x = 4 + @index % 2 * (288 + 32)
y = @index / 2 * 32
self.cursor_rect.set(x, y, self.width / @column_max - 32, 32)
end
if $game_temp.in_battle
if @index == 0
if Input.repeat?(Input::UP)
self.active = false
self.index = -1
@help_window.visible = false
@battle_item=Battle_Item.new
@battle_item.z=300 #was 300
@battle_item.active = true
@battle_item.visible = true
@battle_item.index = 1
end #end up command
end #end if index = 0
end #end if in battle
end #end update cursor rect
And it worked pretty smoothly so far. I found I could get the help thing to STFU by moving it above my code and turning self.active off, and generally changing the self index to zero. Right now I'm trying to move my cursor from the Window_Item to the Battle_Item with no success so far - the left right keys do not apparently respond in the Battle_Item menu.
I've upgraded the Window_Item data, so the Up/Down arrows allow free movement between the two menus (Battle Item and Regular Item) as follows:
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
x = 4 + @index % 2 * (288 + 32)
y = @index / 2 * 32
self.cursor_rect.set(x, y, self.width / @column_max - 32, 32)
end
if $game_temp.in_battle
if @index == 0
if Input.trigger?(Input::UP)
self.active = false
self.index = -1
@help_window.visible = false
@battle_item=Battle_Item.new
@battle_item.z=300 #was 300
@battle_item.active = true
@battle_item.visible = true
end #end up command
end #end if index = 0
#exit battle item menu:
if Input.trigger?(Input::DOWN)
if @index == -1
self.active = true
@help_window.visible = true
self.index = 0
@battle_item.active = false
@battle_item.visible = false
end
end
end #end if in battle
end #end update cursor rect
Right now, I still don't know how to get the left-right arrows to work in the Battle Item Menu.
Left right arrows function:
if self.index == -1
if Input.repeat?(Input::RIGHT)
@battle_item.index = 1
end
if Input.repeat?(Input::LEFT)
@battle_item.index = 0
end
end #end Self.index -1
Now I have to figure out how to hijack the space bar command to act like an item effect and run my snippets.
Update of Scripts
#===================================================================
# Battle Item: Weapon & Shield as Magic Devices
#===================================================================
class Battle_Item < Window_Selectable
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width-32, height-32)
self.back_opacity = 160
refresh
self.index = 0 #may crash pt3, was -1
@column_max = 2
self.active = true
end #end initialize
def refresh
self.contents.clear
@item_max = 2
#-----------------------------------------------------------------
#Place holder for getting actor weapons & shield
#-----------------------------------------------------------------
# for "$store", c.f. line 2629 in SDK III
a = $game_actors[$store].weapon_id
b = $game_actors[$store].armor1_id
temp_wpn = $data_weapons[a].name
temp_shd = $data_armors[b].name
self.contents.font.color = text_color(7)
self.contents.draw_text(0, 0, 200, 32, temp_wpn.to_s)
self.contents.draw_text(328, 0, 200, 32, temp_shd.to_s)
end #end refresh
#-----------------------------------------------------------------
# * Cursor Rectangle Update
#-----------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
x = @index * 328 -8
y = -4
self.cursor_rect.set(x, y+4, 256, 32)
end
end #end cursor rectangle
end #end Battle Item
and in "Go to Command Input for Next Actor", with help from Coz, i added "$store" since I needed to immediately be able to rapidly change out what the current actor was.
#--------------------------------------------------------------------------
# * Go to Command Input for Next Actor
#--------------------------------------------------------------------------
def phase3_next_actor
# Loop
begin
# Actor blink effect OFF
if @active_battler != nil
@active_battler.blink = false
end
# If last actor
if @actor_index == $game_party.actors.size-1
# Start main phase
start_phase4
return
end
# Advance actor index
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
$store = @active_battler.id #shintashi added for Battle_Item
# Once more if actor refuses command input
end until @active_battler.inputable?
# Set up actor command window
phase3_setup_command_window
end
When I figure out how to get the space bar wired up, it should be complete, and i'll post a step by step. I'm thinking it will be 3 or four total edits to classes with only one of them being an entirely new class.
I figured out 'no item' is item # 0, not 'nil', so if your actors have no item in their equipment slot and you call to it, it will crash. By putting in an if ___ != 0 ? stuff: "" you can get around that by passing "" to 0 item commands.
Ive solved some of the problems, i got the thing to cast common events, although Id prefer to cast "skills", but I haven't figure that out yet. In the mean time, I've figured out where the buzzers are located - apparently around lines 2000+ of SDK III. I also fixed a bug that caused it to load improperly when switching back and forth between actors. Right now I'm trying to figure out how to force it to go on to the next actor's actions in battle, i.e., confirm that my current button mashing is my declared action.
Alternatively, if I could get it in the "use item on ally/enemy" loop, that would be just as useful. Right now it's set up so you could attack a monster a million times in the space between actions, rather than as your action. While that's got cool implications for Time stop attacks, as a glitch, it's kind of useless and broken.
so I tossed this:
end_item_select
in my SDK edit, and it closes now - no more infinite between the actions action, but instead, it kicks back to the same actor, so its an action, but it doesn't jump to the next actor. I have a feeling even if I have it go to the next actor, i could theoretically cancel the next actor's action and go back and do it again, creating another broken loop. I'm going to see if I can get to that point first.
Well I was right about the backward cancel loop of doom.
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : item selection)
#--------------------------------------------------------------------------
def update_phase3_item_select
# Make item window visible
@item_window.visible = true
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End item selection
end_item_select
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 it can't be used
unless $game_party.item_can_use?(@item.id)
# Play buzzer SE
#====================================================
# Battle item Module - by shintashi
#====================================================
a = $game_actors[$store].weapon_id
b = $game_actors[$store].armor1_id
if $wpn_or_armor == -1
$game_system.se_play($data_system.buzzer_se)
end
if $wpn_or_armor == 0
if a != 0
$game_system.se_play($data_system.decision_se)
end_item_select
phase3_next_actor
else
$game_system.se_play($data_system.buzzer_se)
end
end
if $wpn_or_armor == 1
if b != 0
$game_system.se_play($data_system.decision_se)
end_item_select
phase3_next_actor
else
$game_system.se_play($data_system.buzzer_se)
end
end
#=====================================================
# End Battle Item Module
#=====================================================
# $game_system.se_play($data_system.buzzer_se)
return
end
I figure its because the 'action' of the item is instantiated during the action selection, instead of during the actor's "do [action you have chosen]" turn. This is of course because the logic flow of turn based combat with initiative is
#1 declare what each actor is going to do
#2 organize the actors and enemies in order of fastest to slowest
#3 commit to actions fastest first, then 2nd fastest, 3rd fastest... 2nd slowest, and finally slowest...
I goofed and put #3 actions in the #1 slot. If I had a "skip actor this round" option, it would solve my problem.
so this stuff
#--------------------------------------------------------------------------
# * Make Item Action Results
#--------------------------------------------------------------------------
def make_item_action_result
# Get item
@item = $data_items[@active_battler.current_action.item_id]
# If unable to use due to items running out
unless $game_party.item_can_use?(@item.id)
# Shift to step 1
@phase4_step = 1
return
end
# If consumable
if @item.consumable
# Decrease used item by 1
$game_party.lose_item(@item.id, 1)
end
# Display item name on help window
@help_window.set_text(@item.name, 1)
# Set animation ID
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
# Set common event ID
@common_event_id = @item.common_event_id
# Decide on target
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
# Set targeted battlers
set_target_battlers(@item.scope)
# Apply item effect
for target in @target_battlers
target.item_effect(@item)
end
end
is where I need to get to, and considering I'm starting with something like
#====================================================
# Battle item Module - by shintashi
#====================================================
a = $game_actors[$store].weapon_id
b = $game_actors[$store].armor1_id
#----------------------------------------------------
# Definition of $tactics
# $tactics = 0: start enemy select
# $tactics = 1: start actor select
# $tactics = 2: start other select
#----------------------------------------------------
if $wpn_or_armor == -1
$game_system.se_play($data_system.buzzer_se)
end
if $wpn_or_armor == 0
if a != 0
$game_system.se_play($data_system.decision_se)
if $tactics == 0
start_enemy_select
elsif $tactics == 1
start_actor_select
else
start_enemy_select
end_item_select
p @enemy_arrow.index
#phase3_next_actor
end
else
$game_system.se_play($data_system.buzzer_se)
end
end
if $wpn_or_armor == 1
if b != 0
$game_system.se_play($data_system.decision_se)
end_item_select
phase3_next_actor
else
$game_system.se_play($data_system.buzzer_se)
end
end
#=====================================================
# End Battle Item Module
#=====================================================
I just need to figure out the stuff between
"start_enemy_select" and "make_item_action_result" and somehow make use if " @enemy_arrow.index" to get there, then my code
common_event = $data_common_events[1]
$game_system.battle_interpreter.setup(common_event.list, 0)
Can be executed and I can make Thor's Hammer shoot lightning bolts... once per action. (right now it can be cheated and used repeatedly)
well I figured out how to get one effect to go off per 'action' and it plays the common event accordingly, but I'm running into some minor problems:
1. how do you use the help window to display text of your own choosing in battle?
2. how you do lock out the actor's battle menu while selecting an enemy to target?
3. is there a way to select 'all enemies' as a default instead of 'select enemy'?
These three things would make the whole effect much smoother, and I'll be working on them soon, although #1 seems impossible.
Quote from: shintashi on March 16, 2011, 03:54:11 AM
well I figured out how to get one effect to go off per 'action' and it plays the common event accordingly, but I'm running into some minor problems:
1. how do you use the help window to display text of your own choosing in battle?
2. how you do lock out the actor's battle menu while selecting an enemy to target?
3. is there a way to select 'all enemies' as a default instead of 'select enemy'?
These three things would make the whole effect much smoother, and I'll be working on them soon, although #1 seems impossible.
Well I think I figured out a work around using UMS to create a fake window status that auto closes and centers the text. #2 and #3 are still eluding me, since there appears to be no select all enemies. There is a "select random" enemy but that's not what I'm going for. Also the arrows up and down still have the potential to unconfirm the effect which is really dumb, and I can't seem to close my actor action. If I could at least 'lock' it in place so up and down don't work once the item effect has been chosen (i.e. goes to target enemy), the flow would be much smoother.
Edit: I swapped the order of
else
end_item_select
start_enemy_select
and now it automatically goes to the enemy select without the option of accidentally selecting "guard" or some such nonsense. That only leaves the issue of variations of "start enemy select".
Meanwhile, I'm going to try to establish a second item with special effects, then a second item category (i.e. shields and such). It may be possible to rig a common event so that a "shield" slot used as a sword produces a second attack, or 'double' attacks.
I'm also interested in producing the FFIV Ninja technique "dart" which allows you to throw your weapons for sick amounts of damage, but consumes them in the process.
I got multiple items finally working in the weapon slot, and am now getting ready to test for items in the shield slot, but while working on the 'defender' effect, I noticed a serious problem with common events: it assumes you know what actor is using the common event. for example, if I wanted to give an actor a new skill temporarily and then take it away later, I would have to know if they were actor 1, 2, 3, or 4. Otherwise some other actor ends up using the effect. Likewise for forced attacks to duplicate second attacks. I also noticed 'deal damage' doesn't work multiple times. I may have to see if I can "call common event" with a deal damage multiple times.
part I - New Class: Battle Item
[spoiler]
#===================================================================
# Battle Item: Weapon & Shield as Magic Devices
#===================================================================
class Battle_Item < Window_Selectable
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width-32, height-32)
self.back_opacity = 160
refresh
self.index = 0
@column_max = 2
self.active = true
end #end initialize
def refresh
self.contents.clear
@item_max = 2
#-----------------------------------------------------------------
#Place holder for getting actor weapons & shield
#-----------------------------------------------------------------
# for "$store", c.f. line 2629 in SDK III
a = $game_actors[$store].weapon_id
b = $game_actors[$store].armor1_id
temp_wpn = a != 0 ? $data_weapons[a].name : ""
temp_shd = b != 0 ? $data_armors[b].name : ""
self.contents.font.color = text_color(7)
self.contents.draw_text(0, 0, 200, 32, temp_wpn.to_s)
self.contents.draw_text(328, 0, 200, 32, temp_shd.to_s)
end #end refresh
#-----------------------------------------------------------------
# * Cursor Rectangle Update
#-----------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
x = @index * 328 -8
y = -4
self.cursor_rect.set(x, y+4, 256, 32)
end
end #end cursor rectangle
end #end Battle Item
[/spoiler]
Part II edited Window Item
[spoiler]
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416) #128 was 64
@column_max = 2
refresh
self.index = 0
$wpn_or_armor = -1
$tactics = 2 #this is the actor/enemy/commmon event targeting system
# If in battle, move window to center of screen
# and make it semi-transparent
if $game_temp.in_battle
self.y = 64
self.height = 256 #was 256
self.back_opacity = 160
end
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
# Also add weapons and items if outside of battle
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
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 # end refresh
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 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 + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
x = 4 + @index % 2 * (288 + 32)
y = @index / 2 * 32
self.cursor_rect.set(x, y, self.width / @column_max - 32, 32)
end
if $game_temp.in_battle
if @index == 0
#ENTER battle item menu:
if Input.trigger?(Input::UP)
self.active = false
self.index = -1
$wpn_or_armor = 0
@help_window.visible = false
@battle_item=Battle_Item.new
@battle_item.z=300 #was 300
@battle_item.active = true
@battle_item.visible = true
end #end up command
end #end if index = 0
if self.index == -1
#===================================================
# Commands while in Battle_Item Go here
#===================================================
if Input.repeat?(Input::RIGHT)
@battle_item.index = 1
$wpn_or_armor = 1
end
if Input.repeat?(Input::LEFT)
@battle_item.index = 0
$wpn_or_armor = 0
end
if Input.trigger?(32) #spacebar
a = $game_actors[$store].weapon_id
b = $game_actors[$store].armor1_id
if @battle_item.index == 0
if a != 0
#do nothing
@battle_item.active = false
@battle_item.visible = false
end
end
if @battle_item.index == 1
if b != 0
#do nothing
@battle_item.active = false
@battle_item.visible = false
end
end
end
#===================================================
# End Battle_Item Commands
#===================================================
end #end Self.index -1
#EXIT battle item menu:
if Input.trigger?(Input::DOWN)
if @index == -1
self.active = true
@help_window.visible = true
self.index = 0
$wpn_or_armor = -1
@battle_item.active = false
@battle_item.visible = false
end
end
end #end if in battle
end #end update cursor rect
end #end Window Item
[/spoiler]
part III - Scene Item Edits
[spoiler]
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs item screen processing.
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make help window, item window
@help_window = Window_Help.new
@item_window = Window_Item.new
# Associate help window
@item_window.help_window = @help_window
# Make target window (set to invisible / inactive)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# 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
@help_window.dispose
@item_window.dispose
@target_window.dispose
@battle_item.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@help_window.update
@item_window.update
@target_window.update
@battle_item.update
# If item window is active: call update_item
if @item_window.active
update_item
return
end
# If target window is active: call update_target
if @target_window.active
update_target
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)
# Switch to menu screen
$scene = Scene_Menu.new(0)
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 $game_party.item_can_use?(@item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is an ally
if @item.scope >= 3
# Activate target window
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Set cursor position to effect scope (single / all)
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# If effect scope is other than an ally
else
# If command event ID is valid
if @item.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @item.common_event_id
# Play item use SE
$game_system.se_play(@item.menu_se)
# If consumable
if @item.consumable
# Decrease used items by 1
$game_party.lose_item(@item.id, 1)
# Draw item window item
@item_window.draw_item(@item_window.index)
end
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If unable to use because items ran out
unless $game_party.item_can_use?(@item.id)
# Remake item window contents
@item_window.refresh
end
# Erase target window
@item_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If items are used up
if $game_party.item_number(@item.id) == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply item effects to entire party
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# If single target
if @target_window.index >= 0
# Apply item use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# If an item was used
if used
# Play item use SE
$game_system.se_play(@item.menu_se)
# If consumable
if @item.consumable
# Decrease used items by 1
$game_party.lose_item(@item.id, 1)
# Redraw item window item
@item_window.draw_item(@item_window.index)
end
# Remake target window contents
@target_window.refresh
# If all party members are dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If common event ID is valid
if @item.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @item.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If item wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
[/spoiler]
Next Post is SDK III edits.
Part IV - SDK III Edits
[spoiler]
#--------------------------------------------------------------------------
# * Go to Command Input for Next Actor
#--------------------------------------------------------------------------
def phase3_next_actor
# Loop
begin
# Actor blink effect OFF
if @active_battler != nil
@active_battler.blink = false
end
# If last actor
if @actor_index == $game_party.actors.size-1
# Start main phase
start_phase4
return
end
# Advance actor index
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
$store = @active_battler.id #shintashi added for Battle_Item
# Once more if actor refuses command input
end until @active_battler.inputable?
# Set up actor command window
phase3_setup_command_window
end
[/spoiler]
Part V - SDK III Edits
[spoiler]
#--------------------------------------------------------------------------
# * Go to Command Input of Previous Actor
#--------------------------------------------------------------------------
def phase3_prior_actor
# Loop
begin
# Actor blink effect OFF
if @active_battler != nil
@active_battler.blink = false
end
# If first actor
if @actor_index == 0
# Start party command phase
start_phase2
return
end
# Return to actor index
@actor_index -= 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
$store = @active_battler.id #shintashi added for Battle_Item
# Once more if actor refuses command input
end until @active_battler.inputable?
# Set up actor command window
phase3_setup_command_window
end
[/spoiler]
Part VI - SDK III Edits
[spoiler]
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : item selection)
#--------------------------------------------------------------------------
def update_phase3_item_select
# Make item window visible
@item_window.visible = true
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End item selection
end_item_select
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 it can't be used
unless $game_party.item_can_use?(@item.id)
# Play buzzer SE
#====================================================
# Battle item Module - by shintashi
#====================================================
a = $game_actors[$store].weapon_id
b = $game_actors[$store].armor1_id
#----------------------------------------------------
# Definition of $tactics
# $tactics = 0: start enemy select
# $tactics = 1: start actor select
# $tactics = 2: start other select
#----------------------------------------------------
if $wpn_or_armor == -1
$game_system.se_play($data_system.buzzer_se)
end
if $wpn_or_armor == 0 #using weapon
if a != 0
$game_system.se_play($data_system.decision_se)
if $tactics == 0
end_item_select
start_enemy_select
elsif $tactics == 1
end_item_select
start_actor_select
else #tactics 2+, currently the default.
end_item_select
start_enemy_select
end
else
$game_system.se_play($data_system.buzzer_se)
end
end
if $wpn_or_armor == 1 #using armor
if b != 0
$game_system.se_play($data_system.decision_se)
end_item_select
start_enemy_select
else
$game_system.se_play($data_system.buzzer_se)
end
end
#=====================================================
# End Battle Item Module
#=====================================================
# $game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.item_id = @item.id
# Make item window invisible
@item_window.visible = false
@item_window.active = false
# If effect scope is single enemy
if @item.scope == 1
# Start enemy selection
start_enemy_select
# If effect scope is single ally
elsif @item.scope == 3 or @item.scope == 5
# Start actor selection
start_actor_select
# If effect scope is not single
else
# End item selection
end_item_select
# Go to command input for next actor
phase3_next_actor
end
return
end
end
[/spoiler]
Part VII - SDK III Edits
[spoiler]
#--------------------------------------------------------------------------
# * Make Item Action Results
#--------------------------------------------------------------------------
def make_item_action_result
# Get item
@item = $data_items[@active_battler.current_action.item_id]
# If unable to use due to items running out
unless $game_party.item_can_use?(@item.id)
# Shift to step 1
@phase4_step = 1
#=======================================================
if $wpn_or_armor == 0
a = $game_actors[@active_battler.id].weapon_id
# Light Sword FX
if a == 9
common_event = $data_common_events[1]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
# Zenif's Hammer FX
if a == 25
common_event = $data_common_events[2]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
end
if $wpn_or_armor == 1 #will follow model of weapons
b = $game_actors[@active_battler.id].armor1_id
# Twin Blade (Shield Alt) FX
if b == 4
$stora = @active_battler.id
common_event = $data_common_events[3]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
end
# shintashi editing this line for FX
#========================================================
return
end
# If consumable
if @item.consumable
# Decrease used item by 1
$game_party.lose_item(@item.id, 1)
end
# Display item name on help window
@help_window.set_text(@item.name, 1)
# Set animation ID
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
# Set common event ID
$storc = @active_battler.id
@common_event_id = @item.common_event_id
# Decide on target
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
# Set targeted battlers
set_target_battlers(@item.scope)
# Apply item effect
for target in @target_battlers
target.item_effect(@item)
end
end
[/spoiler]
As far as I know, this seems to work.
about the only thing it doesn't do right is targeting:
im trying to have target actor, target all actors, target enemy, and target all enemies as four options, but so far, I've only got it to loop through target enemy with success.