Jump to content
Rpg²S Forum
  • 0

[HELP]una stringa mi impalla tutto


rehim McMoon
 Share

Question

 

#=============================================================
=================
# Crissaegrim ABS
#==============================================================================
#--------------------------------------------------------------
# Créditos a Vlad, Chronos e Drod
#--------------------------------------------------------------
# Para Criar um Inimigo, coloque os seguintes comentários:
# Enemy ID - onde ID é o id do monstro no database;
# Die X - onde X = 0 ou 1,2,3,4 (0 apaga o evento do inimigo, 1 liga a switch local 'A', 2 liga a switch local 'B', 3 liga a switch local 'C', 4 liga a switch local 'D')
# OBS.: Die X onde X > 4 ,ativa uma switch X;
# Follow X - Para o evento seguir o herói automaticamente, mude X para a distância da visão do inimigo.
#--------------------------------------------------------------
# CONFIGURAÇÃO GERAL
#--------------------------------------------------------------
module Crissaegrim_ABS
#--------------------------------------------------------------
#Tecla de Ataque, mude o A para outra tecla que queira:
Attack_Button = Input::X
#--------------------------------------------------------------
# Tecla de Skill, mude os números para outra tecla que queira:
Skill_Button = {Input::Y => 0,
               Input::Z => 0}
#--------------------------------------------------------------
# Tecla de Ítem, mude os números para outra tecla que queira:
Item_Button = {Input::L => 0,
              Input::R => 0}
#--------------------------------------------------------------
Distance_Weapons = {}
# Armas de Distância.
# Para criar uma arma de distância, copie: Distance_Weapons[u] = [V, W, X, Y, Z] e mude:
# U:ID da Arma, V:Char, W:Velocidade, X:Distância, Y:Munição, Z:Tempo de espera para atacar
# PS: O gráfico do projétil DEVE SER um gráfico sozinho.
Distance_Weapons[4] = ["!$Arrow", 6, 5, 21, 30]
Distance_Weapons[5] = ["!$shuriken", 6, 5, 21, 30]
#--------------------------------------------------------------
Distance_Skills = {}
# Skills de Distância.
# Para criar uma skill de distância, copie: Distance_Skills[V] = [W, X, Y, Z] e mude:
# V:ID da Arma, W:Char, X:Velocidade, Y:Distância, Z:Tempo de espera para atacar
# PS: O gráfico do projétil DEVE SER um gráfico sozinho.
Distance_Skills[59] = ["!$EnergyBall_3", 4, 5, 60]
Distance_Skills[63] = ["!$EnergyBall_2", 4, 5, 60]
Distance_Skills[67] = ["!$EnergyBall_6", 4, 5, 60]
Distance_Skills[71] = ["!$EnergyBall"  , 4, 5, 60]
Distance_Skills[73] = ["!$EnergyBall_5", 4, 5, 60]
Distance_Skills[76] = ["!$EnergyBall_5", 4, 5, 60]
Distance_Skills[77] = ["!$EnergyBall_6", 4, 5, 60]
Distance_Skills[79] = ["!$EnergyBall_4", 4, 5, 60]
#--------------------------------------------------------------
Distance_Items = {}
# Ítens de Distância.
# Para criar um ítem de distância, copie: Distance_Items[u] = [V, W, X, Y, Z] e mude:
# U:ID da Arma, V:Char, W:Velocidade, X:Distância, Y:Munição, Z:Tempo de espera para atacar
# PS: O gráfico do projétil DEVE SER um gráfico sozinho.
Distance_Items[16] = ["!$EnergyBall_3", 6, 5, 16, 30]
Distance_Items[18] = ["!$EnergyBall_2", 6, 5, 16, 30]
Distance_Items[20] = ["!$EnergyBall_6", 6, 5, 16, 30]
#--------------------------------------------------------------
#Animação qando o Herói passa de Level.
#Mude o 40 para o ID da animação.
LevelUp_Ani = 40
#--------------------------------------------------------------
#Animação do ataque do inimigo, copie  Enemy_atk_ani[X] = Y
# e mude o X para o ID do inimigo, e Y para o ID da animação.
Enemy_atk_ani = {}
Enemy_atk_ani[2] = 13
Enemy_atk_ani[3] = 19
#--------------------------------------------------------------
end
#==============================================================================

#--------------------------------------------------------------
# Game Character
#--------------------------------------------------------------
class Game_Character
 attr_accessor :hp
 attr_accessor :mp
 attr_accessor :damage
 attr_accessor :critical
 attr_accessor :wait_action
 attr_accessor :die
 attr_accessor :use_skill
 attr_accessor :use_item
 alias crissaegrim_abs_gchar_initialize initialize
 def initialize
   @hp = 0
   @mp = 0
   @die = 0
   @use_skill = 0
   @use_item = 0
   @wait_action = 0
   @damage = nil
   @critical = false
   crissaegrim_abs_gchar_initialize
 end 
 def recive_atk(attacker)
   attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_actors[1])
   receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_actors[1])
   if self.is_a?(Game_Player)
     $game_actors[82].attack_effect(attacker_status)
     dmg = $game_actors[1].make_attack_damage_value(attacker_status)
     $game_player.damage = dmg
     $scene = Scene_Gameover.new if $game_actors[1].hp <= 0
   elsif self.is_a?(Game_Event)
     self.enemy_status.make_attack_damage_value(attacker_status)
     dmg = self.enemy_status.make_attack_damage_value(attacker_status)
     if @use_skill <= 0 and @use_item <= 0
     self.damage = dmg
     $data_enemies[self.enemy_id].maxhp -= dmg
     self.kill_enemy if $data_enemies[self.enemy_id].maxhp <= 0 and @use_item <= 0
   end
 end
