Combat dynamique (zoom) - RPG-LIVE

Aug 10, 2007 - weather = RPG::Weather. ... maximum = 192 * (296 - $xcam_z) / 111 ... $xcam_X = [[$xcam_X + distance, - maximum].max, maximum].min end.
322KB taille 3 téléchargements 348 vues
RPG-LIVE.NEUF.FR

Combat dynamique (zoom) Scripts de --------Marcoest

10.08.2007

Auteur: ??? Titre: New_BattleMove Description: Ce script fera des zooms lors du choix de l'attaque, des ripostes ... Tout cela afin de rendre plus dynamique le combat. Ressources: Aucunes

# ============================================ # • ¡ Game_B att ler # ============================================ c lass G ame_B att ler #-----------------------------------------attr_ accessor :x_ pos # ƒoƒ gƒ ‹ƒtƒB [ƒ ‹ƒ h@‰ ¡@ˆ Ê’u( +‚ ª‰ E@ ) attr_ accessor :y_ pos # ƒoƒ gƒ ‹ƒtƒB [ƒ ‹ƒ h ‚ ‚³ ˆ Ê’u(+‚ª ~ @) attr_ access or :z_ pos # ƒoƒ gƒ ‹ƒtƒB [ƒ ‹ƒ h‰œs‚« ˆ Ê’u( +‚ª Žè ‘O) attr_ accessor :zoom # Œ» Ý ‚̃ Y[ƒ €”{ —¦ en d # ============================================ # • ¡ Game_Actor # ============================================ c lass G ame_ Actor < Game_B att ler #-----------------------------------------attr_re ader :act or_in_ batt le fie ld # ƒ AƒNƒ ^  [‚ {ƒt ƒB [ƒ ‹ƒ h‚ É #-----------------------------------------alias xrxs_ bp8_set up setup de f setu p(actor_i d) x rxs_b p8_setu p( actor_ id) # ‹@ ”"ƒAƒNƒ ^ [‚{ƒtƒ B[ƒ ‹ƒ h‚ É" # tr ue‚ð —Dæ ‚·‚é @ actor_ in_b att le fie ld = fals e i f @ actor_i n_b att le fie ld != tr ue en d en d # ============================================ # • ¡ Game_ Ene my # ============================================ c lass G ame_ Enemy < Game_B att ler #-----------------------------------------attr_re ader :act or_in_ batt le fie ld # ƒ AƒNƒ ^  [‚ {ƒt ƒB [ƒ ‹ƒ h‚ É #-----------------------------------------alias xrxs_ bp8_i niti alize in iti alize de f initi ali ze(troo p_id, member_in dex ) @ actor_ in_b att le fie ld = fals e @ x_ pos = $dat a_troo ps [troo p_i d].mem bers[mem ber_i nde x].x - 320 @ y_po s = -($dat a_troo ps[troo p_id ]. membe rs[member_ inde x].y - 304) @ fie ld_x_o ffse t = -192 @ fie ld_y_o ffset = - 144 @ z_ pos = 0 @ zoom = 1.00 x rxs_b p8_in itiali ze(troo p_i d, member _in dex) en d #-----------------------------------------de f screen_ x $xc am_ x = 0 i f $x c am_ x == ni l ret urn 320 - @ fie ld_ x_o ffset + ( @x_ pos .to_i - $xc am _x) * @ zoom en d #-----------------------------------------de f screen_ y $xc am_ y = 0 i f $xcam_y == ni l ret urn 240 - @ fie ld_ y_o ffset + ( - @y_ pos. to_i + 64 + $xc am_y ) * @zo om en d en d # =========== ================================= # • ¡ S prite _Bat tle r # ============================================ c lass Sprite_B att ler < RPG ::Spr ite #-----------------------------------------alias xrxs_ bp8_ update update de f update #  ‰Šú‰» @ z_o ffset = 0 # –ß‚· x rxs_b p 8_u pdate

RPG-LIVE.NEUF.FR

RPG-LIVE.NEUF.FR

Installation: Créez un nouveau script appelé "New_BattleMove" juste avant "Main" puis coller dedans le script suivant:

RPG-LIVE.NEUF.FR

RPG-LIVE.NEUF.FR

