Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Guns enabled for ABS v4

yeah, basically i need help with gettingv guns to work properly on Near's ABS v4 so here's the script:

Code:
#==============================================================================
# â–  Action Battle System
#==============================================================================
#  By: Near Fantastica
#  Date: 03.10.05
#  Version: 4
#==============================================================================
# â–  ABS Key Commands
#==============================================================================
#   A    ● Dash
#   S    ● Sneak
#   D    ● Attack
#   1    ● Skill Key 1
#   2    ● Skill Key 2
#   3    ● Skill Key 3
#   4    ● Skill Key 4
#   5    ● Skill Key 5
#   6    ● Skill Key 6
#   7    ● Skill Key 7
#   8    ● Skill Key 8
#   9    ● Skill Key 9
#   0    ● Skill Key 0
#==============================================================================
# â–  ABS Enemy Ai List
#==============================================================================
#   Name
#   Name Of the Enemy in The Data Base
#---------------------------------------------------------------------------
#   Behavior
#   Passive = 0 ● The Event (Enemy) will only attack when attacked
#   Aggressive = 1 ● The Event will attack when one of its Detection level are set true
#   Linking = 2 ● Event will only attack when another Event is attacked with in its Detection level
#   Aggressive Linking = 3 ● Event will attack when either Aggressive or Linking is true
#---------------------------------------------------------------------------
#   Detection
#   Sound = range ● The range of sound the enemy can hear inactive if set to zero
#   Sight = range ● The range of sightthe enemy can see inactive if set to zero
#---------------------------------------------------------------------------
#   Aggressiveness
#   Aggressiveness = Level ● The high number the less Aggressive the Event
#---------------------------------------------------------------------------
#   Movement
#   Speed = Level ● The movment Speed of the event when engaged
#   Frequency = Level  ● The movment Frequency of the event when engaged 
#---------------------------------------------------------------------------
#   Trigger
#   Erased = 0  ● The event will be erased on death
#   Switch = 1  ● The event will be trigger Switch[ID] on death
#   Varible = 2  ● The event will be set the Varible[ID] = VALUE on death
#   Local Switch = 3 ● The event will trigger Local_Switch[ID] on death
#==============================================================================
# â–  ABS Range Constant
#==============================================================================
#   RANGE_WEAPONS[Weapon Id] = 
#   ["Character Set Name", Ammo Speed, Anmiation Id, Ammo Item Id, Range]
#   RANGE_SKILLS[Skill Id] = 
#   [Range, Ammo Speed, "Character Set Name"]
#==============================================================================
class ABS
  #--------------------------------------------------------------------------
  RANGE_WEAPONS = {}
  RANGE_WEAPONS[17] = ["Arrow", 5, 4, 33, 10]
  RANGE_WEAPONS[18] = ["Arrow", 5, 4, 33, 10]
  RANGE_WEAPONS[19] = ["Arrow", 5, 4, 33, 10]
  RANGE_WEAPONS[20] = ["Arrow", 5, 4, 33, 10]
  #--------------------------------------------------------------------------
  RANGE_SKILLS = {}
  RANGE_SKILLS[7] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[8] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[10] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[11] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[13] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[14] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[16] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[17] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[19] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[20] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[22] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[23] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[25] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[26] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[28] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[29] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[31] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[33] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[35] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[37] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[39] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[41] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[43] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[45] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[47] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[49] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[51] = [10, 5, "Magic Balls"]
  RANGE_SKILLS[57] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[58] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[59] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[60] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[61] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[62] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[63] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[64] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[65] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[66] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[67] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[68] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[69] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[70] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[71] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[72] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[73] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[74] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[75] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[76] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[77] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[78] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[79] = [1, 5, "Magic Balls"]
  RANGE_SKILLS[80] = [1, 5, "Magic Balls"]
  #--------------------------------------------------------------------------
  DASH_KEY = Keyboard::Letters["A"]
  SNEAK_KEY = Keyboard::Letters["S"]
  ATTACK_KEY = Keyboard::Letters["D"]
  SKILL_KEYS = Keyboard::Numberkeys
  #--------------------------------------------------------------------------
  attr_accessor :enemies
  attr_accessor :range
  attr_accessor :skills
  attr_accessor :dash_level
  attr_accessor :sneak_level
  #--------------------------------------------------------------------------
  def initialize
    # Enemies
    @enemies = {}
    # Range
    @range = []
    # Skills
    @skills = []
    # Dashing
    @dashing = false
    @dash_restore = false
    @dash_reduce= false
    @dash_timer = 0
    @dash_level = 5
    @dash_sec = 0
    # Sneaking
    @sneaking = false
    @sneak_restore = false
    @sneak_reduce= false
    @sneak_timer = 0
    @sneak_level = 5
    @sneak_sec = 0
    # Button Mashing
    @mash_bar = 0
  end
  #--------------------------------------------------------------------------
  def ATTACK_KEY
    return ATTACK_KEY
  end
  #--------------------------------------------------------------------------
  def SKILL_KEYS
    return SKILL_KEYS
  end
  #--------------------------------------------------------------------------
  def RANGE_WEAPONS
    return RANGE_WEAPONS
  end
  #--------------------------------------------------------------------------
  def RANGE_SKILLS
    return RANGE_SKILLS
  end
  #--------------------------------------------------------------------------
  def refresh(event, list, character_name)
    @enemies.delete(event.id)
    return if character_name == ""
    return if list == nil
    for i in 0...list.size
      if list[i].code == 108 and list[i].parameters == ["ABS Event Command List"]
        name = list[i+1].parameters[0].split
        for x in 1...$data_enemies.size
          enemy = $data_enemies[x]
          if name[1].upcase == enemy.name.upcase
            @enemies[event.id] = Game_ABS_Enemy.new(enemy.id)
            @enemies[event.id].event_id = event.id
            default_setup(event.id)
            level = list[i+2].parameters[0].split
            @enemies[event.id].level = level[1].to_i
            behavior = list[i+3].parameters[0].split
            @enemies[event.id].behavior = behavior[1].to_i
            sound = list[i+4].parameters[0].split
            @enemies[event.id].detection_sound = sound[1].to_i
            sight = list[i+5].parameters[0].split
            @enemies[event.id].detection_sight = sight[1].to_i
            aggressiveness = list[i+6].parameters[0].split
            @enemies[event.id].aggressiveness = aggressiveness[1].to_i
            speed = list[i+7].parameters[0].split
            @enemies[event.id].speed = speed[1].to_i
            frequency = list[i+8].parameters[0].split
            @enemies[event.id].frequency = frequency[1].to_i
            trigger = list[i+9].parameters[0].split
            @enemies[event.id].trigger= [trigger[1].to_i, trigger[2].to_i, trigger[3].to_i]
          end
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def default_setup(id)
    @enemies[id].level = 1
    @enemies[id].behavior = 1
    @enemies[id].detection_sight = 1
    @enemies[id].detection_sound = 4
    @enemies[id].aggressiveness = 2
    @enemies[id].engaged = false
    @enemies[id].speed = 4
    @enemies[id].frequency = 5
  end
  #--------------------------------------------------------------------------
  def update
    update_dash if @sneaking == false 
    update_sneak if @dashing == false
    update_enemies
    update_player
    update_range
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  def update_range
    for range in @range
      range.update
    end
  end
  #--------------------------------------------------------------------------
  def update_player
    actor = $game_party.actors[0]
    @mash_bar = 100 if @mash_bar >= 100
    @mash_bar += 1 #(actor.dex/10)
  end
  #--------------------------------------------------------------------------
  def update_dash
    if Keyboard.pressed?(DASH_KEY)
      if $game_player.moving?
        @dashing = true
        $game_player.move_speed = 5
        @dash_restore = false
        if @dash_reduce == false
          @dash_timer = 50 # Initial time off set
          @dash_reduce = true
        else
          @dash_timer-= 1
        end
        @dash_sec = (@dash_timer / Graphics.frame_rate)%60
        if @dash_sec == 0
          if @dash_level != 0
            @dash_level -= 1
            @dash_timer = 50 # Timer Count
          end
        end
        if @dash_level == 0
          @dashing = false
          $game_player.move_speed = 4
        end
      end
    else
      @dashing = false
      $game_player.move_speed = 4
      @dash_reduce = false
      if @dash_restore == false
        @dash_timer = 80 # Initial time off set
        @dash_restore = true
      else
        @dash_timer-= 1
      end
      @dash_sec = (@dash_timer / Graphics.frame_rate)%60
      if @dash_sec == 0
        if @dash_level != 5
          @dash_level+= 1
          @dash_timer = 60
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_sneak
    if Keyboard.pressed?(SNEAK_KEY)
      if $game_player.moving?
        @sneaking = true
        $game_player.move_speed = 3
        @sneak_restore = false
        if @sneak_reduce == false
          @sneak_timer = 50 # Initial time off set
          @sneak_reduce = true
        else
          @sneak_timer-= 1
        end
        @sneak_sec = (@sneak_timer / Graphics.frame_rate)%60
        if @sneak_sec == 0
          if @sneak_level != 0
            @sneak_level -= 1
            @sneak_timer = 100 # Timer Count
          end
        end
        if @sneak_level == 0
          @sneaking = false
          $game_player.move_speed = 4
        end
      end
    else
      @sneaking = false
      $game_player.move_speed = 4
      @sneak_reduce = false
      if @sneak_restore == false
        @sneak_timer = 80 # Initial time off set
        @sneak_restore = true
      else
        @sneak_timer-= 1
      end
      @sneak_sec = (@sneak_timer / Graphics.frame_rate)%60
      if @sneak_sec == 0
        if @sneak_level != 5
          @sneak_level+= 1
          @sneak_timer = 60 # Timer Count
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_enemies
    for enemy in @enemies.values
      case enemy.behavior
      when 0
        if enemy.engaged == true
          next if engaged_enemy_detection_sight?(enemy) == true
          next if engaged_enemy_detection_sound?(enemy) == true
        end
      when 1
        if enemy.engaged == true
          next if engaged_enemy_detection_sight?(enemy) == true
          next if engaged_enemy_detection_sound?(enemy) == true
        else
          next if enemy_detection_sight?(enemy) == true
          next if enemy_detection_sound?(enemy) == true
        end
      when 2
        if enemy.engaged == true
          next if engaged_enemy_linking_sight?(enemy) == true
          next if engaged_enemy_linking_sound?(enemy) == true
        else
          next if enemy_linking?(enemy) == true
        end
      when 3
        if enemy.engaged == true
          next if engaged_enemy_linking_sight?(enemy) == true
          next if engaged_enemy_linking_sound?(enemy) == true
        else
          next if enemy_detection_sight?(enemy) == true
          next if enemy_detection_sound?(enemy) == true
          next if enemy_linking?(enemy) == true
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def set_event_movement(enemy)
    event = $game_map.events[enemy.event_id]
    enemy.move_type = event.move_type
    enemy.move_frequency = event.move_frequency
    enemy.move_speed = event.move_speed
    enemy.engaged = true
    event.move_type = 2
    event.move_frequency = enemy.frequency 
    event.move_speed = enemy.speed
  end
  #--------------------------------------------------------------------------
  def return_event_movement(enemy)
    event = $game_map.events[enemy.event_id]
    event.move_type = enemy.move_type
    event.move_frequency = enemy.move_frequency
    event.move_speed = enemy.move_speed
  end
  #--------------------------------------------------------------------------
  def engaged_enemy_linking_sight?(enemy)
    if enemy.detection_sight != 0
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sight)
        enemy.linking = false
        enemy_attack(enemy)
        return true
      else
        if enemy.linking == false
          enemy.engaged = false
          return_event_movement(enemy)
          return false
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def engaged_enemy_linking_sound?(enemy)
    if enemy.detection_sound != 0
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sound)
        enemy.linking = false
        enemy_attack(enemy)
        return true
      else
        if enemy.linking == false
          enemy.engaged = false
          return_event_movement(enemy)
          return false
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def enemy_linking?(enemy)
    for key in @enemies.keys
      if in_range?($game_map.events[enemy.event_id], $game_map.events[key], enemy.detection_sight)
        if @enemies[key].engaged == true
          enemy.engaged = true
          enemy.linking = true
          set_event_movement(enemy)
          return true
        end
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  def enemy_detection_sound?(enemy)
    if enemy.detection_sound != 0
      return false if enemy.level < $game_party.actors[0].level
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sound)
        if @sneaking == true
          return false
        end
        enemy.engaged = true
        set_event_movement(enemy)
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  def enemy_detection_sight?(enemy)
    if enemy.detection_sight != 0
      return false if enemy.level < $game_party.actors[0].level
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sight)
        if facing?($game_map.events[enemy.event_id], $game_player)
          enemy.engaged = true
          set_event_movement(enemy)
          return true
        end
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  def engaged_enemy_detection_sight?(enemy)
    if enemy.detection_sight != 0
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sight)
        enemy_attack(enemy)
        return true
      else
        enemy.engaged = false
        return_event_movement(enemy)
        return false
      end
    end
  end
  #--------------------------------------------------------------------------
  def engaged_enemy_detection_sound?(enemy)
    if enemy.detection_sound != 0
      if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sound)
        enemy_attack(enemy)
        return true
      else
        enemy.engaged = false
        return_event_movement(enemy)
        return false
      end
    end
  end
  #--------------------------------------------------------------------------
  def in_range?(element, object, range)
    x = (element.x - object.x) * (element.x - object.x)
    y = (element.y - object.y) * (element.y - object.y)
    r = x + y
    if r <= (range * range)
       return true
    else
      return false
    end
  end
  #--------------------------------------------------------------------------
  def in_range(element, range)
    objects = []
    x = (element.x - $game_player.x) * (element.x - $game_player.x)
    y = (element.y - $game_player.y) * (element.y - $game_player.y)
    r = x + y
    if r <= (range * range)
      objects.push($game_party.actors[0])
    end
    return objects
  end
  #--------------------------------------------------------------------------
  def facing?(element, object)
    if element.direction == 2
      if object.y >= element.y
        return true
      end
    end
    if element.direction == 4
      if object.x <= element.x
        return true
      end
    end
    if element.direction == 6
      if object.x  >= element.x
        return true
      end
    end
    if element.direction == 8
      if object.y <= element.y
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  def in_line?(element, object)
    if element.direction == 2
      if object.x == element.x
        return true
      end
    end
    if element.direction == 4
      if object.y == element.y
        return true
      end
    end
    if element.direction == 6
      if object.y == element.y
        return true
      end
    end
    if element.direction == 8
      if object.x == element.x
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  def enemy_pre_attack(enemy, actions)
    if enemy.hp * 100.0 / enemy.maxhp > actions.condition_hp
      return true
    end
    if $game_party.max_level < actions.condition_level
      return true
    end
    switch_id = actions.condition_switch_id
    if actions.condition_switch_id > 0 and $game_switches[switch_id] == false
      return true
    end
    n = rand(11) 
    if actions.rating < n
      return true
    end
    return false
  end
  #--------------------------------------------------------------------------
  def hit_player(enemy)
    $game_player.jump(0, 0)
    $game_player.animation_id = enemy.animation2_id
  end
  #--------------------------------------------------------------------------
  def actor_non_dead?(actor, enemy)
    if actor.dead?
      if not enemy.is_a?(Game_Actor)
        return_event_movement(enemy)
        enemy.engaged = false
      end
      $game_temp.gameover = true
      return false
    end
    return true
  end
  #--------------------------------------------------------------------------
  def enemy_attack(enemy)
    for actions in enemy.actions
      next if enemy_pre_attack(enemy, actions) == true
      case actions.kind
      when 0 #Basic
        if Graphics.frame_count % (enemy.aggressiveness * 30) == 0          
          case actions.basic
          when 0 #Attack
            if in_range?($game_map.events[enemy.event_id], $game_player, 1) and 
            facing?($game_map.events[enemy.event_id], $game_player)
              actor = $game_party.actors[0]
              actor.attack_effect(enemy)
              if $game_party.actors[0].damage != "Miss" and $game_party.actors[0].damage != 0
                hit_player(enemy)
              end
              actor_non_dead?(actor, enemy)
              return
            end
          when 1..3 #Nothing
            return
          end
        end
      when 1..2#Skill
        skill = $data_skills[actions.skill_id]
        case skill.scope
        when 1 # One Enemy
          if Graphics.frame_count % (enemy.aggressiveness * 30) == 0
            if in_line?($game_map.events[enemy.event_id], $game_player)
              next if enemy.can_use_skill?(skill) == false
              @range.push(Game_Ranged_Skill.new($game_map.events[enemy.event_id], enemy, skill))
              enemy.sp -= skill.sp_cost
            end
          end
        when 3..4, 7 # User          
          if Graphics.frame_count % (enemy.aggressiveness * 100) == 0
            if enemy.hp < skill.power.abs
              enemy.effect_skill(enemy, skill)
              enemy.sp -= skill.sp_cost
              $game_map.events[enemy.event_id].animation_id = skill.animation2_id
            end
            return
          end
        end
        return
      end
    end
  else
    return
  end
  #--------------------------------------------------------------------------
  def hit_event(event, animation)
    event.jump(0, 0)
    return if animation == 0
    event.animation_id = animation
  end
  #--------------------------------------------------------------------------
  def event_non_dead?(enemy, actor = 0)
    if enemy.dead?
      treasure(enemy) if actor = 0
      id = enemy.event_id
      @enemies.delete(id)
      event = $game_map.events[enemy.event_id]
      event.character_name = ""
      case enemy.trigger[0]
      when 0
        event.erase
      when 1
        print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
        $game_switches[enemy.trigger[1]] = true
        $game_map.need_refresh = true
      when 2
        print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
         if enemy.trigger[2] == 0
           $game_variables[enemy.trigger[1]] += 1
          $game_map.need_refresh = true
        else
          $game_variables[enemy.trigger[1]] = enemy.trigger[2]
          $game_map.need_refresh = true
        end
      when 3
        value = "A" if enemy.trigger[1] == 1
        value = "B" if enemy.trigger[1] == 2
        value = "C" if enemy.trigger[1] == 3
        value = "D" if enemy.trigger[1] == 4
        print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if value == 0
        key = [$game_map.map_id, event.id, value]
        $game_self_switches[key] = true
        $game_map.need_refresh = true
      end
      return false
    end
    return true
  end
  #--------------------------------------------------------------------------
  def treasure(enemy)
    exp = 0
    gold = 0
    treasures = []
    unless enemy.hidden
      exp += enemy.exp
      gold += enemy.gold
      if rand(100) < enemy.treasure_prob
        if enemy.item_id > 0
          treasures.push($data_items[enemy.item_id])
        end
        if enemy.weapon_id > 0
          treasures.push($data_weapons[enemy.weapon_id])
        end
        if enemy.armor_id > 0
          treasures.push($data_armors[enemy.armor_id])
        end
      end
    end
    treasures = treasures[0..5]
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          actor.hp = actor.maxhp
          actor.sp = actor.maxsp
        end
      end
    end
    $game_party.gain_gold(gold)
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
  end
  #--------------------------------------------------------------------------
  def player_attack
    actor = $game_party.actors[0]
    if RANGE_WEAPONS.has_key?(actor.weapon_id) 
      # Range Attack
      range_weapon = RANGE_WEAPONS[actor.weapon_id]
      return if $game_party.item_number(range_weapon[3]) == 0
      $game_party.lose_item(range_weapon[3], 1)
      @range.push(Game_Ranged_Weapon.new($game_player, actor, actor.weapon_id))
    else
      # Test Button Mash
      hit = rand(90) + 10 
      if hit > @mash_bar
        @mash_bar = 0
        return
      end
      @mash_bar = 0
      # Melee Attack
      for enemy in @enemies.values
        event = $game_map.events[enemy.event_id]
        if facing?($game_player, event) and in_range?($game_player, event, 1)
          actor = $game_party.actors[0]
          enemy.attack_effect(actor)
          hit_event(event, $data_weapons[actor.weapon_id].animation2_id) if enemy.damage != "Miss" and enemy.damage != 0
          if event_non_dead?(enemy)
            if enemy.engaged == false
              enemy.engaged = true
              set_event_movement(enemy)
            end
          end
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def player_skill(key)
    return if @skills[key] == nil
    skill = $data_skills[@skills[key]]
    return if skill == nil
    actor = $game_party.actors[0]
    return if not actor.skills.include?(skill.id)
    return if actor.can_use_skill?(skill) == false
    case skill.scope
    when 1 # One Enemy
      @range.push(Game_Ranged_Skill.new($game_player, actor, skill))
      actor.sp -= skill.sp_cost
    when 2 # All Emenies
      $game_player.animation_id = skill.animation2_id
      actor.sp -= skill.sp_cost
      for enemy in @enemies.values
        next if enemy == nil
        enemy.effect_skill(actor, skill)
        if enemy.damage != "Miss" and enemy.damage != 0
          event = $game_map.events[enemy.event_id]
          hit_event(event, 0)
        end
        if event_non_dead?(enemy)
          if enemy.engaged == false
            enemy.behavior = 3
            enemy.linking = true
            enemy.engaged = true
            set_event_movement(enemy)
          end
        end
      end
      return
    when 3..4, 7 # User
      return if actor.can_use_skill?(skill) == false
      actor.effect_skill(actor, skill)
      actor.sp -= skill.sp_cost
      $game_player.animation_id = skill.animation2_id
      return
    end
  end
end


thanks :D
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top