Project1
标题:
转:战斗中换人,口袋口袋依旧是口袋 口袋换人系统
[打印本页]
作者:
px.凤翔九天
时间:
2010-12-16 22:42
标题:
转:战斗中换人,口袋口袋依旧是口袋 口袋换人系统
以前曾经写了一个,貌似那个贴已经失踪到不懂哪里去了,所以今天重写了一个。而且之前写那个还可以玩围攻,这个是模仿口袋的战斗换人,功能就是那样,没得介绍,插入脚本后即可用。
module LimBattlePlug
3 z. N9 F& |' `1 p+ B4 \
! x, o; ]7 ?' m r8 p; b' p M2 k& b7 d
# 队伍最大人数
1 D+ S0 J$ Z& a7 e" [
MaxPartySize = 8
9 x+ A) l) O2 c" c* X
; P4 W, ~' Q3 T- [. u
# 出战人数
2 C. i3 t" A8 G( X9 M/ @
MaxBattlerSize = 1
/ ~- L, c7 R9 v8 [" X" B
7 l+ C& r* h! _, `
# 换人语句
, q% S3 ]! {3 Z5 G
WordChangeBattler = "换人"
+ J# Q5 Z: t9 z$ l" g
# s$ d2 @, c' p' ]5 n7 B
# 换人时播放的动画
0 \6 U- |. R0 @7 ^
AnimationChangeBattler = 26
8 q9 N5 q. z* k. i& d( ^( o5 q
1 H1 L# s7 @1 Z S9 O) j4 ^
end
6 C9 l1 t2 E: Q; z$ Y& ^/ H
9 f& s* v' w0 p1 b* \
class Game_BattleAction
! Y# ^$ D7 d4 S" C5 ~+ M# K
attr_accessor :change_to_battler
' ]+ N' u2 n4 _0 l
# 初始化
* n! q3 H& C2 [0 X/ L) F# w
alias lbp_initialize initialize
C( ^' A* I, Y4 F9 J8 I% ~
def initialize
- }& Y: ? K; Y$ e
lbp_initialize
( h0 |4 H! t" j3 U- O* L# D/ _
@change_to_battler = 0
) B1 r& m9 U0 S- D/ H. J
end
! {4 t6 J; ^! a/ @: Q
# 欲更换角色编号
$ P, f3 J+ K7 [8 C( U# d
def set_change_battler
! _9 V( Y7 e( \
@kind = 3
+ T& N7 K( t/ f9 `2 f( a: ?8 @
end
; E5 |3 E( d5 T/ ~
# 判断行动是否为更换角色
- V& `5 P. x0 D; t# L
def is_change_battler?
2 Q5 X1 k; _2 d6 W" X0 l; K
return (@kind == 3)
! g$ J) P: N6 u" w* H
end
6 }3 u! [+ i" c( \
end
/ y% K! w, } M* t. C1 v
0 ?' l, F1 H7 P5 n, a# @' k9 i% X
class Game_Party
0 O! v! U7 T7 ~* v
include LimBattlePlug
3 L5 O2 p6 m3 y" V- y
attr_reader :actors2
8 S' r7 j- w& |8 U6 U6 S
alias lpb_initialize initialize
1 }& T) u/ d7 s# ]- C
def initialize
& V# N* W# S& e% N
lpb_initialize
" d3 P! Z7 J3 `& }* I$ G* F
@actors2 = []
0 b G0 H. Z2 c2 f
end
6 F3 @ _, j v! r! v. I8 a* \
# 角色加入
5 U# p6 C2 _9 n8 w
def add_actor(actor_id)
9 ?1 n) |. _) B* Q$ E' o
actor = $game_actors[actor_id]
/ ~% R" {( D5 q
if @actors.size < MaxPartySize and not @actors.include?(actor)
' n" q# r' a) L) U
@actors.push(actor)
E2 B+ o# J5 m# Y
$game_player.refresh
% b3 v: U3 i% N/ D+ {: k& V/ r; ?% Q5 @
end
8 `* o5 o- w% K: n6 N9 [4 s0 {
end
" o: J' W# [' ?+ l {0 a4 B% Q
# 设置战斗的角色
4 `5 @: e& J7 A- H
def set_actor_to_battle
% N6 R2 @0 b/ u% _/ ^1 J
@actors2 = []
1 {8 S; X% X& m4 o8 n: ^
@actors.each do |actor|
; f/ `" g6 P! ^4 G' `% M) H7 m
@actors2.push(actor)
/ H2 H5 |+ R7 R8 @4 t( d
end
7 j$ m: W. p/ Y/ a' W
@actors = []
# h, _! v0 [4 _# J
@actors2.each do |actor|
' l/ Y: ?# ?3 N
@actors.push(actor)
8 ~! Q- f8 q, |/ i1 {
break if @actors.size == MaxBattlerSize
9 k2 E% P/ w# n0 G, q/ q
end
+ W' P" e$ E ]
end
. ^' u& p# @! ]+ r' d
# 还原战斗的角色
1 T# g x) v1 p) _3 G1 i* R
def set_actor_to_normal
- A1 s; j5 H n. c6 f
@actors = []
% }! ^/ T; X0 X' l( T. R
@actors2.each do |actor|
9 p+ C8 Z3 ?3 {8 F3 \
@actors.push(actor)
2 Q4 P! k+ G5 Q
end
* }+ W# x( ~2 m1 g4 G {
end
! `3 M- Z: v9 Q8 V# R
# 获取角色id数组
3 N7 N: g6 B( B6 K# o
def get_actors_id
% h1 O+ p# b- a. X" a, ?
id = []
7 l0 e/ m% q a; G8 x
@actors.each{|actor|id.push(actor.id)}
* P6 S3 O& Y& C* x& x
return id
- O( x. J% y: Q% \
end
$ D5 u c' H1 N; m
# 获取角色id数组
$ O1 H2 g8 H! p( a# i. p: m
def get_actors2_id
4 a2 O# V% n8 k" O9 I
id = []
6 h* ~+ z! ?4 I2 y% @' R4 N2 f
@actors2.each{|actor|id.push(actor.id)}
3 e: f, r. p7 D2 e
return id
2 a$ E5 C7 L2 l: o4 t6 o
end
" s2 r+ c% ?- q8 w
# 兑换角色
9 o- C2 W( B2 J
def change_actor(index,id)
3 d" _: w! i2 p* f6 S) m& s/ C
@actors[index] = $game_actors[id]
' M: a& i- e, c% @1 r
end
2 Z" i# H. C( l1 R5 q3 w
# 全灭判定
. [* K2 A* e# \8 s: k7 j4 A5 q
def all_dead?
8 E4 K& h1 j# w- u( C
# 同伴人数为 0 的情况下
2 X/ i V% J" X8 ]" ?& H, r! [
if $game_party.actors.size == 0
' b! q& y. H0 A# ^
return false
- W& u" `. q$ y* ]3 L* Q
end
% @: R. k* T: |! q
# 同伴中无人 HP 在 0 以上
% Z( j" y% f4 S- F* ~
for actor in @actors2
2 o: M" S( \' [/ B7 @
if actor.hp > 0
$ V; g0 |& A( q* p% E) y
return false
. [8 f- f. J7 G, n
end
{1 }$ Q1 _" L! D; S& z
end
$ @ u' q3 [- M, Q6 Z
for actor in @actors
9 P6 q5 o& {& \& @4 o/ x8 w7 Q ~
if actor.hp > 0
$ I, {6 I/ Z/ Q# ]
return false
* g6 S& c8 c4 j$ I- @ u! x9 O# f
end
! D6 v) Q9 X1 p" I
end
# c5 H, I6 B, x' R4 G+ Z
# 全灭
3 H3 G3 K$ d' b& v3 m& ]
return true
& L% ^2 W5 [0 U
end
1 g8 F% ~ W. U
# 其他角色
. I% m$ P9 t0 u3 @
def other_actors
4 j4 J7 g8 P% q- I5 L; |9 \
actors = []
: f, [" K2 k5 y H. G9 y1 S
@actors2.each{|actor|actors.push(actor) if
[email protected]
?(actor)}
5 S$ D" J# ~9 V3 J$ `: o
return actors
6 C. e; L) O$ g/ m |
end
0 F t7 B$ H" S+ y9 G
# 角色位置互换
. t$ V; @6 Y1 ?! W& Z* S
def change_actor_pos(id1,id2)
/ C& R1 n8 Z+ K; D A8 i" }! B
actor_id = []
7 ?) D7 U: @4 M0 z9 s
@actors.each do |actor|
, `7 V J2 a* p, L$ E0 `
actor_id.push(actor.id)
2 i# X" h4 d' F
end
7 k7 V; b+ N; B3 z
return if !actor_id.include?(id1) and !actor_id.include?(id2)
+ X/ B8 B- y; s- A
id1_index = id2_index = -1
1 G. k+ ]/ @/ X3 @ x
(0...actor_id.size).each do |i|
1 y0 b$ K: Q6 s9 ?# @
if actor_id[i] == id1
) k3 y3 C5 g1 [& C, a1 [7 \
id1_index = i
* l* r4 Z" f# w$ n# @! l4 Z8 b
elsif actor_id[i] == id2
6 x, Z: w: i# C0 s6 r# P* E3 l+ P, `
id2_index = i
- Q R' W3 p& j }# ~! j7 u# q, u0 z
end
s5 w! E# w/ ?& o* ^
end
1 R [) L: G1 B# i3 I
temp_actor = @actors[id1_index]
5 R# t3 X. [7 U9 S# S
@actors[id1_index] = @actors[id2_index]
, x9 U$ V+ p3 W0 e c
@actors[id2_index] = temp_actor
. R: r X' d7 E% V
end
' ?2 Y" E6 A8 U1 @
end
% B- w$ e9 u: Y1 C% w F
. t8 I3 H: B% p/ m( T* L
class Window_Actor < Window_Selectable
T# z8 d" m! c# k4 N% b
# 初始化
% E4 S1 H: ]: H! K# S5 m x
def initialize
1 _* Y) _3 z4 u# x8 W' h
super(0,64,640,256)
) \! l6 }+ J, r6 z }
self.back_opacity = 160
2 \7 n+ i8 q" J# L- `# D# X1 @
refresh
5 b8 s6 ~+ C! G: j1 U4 z. C7 m
self.index = -1
3 d, p* _6 O9 U! c, y
self.active = false
/ K, [, A8 `9 C0 L$ F6 w# o
end
/ o Z+ z! T6 y) U5 b' ~" K# W, D
# 刷新
- F6 B4 p1 A* _, a* b
def refresh
( b! w9 S% T+ z! Z' P
@item_max = $game_party.actors2.size
+ s Y% G2 f" x3 @4 B3 _
@data = []
- a8 z. c% j, c9 S0 _
$game_party.actors.each do |actor|
0 t t" [9 f! \, F8 [1 d
@data.push(actor)
0 O; B7 x4 [0 ^! F; u; u' P
end
9 o, A7 V, `% o9 k, M* ~6 d
$game_party.actors2.each do |actor|
4 v0 n1 x6 g2 K5 ]4 G
@data.push(actor) if
[email protected]
?(actor)
% M! d2 f; S9 P
end
: |- G& |+ d! {
if self.contents != nil
1 R m3 y) M# H( V0 o# ~. G
self.contents.clear
$ p# F9 b% R' }
self.contents = nil
+ I: s2 M& `3 m h
end
& L# n4 r% v/ Y' g! e* r
self.contents = Bitmap.new(608,@data.size*32)
% G% N. K' M5 ~3 J* ^! Y+ `
x = 4
E2 }- i8 W- g1 N
y = 0
4 Z% s, p2 E Y$ X0 m7 @
@data.each do |actor|
8 S0 J8 |( E- N% W/ E( P& \
bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)
$ @5 j9 @! v7 B6 G6 V9 b
rect = Rect.new(0,0,bitmap.width/4,31)
5 K1 q* \9 p" N( o( j
self.contents.blt(x+16-bitmap.width/8,y,bitmap,rect)
3 U7 J$ L1 q6 Y8 _" `
draw_actor_name(actor,x+36,y)
* n$ p4 Z: s; }" r1 q; e& r' ~1 `
draw_actor_state(actor,156,y)
" W3 t5 c z+ [7 X4 n( F% K
draw_actor_hp(actor,x+256,y,96)
0 M0 ~& Z7 U! r% ~; d, I$ V6 G
draw_actor_sp(actor,x+376,y,96)
# s7 F/ t; r+ d
if $game_party.actors.include?(actor)
# y) V$ U K2 ^
self.contents.font.color = text_color(6)
* N1 U. j7 T1 Z- P$ I
cword = "出战"
8 ^' p' N% c5 k
else
! y4 R: F( Y0 D4 L9 W( N
self.contents.font.color = text_color(0)
+ V1 @! m1 s9 s# T6 X0 A
cword = "待战"
: ]6 K F7 C. c% x
end
+ t; v- S7 m- {& U$ E0 ?+ l
self.contents.draw_text(x+496,y,60,32,cword)
( [2 ?# G0 T- X; j# h! ?
y += 32
( n1 f0 f/ c+ `5 W, r! n
end
& U* a& d% U& w- ]0 o
end
Z4 V9 e3 P/ m2 p: N; Y8 f
# 获取当前角色编号
# @. ], R, M# f+ B* n( s
def actor_id
f0 g0 Z+ ]4 L- K; S6 w; |
return @data[self.index].id
5 i5 R0 B4 b, Z, `$ F
end
: h- k( W! p7 E+ B* M% X
# 刷新帮助
E, ? U0 U1 \8 [$ d* t- u
def update_help
) \0 H0 Y2 u) n+ f* H* m6 n2 e
@help_window.set_text(@data[self.index] == nil ?\
. [/ m8 ~' K$ s0 o' z
"" : @data[self.index].name)
- R) U! h+ ~; N+ N
end
* @; @( M+ a/ k$ C) l. q
end
3 K3 w: W. Q% P
4 H/ n& x; q/ T
class Scene_Battle
" u; T: `. l' {0 ]# l
include LimBattlePlug
7 r) n" u9 i7 t* X% _( {$ M# d
# 初始化
, T! b% J# g6 R* L1 z
def initialize
$ Q' q, K6 S1 e& S* F* ^
$game_party.set_actor_to_battle
+ I8 Y2 N- @) \* Z1 H/ N4 s# ?
end
6 s* n" n6 g. g+ k6 K% [9 I4 R9 N! C
# 主处理
- M( H1 V, v% C
def main
8 F0 o1 o& |) w4 w7 ]! z
# 初始化战斗用的各种暂时数据
3 W/ l' S& f3 [) m1 ?9 M6 p
$game_temp.in_battle = true
5 c7 Z- w4 |. \1 k& q, W# s
$game_temp.battle_turn = 0
5 A' ]+ w# O( _6 ~
$game_temp.battle_event_flags.clear
/ j, _% u8 r0 P3 G) P+ I$ R, M
$game_temp.battle_abort = false
8 K6 K/ G. n7 K8 P
$game_temp.battle_main_phase = false
f0 |6 s% U$ c \. w9 D7 [8 F, t
$game_temp.battleback_name = $game_map.battleback_name
! ]$ i/ ]( q% i9 N ]( K* I
$game_temp.forcing_battler = nil
& T' j9 ^0 M8 ?+ r
# 初始化战斗用事件解释器
3 p( ?) T, \4 X& l- t
$game_system.battle_interpreter.setup(nil, 0)
& O4 R' g" W# T4 ~, m; F* s/ m" @
# 准备队伍
, `9 x8 M! T5 U! |8 g
@troop_id = $game_temp.battle_troop_id
( s z" W/ H8 k
$game_troop.setup(@troop_id)
2 G; t/ x9 U9 q" W8 t. v8 j+ E0 u5 _
# 生成角色命令窗口
9 z: B; ~7 V3 i
s1 = $data_system.words.attack
! S5 x% D9 q0 a4 O
s2 = $data_system.words.skill
& D: f( w0 @1 s- e! m/ x
s3 = $data_system.words.guard
1 Q% {4 ?# U' O2 P8 P# o" F$ _
s4 = $data_system.words.item
% ~' `0 ~( w( n% y% i- G, K9 E" o
s5 = WordChangeBattler
/ F! e8 v# U* ?! g
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,s5])
# V/ v3 I& \& ?+ w7 y. [
@actor_command_window.y = 128
/ ^5 H6 q4 ~) M; h, f8 s7 m! w
@actor_command_window.back_opacity = 160
; q9 S C: l" K/ f" B9 Z* t
@actor_command_window.active = false
6 E* s' }% I! f2 A) ?' `
@actor_command_window.visible = false
% }9 |9 T2 I/ c6 B
# 生成其它窗口
3 \7 {2 R1 ^$ `. J, f0 C
@party_command_window = Window_PartyCommand.new
h6 \% F @2 v) W. {. B
@help_window = Window_Help.new
: C, B6 [5 q/ r: H
@help_window.back_opacity = 160
+ G! R1 N8 ? |6 t
@help_window.visible = false
3 u0 f, n1 X1 p2 w( _
@status_window = Window_BattleStatus.new
2 S: x1 i$ g7 t1 R: k
@message_window = Window_Message.new
" B2 L- v' |4 t/ Y" c* h
# 生成活动块
7 B9 J6 u5 L4 L. B' x
@spriteset = Spriteset_Battle.new
3 N7 u: i3 x( ~: l4 k. `
# 初始化等待计数
, O3 f9 X/ d" t1 z8 s
@wait_count = 0
5 R+ { C( ], w$ F a: q
# 执行过渡
7 S2 k0 h$ z9 H" `: d( I
if $data_system.battle_transition == ""
9 s6 }$ v5 j0 `& o6 P
Graphics.transition(20)
( o2 T5 ]$ V) u) \$ C+ M
else
3 h9 v3 v9 J8 t3 I* T
Graphics.transition(40, "Graphics/Transitions/" +
# ?+ O: X) k$ j3 J
$data_system.battle_transition)
6 v" P) Y0 ~& K( }; s+ _" ?
end
6 @" X$ b8 p- T: R" N A* l' u7 c
# 开始自由战斗回合
; a' D/ M' o3 b! X% C1 D$ G
start_phase1
. A( Q; t+ g4 s0 f3 L8 |2 C
# 主循环
9 M* o; i6 u6 a3 t' I2 g. A0 C: A5 T
loop do
/ _2 h# \/ F% S0 x! `
# 刷新游戏画面
9 I2 G# M" M! M' [8 ]2 R- d; Z @9 P
Graphics.update
4 C+ |5 P- V# K3 Z
# 刷新输入信息
& X: @7 P) K# P( N
Input.update
- y! t( x5 d9 ?+ u
# 刷新画面
* ]( L6 Y; J3 \$ R: U1 @0 P
update
% s" r8 w+ `2 r
# 如果画面切换的话就中断循环
3 ? f) [3 w* I# P% o+ S4 y6 E& m
if $scene != self
( `# @( X) W/ s* F, v# @
break
2 h* O3 D% C Y N- |- N
end
1 C+ h$ y v# }* X/ f: V$ g
end
7 i, O+ H" P0 ~5 R0 X& w
# 刷新地图
: S; h) } U: q2 a( @0 t& o
$game_map.refresh
! M# v9 r4 S4 `% S5 B
# 准备过渡
] S8 z" r: C, g3 E# B, g
Graphics.freeze
: k0 r* S# v$ p" ?
# 释放窗口
% b. R" y' a3 o% w8 n
@actor_command_window.dispose
: u. I+ O2 r( p, l
@party_command_window.dispose
+ z( s9 j7 c& h$ L J- M
@help_window.dispose
, Z3 U3 e% e3 q: g
@status_window.dispose
/ U* |: O* @3 @5 g& E6 {
@message_window.dispose
7 s j1 k5 G: t- o- h
if @skill_window != nil
# N1 Y6 a$ Y1 u) }
@skill_window.dispose
! m% P) U! P& y8 z) D& O
end
6 t' K$ h/ |+ ?% A1 {8 u, }3 H* m
if @item_window != nil
$ T0 \* P2 ?/ j2 n7 n* g
@item_window.dispose
$ R: I. |" o1 l0 V3 W
end
D5 U" @& B5 {
if @actor_window != nil
/ R2 g4 c3 J, P) ?3 e2 [: x
@actor_window.dispose
& [& i+ }2 c* a7 P
end
6 i- n6 A' j: Z+ \' B% l7 q
if @result_window != nil
! ^& n% N& d- r' V
@result_window.dispose
6 H3 Q3 e1 e! }! s- W. `: p$ e
end
3 j; K- ?8 b& w/ P
# 释放活动块
( h% W$ V+ j4 x# |2 P$ T
@spriteset.dispose
F, y$ V. z2 z' [
# 标题画面切换中的情况
5 Q9 I+ E6 n$ u9 I0 K3 z
if $scene.is_a?(Scene_Title)
' P( h8 g6 l% E0 ^0 W
# 淡入淡出画面
6 j' F5 y3 n" w% `' x
Graphics.transition
) Q7 \1 r4 N" s9 ?; a0 v( x" }
Graphics.freeze
. F8 l0 P7 s4 @& r, C, m0 H, Y
end
/ ~. T2 c1 W# Z8 I& e- H
# 战斗测试或者游戏结束以外的画面切换中的情况
5 q6 h8 P/ K% k7 p& o: E! C
if $BTEST and not $scene.is_a?(Scene_Gameover)
, k! Z/ x! k: H N2 W4 u& ^9 y
$scene = nil
2 P" i0 H a$ A
end
) m3 } |9 E4 b! _
end
* j G' s2 `- X* [) k
# 战斗结束
8 Y" E6 g. N0 T |' Q
alias lpb_battle_end battle_end
2 P9 m& R* P7 q3 M6 |5 ~. I
def battle_end(n)
: @1 u1 @5 F# S$ t4 W. q9 p
lpb_battle_end(n)
$ P% W+ j6 b: J7 C& U# d* a
$game_party.set_actor_to_normal
" @% @! M" i i" o9 _
end
8 L, T" w% q5 M* x8 E% C$ J, {
# 开始回合3
7 H- [; x1 D* j4 ?
alias lbp_start_phase3 start_phase3
& n8 x" c i, s
def start_phase3
5 L A$ s" S2 D: J- ^1 e' b
@changed_battler_id = []
% Y0 q f8 A6 t
lbp_start_phase3
" E7 J/ ?- [+ I- {( {4 t
end
* ^* t4 s* [( x% S! x
# 刷新角色命令回合画面
' W- I! u2 @" i
def update_phase3
) t7 q% n% d% S
# 敌人光标有效的情况下
* }* g+ i9 X+ ~5 `: R
if @enemy_arrow != nil
7 r/ k& n8 l, A, T! X
update_phase3_enemy_select
8 g" @! `$ V& G1 j9 g! {* ]
# 角色光标有效的情况下
4 f! Q9 U1 f2 p
elsif @actor_arrow != nil
! R: Z: t+ m6 Z
update_phase3_actor_select
( `6 w- u# C1 n' {6 W; L# M! } u
# 特技窗口有效的情况下
3 w u. c8 p* m2 g2 s! B8 _
elsif @skill_window != nil
" z5 ~% u) h Z
update_phase3_skill_select
$ S" o/ N X" f# N
# 物品窗口有效的情况下
$ }, g% F" C7 X# A& p
elsif @item_window != nil
) _% m5 h/ d# z' T U# B
update_phase3_item_select
9 F% k3 j& B' N
elsif @actor_window != nil
6 X) G S( m% }1 ^; h9 z& n3 [
update_phase3_battler_select
% h: f% S. D1 M+ x
# 角色指令窗口有效的情况下
6 d2 C: k! f! m& w3 E
elsif @actor_command_window.active
( r) ~ M! ?( Y; M
update_phase3_basic_command
- A( \5 F7 \) S
end
; h9 ?1 A- b! y. f- \4 m
end
9 j2 X8 J3 X, I5 G& ^6 ]$ p
# 角色基本命令
, W' n2 z. P' v5 B. n
def update_phase3_basic_command
, A( Q1 `. U; W j- n6 F3 B
# 按下 B 键的情况下
$ ~$ T# `7 v0 Q; Q6 h
if Input.trigger?(Input::B)
- z5 e& r4 J/ V+ ]! }) C/ Q
# 演奏取消 SE
" r/ j/ U# i/ Q, e& S8 x6 |
$game_system.se_play($data_system.cancel_se)
5 C) o$ L: p2 W; ~0 F5 j" u
# 转向前一个角色的指令输入
$ s! `/ v' e6 X* e
phase3_prior_actor
" @, V. w8 }5 j6 y
return
9 N# p, B/ m4 U
end
9 m( G* P& Y* n- x$ a1 a
# 按下 C 键的情况下
3 k- W4 X& m1 _) d# e6 W; \! h+ t
if Input.trigger?(Input::C)
1 l4 r- a: z3 D1 J! R
# 角色指令窗口光标位置分之
0 G/ b: m6 I* |& b' ? l
case @actor_command_window.index
: Q. V' Z/ @+ D$ v, J2 g
when 0 # 攻击
% |0 w a6 r& q+ P$ }' E6 Q
# 演奏确定 SE
; [ u7 B& N2 s
$game_system.se_play($data_system.decision_se)
2 I: K; y# Z5 c5 k! i! H; R
# 设置行动
2 N: ^2 z) C2 P" J
@active_battler.current_action.kind = 0
# M- \0 K7 n9 Y+ W. c: `3 \ X
@active_battler.current_action.basic = 0
) b* t d" f5 C0 `8 M$ ?# m' E
# 开始选择敌人
5 z* y0 K/ v& G
start_enemy_select
2 q6 d. B" }$ z' _1 v) G' J8 P# Z0 e
when 1 # 特技
: S, \4 p. x! p; _1 y
# 演奏确定 SE
, P. ]6 |7 ~5 j9 A. t% ?5 d
$game_system.se_play($data_system.decision_se)
* e2 ^, u5 Z Q; l4 o, }
# 设置行动
- i& w, N) M% D3 \
@active_battler.current_action.kind = 1
) u: Z7 W$ y1 ~7 V$ U6 H
# 开始选择特技
$ g0 a7 p, k- k" `. c2 s6 o
start_skill_select
: O6 L3 a R, ]9 i- p! Q/ m
when 2 # 防御
" \8 ^# Y# B _' {2 M
# 演奏确定 SE
5 L% u6 C1 T: p2 ]4 H
$game_system.se_play($data_system.decision_se)
4 d( M! t7 l; O4 L: }2 S; p, F9 D
# 设置行动
3 c6 x8 }( r0 {1 T4 N+ g
@active_battler.current_action.kind = 0
/ s- x$ P# s2 r5 O+ [# ~
@active_battler.current_action.basic = 1
9 Y" @/ y5 y$ S! v# l6 T4 z. F
# 转向下一位角色的指令输入
; p7 q4 A, B p
phase3_next_actor
7 x$ m& v# D9 k5 {6 L: M
when 3 # 物品
2 ^. u/ i! H1 ?, ?' N8 R
# 演奏确定 SE
w, U& |8 s& |, Z5 s% w
$game_system.se_play($data_system.decision_se)
# P: m+ y' g" d: O& w: U7 _" a
# 设置行动
+ [ I7 t0 U" Y4 x$ P
@active_battler.current_action.kind = 2
4 u2 t* A M8 [# j: t F
# 开始选择物品
# N9 W7 ]% C/ L
start_item_select
- W. m! l! d- z3 ~: o7 l
when 4 # 换人
! \( v# _9 g8 y' {/ Y
$game_system.se_play($data_system.decision_se)
/ M' P L, q% C* j
@active_battler.current_action.set_change_battler
' R, l- G$ T' V: `
start_battler_select
1 `: ~4 { ~$ i
end
0 u7 L" n: G- {' d5 v0 I3 H/ w. t
return
7 {# T3 B3 d L& D! k5 a: X7 ]
end
# Z B) ~5 c& |2 Q5 p7 l# l5 _
end
' S$ [2 W; ~ F, R
# 开始角色选择
! h& ^* h6 _: }: ^1 n
def start_battler_select
8 D3 C: Z7 o3 R
@actor_window = Window_Actor.new
6 W. K" t2 G1 T3 C" |, C
@actor_window.active = true
. g- ^6 l% g0 y
@actor_window.index = 0
! \- @1 h( j" }) |
@actor_window.help_window = @help_window
& r; b' v6 X. B" S& C. E
@actor_command_window.active = false
$ H7 K1 f# M8 }0 z
@actor_command_window.visible = false
1 W6 G1 g/ h% _/ W* {) i
end
+ s6 ^1 d4 |4 d& W) I
# 结束角色选择
: a D4 V$ s, n. d- z# g8 t5 F8 o
def end_battler_select
) i+ G9 q- T, Q1 ?+ l5 m' l
@actor_window.dispose
* Z2 [1 t6 o# I9 |+ W3 G) L0 Y
@actor_window = nil
g# ~4 o. N3 J9 }* t8 D5 x9 t
@help_window.visible = false
7 Y9 }- H- t K/ m
@actor_command_window.active = true
: B# t& @: [ |3 U7 u+ A
@actor_command_window.visible = true
0 R1 Q9 ?! B! p Q$ ]/ k
end
+ Y+ x$ K5 o7 ? ]
# 刷新角色选择
0 O* R2 W. ?" }$ |" c
def update_phase3_battler_select
. D# V2 N8 q8 C: K" q
@actor_window.visible = true
, f# Y2 E, S7 A; k
@actor_window.update
D1 F% v+ a4 H- G* H9 u
if Input.trigger?(Input::B)
U1 [" |, j5 U. E' e3 p4 r& h
$game_system.se_play($data_system.cancel_se)
+ u+ k& j# y8 ?6 _6 R
end_battler_select
( S% c' l* g! o, ]6 E
return
. |' s, D. Z4 B( K: c& t
end
* t' q6 L3 u a
if Input.trigger?(Input::C)
0 L l1 B% E' D
actor_id = @actor_window.actor_id
0 X7 s6 N8 r. l7 P/ T$ a, S
if $game_party.get_actors_id.include?(actor_id) or
" y5 y! R5 B. R; ]) u9 q" A1 @
$game_actors[actor_id].dead? or
9 e! `/ ?5 _* |
@changed_battler_id.include?(actor_id)
1 \ |, h) o; \2 p2 h! Y
$game_system.se_play($data_system.buzzer_se)
2 k6 T$ l/ i3 K1 I9 A7 B6 C, Z
return
% B# I8 k$ r2 C* X; F( S
end
' H+ r {, ?) g& G
$game_system.se_play($data_system.decision_se)
* s/ }. S8 i. X$ |. n; N1 u7 `6 r) F
@active_battler.current_action.change_to_battler = actor_id
8 I ]0 Q V9 U+ M) D# U3 }
@changed_battler_id.push(actor_id)
& I1 J4 B. y" n, w8 X& P
end_battler_select
3 X4 f* m: y4 j) a! u- r4 l
phase3_next_actor
! {7 P' i9 m9 e$ z$ K# V
return
- G* X1 a+ y! H5 e4 s
end
( q. ]5 O+ e5 l7 V, D8 p4 O G. L
end
! `; p! d7 Z" f7 a6 j: \9 x
# 行动方动画
/ b; G; S( y3 L2 w1 E& K; K
def update_phase4_step3
2 s+ |) H) @# Z: F5 `' t$ E8 x
if @active_battler.current_action.is_change_battler?
+ k ^1 S2 l+ u6 [3 O; m
@animation1_id = AnimationChangeBattler
7 s, B; g# q) \& ^5 f5 N
@target_battlers = []
1 E+ f" [- b) e# u. b
end
! D2 [6 ~* ]5 W% q" X
# 行动方动画 (ID 为 0 的情况下是白色闪烁)
: j3 ]5 E9 J5 M5 v; o
if @animation1_id == 0
: N* w9 m; W, X* b: n8 b" F6 _
@active_battler.white_flash = true
9 o- w3 @. r! t. d% r& D" E" y
else
! h1 f6 H: y+ S( `# D. J
@active_battler.animation_id = @animation1_id
# ?9 W$ R; u4 J7 t$ R
@active_battler.animation_hit = true
3 o( k$ s$ I" K# u. @) x, i
end
& [4 j# H" [$ l6 o; l
# 移至步骤 4
9 y- w) e# U' X/ f& D. F
@phase4_step = 4
$ z1 b, I& Q) g' Z
end
" |' E1 M! ^; |% K5 r2 j3 u0 y8 P
# 对象方动画
) F# f, F! s* T4 v& f( M1 @
def update_phase4_step4
6 A# D# ~3 a; J( G7 L- p( C8 K& t
if @active_battler.current_action.is_change_battler?
0 A6 @# e4 V9 x2 n& I
actor1_id = @active_battler.current_action.change_to_battler
. ]: u/ ~* m; |3 J8 c. u8 q
actor2_id = @active_battler.id
8 j0 N2 J' o+ g: y3 H/ e
(0...$game_party.actors.size).each do |i|
' ?, `2 i7 X) i3 {( ^6 y' B+ ~3 D
if $game_party.actors[i].id == actor2_id
, m6 [3 e# [' S1 t
$game_party.change_actor(i,actor1_id)
) U1 P; N- t& @
@active_battler = $game_actors[actor1_id]
4 h( z# D3 q; I; o: r4 C8 m
@status_window.refresh
/ j3 C1 P+ D' f8 K8 z3 Z5 j
end
( f3 ^& a; Z' Q" c4 _3 @
end
, x( w5 Y! P9 J
end
3 G- p8 g# g4 I, G8 P) ^4 A+ v
# 对像方动画
" b* G9 G1 y9 S, K
for target in @target_battlers
/ _. e+ K1 B& M1 y6 z3 K
target.animation_id = @animation2_id
( y9 t; j3 B# r; y: J
target.animation_hit = (target.damage != "Miss")
0 B* [8 O0 D2 E1 A8 B6 ?
end
; M: y: \* e1 J8 N' `- N% o
# 限制动画长度、最低 8 帧
Q' G4 ^* X. ]2 C& y# o/ z
@wait_count = 8
4 \. k$ u! ^/ J8 D1 Y
# 移至步骤 5
$ B, H, L# d% L0 N7 F9 Q8 v
@phase4_step = 5
$ f$ z2 o- L, m, x6 D! |
end
8 ~! p+ M5 p% e C6 F% ?
# 公共事件
; Y, S5 J' h1 y ?
def update_phase4_step6
- j( A: r! @* F8 [8 o- U1 v
@target_battlers.each do |target|
5 y: r3 E: ]4 m
if target.is_a?(Game_Actor) and target.dead? and
. d. D/ _" m- C( u9 z" c
!$game_party.other_actors.all?{|actor|actor.dead?}
3 R0 ?$ t4 ?; m6 z9 B+ o) W& i! Z! ]
@actor_window = Window_Actor.new
8 \+ `6 o7 K& [9 g; R9 h8 o
@actor_window.index = 0
1 z/ g- h+ \5 {0 A9 x, H# h/ Z
@actor_window.active = true
8 P9 e7 i% [6 p, k
@actor_window.help_window = @help_window
, Z. e$ C0 L! A% V4 B6 }6 g
actor_id = -1
, h' W& k! \1 H& h/ _5 A
loop do
) o- i5 {- c3 q* i. ?
Graphics.update
. R: ?! [- b* L, I" ~% e( Y, a
Input.update
; l5 H( w- g5 M: Q0 G% [
@actor_window.update
A N% s/ x8 l1 {
if Input.trigger?(Input::C)
& v* Q/ F1 @) y! R* A1 U
actor = $game_actors[@actor_window.actor_id]
( b; s1 G: d* j! D* e4 K7 \ D$ I
if actor.dead? or
$ U4 `8 G. o1 V7 {7 L B( E" ~
(@changed_battler_id.include?(actor.id) and
7 I1 s2 U! V+ x- y8 G. R
target.current_action.change_to_battler != actor.id) or
! A5 w/ l& Z( J1 G; E( D+ W
$game_party.actors.include?(actor)
: m3 {3 c3 i7 \3 E5 C5 h
$game_system.se_play($data_system.buzzer_se)
4 Z; z1 p: e9 ~; h0 q
else
0 @& C. G, U3 o, ~9 q/ S
actor_id = actor.id
7 T/ x6 Z2 A+ b* o5 j
end
& p3 x6 S. } G' T" e7 d$ [3 Y
end
$ J( P( w/ p+ f7 ~
break if actor_id >= 0
/ i; Q' E( I0 T
end
& k( z# k8 e Q% [7 Y5 O% G( U9 S
@actor_window.visible = false
3 z. q# }2 Q) E/ n/ d
@actor_window.dispose
" s' |7 ~; x, ?* b+ [2 h! m
@actor_window = nil
7 y' G# N1 E& e% Z0 M. D3 U' b' p
@help_window.visible = false
, R' ]+ h2 Y9 A. Y" z- y. a$ Z5 D
(0...$game_party.actors.size).each do |i|
( k0 E. c6 \+ j7 t$ c8 A
if $game_party.actors[i].id == target.id
, W: }* I# n& v+ I4 v
$game_party.change_actor(i,actor_id)
4 S7 j6 W6 e0 n9 @ }7 ]3 D
@status_window.refresh
/ b! J' L! q% B; S1 h
end
; j) v$ ~- L& c$ ^3 x. a2 A9 ~
end
, }) a+ b3 z( P8 c8 v
end
V: G+ q1 A: O: N9 p# @6 e* J L6 G
end
) \4 C. i8 t& l$ |" P. a
# 清除强制行动对像的战斗者
- W, x5 z$ V/ g# i9 a
$game_temp.forcing_battler = nil
9 A z9 t1 {' e7 r' }
# 公共事件 ID 有效的情况下
. V6 x$ f6 x4 i
if @common_event_id > 0
2 A4 L$ i" Q+ b( V
# 设置事件
4 D/ b: t6 U. P/ @% d1 h4 W, u" r
common_event = $data_common_events[@common_event_id]
" X, C% }2 p0 R6 C4 \+ j
$game_system.battle_interpreter.setup(common_event.list, 0)
" S% p, T6 `# T9 e
end
$ M% w, Q; E! p6 ` r! O8 a; y7 m
# 移至步骤 1
8 q/ Y. y! Q: |. S; \! j
@phase4_step = 1
$ ]$ s+ z4 _ J# g" ]7 v
end
5 ^ w: a2 B5 e; U6 A8 g
end
% u1 w; y: a2 ?% ~
" m4 U4 T0 b: s% }$ m; T9 S( n! W
class Window_MenuStatus
0 m/ v: T* Y% q1 h
def refresh
) ]! b( e* t/ H# l& o3 q" X1 f
self.contents.clear
; A5 K# `8 Y; v- |4 C1 n
@item_max = $game_party.actors.size
; E( L, ?+ o0 p9 [5 K
for i in 0...$game_party.actors.size
5 o% A" m+ d* Y) S/ m
x = 4
, s: x) ^- q; _$ D6 B; Q0 n) k
y = i * 32
9 a" C9 ^' N# V- E3 d; J
actor = $game_party.actors[i]
6 M2 R9 f* g# n
bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)
3 c' C2 w" y# I: p! `. \& D. Y
rect = Rect.new(0,0,bitmap.width/4,31)
+ i% G1 m; l& L% _# E2 a
self.contents.blt(x+16-bitmap.width/8,y,bitmap,rect)
* p" L8 h: z) c$ J, s
draw_actor_name(actor, x+36, y)
1 l' O3 Y8 U5 S9 w# h, I& v
draw_actor_state(actor, x + 136,y)
. t" i ?) ]2 L9 a9 X% E0 ~
draw_actor_hp(actor, x + 236, y,96)
6 a+ W: [9 d3 f" }; w. @
draw_actor_sp(actor, x + 336, y,96)
' z1 I; h- \& g/ a) R
end
5 h- o( @( B$ |# W& h
end
5 }; o, n, Z4 ~% ^& B
def update_cursor_rect
2 \4 L" r1 i9 ^0 P
super
3 E; @2 l2 `- L0 [8 z! L) c
end
$ X' |4 ~* \6 ]3 }
end
复制代码
说明:这个东西是转自enghao_lim的一篇帖子,版权归原作者所有。
作者:
姬文翔
时间:
2011-3-25 03:32
我现在就在用这个做一个类似的游戏。但用了这个脚本后发现有个大问题
8 x5 s* X+ s7 V3 {3 _
只有最后解决掉敌人的那个人才能得到经验……怎样改成只要是在该场战斗中出过场的都可以得到一些经验呢?
作者:
1584927450
时间:
2012-6-30 15:17
LZ能否帮我写个XP的口袋脚本,和你此帖的脚本功能一样,但是是四个队员出战,剩下的待命,可换人那种,求求你了,这是我梦寐以求的口袋脚本!!!!!!!!!!!!!!!!!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1