UltimaForum

Skrypty [VX] - Potwierdzenie komend walki

PaKiTos - Czw 01 Lip, 2010 07:36
Temat postu: Potwierdzenie komend walki
Przed atakiem bohaterów jest przegląd ich działań. Można wznowić turę. Skrypt jest sprawdzony i działa z Ring Menu podczas walki.
Oto on:
Spoiler:

Kod:
#===============================================================================
# Battle Action Confirmation v1.2
# by Deriru
# dla ultimaforum.pl - przesłał pakitos
# PLEASE GIVE CREDIT IF USED!
#
#-------------------------------------------------------------------------------
# What this script does:
# -It adds a confirmation window where you finalize your decision on your
# battler's actions. Their given actions are also displayed at the window.
#-------------------------------------------------------------------------------
# History:
#
# v1.2: Added Dead Action (if character is Incapacitated)
#
# v1.1: Added Auto Action (if character is Auto Battle)
#
# v1.0: Initial release
#-------------------------------------------------------------------------------
# Setup Options:
# NOTHING: Sets the action label if there is no action that cannot be done.
# CONFASK: The text displayed at the confirmation window.
# ALIGN: Alignment of the text. (0 = left, 1 = center, 2 = right)
# WIDTH: The width of the window.
#-------------------------------------------------------------------------------
# Setup Start!
#-------------------------------------------------------------------------------
module Deriru
module ActConf
AUTO = "Automatycznie"
DEAD = "Leżę"
NOTHING = "Brak"
CONFASK = "Wykonać rozkazy?"
ALIGN = 1
WIDTH = 300
end
end
#-------------------------------------------------------------------------------
# Setup End!
# DO NOT TOUCH THE PARTS BELOW IF YOU DON'T KNOW WHAT YOU'RE DOING!
#===============================================================================
class Game_Party < Game_Unit

def everyone_auto?
auto = true
for actor in members
auto = false unless actor.auto_battle
end
return auto
end

end
class Window_BattleActInfo < Window_Base

def initialize
@info = Array.new
@actions = Array.new
w = Deriru::ActConf::WIDTH
super((Graphics.width - w) / 2,(Graphics.height - 152)/2 - 56,w,152)
end

def refresh
self.contents.clear
self.contents.draw_text(0,0, self.width - 32, WLH, Deriru::ActConf::CONFASK, Deriru::ActConf::ALIGN)
for i in 0..$game_party.members.size - 1 do
self.contents.draw_text(0, WLH * (i + 1), self.width - 32, WLH, @actions[i], Deriru::ActConf::ALIGN)
end
end

def get_info
@actions.clear
$game_party.members.each do |i|
if i.hp == 0
@actions.push(i.name + ": " + Deriru::ActConf::DEAD)
elsif i.auto_battle
@actions.push(i.name + ": " + Deriru::ActConf::AUTO)
elsif i.action.attack?
@actions.push(i.name + ": " + Vocab::attack)
elsif i.action.guard?
@actions.push(i.name + ": " + Vocab::guard)
elsif i.action.nothing?
@actions.push(i.name + ": " + Deriru::ActConf::NOTHING)
elsif i.action.skill?
@actions.push(i.name + ": " + Vocab::skill + " - " + i.action.skill.name)
elsif i.action.item?
@actions.push(i.name + ": " + Vocab::item + " - " + i.action.item.name)
else
@actions.push(i.name + ": " + "???")
end
refresh
end
end

end

class Scene_Battle < Scene_Base

alias start_deriruconfact start unless $@
def start
start_deriruconfact
@infowin = Window_BattleActInfo.new
@infoconfirm = Window_Command.new(Deriru::ActConf::WIDTH,["Wykonaj","Wznów turę"],2)
@infoconfirm.x = (Graphics.width - Deriru::ActConf::WIDTH) / 2
@infoconfirm.y = @infowin.y + @infowin.height
@infowin.visible = false
@infoconfirm.visible = @infoconfirm.active = false
end


#--------------------------------------------------------------------------
# * Go to Command Input for Next Actor (override)
#--------------------------------------------------------------------------
def next_actor
loop do
if @actor_index == $game_party.members.size-1
ask_confirmation
return
end
@status_window.index = @actor_index += 1
@active_battler = $game_party.members[@actor_index]
if @active_battler.auto_battle
@active_battler.make_action
next
end
break if @active_battler.inputable?
end
start_actor_command_selection
end

