ok so Ive been working on this - had a power outage today during programming so I'm kinda :facepalm:
inside Scene Battle 3 i made a new menu option (mentioned elsewhere during my font size problems) shown here:
if Input.trigger?(Input::C)
# Branch by actor command window cursor position
case @actor_command_window.index
when 0 # attack
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# Start enemy selection
start_enemy_select
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 1
# Start skill selection
start_skill_select
when 2 # guard
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# Go to command input for next actor
phase3_next_actor
when 3 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 2
# Start item selection
start_item_select
#===================================================================
# *** Strategy2 ***
when 4 # strategy
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
#make strategy bars
make_triangle
make_bars
start_strategy
#-------------------------------------------------------------------
And then I took a bunch of pictures and assembled them with this Problematic script:
The main script here:
#==============================================================================
# ** Scene Battle Strategy
#------------------------------------------------------------------------------
# This class performs battle strategy screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start Strategy (make sure @battler is_an_actor? = true)
#--------------------------------------------------------------------------
def start_strategy
#load background window overlay with actor's name
#load arrow key readers
#@actor_command_window.visible = false
#@actor_command_window.active = false
@triangle_step = 0
update_triangle
end
#--------------------------------------------------------------------------
# * Make Triangle (circle, x_rotate, y_rotate, z_rotate, triangle lid)
#--------------------------------------------------------------------------
def make_triangle
y_mod = 25
# triangle background
@sprite8 = Sprite.new
@sprite8.z, @sprite8.x, @sprite8.y = 115, 477, 280 + y_mod
@sprite8.angle = 0 #keep 0
@sprite8.bitmap = RPG::Cache.picture ("tri_circle")
# get actor
@active_battler = $game_party.actors[@actor_index]
# x_rotate
@sprite9 = Sprite.new
@sprite9.z, @sprite9.x, @sprite9.y = 116, 555, 306 + y_mod
@sprite9.angle = 0 + @active_battler.spd
@sprite9.ox = 6
@sprite9.oy = 6
@sprite9.bitmap = RPG::Cache.picture ("x_rotate")
# y_rotate
@sprite10 = Sprite.new
@sprite10.z, @sprite10.x, @sprite10.y = 117, 503 +6, 381 + y_mod
@sprite10.angle = 0 + @active_battler.uke
@sprite10.ox = 6
@sprite10.oy = 47
@sprite10.bitmap = RPG::Cache.picture ("y_rotate")
#z_rotate
@sprite11 = Sprite.new
@sprite11.z, @sprite11.x, @sprite11.y = 118, 525 +69, 383 + y_mod
@sprite11.angle = 0 + @active_battler.agg
@sprite11.ox = 69
@sprite11.oy = 52
@sprite11.bitmap = RPG::Cache.picture ("z_rotate")
#tri_cover
@sprite12 = Sprite.new
@sprite12.z, @sprite12.x, @sprite12.y = 119, 497, 290 + y_mod
@sprite12.angle = 0 #keep 0
@sprite12.bitmap = RPG::Cache.picture ("tri_cover")
end
#--------------------------------------------------------------------------
# * Make Bars (initiative, semeru, brutality, arrowR, arrowG, arrowB)
#--------------------------------------------------------------------------
def make_bars
# get actor
@active_battler = $game_party.actors[@actor_index]
# @active_battler.name
abs = @active_battler.spd
abu = @active_battler.uke
aba = @active_battler.agg
y_mod = 25
# initiative <=> patience (impulsive/intercept)
@sprite1 = Sprite.new
@sprite1.z, @sprite1.x, @sprite1.y = 120, 260, 274 + y_mod
@sprite1.angle = 0
@sprite1.bitmap = RPG::Cache.picture ("yellow_blue")
# semeru <=> ukeru (forceful/receiving)
@sprite2 = Sprite.new
@sprite2.z, @sprite2.x, @sprite2.y = 121, 261, 348 + y_mod
@sprite2.angle = 0
@sprite2.bitmap = RPG::Cache.picture ("indigo_green")
# brutality <=> finesse (bloody/accurate)
@sprite3 = Sprite.new
@sprite3.z, @sprite3.x, @sprite3.y = 122, 260, 376 + y_mod
@sprite3.angle = 0
@sprite3.bitmap = RPG::Cache.picture ("red_orange")
#arrowB
@sprite4 = Sprite.new
@sprite4.z, @sprite4.x, @sprite4.y = 123, 346 + abs, 334 + y_mod
@sprite4.angle = 0
@sprite4.bitmap = RPG::Cache.picture ("arrowB")
#arrowG
@sprite5 = Sprite.new
@sprite5.z, @sprite5.x, @sprite5.y = 123, 346 + abu, 362 + y_mod
@sprite5.angle = 0
@sprite5.bitmap = RPG::Cache.picture ("arrowG")
#arrowR
@sprite6 = Sprite.new
@sprite6.z, @sprite6.x, @sprite6.y = 124, 346 + aba, 391 + y_mod
@sprite6.angle = 0
@sprite6.bitmap = RPG::Cache.picture ("arrowR")
#black rectangle status display
@sprite7 = Sprite.new
@sprite7.z, @sprite7.x, @sprite7.y = 125, 260, 402 + y_mod
@sprite7.angle = 0
@sprite7.bitmap = RPG::Cache.picture ("black_rectangle")
#you need to stick the +/- 1-10 + text. over black_rectangle
# may need a Window_BlackText to make it happen.
end
#--------------------------------------------------------------------------
# * Frame Update (triangle lines and bar arrows move when updated)
#--------------------------------------------------------------------------
#probably an index loop starting with a case = 1, ++ with up/down
def update_triangle
case @triangle_step
when 1
update_triangle_step1
when 2
update_triangle_step2
when 3
update_triangle_step3
end
end
#--------------------------------------------------------------------------
# * Arrows Verticle: UP & DOWN
#--------------------------------------------------------------------------
def arrows_verticle
if Input.repeat?(Input::UP) and @triangle_step > 1
$game_system.se_play($data_system.cursor_se)
@triangle_step -= 1
refresh
end
if Input.repeat?(Input::DOWN) and @triangle_step < 3
$game_system.se_play($data_system.cursor_se)
@triangle_step += 1
refresh
end
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 1)
#--------------------------------------------------------------------------
def update_triangle_step1
#changes @active_battler.spd with left/right
arrows_verticle #may want this in refresh
#define active battler
@active_battler = $game_party.actors[@actor_index]
if Input.repeat?(Input::LEFT) and @active_battler.spd > -10
$game_system.se_play($data_system.cursor_se)
@active_battler.spd -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @active_battler.spd < 10
$game_system.se_play($data_system.cursor_se)
@active_battler.spd += 1
refresh
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
# make_strategy_result
#p "yosh!"
end
# if you backspace, you want to reset "strategy" to temp values.
# this means you need a "temp" container
# i think the temp container-back space option is the hardest part...
#refresh display => probably could become a "refresh" def
#C button to confirm all three bars info
#if C button, then makebar/maketri/update tri
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 2)
#--------------------------------------------------------------------------
def update_triangle_step2
#changes @active_battler.uke with left/right
arrows_verticle
#define active battler
@active_battler = $game_party.actors[@actor_index]
if Input.repeat?(Input::LEFT) and @active_battler.uke > -10
$game_system.se_play($data_system.cursor_se)
@active_battler.uke -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @active_battler.uke < 10
$game_system.se_play($data_system.cursor_se)
@active_battler.uke += 1
refresh
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
make_strategy_result
end
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 3)
#--------------------------------------------------------------------------
def update_triangle_step3
#changes @active_battler.agg with left/right
arrows_verticle
#define active battler
@active_battler = $game_party.actors[@actor_index]
if Input.repeat?(Input::LEFT) and @active_battler.agg > -10
$game_system.se_play($data_system.cursor_se)
@active_battler.agg -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @active_battler.agg < 10
$game_system.se_play($data_system.cursor_se)
@active_battler.agg += 1
refresh
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
make_strategy_result
end
end
#--------------------------------------------------------------------------
# * Refresh - may cause interference: alt: "strategy_refresh"
#--------------------------------------------------------------------------
def refresh # may crash
make_bars
make_triangle
update_triangle
end
#--------------------------------------------------------------------------
# * Make Strategy Results (Game Battler: attr accessor(s) for @actor)
#--------------------------------------------------------------------------
def make_strategy_result
#lock values in place
# this def is a result of the C button from "update_triangle_step1-3"
#dispose of these windows and bitmaps (may crash)
@sprite1.dispose
@sprite2.dispose
@sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
@sprite7.dispose
@sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
@sprite12.dispose
# Go to command input for next actor
phase3_next_actor
end
end
Here's a screen shot of what it displays so far, in the lower right hand corner,
(http://img59.imageshack.us/img59/9050/bsttest.png)
the gray arrows are supposed to move side to side when using left/right, but nothing is happening. I'm not sure if I need to do a "loop", or if my update is wrong, or something else. I'm also trying to use arrow keys to change a variable, instead of "index", which might be a real problem.
I think you haven't included the update_triangle method in the battle scene's update method. If I remember correctly, Scene_Battle#update is something like this:
def update
case @phase
when 1
update_phase1
when 2
update_phase2
.
.
.
end
and each phase's update method will have it's respective steps. You have to include your "update_triangle" method in the update method of the phase you're doing this, like update_phase3. For example, in update_phase3:
def updte_phase3
if @triangle_step > 0
update_triangle
return
end
# regular phase 3 update stuff
end
Of course, once you're done with your "triangle steps", set @triangle_step to -1.
I tried the update method, but the keys aren't really responding after the strategy bars load.
I think the culprit is somehow in this:
def start_strategy
#load background window overlay with actor's name
#load arrow key readers
#@actor_command_window.visible = false
#@actor_command_window.active = false
@triangle_step = 0
update_triangle
end
When I set @triangle_step = 1, it jumps straight to the "C Button" confirm command, which shuts down all the images and moves to the next actor. Basically, I'm using the C button/spacebar to 'confirm' the satisfaction with the arrangement of the arrows. So in ASCII, it might look like this at start:
[--------------/\----------------]
[--------------/\----------------]
[--------------/\----------------]
and then by using the up/down arrows on the keyboard, I can cycle through which "bar" i have selected, then using left/right keys, can move the arrows on the board left or right. When I'm done, it should look something like this:
[--/\----------------------------]
[--------------------/\----------]
[----------/\--------------------]
At which point I press the C button/spacebar button to confirm. (later I'll use the input:B/escape key to clear changes and go to previous actor)
instead, by pressing the C button to select 'strategy' in my actor_command_window menu, I'm simultaneously pressing the C button to confirm and exit the strategy menu and moving on to the next actor. When I change the code so the Confirm is switched off, however, I realize something even worse:
the arrow keys aren't even being heard in the first place!
After fiddling a bit, I ran into some stack overflows, and then I decided to go for broke and mess around with the "and" part of my input keys. Now much larger portions are working - I even think I saw one of my arrow keys move. This is my progress so far, in case I completely screw it up in my next "fix". - Id rather start again from a half working program than the black screen of dread.
#==============================================================================
# ** Scene Battle Strategy
#------------------------------------------------------------------------------
# This class performs battle strategy screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start Strategy (make sure @battler is_an_actor? = true)
#--------------------------------------------------------------------------
def start_strategy
#load background window overlay with actor's name
#load arrow key readers
#@actor_command_window.visible = false
@actor_command_window.active = false
@triangle_step = 0
update_triangle
end
#--------------------------------------------------------------------------
# * Make Triangle (circle, x_rotate, y_rotate, z_rotate, triangle lid)
#--------------------------------------------------------------------------
def make_triangle
y_mod = 25
# triangle background
@sprite8 = Sprite.new
@sprite8.z, @sprite8.x, @sprite8.y = 115, 477, 280 + y_mod
@sprite8.angle = 0 #keep 0
@sprite8.bitmap = RPG::Cache.picture ("tri_circle")
# get actor
@active_battler = $game_party.actors[@actor_index]
# x_rotate
@sprite9 = Sprite.new
@sprite9.z, @sprite9.x, @sprite9.y = 116, 555, 306 + y_mod
@sprite9.angle = 0 + @active_battler.spd
@sprite9.ox = 6
@sprite9.oy = 6
@sprite9.bitmap = RPG::Cache.picture ("x_rotate")
# y_rotate
@sprite10 = Sprite.new
@sprite10.z, @sprite10.x, @sprite10.y = 117, 503 +6, 381 + y_mod
@sprite10.angle = 0 + @active_battler.uke
@sprite10.ox = 6
@sprite10.oy = 47
@sprite10.bitmap = RPG::Cache.picture ("y_rotate")
#z_rotate
@sprite11 = Sprite.new
@sprite11.z, @sprite11.x, @sprite11.y = 118, 525 +69, 383 + y_mod
@sprite11.angle = 0 + @active_battler.agg
@sprite11.ox = 69
@sprite11.oy = 52
@sprite11.bitmap = RPG::Cache.picture ("z_rotate")
#tri_cover
@sprite12 = Sprite.new
@sprite12.z, @sprite12.x, @sprite12.y = 119, 497, 290 + y_mod
@sprite12.angle = 0 #keep 0
@sprite12.bitmap = RPG::Cache.picture ("tri_cover")
end
#--------------------------------------------------------------------------
# * Make Bars (initiative, semeru, brutality, arrowR, arrowG, arrowB)
#--------------------------------------------------------------------------
def make_bars
# get actor
@active_battler = $game_party.actors[@actor_index]
# @active_battler.name
abs = @active_battler.spd
abu = @active_battler.uke
aba = @active_battler.agg
y_mod = 25
# initiative <=> patience (impulsive/intercept)
@sprite1 = Sprite.new
@sprite1.z, @sprite1.x, @sprite1.y = 120, 260, 274 + y_mod
@sprite1.angle = 0
@sprite1.bitmap = RPG::Cache.picture ("yellow_blue")
# semeru <=> ukeru (forceful/receiving)
@sprite2 = Sprite.new
@sprite2.z, @sprite2.x, @sprite2.y = 121, 261, 348 + y_mod
@sprite2.angle = 0
@sprite2.bitmap = RPG::Cache.picture ("indigo_green")
# brutality <=> finesse (bloody/accurate)
@sprite3 = Sprite.new
@sprite3.z, @sprite3.x, @sprite3.y = 122, 260, 376 + y_mod
@sprite3.angle = 0
@sprite3.bitmap = RPG::Cache.picture ("red_orange")
#arrowB
@sprite4 = Sprite.new
@sprite4.z, @sprite4.x, @sprite4.y = 123, 346 + abs, 334 + y_mod
@sprite4.angle = 0
@sprite4.bitmap = RPG::Cache.picture ("arrowB")
#arrowG
@sprite5 = Sprite.new
@sprite5.z, @sprite5.x, @sprite5.y = 123, 346 + abu, 362 + y_mod
@sprite5.angle = 0
@sprite5.bitmap = RPG::Cache.picture ("arrowG")
#arrowR
@sprite6 = Sprite.new
@sprite6.z, @sprite6.x, @sprite6.y = 124, 346 + aba, 391 + y_mod
@sprite6.angle = 0
@sprite6.bitmap = RPG::Cache.picture ("arrowR")
#black rectangle status display
@sprite7 = Sprite.new
@sprite7.z, @sprite7.x, @sprite7.y = 125, 260, 402 + y_mod
@sprite7.angle = 0
@sprite7.bitmap = RPG::Cache.picture ("black_rectangle")
#you need to stick the +/- 1-10 + text. over black_rectangle
# may need a Window_BlackText to make it happen.
end
#--------------------------------------------------------------------------
# * Frame Update (triangle lines and bar arrows move when updated)
#--------------------------------------------------------------------------
#probably an index loop starting with a case = 1, ++ with up/down
def update_triangle
case @triangle_step
when -1
@triangle_step += 1
when 0
arrows_verticle
when 1
update_triangle_step1
when 2
update_triangle_step2
when 3
update_triangle_step3
end
end
#--------------------------------------------------------------------------
# * Arrows Verticle: UP & DOWN
#--------------------------------------------------------------------------
def arrows_verticle
# if Input.repeat?(Input::UP) and @triangle_step > 1
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@triangle_step -= 1
p @triangle_step
#refresh
end
# if Input.repeat?(Input::DOWN) and @triangle_step < 3
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@triangle_step += 1
p @triangle_step
#refresh
end
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 1)
#--------------------------------------------------------------------------
def update_triangle_step1
#changes @active_battler.spd with left/right
arrows_verticle #may want this in refresh
#define active battler
@active_battler = $game_party.actors[@actor_index]
#if Input.repeat?(Input::LEFT) and @active_battler.spd > -10
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@active_battler.spd -= 1
p @active_battler.spd
refresh
end
#if Input.repeat?(Input::RIGHT) and @active_battler.spd < 10
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@active_battler.spd += 1
p @active_battler.spd
refresh
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
make_strategy_result
#p "yosh!"
end
# if you backspace, you want to reset "strategy" to temp values.
# this means you need a "temp" container
# i think the temp container-back space option is the hardest part...
#refresh display => probably could become a "refresh" def
#C button to confirm all three bars info
#if C button, then makebar/maketri/update tri
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 2)
#--------------------------------------------------------------------------
def update_triangle_step2
#changes @active_battler.uke with left/right
arrows_verticle
#define active battler
@active_battler = $game_party.actors[@actor_index]
if Input.repeat?(Input::LEFT) and @active_battler.uke > -10
$game_system.se_play($data_system.cursor_se)
@active_battler.uke -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @active_battler.uke < 10
$game_system.se_play($data_system.cursor_se)
@active_battler.uke += 1
refresh
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
make_strategy_result
end
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 3)
#--------------------------------------------------------------------------
def update_triangle_step3
#changes @active_battler.agg with left/right
arrows_verticle
#define active battler
@active_battler = $game_party.actors[@actor_index]
if Input.repeat?(Input::LEFT) and @active_battler.agg > -10
$game_system.se_play($data_system.cursor_se)
@active_battler.agg -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @active_battler.agg < 10
$game_system.se_play($data_system.cursor_se)
@active_battler.agg += 1
refresh
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
make_strategy_result
end
end
#--------------------------------------------------------------------------
# * Refresh - may cause interference: alt: "strategy_refresh"
#--------------------------------------------------------------------------
def refresh # may crash
#clear old sprites
@sprite1.dispose
@sprite2.dispose
@sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
@sprite7.dispose
@sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
@sprite12.dispose
#make new sprites
make_bars
make_triangle
arrows_verticle
update_triangle
end
#--------------------------------------------------------------------------
# * Make Strategy Results (Game Battler: attr accessor(s) for @actor)
#--------------------------------------------------------------------------
def make_strategy_result
#lock values in place
# deactivate triangle_update through "@triangle_step"
@triangle_step = -1
#dispose of these windows and bitmaps
@sprite1.dispose
@sprite2.dispose
@sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
@sprite7.dispose
@sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
@sprite12.dispose
# Go to command input for next actor
phase3_next_actor
end
end
running into the stack overflow somehow when pressing the keys, they count as infinity or something and the "dispose" isn't keeping up. if the refresh isn't built into the arrow key commands, nothing happens, so It's at a catch 22. A way to get around the catch 22 for now, is by disabling the C button's real purpose (they now post Mario character names instead) and by sticking in a "print (something)" between the number changes and the refresh, preventing the stack overflow.
Unfortunately, I don't know of a viable alternative to interrupting the "refresh" which is probably being understood as "you are still pressing the key, reload the images" times like a thousand or something?
#==============================================================================
# ** Scene Battle Strategy
#------------------------------------------------------------------------------
# This class performs battle strategy screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start Strategy (make sure @battler is_an_actor? = true)
#--------------------------------------------------------------------------
def start_strategy
#load background window overlay with actor's name
#load arrow key readers
#@actor_command_window.visible = false
@actor_command_window.active = false
@triangle_step = 0
update_triangle
end
#--------------------------------------------------------------------------
# * Make Triangle (circle, x_rotate, y_rotate, z_rotate, triangle lid)
#--------------------------------------------------------------------------
def make_triangle
y_mod = 25
# triangle background
@sprite8 = Sprite.new
@sprite8.z, @sprite8.x, @sprite8.y = 115, 477, 280 + y_mod
@sprite8.angle = 0 #keep 0
@sprite8.bitmap = RPG::Cache.picture ("tri_circle")
# get actor
@active_battler = $game_party.actors[@actor_index]
# x_rotate
@sprite9 = Sprite.new
@sprite9.z, @sprite9.x, @sprite9.y = 116, 555, 306 + y_mod
@sprite9.angle = 0 + (@active_battler.spd * 3)
@sprite9.ox = 6
@sprite9.oy = 6
@sprite9.bitmap = RPG::Cache.picture ("x_rotate")
# y_rotate
@sprite10 = Sprite.new
@sprite10.z, @sprite10.x, @sprite10.y = 117, 503 +6, 381 + y_mod
@sprite10.angle = 0 + (@active_battler.uke * 3)
@sprite10.ox = 6
@sprite10.oy = 47
@sprite10.bitmap = RPG::Cache.picture ("y_rotate")
#z_rotate
@sprite11 = Sprite.new
@sprite11.z, @sprite11.x, @sprite11.y = 118, 525 +69, 383 + y_mod
@sprite11.angle = 0 + (@active_battler.agg * 3)
@sprite11.ox = 69
@sprite11.oy = 52
@sprite11.bitmap = RPG::Cache.picture ("z_rotate")
#tri_cover
@sprite12 = Sprite.new
@sprite12.z, @sprite12.x, @sprite12.y = 119, 497, 290 + y_mod
@sprite12.angle = 0 #keep 0
@sprite12.bitmap = RPG::Cache.picture ("tri_cover")
end
#--------------------------------------------------------------------------
# * Make Bars (initiative, semeru, brutality, arrowR, arrowG, arrowB)
#--------------------------------------------------------------------------
def make_bars
# get actor
@active_battler = $game_party.actors[@actor_index]
# @active_battler.name
abs = 8 * @active_battler.spd
abu = 8 * @active_battler.uke
aba = 8 * @active_battler.agg
y_mod = 25
# initiative <=> patience (impulsive/intercept)
@sprite1 = Sprite.new
@sprite1.z, @sprite1.x, @sprite1.y = 120, 260, 274 + y_mod
@sprite1.angle = 0
@sprite1.bitmap = RPG::Cache.picture ("yellow_blue")
# semeru <=> ukeru (forceful/receiving)
@sprite2 = Sprite.new
@sprite2.z, @sprite2.x, @sprite2.y = 121, 261, 348 + y_mod
@sprite2.angle = 0
@sprite2.bitmap = RPG::Cache.picture ("indigo_green")
# brutality <=> finesse (bloody/accurate)
@sprite3 = Sprite.new
@sprite3.z, @sprite3.x, @sprite3.y = 122, 260, 376 + y_mod
@sprite3.angle = 0
@sprite3.bitmap = RPG::Cache.picture ("red_orange")
#arrowB
@sprite4 = Sprite.new
@sprite4.z, @sprite4.x, @sprite4.y = 123, 346 + abs, 334 + y_mod
@sprite4.angle = 0
@sprite4.bitmap = RPG::Cache.picture ("arrowB")
#arrowG
@sprite5 = Sprite.new
@sprite5.z, @sprite5.x, @sprite5.y = 123, 346 + abu, 362 + y_mod
@sprite5.angle = 0
@sprite5.bitmap = RPG::Cache.picture ("arrowG")
#arrowR
@sprite6 = Sprite.new
@sprite6.z, @sprite6.x, @sprite6.y = 124, 346 + aba, 391 + y_mod
@sprite6.angle = 0
@sprite6.bitmap = RPG::Cache.picture ("arrowR")
#black rectangle status display
@sprite7 = Sprite.new
@sprite7.z, @sprite7.x, @sprite7.y = 125, 260, 402 + y_mod
@sprite7.angle = 0
@sprite7.bitmap = RPG::Cache.picture ("black_rectangle")
#you need to stick the +/- 1-10 + text. over black_rectangle
# may need a Window_BlackText to make it happen.
end
#--------------------------------------------------------------------------
# * Frame Update (triangle lines and bar arrows move when updated)
#--------------------------------------------------------------------------
#probably an index loop starting with a case = 1, ++ with up/down
def update_triangle
case @triangle_step
when -1
@triangle_step += 1
when 0
arrows_verticle
when 1
update_triangle_step1
when 2
update_triangle_step2
when 3
update_triangle_step3
when 4
@triangle_step -= 1
end
end
#--------------------------------------------------------------------------
# * Arrows Verticle: UP & DOWN
#--------------------------------------------------------------------------
def arrows_verticle
# if Input.repeat?(Input::UP) and @triangle_step > 1
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@triangle_step -= 1
p @triangle_step
#refresh
end
# if Input.repeat?(Input::DOWN) and @triangle_step < 3
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@triangle_step += 1
p @triangle_step
#refresh
end
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 1)
#--------------------------------------------------------------------------
def update_triangle_step1
#changes @active_battler.spd with left/right
arrows_verticle #may want this in refresh
#define active battler
@active_battler = $game_party.actors[@actor_index]
#if Input.repeat?(Input::LEFT) and @active_battler.spd > -10
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@active_battler.spd -= 1
p @active_battler.spd
refresh
end
#if Input.repeat?(Input::RIGHT) and @active_battler.spd < 10
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@active_battler.spd += 1
p @active_battler.spd
refresh
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
# make_strategy_result
p "yosh!"
end
# if you backspace, you want to reset "strategy" to temp values.
# this means you need a "temp" container
# i think the temp container-back space option is the hardest part...
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 2)
#--------------------------------------------------------------------------
def update_triangle_step2
#changes @active_battler.uke with left/right
arrows_verticle
#define active battler
@active_battler = $game_party.actors[@actor_index]
#if Input.repeat?(Input::LEFT) and @active_battler.uke > -10
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@active_battler.uke -= 1
p @active_battler.uke
refresh
end
#if Input.repeat?(Input::RIGHT) and @active_battler.uke < 10
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@active_battler.uke += 1
p @active_battler.uke
refresh
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
#make_strategy_result
p "Mario!"
end
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 3)
#--------------------------------------------------------------------------
def update_triangle_step3
#changes @active_battler.agg with left/right
arrows_verticle
#define active battler
@active_battler = $game_party.actors[@actor_index]
#if Input.repeat?(Input::LEFT) and @active_battler.agg > -10
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@active_battler.agg -= 1
p @active_battler.agg
refresh
end
#if Input.repeat?(Input::RIGHT) and @active_battler.agg < 10
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@active_battler.agg += 1
p @active_battler.agg
refresh
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
#make_strategy_result
p "Luigi!"
end
end
#--------------------------------------------------------------------------
# * Refresh - may cause interference: alt: "strategy_refresh"
#--------------------------------------------------------------------------
def refresh # may crash
#clear old sprites
@sprite1.dispose
@sprite2.dispose
@sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
@sprite7.dispose
@sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
@sprite12.dispose
#make new sprites
make_bars
make_triangle
arrows_verticle
update_triangle
end
#--------------------------------------------------------------------------
# * Make Strategy Results (Game Battler: attr accessor(s) for @actor)
#--------------------------------------------------------------------------
def make_strategy_result
#lock values in place
# deactivate triangle_update through "@triangle_step"
@triangle_step = -1
#dispose of these windows and bitmaps
@sprite1.dispose
@sprite2.dispose
@sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
@sprite7.dispose
@sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
@sprite12.dispose
# Go to command input for next actor
phase3_next_actor
end
end
ok so I did some tests. This is what it boils down to:
This works:
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@active_battler.spd -= 1
p @active_battler.spd
refresh
end
this doesn't: (stack overflow)
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@active_battler.spd -= 1
refresh
end
notice all I took out was the "print @active_battler.spd". I could have said print "who wants to be a millionaire?" and it would still work. Now I'm confused.
After your first response for my post, I swear I don't understand a word of what you said ._.
I've scrolled through the code and it's, sorry to say, confusing. I'll tell you what. You explain to me what you want and I'll teach you how to script it. You tried to script this yourself, which shows you are interested in learning. Just explain the system you want as clearly as possible, and we'll make a plan and help you code each part. What do you say?
(Meanwhile, I'll take a closer look at the code.)
Not to mention, your script has a heavy use of pictures we don't have access to. *hint*
ok, I'll do my best to explain:
first, I added a new command called "strategy", at the bottom of the actor command window. Basically this will eventually be the replacement for Guard, since it includes "guard" like actions.
Strategy allows an actor to decide "how" they will fight, by changing their focus in three categories important in battle:
- your sense of timing
- your sense of attacker vs. defender
- your level of rage vs. self control
Timing governs
initiative and patience - the yellow/blue bar. Favoring initiative means you tend to attack first, Favoring patience means you wait for an opening, maximizing criticals. This is a boxing strategy.
attacker/defender are using variants of anime/Martial Art terms
Semeru and Ukeru - the green/indigo bar in the middle. In practice, the 'Uke" is the person who receives the attack, so their defense and preparation to get hit/thrown is maxed out. The "Seme" or attacker is focusing on properly hitting and throwing, so their skill at attacking and stamina to keep up the offense is higher.
rage/self control governs
brutality and finesse - the red/orange bar at the bottom. Angry people tend to throw wild powerful blows, and swing swords a lot harder, but their accuracy sucks. A person with a lot of finesse is accurate, agile, and effective.
A bonus in one category is a penalty in it's opposite. So we are looking at
- Evasion (vs. hit/crit),
- Initiative (going first),
- Critical (dmg multiplier),
- Damage (base dmg),
- Attack (chance to hit),
- and Defense (vs. dmg)
Here's a screen shot of the various bitmaps:
(http://img840.imageshack.us/img840/8528/strategy12.png)
the x_rotate, y_rotate, and z_rotate images are tiny hexagons with long white lines, that then rotate with the hexagons as their origin point over the red space of the tri_circle. The hexagon parts of these three images is concealed with a "lid", called tri_cover.
The arrowR, arrowG, and arrowB represent red, green, and blue, and slide side to side along the three bars. Each of the three parts points at a different part of the triangle. Assembled at start,
here's what the strategy bar & triangle look like when the three attributes are at 0:
(http://img59.imageshack.us/img59/9050/bsttest.png)
and here's what a strategy bar looks like when the three attributes are changed:
(http://img411.imageshack.us/img411/5166/bsttest2.png)
The purpose of the script is to allow the following sequence:
1. load the images in place
2. get the current actor's 3 attributes
class Game_Actor < Game_Battler
attr_accessor :spd # initiative/timing strategy
attr_accessor :uke # uke/seme strategy
attr_accessor :agg # brutal/finesse strategy
def setup(actor_id)
@spd = 0
@uke = 0
@agg = 0
end
#--------------------------------------------------------------------------
# * Calculate SPD - yellow/blue initiative/critical bar
#--------------------------------------------------------------------------
def spd=(spd)
@spd = [[spd, 10].min, -10].max
end
#--------------------------------------------------------------------------
# * Calculate UKE - green/indigo attack/dodge bar
#--------------------------------------------------------------------------
def uke=(uke)
@uke = [[uke, 10].min, -10].max
end
#--------------------------------------------------------------------------
# * Calculate AGG - red/orange damage/evasion bar
#--------------------------------------------------------------------------
def agg=(agg)
@agg = [[agg, 10].min, -10].max
end
end
3. decide which of the three bars you are going to change by pushing UP or DOWN (it might help the player to know which is highlighted if these could be made to glow when active)
4. decide where the arrow is going to be by pushing LEFT or RIGHT repeatedly, to a max of +/- 10
5. hit SPACE BAR (Input C) to confirm
6. hit ESC (Input B) to cancel changes (I haven't added this yet because steps 3,4, and 5 are glitched)
if you want, I can make a demo of the current script on a new project, so all my other changes don't act as a distraction
http://www.2shared.com/file/xdYvTipl/strategy_bar.html
this link should have the demo file (never used this before),
instructions:
1. talk to the goblin north of your position
2. when you activate the goblin event, and go in battle, you'll see "strategy" as a menu option, activate it
3. by pressing UP and DOWN, you'll change your row number, ranging from -1 to 3.
4. Rows that work include 1,2, and 3.
5. when the numbers are on 1, 2, or 3, you may press LEFT or RIGHT to move the arrows.
6. the numbers displaying when pressing LEFT or RIGHT range from -10 to 10.
7. the numbers are reflected in the left-right motion of the arrows, and in the angle change of the white lines in the red triangle.
The problems should be immediately obvious: a print window pops up inbetween each push of LEFT/RIGHT/UP/DOWN keys. Try commenting out one of these print instructions in Scene_Strategy (below Scene_Battle 4), and see what happens.
Found it?
#--------------------------------------------------------------------------
# * Refresh - may cause interference: alt: "strategy_refresh"
#--------------------------------------------------------------------------
def refresh # may crash
#clear old sprites
@sprite1.dispose
@sprite2.dispose
@sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
@sprite7.dispose
@sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
@sprite12.dispose
#make new sprites
make_bars
make_triangle
end
You were calling 'update_triangle' again when the program was already running through 'update_triangle'. Tested: Went to a bar, held down right/left key, no stack error.
EDIT: Hell, I got bored.
#==============================================================================
# ** Scene Battle Strategy
#------------------------------------------------------------------------------
# This class performs battle strategy screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start Strategy (make sure @battler is_an_actor? = true)
#--------------------------------------------------------------------------
def start_strategy
#load background window overlay with actor's name
#load arrow key readers
#@actor_command_window.visible = false
@actor_command_window.active = false
@triangle_step = 1
@spd = @active_battler.spd
@uke = @active_battler.uke
@agg = @active_battler.agg
end
#--------------------------------------------------------------------------
# * Make Triangle (circle, x_rotate, y_rotate, z_rotate, triangle lid)
#--------------------------------------------------------------------------
def make_triangle
y_mod = 25
# triangle background
@sprite8 = Sprite.new
@sprite8.z, @sprite8.x, @sprite8.y = 115, 477, 280 + y_mod
@sprite8.angle = 0 #keep 0
@sprite8.bitmap = RPG::Cache.picture ("tri_circle")
# x_rotate
@sprite9 = Sprite.new
@sprite9.z, @sprite9.x, @sprite9.y = 116, 555, 306 + y_mod
@sprite9.angle = 0 + (@spd * 3)
@sprite9.ox = 6
@sprite9.oy = 6
@sprite9.bitmap = RPG::Cache.picture ("x_rotate")
# y_rotate
@sprite10 = Sprite.new
@sprite10.z, @sprite10.x, @sprite10.y = 117, 503 +6, 381 + y_mod
@sprite10.angle = 0 + (@uke * 3)
@sprite10.ox = 6
@sprite10.oy = 47
@sprite10.bitmap = RPG::Cache.picture ("y_rotate")
#z_rotate
@sprite11 = Sprite.new
@sprite11.z, @sprite11.x, @sprite11.y = 118, 525 +69, 383 + y_mod
@sprite11.angle = 0 + (@agg * 3)
@sprite11.ox = 69
@sprite11.oy = 52
@sprite11.bitmap = RPG::Cache.picture ("z_rotate")
#tri_cover
@sprite12 = Sprite.new
@sprite12.z, @sprite12.x, @sprite12.y = 119, 497, 290 + y_mod
@sprite12.angle = 0 #keep 0
@sprite12.bitmap = RPG::Cache.picture ("tri_cover")
end
#--------------------------------------------------------------------------
# * Make Bars (initiative, semeru, brutality, arrowR, arrowG, arrowB)
#--------------------------------------------------------------------------
def make_bars
# @active_battler.name
abs = 8 * @spd
abu = 8 * @uke
aba = 8 * @agg
y_mod = 25
# initiative <=> patience (impulsive/intercept)
@sprite1 = Sprite.new
@sprite1.z, @sprite1.x, @sprite1.y = 120, 260, 274 + y_mod
@sprite1.angle = 0
@sprite1.bitmap = RPG::Cache.picture ("yellow_blue")
# semeru <=> ukeru (forceful/receiving)
@sprite2 = Sprite.new
@sprite2.z, @sprite2.x, @sprite2.y = 121, 261, 348 + y_mod
@sprite2.angle = 0
@sprite2.bitmap = RPG::Cache.picture ("indigo_green")
# brutality <=> finesse (bloody/accurate)
@sprite3 = Sprite.new
@sprite3.z, @sprite3.x, @sprite3.y = 122, 260, 376 + y_mod
@sprite3.angle = 0
@sprite3.bitmap = RPG::Cache.picture ("red_orange")
#arrowB
@sprite4 = Sprite.new
@sprite4.z, @sprite4.x, @sprite4.y = 123, 346 + abs, 334 + y_mod
@sprite4.angle = 0
@sprite4.bitmap = RPG::Cache.picture ("arrowB")
#arrowG
@sprite5 = Sprite.new
@sprite5.z, @sprite5.x, @sprite5.y = 123, 346 + abu, 362 + y_mod
@sprite5.angle = 0
@sprite5.bitmap = RPG::Cache.picture ("arrowG")
#arrowR
@sprite6 = Sprite.new
@sprite6.z, @sprite6.x, @sprite6.y = 124, 346 + aba, 391 + y_mod
@sprite6.angle = 0
@sprite6.bitmap = RPG::Cache.picture ("arrowR")
#black rectangle status display
@sprite7 = Sprite.new
@sprite7.z, @sprite7.x, @sprite7.y = 125, 260, 402 + y_mod
@sprite7.angle = 0
@sprite7.bitmap = RPG::Cache.picture ("black_rectangle")
#you need to stick the +/- 1-10 + text. over black_rectangle
# may need a Window_BlackText to make it happen.
end
#--------------------------------------------------------------------------
# * Frame Update (triangle lines and bar arrows move when updated)
#--------------------------------------------------------------------------
#probably an index loop starting with a case = 1, ++ with up/down
def update_triangle
case @triangle_step
when 1
update_triangle_step1
when 2
update_triangle_step2
when 3
update_triangle_step3
end
end
#--------------------------------------------------------------------------
# * Arrows Verticle: UP & DOWN
#--------------------------------------------------------------------------
def arrows_verticle
if Input.repeat?(Input::UP) and @triangle_step > 1
$game_system.se_play($data_system.cursor_se)
@triangle_step -= 1
end
if Input.repeat?(Input::DOWN) and @triangle_step < 3
$game_system.se_play($data_system.cursor_se)
@triangle_step += 1
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
make_strategy_result
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
make_strategy_result(false)
end
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 1)
#--------------------------------------------------------------------------
def update_triangle_step1
if Input.repeat?(Input::LEFT) and @spd > -10
$game_system.se_play($data_system.cursor_se)
@spd -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @spd < 10
$game_system.se_play($data_system.cursor_se)
@spd += 1
refresh
end
#changes @active_battler.spd with left/right
arrows_verticle
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 2)
#--------------------------------------------------------------------------
def update_triangle_step2
if Input.repeat?(Input::LEFT) and @uke > -10
$game_system.se_play($data_system.cursor_se)
@uke -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @uke < 10
$game_system.se_play($data_system.cursor_se)
@uke += 1
refresh
end
#changes @active_battler.uke with left/right
arrows_verticle
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 3)
#--------------------------------------------------------------------------
def update_triangle_step3
if Input.repeat?(Input::LEFT) and @agg > -10
$game_system.se_play($data_system.cursor_se)
@agg -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @agg < 10
$game_system.se_play($data_system.cursor_se)
@agg += 1
refresh
end
#changes @active_battler.agg with left/right
arrows_verticle
end
#--------------------------------------------------------------------------
# * Refresh - may cause interference: alt: "strategy_refresh"
#--------------------------------------------------------------------------
def refresh # may crash
#clear old sprites
@sprite1.dispose
@sprite2.dispose
@sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
@sprite7.dispose
@sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
@sprite12.dispose
#make new sprites
make_bars
make_triangle
end
#--------------------------------------------------------------------------
# * Make Strategy Results (Game Battler: attr accessor(s) for @actor)
#--------------------------------------------------------------------------
def make_strategy_result(save_changes=true)
if save_changes
@active_battler.spd = @spd
@active_battler.uke = @uke
@active_battler.agg = @agg
end
#lock values in place
# deactivate triangle_update through "@triangle_step"
@triangle_step = nil
#dispose of these windows and bitmaps
@sprite1.dispose
@sprite2.dispose
@sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
@sprite7.dispose
@sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
@sprite12.dispose
# Go to command input for next actor
@actor_command_window.active = true
end
end
#==============================================================================
# ** Scene_Battle (part 3)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start Actor Command Phase
#--------------------------------------------------------------------------
def start_phase3
# Shift to phase 3
@phase = 3
# Set actor as unselectable
@actor_index = -1
@active_battler = nil
# Go to command input for next actor
phase3_next_actor
end
#--------------------------------------------------------------------------
# * 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
# Once more if actor refuses command input
end until @active_battler.inputable?
# Set up actor command window
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# * 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
# Once more if actor refuses command input
end until @active_battler.inputable?
# Set up actor command window
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# * Actor Command Window Setup
#--------------------------------------------------------------------------
def phase3_setup_command_window
# Disable party command window
@party_command_window.active = false
@party_command_window.visible = false
# Enable actor command window
@actor_command_window.active = true
@actor_command_window.visible = true
# Set actor command window position
@actor_command_window.x = @actor_index * 160
# Set index to 0
@actor_command_window.index = 0
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase)
#--------------------------------------------------------------------------
def update_phase3
#--------------------------------------------------------------------------
# *** Strategy3 ***
if @triangle_step != nil
update_triangle
return
end
#--------------------------------------------------------------------------
# If enemy arrow is enabled
if @enemy_arrow != nil
update_phase3_enemy_select
# If actor arrow is enabled
elsif @actor_arrow != nil
update_phase3_actor_select
# If skill window is enabled
elsif @skill_window != nil
update_phase3_skill_select
# If item window is enabled
elsif @item_window != nil
update_phase3_item_select
# If actor command window is enabled
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : basic command)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Go to command input for previous actor
phase3_prior_actor
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by actor command window cursor position
case @actor_command_window.index
when 0 # attack
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# Start enemy selection
start_enemy_select
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 1
# Start skill selection
start_skill_select
when 2 # guard
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# Go to command input for next actor
phase3_next_actor
when 3 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 2
# Start item selection
start_item_select
#===================================================================
# *** Strategy2 ***
when 4 # strategy
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
#make strategy bars
start_strategy
make_triangle
make_bars
#-------------------------------------------------------------------
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : skill selection)
#--------------------------------------------------------------------------
def update_phase3_skill_select
# Make skill window visible
@skill_window.visible = true
# Update skill window
@skill_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End skill selection
end_skill_select
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If it can't be used
if @skill == nil or not @active_battler.skill_can_use?(@skill.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)
# Set action
@active_battler.current_action.skill_id = @skill.id
# Make skill window invisible
@skill_window.visible = false
# If effect scope is single enemy
if @skill.scope == 1
# Start enemy selection
start_enemy_select
# If effect scope is single ally
elsif @skill.scope == 3 or @skill.scope == 5
# Start actor selection
start_actor_select
# If effect scope is not single
else
# End skill selection
end_skill_select
# Go to command input for next actor
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : item selection)
#--------------------------------------------------------------------------
def update_phase3_item_select
# Make item window visible
@item_window.visible = true
# Update item window
@item_window.update
# 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
$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
# 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
#--------------------------------------------------------------------------
# * Frame Updat (actor command phase : enemy selection)
#--------------------------------------------------------------------------
def update_phase3_enemy_select
# Update enemy arrow
@enemy_arrow.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End enemy selection
end_enemy_select
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.target_index = @enemy_arrow.index
# End enemy selection
end_enemy_select
# If skill window is showing
if @skill_window != nil
# End skill selection
end_skill_select
end
# If item window is showing
if @item_window != nil
# End item selection
end_item_select
end
# Go to command input for next actor
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : actor selection)
#--------------------------------------------------------------------------
def update_phase3_actor_select
# Update actor arrow
@actor_arrow.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End actor selection
end_actor_select
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.target_index = @actor_arrow.index
# End actor selection
end_actor_select
# If skill window is showing
if @skill_window != nil
# End skill selection
end_skill_select
end
# If item window is showing
if @item_window != nil
# End item selection
end_item_select
end
# Go to command input for next actor
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# * Start Enemy Selection
#--------------------------------------------------------------------------
def start_enemy_select
# Make enemy arrow
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
# Associate help window
@enemy_arrow.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# * End Enemy Selection
#--------------------------------------------------------------------------
def end_enemy_select
# Dispose of enemy arrow
@enemy_arrow.dispose
@enemy_arrow = nil
# If command is [fight]
if @actor_command_window.index == 0
# Enable actor command window
@actor_command_window.active = true
@actor_command_window.visible = true
# Hide help window
@help_window.visible = false
end
end
#--------------------------------------------------------------------------
# * Start Actor Selection
#--------------------------------------------------------------------------
def start_actor_select
# Make actor arrow
@actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
@actor_arrow.index = @actor_index
# Associate help window
@actor_arrow.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# * End Actor Selection
#--------------------------------------------------------------------------
def end_actor_select
# Dispose of actor arrow
@actor_arrow.dispose
@actor_arrow = nil
end
#--------------------------------------------------------------------------
# * Start Skill Selection
#--------------------------------------------------------------------------
def start_skill_select
# Make skill window
@skill_window = Window_Skill.new(@active_battler)
# Associate help window
@skill_window.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# * End Skill Selection
#--------------------------------------------------------------------------
def end_skill_select
# Dispose of skill window
@skill_window.dispose
@skill_window = nil
# Hide help window
@help_window.visible = false
# Enable actor command window
@actor_command_window.active = true
@actor_command_window.visible = true
end
#--------------------------------------------------------------------------
# * Start Item Selection
#--------------------------------------------------------------------------
def start_item_select
# Make item window
@item_window = Window_Item.new
# Associate help window
@item_window.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# * End Item Selection
#--------------------------------------------------------------------------
def end_item_select
# Dispose of item window
@item_window.dispose
@item_window = nil
# Hide help window
@help_window.visible = false
# Enable actor command window
@actor_command_window.active = true
@actor_command_window.visible = true
end
end
You may also delete the set methods you implemented in Game_Actor.
@shintashi: So it's basically an auto-action system. You've explained how the configuration works, and I can help you with that, but what what do you do afterwards? I'm thinking when you confirm a strategy, you call a method which generates an appropriate battle action.
@KK20: Wow! Is it working? *powers up*
@shintashi: try out KK20's edits first.
so far I've tested the "get rid of the extra update" and it worked like a charm. I'll test out the rest of it in the morning when I'm not so bleary eyed. I still have to figure out how to superimpose text on top of that black rectangle bitmap, and probably highlight, glow, or otherwise mess with the alpha of the bars, so people will know which one is hi-lighted.
@Fantasist: Thanks :^_^':
Yeah, everything should work as it is suppose to be. In my last edit, I've practically finished the controls stuff. Pressing "C" confirms and saves the 3 stats. Pressing "B" will cancel any changes made to the stats. Also cleaned up a few things and changed some orders around. @active_battler was constantly being assigned a value when it already has the actor data before you even started up Scene_Strategy.
Will the images be displayed there in the final product? All the text in the background window kinda destroys it. Easy fix would either be move the graphics on top of the enemy graphics or put a dark background behind the graphics to block off the windows behind it (the latter sounds better).
ok, so I fiddled with the new version, and at first it crashed, until I swapped the order of "start_strategy".
from this,
#make strategy bars
make_triangle
make_bars
start_strategy
to this,
#make strategy bars
start_strategy
make_triangle
make_bars
Then it appeared to work. I noticed you have it set up so spacebar confirms it, but you have to use another action to move to the next actor. i.e.
# Go to command input for next actor
@actor_command_window.active = true
For some games, that's going to make sense, for others, the ability to change your strategy in the middle of battle can be as useful as casting a spell buff, so I figured I wanted Characters to be able to change their strategy bars outside of combat (sort of like casting a buff before you go into battle), but then it would count as an action inside battle. That way lazy people would want to figure out a strategy that "works for them" and just leave it that way except in dire circumstances. Hence,
# Go to command input for next actor
@actor_command_window.active = true
phase3_next_actor
KK20 - you are absolutely correct about the 'background' needing to be blanked out or something. I need to also add the numerical values (+/- 1-10) on top of that little black rectangle. Since they would change as you push left and right, I couldn't use a bitmap, it had to be text, but I don't know how to make text appear and disappear outside of a window class, or mess with it's depth/z axis, but I'm going to try that today.
If I can't "blank" the actor stat text in the background, I'll create a 13th image that looks just like my window background but with no text on it.
ok, as can be seen in this screenshot,
(http://img854.imageshack.us/img854/8660/strategytest3.png)
I cleaned up the text in the background.
I did this by creating a blank copy of Window_BattleStatus called "Window_BlankStatus".
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays nothing on the battle screen.
#==============================================================================
class Window_BlankStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
#super(0, 320, 640, 160)
super(240, 320, 400, 160)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# * Refresh *Revised*
#--------------------------------------------------------------------------
def refresh
self.contents.clear
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# Slightly lower opacity level during main phase
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end
Then I changed these parts of Scene Strategy:
beginning:
def start_strategy
#load background window overlay with actor's name
#load arrow key readers
#@actor_command_window.visible = false
@actor_command_window.active = false
@triangle_step = 1
@spd = @active_battler.spd
@uke = @active_battler.uke
@agg = @active_battler.agg
end
end:
# Go to command input for next actor
@actor_command_window.active = true
phase3_next_actor
to these:
beginning:
def start_strategy
#load background window overlay with actor's name
#load arrow key readers
#@actor_command_window.visible = false
@actor_command_window.active = false
@triangle_step = 1
@spd = @active_battler.spd
@uke = @active_battler.uke
@agg = @active_battler.agg
@status_window.dispose
@status_window = Window_BlankStatus.new
end
end:
# Go to command input for next actor
@actor_command_window.active = true
@status_window.dispose
@status_window = Window_BattleStatus.new
phase3_next_actor
Now I just need to figure out how to make the colored strategy bars highlight or glow when selected. :)
Vwalla! Glowiness!
def update_triangle
case @triangle_step
when 1
update_triangle_step1
@sprite1.tone = Tone.new(55, 0, 55, 0)
@sprite2.tone = Tone.new(0, 0, 0, 0)
when 2
update_triangle_step2
@sprite1.tone = Tone.new(0, 0, 0, 0)
@sprite2.tone = Tone.new(100, 0, 100, 0)
@sprite3.tone = Tone.new(0, 0, 0, 0)
when 3
update_triangle_step3
@sprite2.tone = Tone.new(0, 0, 0, 0)
@sprite3.tone = Tone.new(155, 0, 155, 0)
end
end
This basically highlights a given strategy bar, without completely making its previous colors unknown, and changes back to normal when some other bar is selected. I think I'll try to put the numbers in the Blank window if i can, and then mess around with Fantasist's command menu size alteration (which confused me because it looks like a whole new class is needed)
Couple things to address:
1.) The glowing of bars gets funky when holding left or right arrow keys: the bars flash. This is because you are disposing the bar graphic, recreating it, and giving it the tone again. When repeated fast enough, you can see that instance where the tone has not been applied.
2.) If saving the changes of a strategy counts as an action, you will have to change the way your actors save these values. Assuming you are using the way the DBS works, confirming a strategy will then let you choose an action for the next actor. Pressing "B" will send you back to the previous actor you have just set the strategy for. Now the player can make this actor attack. In other words, this actor has just performed two actions when you only want it to do one.
I solved #1:
#==============================================================================
# ** Scene Battle Strategy
#------------------------------------------------------------------------------
# This class performs battle strategy screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start Strategy (make sure @battler is_an_actor? = true)
#--------------------------------------------------------------------------
def start_strategy
#load background window overlay with actor's name
#load arrow key readers
#@actor_command_window.visible = false
@actor_command_window.active = false
@triangle_step = 1
@spd = @active_battler.spd
@uke = @active_battler.uke
@agg = @active_battler.agg
@status_window.dispose
@status_window = Window_BlankStatus.new
end
#--------------------------------------------------------------------------
# * Make Triangle (circle, triangle lid)
#--------------------------------------------------------------------------
def make_triangle
y_mod = 25
# triangle background
@sprite8 = Sprite.new
@sprite8.z, @sprite8.x, @sprite8.y = 115, 477, 280 + y_mod
@sprite8.angle = 0 #keep 0
@sprite8.bitmap = RPG::Cache.picture ("tri_circle")
#Create x_, y_, and z_rotate
make_rotate
#tri_cover
@sprite12 = Sprite.new
@sprite12.z, @sprite12.x, @sprite12.y = 119, 497, 290 + y_mod
@sprite12.angle = 0 #keep 0
@sprite12.bitmap = RPG::Cache.picture ("tri_cover")
end
#--------------------------------------------------------------------------
# * Make Triangle (x_rotate, y_rotate, z_rotate)
#--------------------------------------------------------------------------
def make_rotate
y_mod = 25
# x_rotate
@sprite9 = Sprite.new
@sprite9.z, @sprite9.x, @sprite9.y = 116, 555, 306 + y_mod
@sprite9.angle = 0 + (@spd * 3)
@sprite9.ox = 6
@sprite9.oy = 6
@sprite9.bitmap = RPG::Cache.picture ("x_rotate")
# y_rotate
@sprite10 = Sprite.new
@sprite10.z, @sprite10.x, @sprite10.y = 117, 503 +6, 381 + y_mod
@sprite10.angle = 0 + (@uke * 3)
@sprite10.ox = 6
@sprite10.oy = 47
@sprite10.bitmap = RPG::Cache.picture ("y_rotate")
#z_rotate
@sprite11 = Sprite.new
@sprite11.z, @sprite11.x, @sprite11.y = 118, 525 +69, 383 + y_mod
@sprite11.angle = 0 + (@agg * 3)
@sprite11.ox = 69
@sprite11.oy = 52
@sprite11.bitmap = RPG::Cache.picture ("z_rotate")
end
#--------------------------------------------------------------------------
# * Make Bars (initiative, semeru, brutality)
#--------------------------------------------------------------------------
def make_bars
# @active_battler.name
abs = 8 * @spd
abu = 8 * @uke
aba = 8 * @agg
y_mod = 25
# initiative <=> patience (impulsive/intercept)
@sprite1 = Sprite.new
@sprite1.z, @sprite1.x, @sprite1.y = 120, 260, 274 + y_mod
@sprite1.angle = 0
@sprite1.bitmap = RPG::Cache.picture ("yellow_blue")
# semeru <=> ukeru (forceful/receiving)
@sprite2 = Sprite.new
@sprite2.z, @sprite2.x, @sprite2.y = 121, 261, 348 + y_mod
@sprite2.angle = 0
@sprite2.bitmap = RPG::Cache.picture ("indigo_green")
# brutality <=> finesse (bloody/accurate)
@sprite3 = Sprite.new
@sprite3.z, @sprite3.x, @sprite3.y = 122, 260, 376 + y_mod
@sprite3.angle = 0
@sprite3.bitmap = RPG::Cache.picture ("red_orange")
#black rectangle status display
@sprite7 = Sprite.new
@sprite7.z, @sprite7.x, @sprite7.y = 125, 260, 402 + y_mod
@sprite7.angle = 0
@sprite7.bitmap = RPG::Cache.picture ("black_rectangle")
# create arrow graphics
make_arrows
#you need to stick the +/- 1-10 + text. over black_rectangle
# may need a Window_BlackText to make it happen.
end
#--------------------------------------------------------------------------
# * Make Arrows (arrowR, arrowG, arrowB)
#--------------------------------------------------------------------------
def make_arrows
abs = 8 * @spd
abu = 8 * @uke
aba = 8 * @agg
y_mod = 25
#arrowB
@sprite4 = Sprite.new
@sprite4.z, @sprite4.x, @sprite4.y = 123, 346 + abs, 334 + y_mod
@sprite4.angle = 0
@sprite4.bitmap = RPG::Cache.picture ("arrowB")
#arrowG
@sprite5 = Sprite.new
@sprite5.z, @sprite5.x, @sprite5.y = 123, 346 + abu, 362 + y_mod
@sprite5.angle = 0
@sprite5.bitmap = RPG::Cache.picture ("arrowG")
#arrowR
@sprite6 = Sprite.new
@sprite6.z, @sprite6.x, @sprite6.y = 124, 346 + aba, 391 + y_mod
@sprite6.angle = 0
@sprite6.bitmap = RPG::Cache.picture ("arrowR")
end
#--------------------------------------------------------------------------
# * Frame Update (triangle lines and bar arrows move when updated)
#--------------------------------------------------------------------------
#probably an index loop starting with a case = 1, ++ with up/down
def update_triangle
case @triangle_step
when 1
update_triangle_step1
when 2
update_triangle_step2
when 3
update_triangle_step3
end
end
#--------------------------------------------------------------------------
# * Arrows Verticle: UP & DOWN
#--------------------------------------------------------------------------
def arrows_verticle
if Input.repeat?(Input::UP) and @triangle_step > 1
$game_system.se_play($data_system.cursor_se)
@triangle_step -= 1
end
if Input.repeat?(Input::DOWN) and @triangle_step < 3
$game_system.se_play($data_system.cursor_se)
@triangle_step += 1
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
make_strategy_result
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
make_strategy_result(false)
end
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 1)
#--------------------------------------------------------------------------
def update_triangle_step1
@sprite1.tone = Tone.new(55, 0, 55, 0)
@sprite2.tone = Tone.new(0, 0, 0, 0)
if Input.repeat?(Input::LEFT) and @spd > -10
$game_system.se_play($data_system.cursor_se)
@spd -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @spd < 10
$game_system.se_play($data_system.cursor_se)
@spd += 1
refresh
end
#changes @active_battler.spd with left/right
arrows_verticle
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 2)
#--------------------------------------------------------------------------
def update_triangle_step2
@sprite1.tone = Tone.new(0, 0, 0, 0)
@sprite2.tone = Tone.new(100, 0, 100, 0)
@sprite3.tone = Tone.new(0, 0, 0, 0)
if Input.repeat?(Input::LEFT) and @uke > -10
$game_system.se_play($data_system.cursor_se)
@uke -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @uke < 10
$game_system.se_play($data_system.cursor_se)
@uke += 1
refresh
end
#changes @active_battler.uke with left/right
arrows_verticle
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 3)
#--------------------------------------------------------------------------
def update_triangle_step3
@sprite2.tone = Tone.new(0, 0, 0, 0)
@sprite3.tone = Tone.new(155, 0, 155, 0)
if Input.repeat?(Input::LEFT) and @agg > -10
$game_system.se_play($data_system.cursor_se)
@agg -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @agg < 10
$game_system.se_play($data_system.cursor_se)
@agg += 1
refresh
end
#changes @active_battler.agg with left/right
arrows_verticle
end
#--------------------------------------------------------------------------
# * Refresh - may cause interference: alt: "strategy_refresh"
#--------------------------------------------------------------------------
def refresh # may crash
#clear old sprites
# @sprite1.dispose
# @sprite2.dispose
# @sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
# @sprite7.dispose
# @sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
# @sprite12.dispose
#make new sprites
# make_bars
# make_triangle
make_arrows
make_rotate
end
#--------------------------------------------------------------------------
# * Make Strategy Results (Game Battler: attr accessor(s) for @actor)
#--------------------------------------------------------------------------
def make_strategy_result(save_changes=true)
if save_changes
@active_battler.spd = @spd
@active_battler.uke = @uke
@active_battler.agg = @agg
end
#lock values in place
# deactivate triangle_update through "@triangle_step"
@triangle_step = nil
#dispose of these windows and bitmaps
@sprite1.dispose
@sprite2.dispose
@sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
@sprite7.dispose
@sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
@sprite12.dispose
# Go to command input for next actor
@actor_command_window.active = true
@status_window.dispose
@status_window = Window_BattleStatus.new
phase3_next_actor if save_changes
end
end
#2 will require some variables and setting the actor's stats accordingly AFTER selecting actions for the entire party.
I'm glad you picked up on that. I hadn't noticed until about 5 minutes ago when I tried going to the next actor. I was busy trying to make text appear on top of the black rectangle. I figured out how to sort of get away with a global:
$active_actor = $game_party.actors[@actor_index]
Which allowed me to create this [VERY FLAWED] window:
#==============================================================================
# ** Window_ST
#------------------------------------------------------------------------------
# This window displays nothing but text on the battle screen.
#==============================================================================
class Window_ST < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(240, 320, 400, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# * Refresh *Revised*
#--------------------------------------------------------------------------
def refresh
self.contents.clear
aname = $active_actor.name
a_spd = $active_actor.spd
# p $active_actor.name
self.contents.font.color = normal_color
self.contents.font.size = 16
self.contents.draw_text(10, 52, 80, 32, "EXP")
self.contents.draw_text(10, 72, 80, 32, "NEXT")
self.contents.draw_text(10, 88, 80, 32, a_spd.to_s)
self.contents.draw_text(288, 88, 80, 32, aname.to_s)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
end
end
The chief problem I ran into wasn't displaying the text, but getting it to change when the actor's variables changed. It would display my actor's name and their Base @spd, which was 0, but when I pressed left and right, the 0 never changed.
^ You need to call refresh method every time there is a change in the displayed values. But I;m sure KK20 can take care of it :D
One more thing. It might just be me, but dummy windows don't feel like a good idea...
Quote from: Fantasist on October 20, 2011, 07:31:28 pm
^ You need to call refresh method every time there is a change in the displayed values. But I;m sure KK20 can take care of it :D
One more thing. It might just be me, but dummy windows don't feel like a good idea...
I had a thing called @window_st.refresh (st for strategy text) but as i thought about it today I realized since KK20's version doesn't update until i press enter, there's no way to know if the global variable was the problem, and i also realized i could have used the global in a much cleaner way.
you are right about dummy windows, it's just the only thing I could think of once i realized the layer of the text is always the same as the window.
layer 100ish = background dummy window
layer 110ish = strategy bar stuff
layer 120ish = text dummy window
it kinda sucks that i need two windows to get the layering right.
edit: tested it by going through a full round of combat, and the confirmed modifiers show up. For now, I'm going to try positioning the terms in the right place, and then I can worry about how to get them to update "live".
Here's a demo with my corrections. I mainly cleaned up the code and reorganized a few things:
http://www.sendspace.com/file/5pmrvw
Look for changes in the scripts in the editor so you can incorporate them into your project.
Legend:
+ <script_name>: New script, just copy the entire script slot and add it to your project
* <script_name>: Made changes to the original. To find the change, go to the slot, hit CTRL+F and type "# MOD". You'll see what's changed. Simply make those changes to your project.
Though, the changes I've made were already made in your project, I think. Pay attention to "+ Game_Actor" and replicate those changes into your project.
Changes I've made from the original:
- redefined and reorganized the update phases.
- removed the "make_strategy_result" method. It's now taken care of by the "end_strategy" method.
- renamed the sprite variables to be more descriptive.
- instead of calling the refresh method each time an arrow is moved, I've simply changed the arrow sprites' .x values and _rotate sprites' .angle values.
- Some other stuff I might not remember.
For displaying the +/- 1-10 values on the black rectangle, you could draw directly on the sprite instead of creating a new window for that. Bitmap objects have a method to draw text on them. Even in windows, what you always see is "self.contents.draw_text(x, y, width, height, text, align)", but self.contents is a Bitmap (in the window's initialize method, you'll see "self.contents = Bitmap.new(width, height)" ). So even the black sprite has a bitmap, right? (@sprite.bitmap = RPG::Cache.picture("black_rectangle")) You just need to use draw_text on that bitmap: "@sprite.bitmap.draw_text(x, y, width, height, text, align)". But beware, when you clear the bitmap before drawing text, there will be a transparent bg. self.contents is cleared before drawing text because it's transparent to begin with. But when drawing to your black rextangle, instead f clearing the area, you replace the area from the original graphic using Bitmap's "blt" method (read up on it in the RMXP help file). Following me so far?
For cleaning up the status window, you could simply clear the contents of Window_BattleStatus and redraw them. Basically, wherever you've changed the @status_window to Window_BlankStatus, simply do this: "@status_window.contents.clear". When you want to restore the original: "@status_window.refresh". This way, you can completely skip making a new window.
Well i got a lot of the kinks out of the system, and i got text to display on top of the strategies, and to also change when the arrow keys are moved. The stats also stay in position when moving to the next character, but reset when canceling (although one might be able to lock some in place by going all the way back and forward.. that part is a bit weird).
(http://img33.imageshack.us/img33/7914/strategytest4.png)
The descriptive words for each category change depending on your settings, and change colors when near extremes. For this part of the project, I had to add new colors to my Window_Base. I also reversed the order of C and B buttons in KK20's code.
New colors: (nothing special, but irritating)
#--------------------------------------------------------------------------
# * Get Blue Text Color
#--------------------------------------------------------------------------
def blue_color
return Color.new(0, 0, 255, 255)
end
#--------------------------------------------------------------------------
# * Get Green Text Color
#--------------------------------------------------------------------------
def green_color
return Color.new(0, 255, 0, 255)
end
#--------------------------------------------------------------------------
# * Get Red Text Color
#--------------------------------------------------------------------------
def red_color
return Color.new(255, 0, 0, 255)
end
#--------------------------------------------------------------------------
# * Get Yellow Text Color
#--------------------------------------------------------------------------
def yellow_color
return Color.new(255, 255, 0, 255)
end
#--------------------------------------------------------------------------
# * Get Magenta Text Color
#--------------------------------------------------------------------------
def magenta_color
return Color.new(255, 0, 255, 255)
end
#--------------------------------------------------------------------------
# * Get Orange Text Color
#--------------------------------------------------------------------------
def orange_color
return Color.new(255, 128, 0, 255)
end
#--------------------------------------------------------------------------
# * Get Purple Text Color
#--------------------------------------------------------------------------
def purple_color
return Color.new(128, 55, 255, 255)
end
Window_ST:
#==============================================================================
# ** Window_ST
#------------------------------------------------------------------------------
# This window displays Window Strategy Text in the Strategy Bars.
#==============================================================================
class Window_ST < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(240, 320, 400, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@actor = $active_actor
refresh
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# * Refresh *Revised*
#--------------------------------------------------------------------------
def refresh
self.contents.clear
a_name = @actor.name
a_spd = @actor.spd
a_uke = @actor.uke
a_agg = @actor.agg
# p $active_actor.name
self.contents.font.color = normal_color
self.contents.font.size = 11
# initive/patience bar (timing)
if a_spd > 7
self.contents.font.color = blue_color
self.contents.draw_text(124, 94, 80, 11, "Sage", 1)
end
if a_spd > 2 && a_spd < 8
self.contents.font.color = normal_color
self.contents.draw_text(124, 94, 80, 11, "Reserved", 1)
end
if a_spd > -3 && a_spd < 3
self.contents.font.color = normal_color
self.contents.draw_text(124, 94, 80, 11, "Calm", 1)
end
if a_spd > -8 && a_spd < -2
self.contents.font.color = normal_color
self.contents.draw_text(124, 94, 80, 11, "Impulsive", 1)
end
if a_spd < -7
self.contents.font.color = yellow_color
self.contents.draw_text(124, 94, 80, 11, "Kensai", 1)
end
# uke/seme bar (fight/flight)
if a_uke > 7
self.contents.font.color = green_color
self.contents.draw_text(124, 106, 80, 11, "Tank", 1)
end
if a_uke > 2 && a_uke < 8
self.contents.font.color = normal_color
self.contents.draw_text(124, 106, 80, 11, "Masochist", 1)
end
if a_uke > -3 && a_uke < 3
self.contents.font.color = normal_color
self.contents.draw_text(124, 106, 80, 11, "Balanced", 1)
end
if a_uke > -8 && a_uke < -2
self.contents.font.color = normal_color
self.contents.draw_text(124, 106, 80, 11, "Sadist", 1)
end
if a_uke < -7
self.contents.font.color = purple_color
self.contents.draw_text(124, 106, 80, 11, "Dominatrix", 1)
end
#brutality/finesse bar (self control)
if a_agg > 7
self.contents.font.color = orange_color
self.contents.draw_text(124, 118, 80, 11, "Sublime", 1)
end
if a_agg > 2 && a_agg < 8
self.contents.font.color = normal_color
self.contents.draw_text(124, 118, 80, 11, "Graceful", 1)
end
if a_agg > -3 && a_agg < 3
self.contents.font.color = normal_color
self.contents.draw_text(124, 118, 80, 11, "Moderate", 1)
end
if a_agg > -8 && a_agg < -2
self.contents.font.color = normal_color
self.contents.draw_text(124, 118, 80, 11, "Rage", 1)
end
if a_agg < -7
self.contents.font.color = red_color
self.contents.draw_text(124, 118, 80, 11, "Berserk", 1)
end
# numerical values of strategy bars
self.contents.font.color = normal_color
if a_spd < 1
self.contents.draw_text(0, 94, 80, 11, a_spd.to_s, 1)
else
self.contents.draw_text(0, 94, 80, 11, "+" + a_spd.to_s, 1)
end
if a_uke < 1
self.contents.draw_text(0, 106, 80, 11, a_uke.to_s, 1)
else
self.contents.draw_text(0, 106, 80, 11, "+" + a_uke.to_s, 1)
end
if a_agg < 1
self.contents.draw_text(0, 118, 80, 11, a_agg.to_s, 1)
else
self.contents.draw_text(0, 118, 80, 11, "+" + a_agg.to_s, 1)
end
# active actor's name display
self.contents.font.name = "Arial Black"
self.contents.font.size = 18
self.contents.draw_text(260, 86, 80, 32, a_name.to_s, 1)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
end
end
Strategy:
#==============================================================================
# ** Scene Battle Strategy
#------------------------------------------------------------------------------
# This class performs battle strategy screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Start Strategy (make sure @battler is_an_actor? = true)
#--------------------------------------------------------------------------
def start_strategy
#load background window overlay with actor's name
#load arrow key readers
#@actor_command_window.visible = false
@actor_command_window.active = false
@triangle_step = 1
@spd = @active_battler.spd
@uke = @active_battler.uke
@agg = @active_battler.agg
@b_spd = @active_battler.spd
@b_uke = @active_battler.uke
@b_agg = @active_battler.agg
@status_window.dispose
@status_window = Window_BlankStatus.new
$active_actor = $game_party.actors[@actor_index]
@window_st = Window_ST.new
@window_st.z = 200
end
#--------------------------------------------------------------------------
# * Make Triangle (circle, triangle lid)
#--------------------------------------------------------------------------
def make_triangle
y_mod = 25
# triangle background
@sprite8 = Sprite.new
@sprite8.z, @sprite8.x, @sprite8.y = 115, 477, 280 + y_mod
@sprite8.angle = 0 #keep 0
@sprite8.bitmap = RPG::Cache.picture ("tri_circle")
#Create x_, y_, and z_rotate
make_rotate
#tri_cover
@sprite12 = Sprite.new
@sprite12.z, @sprite12.x, @sprite12.y = 119, 497, 290 + y_mod
@sprite12.angle = 0 #keep 0
@sprite12.bitmap = RPG::Cache.picture ("tri_cover")
end
#--------------------------------------------------------------------------
# * Make Triangle (x_rotate, y_rotate, z_rotate)
#--------------------------------------------------------------------------
def make_rotate
y_mod = 25
# x_rotate
@sprite9 = Sprite.new
@sprite9.z, @sprite9.x, @sprite9.y = 116, 555, 306 + y_mod
@sprite9.angle = 0 + (@spd * 3)
@sprite9.ox = 6
@sprite9.oy = 6
@sprite9.bitmap = RPG::Cache.picture ("x_rotate")
# y_rotate
@sprite10 = Sprite.new
@sprite10.z, @sprite10.x, @sprite10.y = 117, 503 +6, 381 + y_mod
@sprite10.angle = 0 + (@uke * 3)
@sprite10.ox = 6
@sprite10.oy = 47
@sprite10.bitmap = RPG::Cache.picture ("y_rotate")
#z_rotate
@sprite11 = Sprite.new
@sprite11.z, @sprite11.x, @sprite11.y = 118, 525 +69, 383 + y_mod
@sprite11.angle = 0 + (@agg * 3)
@sprite11.ox = 69
@sprite11.oy = 52
@sprite11.bitmap = RPG::Cache.picture ("z_rotate")
end
#--------------------------------------------------------------------------
# * Make Bars (initiative, semeru, brutality)
#--------------------------------------------------------------------------
def make_bars
# @active_battler.name
abs = 8 * @spd
abu = 8 * @uke
aba = 8 * @agg
y_mod = 25
# initiative <=> patience (impulsive/intercept)
@sprite1 = Sprite.new
@sprite1.z, @sprite1.x, @sprite1.y = 120, 260, 274 + y_mod
@sprite1.angle = 0
@sprite1.bitmap = RPG::Cache.picture ("yellow_blue")
# semeru <=> ukeru (forceful/receiving)
@sprite2 = Sprite.new
@sprite2.z, @sprite2.x, @sprite2.y = 121, 261, 348 + y_mod
@sprite2.angle = 0
@sprite2.bitmap = RPG::Cache.picture ("indigo_green")
# brutality <=> finesse (bloody/accurate)
@sprite3 = Sprite.new
@sprite3.z, @sprite3.x, @sprite3.y = 122, 260, 376 + y_mod
@sprite3.angle = 0
@sprite3.bitmap = RPG::Cache.picture ("red_orange")
#black rectangle status display /was y 402
@sprite7 = Sprite.new
@sprite7.z, @sprite7.x, @sprite7.y = 125, 260, 400 + y_mod
@sprite7.angle = 0
@sprite7.bitmap = RPG::Cache.picture ("black_rectangle")
# create arrow graphics
make_arrows
#you need to stick the +/- 1-10 + text. over black_rectangle
# may need a Window_BlackText to make it happen.
end
#--------------------------------------------------------------------------
# * Make Arrows (arrowR, arrowG, arrowB)
#--------------------------------------------------------------------------
def make_arrows
abs = 8 * @spd
abu = 8 * @uke
aba = 8 * @agg
y_mod = 25
#arrowB
@sprite4 = Sprite.new
@sprite4.z, @sprite4.x, @sprite4.y = 123, 346 + abs, 334 + y_mod
@sprite4.angle = 0
@sprite4.bitmap = RPG::Cache.picture ("arrowB")
#arrowG
@sprite5 = Sprite.new
@sprite5.z, @sprite5.x, @sprite5.y = 123, 346 + abu, 362 + y_mod
@sprite5.angle = 0
@sprite5.bitmap = RPG::Cache.picture ("arrowG")
#arrowR
@sprite6 = Sprite.new
@sprite6.z, @sprite6.x, @sprite6.y = 124, 346 + aba, 391 + y_mod
@sprite6.angle = 0
@sprite6.bitmap = RPG::Cache.picture ("arrowR")
end
#--------------------------------------------------------------------------
# * Frame Update (triangle lines and bar arrows move when updated)
#--------------------------------------------------------------------------
#probably an index loop starting with a case = 1, ++ with up/down
def update_triangle
case @triangle_step
when 1
update_triangle_step1
when 2
update_triangle_step2
when 3
update_triangle_step3
end
end
#--------------------------------------------------------------------------
# * Arrows Verticle: UP & DOWN
#--------------------------------------------------------------------------
def arrows_verticle
if Input.repeat?(Input::UP) and @triangle_step > 1
$game_system.se_play($data_system.cursor_se)
@triangle_step -= 1
end
if Input.repeat?(Input::DOWN) and @triangle_step < 3
$game_system.se_play($data_system.cursor_se)
@triangle_step += 1
end
#Confirm Choices and Exit
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
make_strategy_result(false)
phase3_next_actor
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
make_strategy_result
end
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 1)
#--------------------------------------------------------------------------
def update_triangle_step1
@sprite1.tone = Tone.new(55, 0, 55, 0)
@sprite2.tone = Tone.new(0, 0, 0, 0)
if Input.repeat?(Input::LEFT) and @spd > -10
$game_system.se_play($data_system.cursor_se)
@spd -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @spd < 10
$game_system.se_play($data_system.cursor_se)
@spd += 1
refresh
end
#changes @active_battler.spd with left/right
arrows_verticle
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 2)
#--------------------------------------------------------------------------
def update_triangle_step2
@sprite1.tone = Tone.new(0, 0, 0, 0)
@sprite2.tone = Tone.new(100, 0, 100, 0)
@sprite3.tone = Tone.new(0, 0, 0, 0)
if Input.repeat?(Input::LEFT) and @uke > -10
$game_system.se_play($data_system.cursor_se)
@uke -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @uke < 10
$game_system.se_play($data_system.cursor_se)
@uke += 1
refresh
end
#changes @active_battler.uke with left/right
arrows_verticle
end
#--------------------------------------------------------------------------
# * Frame Update (Strategy Option 3)
#--------------------------------------------------------------------------
def update_triangle_step3
@sprite2.tone = Tone.new(0, 0, 0, 0)
@sprite3.tone = Tone.new(125, 0, 125, 0)
if Input.repeat?(Input::LEFT) and @agg > -10
$game_system.se_play($data_system.cursor_se)
@agg -= 1
refresh
end
if Input.repeat?(Input::RIGHT) and @agg < 10
$game_system.se_play($data_system.cursor_se)
@agg += 1
refresh
end
#changes @active_battler.agg with left/right
arrows_verticle
end
#--------------------------------------------------------------------------
# * Refresh - may cause interference: alt: "strategy_refresh"
#--------------------------------------------------------------------------
def refresh # may crash
#clear old sprites
# @sprite1.dispose
# @sprite2.dispose
# @sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
# @sprite7.dispose
# @sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
# @sprite12.dispose
#Refresh Window Strategy Text
@active_battler.spd = @spd
@active_battler.uke = @uke
@active_battler.agg = @agg
@window_st.refresh
# make_bars
# make_triangle
make_arrows
make_rotate
end
#--------------------------------------------------------------------------
# * Make Strategy Results (Game Battler: attr accessor(s) for @actor)
#--------------------------------------------------------------------------
def make_strategy_result(save_changes=true)
if save_changes
@active_battler.spd = @b_spd
@active_battler.uke = @b_uke
@active_battler.agg = @b_agg
end
#lock values in place
# deactivate triangle_update through "@triangle_step"
@triangle_step = nil
#dispose of these windows and bitmaps
@sprite1.dispose
@sprite2.dispose
@sprite3.dispose
@sprite4.dispose
@sprite5.dispose
@sprite6.dispose
@sprite7.dispose
@sprite8.dispose
@sprite9.dispose
@sprite10.dispose
@sprite11.dispose
@sprite12.dispose
# Go to command input for next actor
@actor_command_window.active = true
@status_window.dispose
@window_st.dispose
@status_window = Window_BattleStatus.new
phase3_prior_actor if save_changes
end
end