# ƒo ƒgƒ ‰[‚ª n il ‚Ìê–ß‚é ‡ ret urn i f @bat tle r == ni l # “G ‚݂̂Ƀ Jƒ ƒ ‰‚ª ‰e‹¿B # Œ ©•û ‚{ƒ oƒgƒ ‹ƒt ƒB  [ƒ ‹ƒ h‚É‚ ¢‚éê ‡‚ ±‚ ±‚Ì i f ‚ðŠ O‚ · B i f ( @batt ler.is _a?( Game_Actor) an d @b att ler. actor_i n_b att le fie ld) or @b att ler .is_a?(G ame_ Enemy ) # ƒ Y [ƒ €— ¦ zoom = 1.00 * 185 / (( $xc am_ z != ni l ? $xc am _z : 185) - @ z_o ffset) se lf. zoom_ x = zoo m se lf. zoom_ y = zoo m @ batt ler .zoo m = zoo m # ƒ Xƒvƒ ‰ƒ Cƒg ‚Ì [•W‚ðÝ ’è se lf. x = @b att ler.s creen_x se lf. y = @b att ler.sc reen_y se lf. z = @b att ler.screen_z en d en d en d # =================== ========================= # • ¡ S prites et_B att le # ============================================ c lass Spriteset_B att le #-----------------------------------------#  œ ƒIƒ uƒWƒ Fƒ Nƒg ‰Šú ‰» #-----------------------------------------alias xrxs_ bp8_i niti alize i n iti alize de f initi ali ze #  ‰Šú‰» @ now_bg_ x = -1 @ now_bg_y = - 1 @ now_bg_ z = -1 # ’Êí Žž‚ÌŽ[s x rxs_b p8_in itiali ze # ƒ rƒ… [ƒ |[ƒg‚ðì ¬ @ vie wport 1 = Vie wpor t.ne w( - 192, - 144, 1024, 768) # ƒo ƒgƒ ‹ƒo ƒbƒN ƒXƒv ƒ‰ƒCƒg ‚ð •ì• ¬ @ batt leb ack _spri te = Sprite .ne w(@ vie wpor t 1) @ batt leb ack _name = "" # ƒ Gƒ lƒ ~ [ƒXƒ vƒ‰ƒ Cƒ g‚ðì ¬ @e nemy _spr ites = [] for e nemy in $game_troop.en emies .reverse @e nemy _spr ites.pus h(S prite _Bat tle r.ne w( @vie wport 1, enem y)) en d # “VŒó‚ð •ì• ¬ @ we at her = RPG::We at her .ne w(@ viewport 1) # ƒ tƒŒ [ƒ €X V u pd ate en d #-----------------------------------------#  œ ƒtƒ Œ[ƒ €XV #-----------------------------------------alias xrxs_ bp8_ update update de f update # ƒo ƒgƒ ‹ƒo ƒbƒN ‚̃t ƒ@ƒ Cƒ‹ –¼ ‚ªŒ» Ý‚Ì ‚{‚Ì‚Æ ˆ|‚¤ê ‡ i f @bat tle bac k_n ame != $g ame_ tem p.b att leb ack_ name @ batt leb ack _ name = $game _tem p.b att leb ack_ name i f @bat tle bac k_spr ite.b itmap != ni l @ batt leb ack _spri te.bi tmap.dis pose en d bg _bit map = RPG:: Cac he .b att leb ack( @bat tle bac k_n ame ) bg _bit map_stretc h = Bitmap.ne w( 1024, 768) bg _bit map_stretc h.stretch_b lt( Rect .ne w( 0, 0, 1024, 768 ), bg_bi tmap, bg_b it map.rec t) @ batt leb ack _spri te.bi tmap = b g_bit map_stre tc h en d # ƒ Jƒ ƒ‰ˆ Ê’u‚ª “®‚¢‚½ê ‡ i f @no w_bg_ x != $xcam_x or @no w_bg _y != $xcam_y o r @no w_b g_z != $xc am _z # ƒ Y [ƒ €— ¦ zoom = 1.00 * 185 / $xc am_z @ batt leb ack _spri te.zoom_ x = zoo m @ batt leb ack _spri te.zoom_y = zoom # ƒ Jƒ ƒ‰z‚É‚æ ‚éˆ Ê’u‚Ì C³ m ax imu m = 192 * ( 296 - $xc am_ z) / 111 $xc am_ x = [[$xc am_ x, - maxi mum ]. max, maxim um ]. min # ”wŒiˆ Ê’u•X• V @ batt leb ack _spri te.x = -$xc am_ x * zoo m - 512 * (zoom - 1) @ batt leb ack _spri te.y = $xcam_y * zo om - 384 * (zoo m - 1)

RPG-LIVE.NEUF.FR

RPG-LIVE.NEUF.FR