end
 def recive_skill(attacker, skill)
   attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_actors[1])
   receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_actors[1])
   if self.is_a?(Game_Player)
     dmag = $game_actors[1].make_obj_damage_value($game_actors[1], $data_skills[skill])
     $game_actors[1].skill_effect($game_actors[1], $data_skills[skill])
     $game_player.damage = dmag
     $scene = Scene_Gameover.new if $game_actors[1].hp <= 0
   elsif self.is_a?(Game_Event)
     dmg = enemy_status.make_obj_damage_value(enemy_status, $data_skills[skill])
     enemy_status.skill_effect(enemy_status, $data_skills[skill])
     self.damage = dmg
     $data_enemies[self.enemy_id].maxhp -= dmg
     if @use_skill > 0
     self.kill_enemy  if $data_enemies[self.enemy_id].maxhp <= 0 and @use_item <= 0 and @use_skill == $data_skills[skill].id
     else
     self.kill_enemy  if $data_enemies[self.enemy_id].maxhp <= 0 and @use_item <= 0 and @use_skill <= 0
     end
   end
 end
   def recive_itemeffect(attacker, item)
     attacker_status = (attacker.is_a?(Game_Event) ? attacker.enemy_status : $game_actors[1])
     receptor_status = (self.is_a?(Game_Event) ? self.enemy_status : $game_actors[1])
   if self.is_a?(Game_Player)
     dmag = $game_actors[1].make_obj_damage_value($game_actors[1], $data_items[item])
     $game_actors[1].item_effect($game_actors[1], $data_items[item])
     $game_player.damage = dmag
     $scene = Scene_Gameover.new if $game_actors[1].hp <= 0
   elsif self.is_a?(Game_Event)
     dmg = enemy_status.make_obj_damage_value(enemy_status, $data_items[item])
     enemy_status.item_effect($game_actors[1], $data_items[item])
     $data_enemies[self.enemy_id].maxhp -= dmg
     self.damage = dmg
     if @use_item > 0
     self.kill_enemy  if $data_enemies[self.enemy_id].maxhp <= 0 and @use_skill <= 0 and @use_item == $data_items[item].id
   else
     self.kill_enemy  if $data_enemies[self.enemy_id].maxhp <= 0 and @use_skill <= 0 and @use_item <= 0
   end
 end
end
 def kill_enemy
   $data_enemies[self.enemy_id].maxhp = self.hp
   $data_enemies[self.enemy_id].maxmp = self.mp
     $game_actors[1].gain_exp(enemy_status.exp, 1)
     Sound::play_enemy_collapse
     if @die == 0
         self.erase
       elsif @die == 1
         key = [$game_map.map_id, self.id, "A"]
         $game_self_switches[key] = true
         elsif @die == 2
         key = [$game_map.map_id, self.id, "B"]
         $game_self_switches[key] = true
         elsif @die == 3
         key = [$game_map.map_id, self.id, "C"]
         $game_self_switches[key] = true
         elsif @die == 4
         key = [$game_map.map_id, self.id, "D"]
         $game_self_switches[key] = true
       else
         $game_switches[@die] = true
         $game_map.need_refresh = true
       end
       @automove = false
         refresh
       end
 def follow_hero(dx, dy)
       sx = @x - dx
       sy = @y - dy
       if sx == 0 and sy == 0
         return
       end
       abs_sx = sx.abs
       abs_sy = sy.abs
       if abs_sx == 0
         sy > 0 ? move_up : move_down
         if not moving? and sx != 0
           sx > 0 ? move_left : move_right
         end
         return
       elsif abs_sy == 0
         sx > 0 ? move_left : move_right
         if not moving? and sy != 0
           sy > 0 ? move_up : move_down
         end
         return
       end
       if abs_sx == abs_sy
         rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
       end
       if abs_sx > abs_sy
         sx > 0 ? move_left : move_right
         if not moving? and sy != 0
           sy > 0 ? move_up : move_down
         end
       else
         sy > 0 ? move_up : move_down
         if not moving? and sx != 0
           sx > 0 ? move_left : move_right
         end
       end
     end
   end
 
#--------------------------------------------------------------
# Game Event
#--------------------------------------------------------------
class Game_Event < Game_Character
 attr_reader :inimigo
 attr_reader :enemy_status
 attr_reader :enemy_id
 attr_accessor :move_speed
 attr_accessor :through
 alias crissaegrim_abs_gevent_initialize initialize
 alias crissaegrim_abs_gevent_update update
 alias crissaegrim_abs_gevent_refresh refresh
 def initialize(map_id, event)
   @inimigo = false
   @automove = false
   crissaegrim_abs_gevent_initialize(map_id, event)
 end
 def update
   crissaegrim_abs_gevent_update
   if self.wait_action > 0
     self.wait_action -= 1
   end
   if @inimigo
     new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
     new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
     if $game_player.x == new_x and $game_player.y == new_y and self.wait_action <= 0
       for action in $data_enemies[@enemy_id].actions
         next unless enemy_status.conditions_met?(action)
         case action.kind
         when 0
           case action.basic
           when 0
         $game_player.recive_atk(self)
         $game_player.animation_id = self.enemy_atk_animation_id
         $game_player.jump(0,0)
        when 1..3
          return
      end
        when 1
          case $data_skills[action.skill_id].scope
          when 1..6
          if $data_enemies[@enemy_id].maxmp >= $data_skills[action.skill_id].mp_cost
            $data_enemies[@enemy_id].maxmp -= $data_skills[action.skill_id].mp_cost
            $game_player.animation_id = $data_skills[action.skill_id].animation_id
            $game_player.jump(0,0)
            $game_player.recive_skill(self, action.skill_id)
        end
          when 7..11
             if $data_enemies[@enemy_id].maxmp >= $data_skills[action.skill_id].mp_cost
            $data_enemies[@enemy_id].maxmp -= $data_skills[action.skill_id].mp_cost
            enemy_status.skill_effect(enemy_status, $data_skills[action.skill_id])
            rec = enemy_status.make_obj_damage_value(enemy_status, $data_skills[action.skill_id])
            self.hp -= rec
          self.animation_id = $data_skills[action.skill_id].animation_id
        end
      end
    end
  end
  speed = $data_enemies[@enemy_id].agi / 10
  self.wait_action = 60 - speed