#--------------------------------------------------------------------------
# [New method] Ask for confirmation
#--------------------------------------------------------------------------
def ask_confirmation
@infowin.visible = true
@infowin.get_info
@infoconfirm.visible = @infoconfirm.active = true
@actor_command_window.active = false
end

def end_confirmation
@infowin.visible = false
@infowin.get_info
@infoconfirm.visible = @infoconfirm.active = false
end

def update_confirmation_selection
@infoconfirm.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_confirmation
@status_window.index = @actor_index = 0
unless $game_party.everyone_auto?
for i in $game_party.members do
if i.auto_battle
@status_window.index = @actor_index += 1
@active_battler = $game_party.members[@actor_index]
else
break
end
end
start_actor_command_selection
else
@active_battler = $game_party.members.first
start_party_command_selection
end
elsif Input.trigger?(Input::C)
if @infoconfirm.index == 0
Sound.play_decision
end_confirmation
start_main
else
Sound.play_decision
end_confirmation
@status_window.index = @actor_index = 0
unless $game_party.everyone_auto?
for i in $game_party.members do
if i.auto_battle
@status_window.index = @actor_index += 1
@active_battler = $game_party.members[@actor_index]
else
break
end
end
start_actor_command_selection
else
@active_battler = $game_party.members.first
start_party_command_selection
end
end
end
end

#--------------------------------------------------------------------------
# * Frame Update (override)
#--------------------------------------------------------------------------
def update
super
update_basic(true)
update_info_viewport # Update information viewport
if $game_message.visible
@info_viewport.visible = false
@message_window.visible = true
end
unless $game_message.visible # Unless displaying a message
return if judge_win_loss # Determine win/loss results
update_scene_change
#======== added if statement ====
if @infoconfirm.active == true
update_confirmation_selection
#================================
elsif @target_enemy_window != nil
update_target_enemy_selection # Select target enemy
elsif @target_actor_window != nil
update_target_actor_selection # Select target actor
elsif @skill_window != nil
update_skill_selection # Select skill
elsif @item_window != nil
update_item_selection # Select item
elsif @party_command_window.active
update_party_command_selection # Select party command
elsif @actor_command_window.active
update_actor_command_selection # Select actor command
else
process_battle_event # Battle event processing
process_action # Battle action
process_battle_event # Battle event processing
end
end
end

end


radek02 - Czw 01 Lip, 2010 07:48

możesz podac jakiś screen ?
PaKiTos - Czw 01 Lip, 2010 08:05

Masz, zadowolony?
Spoiler:



radek02 - Czw 01 Lip, 2010 08:08

PaKiTos, teraz wiem , że znalazłeś super skrypt . Co prawda , w mojej grze , nie będzie zbyt dużo walk , ale raczej go wykorzystam .
PaKiTos - Czw 01 Lip, 2010 08:16

;P Dzięki >) Skrypt jest łatwy w obsłudze a bardzo fajny 8)
Angius - Sob 20 Lis, 2010 12:33

Err... Screen wygasł :)
Jeśli mógłbyś wrzucić go jeszcze raz, byłbym ci niezmiernie wdzieczny, bo nie zwykłem instalować w ciemno :P

sled - Sob 20 Lis, 2010 19:43

bardzo fajny skrypt - szczególnie cieszy mnie iż działa z ring menu gdyż właśnie tego systemu walki używam w swojej gierce :->
a screena nie trudno sobie wyobrazić - po wykonaniu akcji pojawia się pytanie czy wykonać np atak przez xxx na yyy gdzie xxx to postać którą owy atak wykonujemy, a yyy to cel danej postaci! (oczywiście w grze nie pisze "xxx" czy "yyy" tylko nazwa danej postaci ;-) )

wojtas025c - Nie 21 Lis, 2010 20:57

Bardzo dobry skrypt ale raczej w mojej grze zarazie nie będę jej używał :P
Agumon - Nie 21 Lis, 2010 21:44

PaKiTos, podaj jeszcze raz tego screena bo wygasł.
kylu31 - Pon 22 Lis, 2010 18:58

Też prosze o screna bo jak taki fajny jak piszą to też użyje :D

Powered by phpBB modified by Przemo © 2003 phpBB Group