# ’l•X•V @ now_bg_ x = $xcam_x @ now_bg_y = $xcam_y @ now_bg_ z = $xcam_z en d # –ß‚· x rxs_b p8_u pdate en d en d # ============================================ # • ¡ S cene_B att le # ============================================ c lass Scene _Bat tle #-----------------------------------------#  œ ƒƒ Cƒ “ —• ˆ #-----------------------------------------alias xrxs_ bp8_ mai n main de f main # ƒ Jƒ ƒ‰‰Š úˆ Ê’uŒˆ’è $xc am_ x = 0 $xc am_ y = 0 $xc am_ z = 295 # ƒ Jƒ ƒ‰‚Ì Å ‰‚Ì –Ú “I’l @ xcam_x_desti nat ion = 0 @ xcam_y_ desti nati on = 0 @ xcam_ z_desti nat ion = 185 #  ¡ A’ – Ú ƒoƒgƒ ‰[‚Í– ³ ‚µ•B @ xcam_ wat ch_battler = ni l #  ‰Šú‰» @ wait_co unt_ xcam = 0 # –ß‚· x rxs_b p8_main en d #-----------------------------------------#  œ ƒtƒ Œ[ƒ €XV #-----------------------------------------alias xrxs_ bp8_ update update de f update # ƒ Jƒ ƒ‰ˆ Ê’u‚Ì XV B i f @wait_co unt_ xcam > 0 # ƒ EƒFƒCƒgƒ Jƒ Eƒ “ƒ g‚ðŒ ¸‚ç ‚· @ wait_co unt_ xcam - = 1 e lse # ƒ Jƒ ƒ‰: Z [•W i f $xc am_ z != @ xcam_z_desti nat ion i f $xc am_ z < @ xcam_z_desti nat ion d istance = [(@xcam_z_ desti nat ion - $xc am_ z) /8, 1].m ax e lse d istance = [(@xcam_z_ desti nat ion - $xc am_ z) /8, -1].mi n en d $xc am_ z = [[$xc am_ z + dist ance , 74]. max, 296].min en d # ƒ Jƒ ƒ‰: X [•W i f @xc am_ watc h_b att ler != ni l i f $xc am_ x != @ xcam_ watc h_b att ler .x_ pos i f ( $xcam_x - @xc am_ watc h_b att ler .x_ pos) .abs < 8 d istance = @ xcam_ watc h_b att ler .x_ pos - $xc am_ x e lsi f $xc am_ x < @ xcam_ watc h_b att ler. x_ pos d istance = [(@xcam_watc h_b att ler .x_ pos - $xc am_ x) /8, 8].m ax e lse d istance = [(@xcam_watc h_b att ler .x_ pos - $xc am_ x) /8, - 8].mi n en d m ax imu m = 192 * ( 296 - $xc am_ z) / 111 $xc am_ x = [[$xc am_ x + dist ance , -m axi mu m].m ax, m ax imu m].mi n en d e lsi f $xc am_ x != @ xcam_x_desti nat ion i f ( $xcam_x - @xc am_ x_desti nat ion) .abs < 8 d istance = @ xcam_x_ destin atio n - $xc am_ x e lsi f $xc am_ x < @ xcam_x_ destin atio n d istance = [(@xcam_x_ desti nat ion - $xc am_ x) /8, 8].m ax e lse d istance = [(@xcam_x_ desti nat ion - $xc am_ x) /8, -8].mi n en d m ax imu m = 192 * ( 296 - $xc am_ z) / 111 $xc am_ x = [[$xc am_ x + dist ance , -m axi mu m].m ax, m ax imu m].mi n

RPG-LIVE.NEUF.FR

RPG-LIVE.NEUF.FR