end
end
if @automove
 unless moving?
   if in_range?(self, $game_player, @follow_distance)
#      @move_route_forcing = true
   self.follow_hero($game_player.x, $game_player.y)
#  else
#    @move_route_forcing = false
 end
end
end
end
def in_range?(event, target, distance)
   x = (event.x - target.x) * (event.x - target.x)
   y = (event.y - target.y) * (event.y - target.y)
   r = x + y
   return true if r <= (distance * distance)
   return false
 end
 def refresh
   crissaegrim_abs_gevent_refresh
   @inimigo = false
   @enemy_id = check_comment("Enemy")
   @die = check_comment("Die")
   @follow_distance = check_comment("Follow")
   @use_skill = check_comment("Skill")
   @use_item = check_comment("Item")
   @automove = true if @follow_distance > 0
   if @enemy_id > 0
     @inimigo = true
     @enemy_status = Game_Enemy.new(1, @enemy_id)
     self.hp = @enemy_status.maxhp
     self.mp = @enemy_status.maxmp
   end
 end
   def check_com(comentario)
   return false if @list.nil? or @list.size <= 0 
   for item in @list
     if item.code == 108 or item.code == 408
       if item.parameters[0].downcase.include?(comentario.downcase)
         return true
       end
     end
   end
 end
 def check_comment(comentario)
   com = comentario.downcase
   return 0 if @list.nil? or @list.size <= 0 
   for item in @list
     if item.code == 108 or item.code == 408
       if item.parameters[0].downcase =~ /#{com}[ ]?(\d+)?/
         return $1.to_i
       end
     end
   end
   return 0
 end
 def enemy_atk_animation_id
   if Crissaegrim_ABS::Enemy_atk_ani[@enemy_id]
   return (@enemy_status.nil? ? 0 : Crissaegrim_ABS::Enemy_atk_ani[@enemy_id])
 else
   return (@enemy_status.nil? ? 0 : 1)
 end
 end
end

#--------------------------------------------------------------
# Game Player
#--------------------------------------------------------------
class Game_Player < Game_Character
 attr_accessor :ATAQUE
 attr_accessor :SKILL
 attr_accessor :ITEM
 alias crissaegrim_abs_gplayer_initialize initialize
 alias crissaegrim_abs_gplayer_update update
 alias crissaegrim_abs_gplayer_refresh refresh
 def initialize
   crissaegrim_abs_gplayer_initialize
   @distance = Distance_Base.new
   @ATAQUE = false
   @SKILL = false
   @ITEM = false
 end
 def update
   crissaegrim_abs_gplayer_update
   if self.wait_action > 0
     self.wait_action -= 1
   end
   @distance.update
