Started by fjurio, January 31, 2011, 08:08:43 am
$BlizzABS.player.switch_leader
Quote from: winkioI do not speak to bricks, either as individuals or in wall form.
Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.
Quote from: winkio on June 15, 2011, 07:30:23 pmAh, excellent. You liked my amusing sideshow, yes? I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.
module BlizzABS class Controller def update_control # get pixel movement rate pix = $BlizzABS.pixel # reset move speed player.move_speed = player.normal_speed # reset spriteset name player.character_name = player.character_name_org # if allowed to change speed unless $game_system.map_interpreter.running? || player.move_route_forcing || $game_temp.message_window_showing # if run button works and running if $game_system.running_button && Input.press?(Input::Run) # set running speed player.move_speed = Config::RUN_SPEED # if sneak button works and sneaking elsif $game_system.sneaking_button && Input.press?(Input::Sneak) || Config::SNEAK_SPEED > 0 && Config::SNEAK_ON_CHARGE && player.charging? # set sneaking speed player.move_speed = Config::SNEAK_SPEED end end # if battler exists and either dead or select triggered if player.battler != nil && ($game_system.select_button && Input.trigger?(Input::Select) || player.battler.dead?) # switch to next valid actor $scene = Scene_Player_Select.new end # setup sprite animation player.sprite_animation_setup # update action player.update_action # if allowed to turn and pressed turning button or defending if ((player.ai.act.defend? && player.attacked == 0) || $game_system.turn_button && Input.press?(Input::Turn)) && !player.moving? && !$game_system.map_interpreter.running? && !player.move_route_forcing && !$game_temp.message_window_showing # get input depending on confusion input = (player.restriction == 3 ? 10 - Input.dir4 : Input.dir4) # depending on input turn case input when 2 then player.turn_down when 4 then player.turn_left when 6 then player.turn_right when 8 then player.turn_up end # updates any attacked action player.update_attacked # abort method return nil end # updates any attacked action player.update_attacked # if acting if player.in_action > 0 # decrease action counter if in_action is greater than 0 player.in_action -= 1 if player.in_action > 0 # return data return [player.moving?, player.real_x, player.real_y] end # if allowed to move unless $game_system.map_interpreter.running? || player.move_route_forcing || $game_temp.message_window_showing # if jump button was pressed and not already jumping if $game_system.jumping_button && Input.trigger?(Input::Jump) && !player.jumping? && player.restriction < 4 # set to jump @memory_jump = true end # if not moving unless player.moving? # get jumping range range = Config::JUMPING # if jumping turned on and not jumping and jumped if range > 0 && !player.jumping? && @memory_jump # if sneaking or running is possible if Config::RUN_SPEED > 0 || Config::SNEAK_SPEED > 0 # get difference between current speed and normal speed dplus = player.move_speed - player.normal_speed else # difference is 0 dplus = 0 end # get direction direction = $game_system._8_way ? Input.dir8 : Input.dir4 # set jumping direction x, y = Cache::DirOffsets[direction] # jump into direction with considering running/sneaking player.jump(x*range + x*dplus, y*range + y*dplus, direction) # if not already jumping elsif !player.jumping? # move move($game_system._8_way ? Input.dir8 : Input.dir4) # allow idle if no movement player.idle_allowed = !player.moving? end # not jumping anymore @memory_jump = false end end # return data return [player.moving?, player.real_x, player.real_y] end endend#==============================================================================# Scene Player Select#==============================================================================class Scene_Player_Select def main @spriteset = Spriteset_Map.new @change_char = Window_Player_Select.new @change_char.x = 320 - (@change_char.width / 2) @change_char.y = 240 - (@change_char.height / 2) # create HUD if HUD is turned on and HUD active @hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud # if ASSIGNMENT is turned on and assignment display active if BlizzABS::Config::HOTKEYS && $game_system.hotkeys # create assignment display @hotkeys = Hotkey_Assignment.new end # if MINIMAP is turned on and minimap active if BlizzABS::Config::MINIMAP && $game_system.minimap > 0 # create HUD @minimap = Minimap.new # create HUD @minimap.update end Graphics.transition loop do Graphics.update Input.update update break if $scene != self end Graphics.freeze [@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil} @change_char.dispose @spriteset.dispose end def update @change_char.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $game_party.swap_actor(@change_char.index) $scene = Scene_Map.new end end end#==============================================================================# Window Plyer Select#==============================================================================class Window_Player_Select < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(350, 200, 150,($game_party.actors.size*32)+ 32) @column_max = 1 refresh self.index = 0 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @item_max = $game_party.actors.size self.contents = Bitmap.new(width - 32, (@item_max*32)) (0...@item_max).each{|i|draw_item(i)} end #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) name = $game_party.actors[index].name y = index * 32 self.contents.draw_text(4, y, 100, 32, name.to_s) endend#==============================================================================# Game_Party#==============================================================================class Game_Party def swap_actor(switch_id) hold = @actors[0] @actors[0] = @actors[switch_id] @actors[switch_id] = hold $game_player.refresh end end
Quote from: elmangakac on January 31, 2011, 12:49:28 pmWell if you need it... someone gives me a script that allows you select the leader in a little window when you hit a button... in my case is ctrl... if you are dead... the windows appears and let you select the leader that continues...module BlizzABS class Controller def update_control # get pixel movement rate pix = $BlizzABS.pixel # reset move speed player.move_speed = player.normal_speed # reset spriteset name player.character_name = player.character_name_org # if allowed to change speed unless $game_system.map_interpreter.running? || player.move_route_forcing || $game_temp.message_window_showing # if run button works and running if $game_system.running_button && Input.press?(Input::Run) # set running speed player.move_speed = Config::RUN_SPEED # if sneak button works and sneaking elsif $game_system.sneaking_button && Input.press?(Input::Sneak) || Config::SNEAK_SPEED > 0 && Config::SNEAK_ON_CHARGE && player.charging? # set sneaking speed player.move_speed = Config::SNEAK_SPEED end end # if battler exists and either dead or select triggered if player.battler != nil && ($game_system.select_button && Input.trigger?(Input::Select) || player.battler.dead?) # switch to next valid actor $scene = Scene_Player_Select.new end # setup sprite animation player.sprite_animation_setup # update action player.update_action # if allowed to turn and pressed turning button or defending if ((player.ai.act.defend? && player.attacked == 0) || $game_system.turn_button && Input.press?(Input::Turn)) && !player.moving? && !$game_system.map_interpreter.running? && !player.move_route_forcing && !$game_temp.message_window_showing # get input depending on confusion input = (player.restriction == 3 ? 10 - Input.dir4 : Input.dir4) # depending on input turn case input when 2 then player.turn_down when 4 then player.turn_left when 6 then player.turn_right when 8 then player.turn_up end # updates any attacked action player.update_attacked # abort method return nil end # updates any attacked action player.update_attacked # if acting if player.in_action > 0 # decrease action counter if in_action is greater than 0 player.in_action -= 1 if player.in_action > 0 # return data return [player.moving?, player.real_x, player.real_y] end # if allowed to move unless $game_system.map_interpreter.running? || player.move_route_forcing || $game_temp.message_window_showing # if jump button was pressed and not already jumping if $game_system.jumping_button && Input.trigger?(Input::Jump) && !player.jumping? && player.restriction < 4 # set to jump @memory_jump = true end # if not moving unless player.moving? # get jumping range range = Config::JUMPING # if jumping turned on and not jumping and jumped if range > 0 && !player.jumping? && @memory_jump # if sneaking or running is possible if Config::RUN_SPEED > 0 || Config::SNEAK_SPEED > 0 # get difference between current speed and normal speed dplus = player.move_speed - player.normal_speed else # difference is 0 dplus = 0 end # get direction direction = $game_system._8_way ? Input.dir8 : Input.dir4 # set jumping direction x, y = Cache::DirOffsets[direction] # jump into direction with considering running/sneaking player.jump(x*range + x*dplus, y*range + y*dplus, direction) # if not already jumping elsif !player.jumping? # move move($game_system._8_way ? Input.dir8 : Input.dir4) # allow idle if no movement player.idle_allowed = !player.moving? end # not jumping anymore @memory_jump = false end end # return data return [player.moving?, player.real_x, player.real_y] end endend#==============================================================================# Scene Player Select#==============================================================================class Scene_Player_Select def main @spriteset = Spriteset_Map.new @change_char = Window_Player_Select.new @change_char.x = 320 - (@change_char.width / 2) @change_char.y = 240 - (@change_char.height / 2) # create HUD if HUD is turned on and HUD active @hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud # if ASSIGNMENT is turned on and assignment display active if BlizzABS::Config::HOTKEYS && $game_system.hotkeys # create assignment display @hotkeys = Hotkey_Assignment.new end # if MINIMAP is turned on and minimap active if BlizzABS::Config::MINIMAP && $game_system.minimap > 0 # create HUD @minimap = Minimap.new # create HUD @minimap.update end Graphics.transition loop do Graphics.update Input.update update break if $scene != self end Graphics.freeze [@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil} @change_char.dispose @spriteset.dispose end def update @change_char.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new elsif Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $game_party.swap_actor(@change_char.index) $scene = Scene_Map.new end end end#==============================================================================# Window Plyer Select#==============================================================================class Window_Player_Select < Window_Selectable #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(350, 200, 150,($game_party.actors.size*32)+ 32) @column_max = 1 refresh self.index = 0 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @item_max = $game_party.actors.size self.contents = Bitmap.new(width - 32, (@item_max*32)) (0...@item_max).each{|i|draw_item(i)} end #-------------------------------------------------------------------------- # * Draw Item # index : item number #-------------------------------------------------------------------------- def draw_item(index) name = $game_party.actors[index].name y = index * 32 self.contents.draw_text(4, y, 100, 32, name.to_s) endend#==============================================================================# Game_Party#==============================================================================class Game_Party def swap_actor(switch_id) hold = @actors[0] @actors[0] = @actors[switch_id] @actors[switch_id] = hold $game_player.refresh end endPut it below Bliz abs