en d # ƒ Jƒ ƒ‰: Y [•W i f @xc am_ watc h_b att ler != ni l y = @xc am_ watc h_b a tt ler .y_ pos/2 i f $xc am_ y != y i f ( $xcam_y - y).abs < 8 d istance = y - $xcam_y e lsi f $xc am_ y < y d istance = [(y - $xc am_y)/8, 8].m ax e lse d istance = [(y - $xc am_y)/8, - 8].mi n en d m ax imu m = 144 * ( 296 - $xc am_ z) / 111 $xc am_ y = [[$xc am_y + dist ance , -m axi mu m].m ax, m ax imu m].mi n en d e lsi f $xc am_ y != @xcam_y_ desti natio n i f $xc am_ y < @ xcam_y_ desti nat ion d istance = [(@xcam_y_ desti nat ion - $xc am_ y) /8, 1].m ax e lse d istance = [(@xcam_y_ desti nat ion - $xc am_ y) /8, -1].mi n en d m ax imu m = 164 * ( 296 - $xc am_ z) / 111 $xc am_ y = [[$xc am_y + dist ance , -m axi mu m].m ax, m ax imu m].mi n en d en d # ’Êí Ž[s x rxs_b p8_u pdate en d #-----------------------------------------#  œ ƒ p[ƒeƒB ƒRƒ}ƒ “ƒ hƒtƒ F [ƒYŠ JŽn #-----------------------------------------alias xrxs_ bp8_st art_ phase 2 st art_ phase 2 de f start _phase 2 # ƒ Jƒ ƒ‰ FƒZƒ “ƒ ^ƒŠƒ “ƒO @ xcam_ wat ch_battler = ni l @ xcam_x_desti nat ion = 0 @ xcam_ z_desti nat ion = 185 # –ß‚· x rxs_b p8_st art_ phase 2 en d #-----------------------------------------#  œ ƒtƒ Œ[ƒ €XV (ƒ AƒN ƒ ^[ƒRƒ}ƒ “ƒhƒtƒ F [ƒY) #-----------------------------------------alias xrxs_ bp8_ update_ phase3 u pd ate_phase 3 de f update_phase 3 # ƒ Jƒ ƒ‰‚ð ƒLƒ ƒƒ‰ˆ Ê’u ‚Ö i f @act ive_b att ler != ni l and @ac tive_b att ler .act or_i n_b att le fie ld @ xcam_x_desti nat ion = @ acti ve_b att ler. x_pos @ xcam_ z_desti nat ion = 175 en d x rxs_b p8_u pdate_ phase 3 en d #-----------------------------------------#  œ ƒtƒ Œ[ƒ €XV (ƒ AƒN ƒ ^[ƒRƒ}ƒ “ƒhƒtƒ F [ƒY : ƒGƒ lƒ ~ [‘I‘ð ) #-----------------------------------------alias xrxs_ bp8_ update_ phase3_enem y_se lect update_ phase 3_e nem y_se lect de f update_phase 3_ene my_s ele ct # ƒ Jƒ ƒ‰ F“Gƒ ^ [ƒQƒ bƒg ‚ðƒ Y[ƒ€ƒAƒbƒv @ xcam_x_desti nat ion = $g ame_ troop.ene mies [@ene my_ arro w.i nde x].x_ pos * $game_troo p.e nemies [@e nemy _arro w.inde x ].zoom @ xcam_ z_desti nat ion = 175 # –ß‚· x rxs_b p8_u pdate_ phase 3_ene my_se lec t en d #-----------------------------------------#  œ ƒG ƒlƒ~[‘I‘ðI —¹ #-----------------------------------------alias xrxs_ bp8_e nd_e nemy_s ele ct en d_ene my_se lect de f end_e nemy_se lect # ƒ Jƒ ƒ‰ F’†S ‚Ö @ xcam_x_desti nat ion = 0 @ xcam_ z_desti nat ion = 185 # –ß‚· x rxs_b p8_en d_ene my _se lect en d #------------------------------------------

RPG-LIVE.NEUF.FR

RPG-LIVE.NEUF.FR