#--------------------------------------------------------------
   if Input.trigger?(Crissaegrim_ABS::Attack_Button) and self.wait_action <= 0
     @atk = $game_actors[1].weapon_id
     if Crissaegrim_ABS::Distance_Weapons.has_key?(@atk)
       @ATAQUE = true
     hero_x = ($game_player.x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
     hero_y = ($game_player.y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
     if $game_map.passable?(hero_x, hero_y) or $game_map.passable?(hero_x, hero_y, 0x02)
       if  $game_party.has_item?($data_items[Crissaegrim_ABS::Distance_Weapons[@atk][3]])
     $game_map.events[1].moveto(hero_x, hero_y)
     $game_map.events[1 ].set_graphic(Crissaegrim_ABS::Distance_Weapons[@atk][0],0)
     $game_map.events[1].move_speed = Crissaegrim_ABS::Distance_Weapons[@atk][1]
     $game_map.events[1].through = true
     $game_party.consume_item($data_items[Crissaegrim_ABS::Distance_Weapons[@atk][3]])
     case $game_player.direction
     when 2
       $game_map.events[1].turn_down
     when 4
       $game_map.events[1].turn_left
     when 6
       $game_map.events[1].turn_right
     when 8
       $game_map.events[1].turn_up
     end
   end
   self.wait_action = Crissaegrim_ABS::Distance_Weapons[@atk][4]
 end
 else
   new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
   new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
     for event in $game_map.events.values
       if event.inimigo
         if event.x == new_x and event.y == new_y
           event.recive_atk(self)
           event.animation_id = self.player_atk_animation_id
           event.jump(0,0)
           speed = $game_actors[1].agi / 10
           self.wait_action = 60 - speed
           break
         end
       end
     end
   end
 end
#--------------------------------------------------------------
  for button in Crissaegrim_ABS::Skill_Button.keys
   if Input.trigger?(button) and Crissaegrim_ABS::Skill_Button[button] != nil and Crissaegrim_ABS::Skill_Button[button] != 0 and $game_actors[1].mp >= $data_skills[Crissaegrim_ABS::Skill_Button[button]].mp_cost and self.wait_action <= 0
     @skl = Crissaegrim_ABS::Skill_Button[button]
     $game_temp.common_event_id = $data_skills[@skl].common_event_id if $data_skills[@skl].common_event_id > 0
     Sound.play_use_skill
     if Crissaegrim_ABS::Distance_Skills.has_key?(@skl)
       @SKILL = true
       hero_x = ($game_player.x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
       hero_y = ($game_player.y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
     if $game_map.passable?(hero_x, hero_y) or $game_map.passable?(hero_x, hero_y, 0x02)
     if $game_actors[1].mp >= $data_skills[@skl].mp_cost
     $game_map.events[1].moveto(hero_x, hero_y)
     $game_map.events[1].set_graphic(Crissaegrim_ABS::Distance_Skills[@skl][0],0)
     $game_map.events[1].move_speed = Crissaegrim_ABS::Distance_Skills[@skl][1]
     $game_map.events[1].through = true
     $game_actors[1].mp -= $game_actors[1].calc_mp_cost($data_skills[@skl])
     case $game_player.direction
     when 2
       $game_map.events[1].turn_down
     when 4
       $game_map.events[1].turn_left
     when 6
       $game_map.events[1].turn_right
     when 8
       $game_map.events[1].turn_up
     end
   end
   self.wait_action = Crissaegrim_ABS::Distance_Skills[@skl][3]
 end
else
 case $data_skills[@skl].scope
     when 1..6
     new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
     new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
     for event in $game_map.events.values
       if event.inimigo
         if event.x == new_x and event.y == new_y
           $game_actors[1].mp -= $game_actors[1].calc_mp_cost($data_skills[@skl])
           event.recive_skill(self, @skl)
           event.animation_id = self.player_skl_animation_id(@skl)
           event.jump(0,0)
         end
       end
     end
     when 7..11
       $game_actors[1].mp -= $game_actors[1].calc_mp_cost($data_skills[@skl])
       $game_player.animation_id = player_skl_animation_id(@skl)
       $game_actors[1].skill_effect($game_actors[1], $data_skills[@skl])
       end
       speed = $game_actors[1].agi / 10
       self.wait_action = 60 - speed
       break
     end
   end
 end
#--------------------------------------------------------------
 for button in Crissaegrim_ABS::Item_Button.keys
   if Input.trigger?(button) and Crissaegrim_ABS::Item_Button[button] != nil and Crissaegrim_ABS::Item_Button[button] != 0 and $game_party.item_number($data_items[Crissaegrim_ABS::Item_Button[button]]) > 0 and self.wait_action <= 0
     @itm = Crissaegrim_ABS::Item_Button[button]
     $game_temp.common_event_id = $data_items[@itm].common_event_id if $data_items[@itm].common_event_id > 0
     if Crissaegrim_ABS::Distance_Items.has_key?(@itm)
       @ITEM = true
       hero_x = ($game_player.x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
       hero_y = ($game_player.y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
     if $game_map.passable?(hero_x, hero_y) or $game_map.passable?(hero_x, hero_y, 0x02)
     if $game_party.has_item?($data_items[Crissaegrim_ABS::Distance_Items[@itm][3]])
     $game_map.events[1].moveto(hero_x, hero_y)
     $game_map.events[1].set_graphic(Crissaegrim_ABS::Distance_Items[@itm][0],0)
     $game_map.events[1].move_speed = Crissaegrim_ABS::Distance_Items[@itm][1]
     $game_map.events[1].through = true
     $game_party.consume_item($data_items[Crissaegrim_ABS::Distance_Items[@itm][3]])
     case $game_player.direction
     when 2
       $game_map.events[1].turn_down
     when 4
       $game_map.events[1].turn_left
     when 6
       $game_map.events[1].turn_right
     when 8
       $game_map.events[1].turn_up
     end
   end
   self.wait_action = Crissaegrim_ABS::Distance_Items[@itm][4]
 end
     else
     case $data_items[@itm].scope
     when 1..6
       new_x = (@x + ($game_player.direction == 4 ? -1 : $game_player.direction == 6 ? 1 : 0))
       new_y = (@y + ($game_player.direction == 8 ? -1 : $game_player.direction == 2 ? 1 : 0))
     for event in $game_map.events.values
       if event.inimigo
         if event.x == new_x and event.y == new_y
           event.recive_itemeffect(self, @itm)
           event.animation_id = $data_items[@itm].animation_id
           $game_party.consume_item($data_items[@itm])
           event.jump(0,0)
         end
       end
     end
     when 7..11
     $game_player.animation_id = player_item_animation_id(@itm)
     $game_actors[1].item_effect($game_actors[1], $data_items[@itm])
     $game_party.consume_item($data_items[@itm])
     $game_temp.common_event_id = $data_items[@itm].common_event_id if $data_items[@itm].common_event_id > 0
   end
   speed = $game_actors[1].agi / 10
   self.wait_action = 60 - speed
 end
end
end
#--------------------------------------------------------------
   $game_map.events[1].refresh
     weapon_x = $game_map.events[1].x
     weapon_y = $game_map.events[1].y
     for event in $game_map.events.values
       if event.inimigo
         if event.x == weapon_x and event.y == weapon_y
        if @ATAQUE == true
         event.animation_id = self.player_atk_animation_id
          event.recive_atk(self)
         elsif @SKILL == true
            event.animation_id = self.player_skl_animation_id(@skl)
            event.recive_skill(self, @skl)
          elsif @ITEM == true
           event.animation_id = self.player_item_animation_id(@itm)
            event.recive_itemeffect(self, @itm)
          end
          event.jump(0,0)
          $game_map.events[1].set_graphic("",0)
          $game_map.events[1].moveto(0,0)
          @ATAQUE = false
         @SKILL = false
          @ITEM = false
         end
      end
    end
#--------------------------------------------------------------
   def player_atk_animation_id
   return ($game_actors[1].nil? ? 0 : $game_actors[1].atk_animation_id)
   end
 def player_skl_animation_id(skl)
   return ($game_actors[1].nil? ? 0 : $data_skills[skl].animation_id)
 end
 def player_item_animation_id(itm)
   return ($game_actors[1].nil? ? 0 : $data_items[itm].animation_id)
 end
 end
end

#--------------------------------------------------------------
# Game Actor
#--------------------------------------------------------------
class Game_Actor
 alias crissaegrim_abs_change_exp change_exp
 def change_exp(exp, show)
   last_level = @level
   last_skills = skills
   @exp = [[exp, 9999999].min, 0].max
   while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
     level_up
   end
   while @exp < @exp_list[@level]
     level_down
   end
   @hp = [@hp, maxhp].min
   @mp = [@mp, maxmp].min
   if show and @level > last_level
     show_level_up
   end
   crissaegrim_abs_change_exp(exp,show)
 end
 def show_level_up
   $game_player.animation_id = Crissaegrim_ABS::LevelUp_Ani
   $game_actors[1].hp = $game_actors[1].maxhp
   $game_actors[1].mp = $game_actors[1].maxmp
   $game_player.damage = "Level Up"
 end
end

#--------------------------------------------------------------
# Distance Weapons
#-------------------------------------------------------------- 
class Distance_Base  < Game_Character
  def initialize
   refresh
 end
 def refresh
   if Crissaegrim_ABS::Distance_Weapons.has_key?($game_actors[1].weapon_id)
    weapondistance_x = ($game_map.events[1].x + ($game_map.events[1].direction == 4 ? -1 : $game_map.events[1].direction == 6 ? 1 : 0))
    weapondistance_y = ($game_map.events[1].y + ($game_map.events[1].direction == 8 ? -1 : $game_map.events[1].direction == 2 ? 1 : 0))
  if $game_map.passable?(weapondistance_x, weapondistance_y) or $game_map.passable?(weapondistance_x, weapondistance_y, 0x02)
 unless $game_map.events[1].moving?; $game_map.events[1].move_away_from_player end
 end
if $game_map.events[1].moving? == false
  $game_map.events[1].set_graphic("",0)
  $game_map.events[1].moveto(0, 0)
  $game_player.ATAQUE = false
  $game_player.SKILL = false
  $game_player.ITEM = false
end
end
for button in Crissaegrim_ABS::Skill_Button.keys
if Crissaegrim_ABS::Distance_Skills.has_key?(Crissaegrim_ABS::Skill_Button[button])
 weapondistance_x = ($game_map.events[1].x + ($game_map.events[1].direction == 4 ? -1 : $game_map.events[1].direction == 6 ? 1 : 0))
 weapondistance_y = ($game_map.events[1].y + ($game_map.events[1].direction == 8 ? -1 : $game_map.events[1].direction == 2 ? 1 : 0))
  if $game_map.passable?(weapondistance_x, weapondistance_y) or $game_map.passable?(weapondistance_x, weapondistance_y, 0x02)
 unless $game_map.events[1].moving?; $game_map.events[1].move_away_from_player end
 end
if $game_map.events[1].moving? == false
  $game_map.events[1].set_graphic("",0)
  $game_map.events[1].moveto(0, 0)
  $game_player.ATAQUE = false
  $game_player.SKILL = false
  $game_player.ITEM = false
end
end
end
for key in Crissaegrim_ABS::Item_Button.keys
if Crissaegrim_ABS::Distance_Items.has_key?(Crissaegrim_ABS::Item_Button[key])
 weapondistance_x = ($game_map.events[1].x + ($game_map.events[1].direction == 4 ? -1 : $game_map.events[1].direction == 6 ? 1 : 0))
 weapondistance_y = ($game_map.events[1].y + ($game_map.events[1].direction == 8 ? -1 : $game_map.events[1].direction == 2 ? 1 : 0))
  if $game_map.passable?(weapondistance_x, weapondistance_y) or $game_map.passable?(weapondistance_x, weapondistance_y, 0x02)
 unless $game_map.events[1].moving?; $game_map.events[1].move_away_from_player end
 end
if $game_map.events[1].moving? == false
  $game_map.events[1].set_graphic("",0)
  $game_map.events[1].moveto(0, 0)
  $game_player.ATAQUE = false
  $game_player.SKILL = false
  $game_player.ITEM = false
end
end
end
end
def update
    if Crissaegrim_ABS::Distance_Weapons.has_key?($game_actors[1].weapon_id)
      case $game_player.direction
     when 2
       map_height = $game_player.y + Crissaegrim_ABS::Distance_Weapons[$game_actors[1].weapon_id][2]
     when 4
       map_width = $game_player.x - Crissaegrim_ABS::Distance_Weapons[$game_actors[1].weapon_id][2]
     when 6
       map_width = $game_player.x + Crissaegrim_ABS::Distance_Weapons[$game_actors[1].weapon_id][2]
     when 8
       map_height = $game_player.y - Crissaegrim_ABS::Distance_Weapons[$game_actors[1].weapon_id][2]
     end
  if Crissaegrim_ABS::Distance_Weapons.has_key?($game_actors[1].weapon_id)
    if map_width == $game_map.events[1].x or $game_map.events[1].x == 0
      $game_map.events[1].set_graphic("",0)
      $game_map.events[1].moveto(0, 0)
      $game_player.ATAQUE = false
      $game_player.SKILL = false
      $game_player.ITEM = false
      elsif map_height == $game_map.events[1].y or $game_map.events[1].y == 0
      $game_map.events[1].set_graphic("",0)
      $game_map.events[1].moveto(0, 0)
      $game_player.ATAQUE = false
      $game_player.SKILL = false
      $game_player.ITEM = false
      end
    end
  refresh
end
for button in Crissaegrim_ABS::Skill_Button.keys
if Crissaegrim_ABS::Distance_Skills.has_key?(Crissaegrim_ABS::Skill_Button[button])
      case $game_player.direction
     when 2
       map_height = $game_player.y + Crissaegrim_ABS::Distance_Skills[Crissaegrim_ABS::Skill_Button[button]][2]
     when 4
       map_width = $game_player.x - Crissaegrim_ABS::Distance_Skills[Crissaegrim_ABS::Skill_Button[button]][2]
     when 6
       map_width = $game_player.x + Crissaegrim_ABS::Distance_Skills[Crissaegrim_ABS::Skill_Button[button]][2]
     when 8
       map_height = $game_player.y - Crissaegrim_ABS::Distance_Skills[Crissaegrim_ABS::Skill_Button[button]][2]
     end
  if Crissaegrim_ABS::Distance_Skills.has_key?(Crissaegrim_ABS::Skill_Button[button])
    if map_width == $game_map.events[1].x or $game_map.events[1].x == 0
      $game_map.events[1].set_graphic("",0)
      $game_map.events[1].moveto(0, 0)
      $game_player.ATAQUE = false
      $game_player.SKILL = false
      $game_player.ITEM = false
      elsif map_height == $game_map.events[1].y or $game_map.events[1].y == 0
      $game_map.events[1].set_graphic("",0)
      $game_map.events[1].moveto(0, 0)
      $game_player.ATAQUE = false
      $game_player.SKILL = false
      $game_player.ITEM = false
      end
    end
  refresh
end
end
for key in Crissaegrim_ABS::Item_Button.keys
if Crissaegrim_ABS::Distance_Items.has_key?(Crissaegrim_ABS::Item_Button[key])
 case $game_player.direction
 when 2
   map_height = $game_player.y + Crissaegrim_ABS::Distance_Items[Crissaegrim_ABS::Item_Button[key]][2]
   when 4
     map_width = $game_player.x - Crissaegrim_ABS::Distance_Items[Crissaegrim_ABS::Item_Button[key]][2]
   when 6
     map_width = $game_player.x + Crissaegrim_ABS::Distance_Items[Crissaegrim_ABS::Item_Button[key]][2]
   when 8
     map_height = $game_player.y - Crissaegrim_ABS::Distance_Items[Crissaegrim_ABS::Item_Button[key]][2]
   end
   if Crissaegrim_ABS::Distance_Items.has_key?(Crissaegrim_ABS::Item_Button[key])
     if map_width == $game_map.events[1].x
      $game_map.events[1].set_graphic("",0)
      $game_map.events[1].moveto(0, 0)
      $game_player.ATAQUE = false
      $game_player.SKILL = false
      $game_player.ITEM = false
      elsif map_height == $game_map.events[1].y
      $game_map.events[1].set_graphic("",0)
      $game_map.events[1].moveto(0, 0)
      $game_player.ATAQUE = false
      $game_player.SKILL = false
      $game_player.ITEM = false
      end
    end
  refresh
end
end
end
end

#--------------------------------------------------------------
# Sprite Base
#--------------------------------------------------------------
 class Sprite_Base 
 alias animation animation_set_sprites
def animation_set_sprites(frame)
   cell_data = frame.cell_data
   for i in 0..15
     sprite = @animation_sprites[i]
     next if sprite == nil
     pattern = cell_data[i, 0]
     if pattern == nil or pattern == -1
       sprite.visible = false
       next
     end
     if pattern < 100
       sprite.bitmap = @animation_bitmap1
     else
       sprite.bitmap = @animation_bitmap2
     end
     sprite.visible = true
     sprite.src_rect.set(pattern % 5 * 192,
       pattern % 100 / 5 * 192, 192, 192)
     if @animation_mirror
       sprite.x = @animation_ox - cell_data[i, 1] / 2
       sprite.y = @animation_oy - cell_data[i, 2] / 2
       sprite.angle = (360 - cell_data[i, 4])
       sprite.mirror = (cell_data[i, 5] == 0)
     else
       sprite.x = @animation_ox + cell_data[i, 1] / 2
       sprite.y = @animation_oy + cell_data[i, 2] / 2
       sprite.angle = cell_data[i, 4]
       sprite.mirror = (cell_data[i, 5] == 1)
     end
     sprite.z = self.z + 300
     sprite.ox = 96
     sprite.oy = 96
     sprite.zoom_x = cell_data[i, 3] / 200.0
     sprite.zoom_y = cell_data[i, 3] / 200.0
     sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
     sprite.blend_type = cell_data[i, 7]
   end
 end
end

#--------------------------------------------------------------
# Sprite Character
#--------------------------------------------------------------
class Sprite_Character < Sprite_Base
 alias crissaegrim_abs_spchar_update update
 def initialize(viewport, character = nil)
   super(viewport)
   @character = character
   @balloon_duration = 0
   @_damage_duration = 0
   update
 end
 def update
   super
   if @_damage_duration > 0
     @_damage_duration -=1
       @_damage_sprite.x = self.x
       if @_damage_duration <= 0
         dispose_damage
       end
     end
     if @character != nil and @character.damage != nil
     damage(@character.damage, @character.critical)
     @character.damage = nil
     @character.critical = false
   end
   crissaegrim_abs_spchar_update
 end
def damage(value, critical)
     dispose_damage
     if value.is_a?(Numeric)
       damage_string = value.abs.to_s
     else
       damage_string = value.to_s
     end
     bitmap = Bitmap.new(160, 48)
     bitmap.font.name = "Georgia"
     bitmap.font.size = 22
     bitmap.font.italic = true
     if value.is_a?(Numeric) and value <= 0
       bitmap.font.color.set(0, 0, 0)
       bitmap.draw_text(1, 13, 160, 36, "Miss", 1)
       bitmap.font.color.set(255, 245, 155)
       bitmap.draw_text(0, 12, 160, 36, "Miss", 1)
     else
       bitmap.font.color.set(0, 0, 0)
       bitmap.draw_text(1, 13, 160, 36, damage_string, 1)
       bitmap.font.color.set(255, 255, 255)
       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
     end
     if critical
       bitmap.font.color.set(0, 0, 0)
       bitmap.draw_text(1, 6, 160, 20, "Critical", 1)
       bitmap.font.color.set(255, 245, 155)
       bitmap.draw_text(0, 5, 160, 20, "Critical", 1)
     end
     @_damage_sprite = ::Sprite.new(self.viewport)
     @_damage_sprite.bitmap = bitmap
     @_damage_sprite.ox = 80
     @_damage_sprite.oy = 20
     @_damage_sprite.x = self.x
     @_damage_sprite.y = self.y - self.oy / 2 - 40
     @_damage_sprite.z += 99999
     @_damage_duration = 30
   end
   def show_text(string, size=16, color=0)
     dispose_damage
     damage_string = string
     if string.is_a?(Array)
       array = true
     else
       array = false
     end
     bitmap = Bitmap.new(160, 48)
     bitmap.font.name = "Georgia"
     bitmap.font.size = size
     bitmap.font.italic = true
     if array
       for i in 0..string.size
         next if damage_string[i] == nil
         bitmap.font.color.set(96, 96-20, 0) if color == 0
         bitmap.font.color.set(0, 0, 0) if color != 0 
         bitmap.draw_text(-1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1)
         bitmap.draw_text(+1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1)
         bitmap.draw_text(-1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1)
         bitmap.draw_text(+1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1)
         bitmap.font.color.set(255, 245, 155) if color == 0
         bitmap.font.color.set(144, 199, 150) if color == 1
         bitmap.font.color.set(197, 147, 190)if color == 2
         bitmap.font.color.set(138, 204, 198)if color == 3
         bitmap.draw_text(0, (12+(16*i))-16, 160, 36, damage_string[i], 1)
       end
     else
       bitmap.font.color.set(96, 96-20, 0) if color == 0
       bitmap.font.color.set(0, 0, 0) if color != 0 
       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
       bitmap.font.color.set(255, 245, 155) if color == 0
       bitmap.font.color.set(144, 199, 150) if color == 1
       bitmap.font.color.set(197, 147, 190)if color == 2
       bitmap.font.color.set(138, 204, 198)if color == 3
       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
     end
     @_damage_sprite = ::Sprite.new(self.viewport)
     @_damage_sprite.bitmap = bitmap
     @_damage_sprite.ox = 80
     @_damage_sprite.oy = 20
     @_damage_sprite.x = self.x
     @_damage_sprite.y = self.y - self.oy / 2
     @_damage_sprite.z = 3000
     @_damage_duration = 30
   end 
   def dispose_damage
   if @_damage_sprite != nil
     @_damage_sprite.dispose
     @_damage_sprite = nil
   end
 end
end
 
#--------------------------------------------------------------
# Window Skill
#--------------------------------------------------------------
class Window_Skill < Window_Selectable
 alias crissaegrim_abs_wskill_draw_item draw_item
 def draw_item(index)
   crissaegrim_abs_wskill_draw_item(index)
   rect = item_rect(index)
   self.contents.clear_rect(rect)
   skill = @data[index]
   if skill != nil
     rect.width -= 4
     enabled = true
     draw_item_name(skill, rect.x, rect.y, enabled)
     self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
   end
 end
end
class Scene_Skill
 alias crissaegrim_abs_sskill_start start
 alias crissaegrim_abs_sskill_update update
 def start
   @memory = Window_Command.new(150, ["Memorizada!"])
   @memory.active = false
   @memory.visible = false
   @memory.x = (544 - @memory.width) / 2
   @memory.y = (416 - @memory.height) / 2
   @memory.z = 1500
   crissaegrim_abs_sskill_start
 end
def update
 @memory.update if @memory.active
 crissaegrim_abs_sskill_update
 return update_memory if @memory.active
end
def update_skill_selection
 for button in Crissaegrim_ABS::Skill_Button.keys
   if Input.trigger?(Input::B)
     Sound.play_cancel
     return_scene
   elsif Input.trigger?(Input::R)
     Sound.play_cursor
     next_actor
   elsif Input.trigger?(Input::L)
     Sound.play_cursor
     prev_actor
   elsif Input.trigger?(Input::C)
      @skill = @skill_window.skill
     if @actor.skill_can_use?(@skill)
       case @skill.scope
       when 0..6
         Sound.play_buzzer
       when 7..11
       Sound.play_decision
       $game_actors[1].skill_effect($game_actors[1], @skill)
     end
     else
       Sound.play_buzzer
     end
   elsif Input.trigger?(button)
     Sound.play_decision
     Crissaegrim_ABS::Skill_Button[button] = @skill_window.skill.id
     @memory.active = @memory.visible = true
     @skill_window.active = false
   end
 end
end

 def update_memory
if Input.trigger?(Input::C)
 Sound.play_decision
 @memory.active = @memory.visible = false
 @skill_window.active = true
end
end
end

#--------------------------------------------------------------
# Window Item
#--------------------------------------------------------------
class Scene_Item
 alias crissaegrim_abs_sitem_start start
 alias crissaegrim_abs_sitem_update update
 alias crissaegrim_abs_sitem_update_item_selection update_item_selection
 def start
   @memory = Window_Command.new(150, ["Memorizado!"])
   @memory.active = false
   @memory.visible = false
   @memory.x = (544 - @memory.width) / 2
   @memory.y = (416 - @memory.height) / 2
   @memory.z = 1500
   crissaegrim_abs_sitem_start
 end
def update
 @memory.update if @memory.active
 crissaegrim_abs_sitem_update
 return update_memory if @memory.active
end
def update_item_selection
 crissaegrim_abs_sitem_update_item_selection
 for button in Crissaegrim_ABS::Item_Button.keys
 if Input.trigger?(button)
 Sound.play_decision
 Crissaegrim_ABS::Item_Button[button] = @item_window.item.id
 @memory.active = @memory.visible = true
 @item_window.active = false
end
end
end
 def update_memory
if Input.trigger?(Input::C)
 Sound.play_decision
 @memory.active = @memory.visible = false
 @item_window.active = true
end
end
end

#--------------------------------------------------------------
# Fim do ABS
#--------------------------------------------------------------

 

 

me da errore alla riga 523:

 

$game_map.events[1].refresh

 

un help??è da 2 gg che lo guardo,ma nada..

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

l'unico altro script che per ora ho inserito è questo,che mostra le barre in alto come lo screen nel mio progetto..

 

 

#=================================
# Window Hud
#=================================
module CrissaegrimHud
#----------------------------------------------------------
 # Imagem da base da Hud
 Picture_Base = "HUD-Base"

 # Imagem das hotkeys das skills
 Picture_Hot_Skills = "HUD-Skills"
 
 # Imagem das Hhtkeys dos ítens
 Picture_Hot_Items = "HUD-Items"
 
 # Switch que ativa / desativa a HUD
 # se for = 0, a Hud será mostrada na tela permanentemente
 OnOff_Hud_Switch = 0
#----------------------------------------------------------
end
#----------------------------------------------------------
class Window_CrissaegrimHud < Window_Base
 def initialize
   super(-12,-12,190,117)
   self.opacity = 0
   self.visible = false
   update
 end
  def update
    if CrissaegrimHud::OnOff_Hud_Switch == 0
      self.visible = true
      self.active = true
    else
    if $game_switches[CrissaegrimHud::OnOff_Hud_Switch] == true
      self.visible = true
      self.active = true
    else
      self.visible = false
      self.active = false
    end
  end
    self.contents.clear
     bitmap = Cache.system(CrissaegrimHud::Picture_Base)
     self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 148, 85))
    refresh
  end
  def refresh
     actor = $game_actors[1]
     draw_actor_hp(actor, 16, 0, 96)
     draw_actor_mp(actor, 16, 24, 96)
     draw_actor_level(actor, 16, 48)
     show_state(actor, 119, 2)
   end
   def show_state(actor, x, y, width = 32)
   count = 0
   for state in actor.states
     draw_icon(state.icon_index, x, y + 28 * count)
     count += 1
     break if (24 * count > height - 24)
   end
 end
end
#----------------------------------------------------------
class Window_CrissaegrimHud2 < Window_Base
 def initialize
   super(40,347,296,80)
   self.opacity = 0
   self.visible = false
   update
 end
  def update
    if CrissaegrimHud::OnOff_Hud_Switch == 0
      self.visible = true
      self.active = true
    else
    if $game_switches[CrissaegrimHud::OnOff_Hud_Switch] == true
      self.visible = true
      self.active = true
    else
      self.visible = false
      self.active = false
    end
  end
    self.contents.clear
     bitmap = Cache.system(CrissaegrimHud::Picture_Hot_Skills)
     self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 156, 48))
     skill_count = 0
     for button in Crissaegrim_ABS::Skill_Button.keys
       next if button == nil
       skill = $data_skills[Crissaegrim_ABS::Skill_Button[button]]
       next if skill == nil
       show_icon(skill, 10 + 28 * skill_count, 8)
       self.contents.font.size = 16
#          self.contents.draw_text(16 + 28 * skill_count, 26, 32, 18, "")
       skill_count += 1
     end
   end
   def show_icon(item, x, y, enabled = true)
   if item != nil
     draw_icon(item.icon_index, x, y, enabled)
     self.contents.font.color = normal_color
     self.contents.font.color.alpha = enabled ? 255 : 128
   end
 end
end
#----------------------------------------------------------
class Window_CrissaegrimHud3 < Window_Base
 def initialize
   super(-12,225,80,202)
   self.opacity = 0
   self.visible = false
   update
 end
  def update
    if CrissaegrimHud::OnOff_Hud_Switch == 0
      self.visible = true
      self.active = true
    else
    if $game_switches[CrissaegrimHud::OnOff_Hud_Switch] == true
      self.visible = true
      self.active = true
    else
      self.visible = false
      self.active = false
    end
  end
    self.contents.clear
     bitmap = Cache.system(CrissaegrimHud::Picture_Hot_Items)
     self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 48, 170))
     item_count = 0
     for button in Crissaegrim_ABS::Item_Button.keys
       next if button == nil
       item = $data_items[Crissaegrim_ABS::Item_Button[button]]
       next if item == nil
       show_item_icon(item, 4, 8 + 30 * item_count)
       self.contents.font.size = 16
       self.contents.draw_text(28, 12 + 30 * item_count, 32, 18, $game_party.item_number(item))
       item_count += 1
     end
   end
   def show_item_icon(item, x, y, enabled = true)
   if item != nil
     draw_icon(item.icon_index, x, y, enabled)
     self.contents.font.color = normal_color
     self.contents.font.color.alpha = enabled ? 255 : 128
   end
 end
end
#----------------------------------------------------------
class Scene_Map
 alias hud_start start
 alias hud_update update
 alias hud_terminate terminate
 def start
   super
   @hud = Window_CrissaegrimHud.new
   @hud2 = Window_CrissaegrimHud2.new
   @hud3 = Window_CrissaegrimHud3.new
   hud_start
 end
 def update
   super
   @hud.update
   @hud2.update
   @hud3.update
   hud_update
 end
 def terminate
   super
   @hud.dispose
   @hud2.dispose
   @hud3.dispose
   hud_terminate
 end
end

 

 

Link to comment
Share on other sites

  • 0

alllora, ho provato l'abs in un progetto vuoto e non mi dà nessun errore, dove l'hai messo?

 

perchè in rpg maker vx vanno inseriti sopra la classe "Material" e NON sopra "main"....

Finrod, GDR PBF

2PV e 1PAEquip: - faretra con 20 frecce- arco lungo- pugnale comune- Armatura di cuoio- Torcia- Cappuccio

Mi sa che è ora di vincere qualche premio per rinnovare questa firma! :3Posizioni raggiunte nei contest

http://rpg2s.net/gif/SCContest3Oct.gifhttp://www.rpg2s.net/awards/bestresourCSist3.jpghttp://www.rpg2s.net/awards/mosthelpful2.jpghttp://www.rpg2s.net/awards/mostpresent2.jpg

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...