#  œ ƒtƒ Œ[ƒ €XV (ƒƒ Cƒ “ƒt ƒF[ƒ Y ƒX ƒeƒbƒ v 2 : ƒAƒ NƒVƒ ‡ƒ “ŠJ Žn) #-----------------------------------------alias xrxs_ bp8_ update_ phase4_step2 update _phase4_ste p2 de f update_phase 4_ste p2 # –ß‚· x rxs_b p 8_u pdate_ phase 4_ste p2 # ƒ Xƒeƒb ƒv 3 ‚Ɉ Ú s‚·‚éê ‡ i f @phase 4_ste p == 3 i f @act ive_b att ler.is_a? (G ame_ Enem y) or @ acti ve_b att ler .acto r_in_b att le fie ld # ƒ Jƒ ƒ‰ Fs “®ƒoƒgƒ‰ [‚ Ö‚Ì ƒY [ƒ €ƒ Aƒbƒ— v‚ð–ñ @ xcam_x_desti nat ion = @ acti ve_b att ler. x_pos * @ acti ve_b att ler. zo om if @ acti ve_b att ler. x_pos != ni l @ xcam_ z_desti nat ion = 175 en d #  Å’| 20 ƒtƒ Œ[ƒ €‘Ò ‚] @ wait_co unt = 20 en d en d #-----------------------------------------#  œ ƒtƒ Œ[ƒ €XV (ƒƒ Cƒ “ƒt ƒF[ƒ Y ƒX ƒeƒbƒ v 3 :  s“®‘¤ƒAƒ jƒ[ƒVƒ ‡ƒ “) #-----------------------------------------alias xrxs_ bp8_ update_ phase4_step3 update _phase4_ste p3 de f update_phase 4_ste p3 # –ß‚· x rxs_b p8_u pdate_ phase 4_ste p3 i f @tar get_b att lers.s ize > 0 and ( @tar get_b att lers [0].is_a?( Game_ Ene my) or @target _bat tlers[0]. actor_i n_b att le fie ld) # ƒ Jƒ ƒ‰ ƒF^[ƒQƒb ƒg‚Ö ‚̃Y [ƒ €ƒAƒ bƒv ‚ð — –ñ @ xcam_x_desti nat ion = @t arge t_batt lers[0]. x_pos * @t arge t_batt lers[0]. zoo m i f @t arget _bat tler s[0] != ni l @ xcam_ z_desti nat ion = 185 # ‚{‚µ‘Î Ûƒ Aƒ jƒ ‚ª uˆ Ê’u F‰æ – ʁv ‚Ì‚ {‚Ì ‚Ìê ‡ i f @an imation 2_i d > 0 and $dat a_anim atio ns[@ani m ati on 2_id ]. posit ion == 3 # ƒ Jƒ ƒ‰‚ð ƒZƒ“ƒ^ƒŠƒ “ƒO @ xcam_x_desti nat ion = 0 # ƒ Y [ƒ €ƒ Aƒ Eƒg ‚Ü‚Å‚}‚\‚¿‚|‚ ¤¥w¥ @ xcam_ z_desti nat ion = 222 en d en d #  Å’| 20 ƒtƒ Œ[ƒ €‘Ò ‚] @ wait_co unt = 20 en d #-----------------------------------------#  œ ƒ Aƒtƒ ^ [ƒoƒ gƒ ‹ƒtƒ F [ƒYŠ JŽ n #-----------------------------------------alias xrxs_ bp8_st art_ phase 5 st art_ phase 5 de f start _phase 5 @ xcam_ z_desti nat ion = 185 x rxs_b p8_st art_ phase 5 en d en d # ============================================ #  ž RPG:: Ä’è‹` uí “¬’†‚ Ì"‰– æ Ê"ƒ Aƒ jƒ ‚̈ Ê’uC³v # ============================================ mo du le RPG c lass Sprite < ::S prite de f an imation_se t_spr ites(s prites , ce ll_d at a, positio n) for i in 0..15 s prite = s prites [i ] patt ern = ce ll_dat a[i , 0] i f s prite == n il or patter n == ni l or pattern == - 1 s prite .visib le = false i f s prite != ni l ne xt en d s prite .visib le = t rue s prite .src_rect .set( pattern % 5 * 192, pattern / 5 * 192, 192, 192) i f positio n == 3 i f se lf.vie wpor t != ni l i f $scene .is_ a?(Sce ne_B att le) s prite .x = se lf.vie wport .rect .widt h / 2 s prite .y = 304 e lse s prite .x = se lf.vie wport .rect .widt h / 2 s prite .y = se lf.v iewport .rect .heig ht - 160 en d e lse s prite .x = 320

RPG-LIVE.NEUF.FR

s prite .y = 240 en d e lse s prite .x = se lf.x - se lf.o x + se lf.src _rect. wi dt h / 2 s prite .y = se lf.y - se lf.oy + se lf.src _rect. he ig ht / 2 s prite .y - = se lf.src _rect.hei ght / 4 i f pos ition == 0 s prite .y += se lf.src_re ct.hei ght / 4 i f pos ition == 2 en d s prite .x += ce ll_data[i , 1] s prite .y += ce ll_data[i , 2] s prite .z = 2000 s prite .ox = 96 s prite .oy = 96 s prite .zoo m_x = ce ll_ dat a[i, 3] / 100. 0 s prite .zoo m_y = ce ll_dat a[i, 3] / 100. 0 s prite .an g le = ce ll_data[i, 4] s prite .mirror = (ce ll_data[i , 5] == 1) s prite .opacit y = ce ll_data[i, 6] * se lf.o pac ity / 255.0 s prite .b lend_ty pe = ce ll_data[i, 7] en d en d en d en d

RPG-LIVE.NEUF.FR