UltimaForum

Wsparcie [XP] - ABS - odrodzenie

Zimeros - Pią 16 Lip, 2010 12:13
Temat postu: ABS - odrodzenie
Witam, mam taki ABS:
Spoiler:

Kod:
class ABS

def setup
    @enemies = []
    for event in $game_map.events.values
      for monster in $data_enemies.compact
        if event.event.name == monster.name
          @enemies.push(ABS_Enemy.new(monster, event))
          break
        end
      end
    end
    @cooldown = 0
  end

  def update
    for enemy in @enemies
      if ($game_player.abs_in_range?(enemy.event, 1) and @cooldown <= 0 and
          $game_player.abs_facing?(enemy.event) and Input.trigger?(Input::C))
        enemy.attack_effect($game_party.actors[0])
        enemy.engage
        $game_player.animation_id = $game_party.actors[0].animation1_id
        enemy.event.animation_id = $game_party.actors[0].animation2_id
        @cooldown = 20
        if enemy.dead?
          @enemies.delete(enemy)
          enemy.event.erase
        end
      end
      enemy.update
    end
    @cooldown -= 1 if @cooldown > 0
  end
end

class ABS_Enemy < Game_Enemy

  attr_reader :event

  def initialize(monster, event)
    abs_initialize
    @enemy_id = monster.id
    @hp = maxhp
    @sp = maxsp
    @monster = monster
    @event = event
    @cooldown = 0
  end

  def update
    if @engaged
      if (@event.abs_in_range?($game_player, 1) and @cooldown <= 0 and
          @event.abs_facing?($game_player) and not @event.moving?)
        $game_party.actors[0].attack_effect(self)
        $game_temp.gameover = $game_party.actors[0].dead?
        $game_map.events[@event.id].animation_id = animation1_id
        $game_player.animation_id = animation2_id
        @cooldown = 75
      end
    elsif (@event.abs_in_range?($game_player) and
           @event.abs_facing?($game_player))
      engage
    end
    @cooldown -= 1 if @cooldown > 0
  end
 
  def engage
    @engaged = true
    @event.move_type = 2
  end
end

$abs = ABS.new

class Scene_Map
  alias abs_update update
  def update
    abs_update
    $abs.update
  end
end

class Game_Map
  alias abs_setup setup
  def setup(map_id)
    abs_setup(map_id)
    $abs.setup
  end
end

class Game_Battler
  alias abs_initialize initialize
  def initialize
    abs_initialize
  end
end

class Game_Character

  attr_accessor :move_type, :move_frequency, :move_speed, :character_name
  attr_reader :event

  def abs_facing?(event)
    case self.direction
    when 2
      return true if event.y > self.y
    when 4
      return true if event.x < self.x
    when 6
      return true if event.x > self.x
    when 8
      return true if event.y < self.y
    end
    return false
  end

  def abs_in_range?(event, range = 5)
    x = (self.x - event.x).abs
    y = (self.y - event.y).abs
    return x + y <= range
  end
end



Czy mógłby, mi ktoś przerobić, aby potwór po ustawionym czasie się odradzał??
Chciałbym, w taki sposób jak tu:
http://www.ultimateam.pl/viewtopic.php?t=3157

pw115 - Pią 16 Lip, 2010 12:58

Jeśli jest to ABS w którym potwora deklarujesz w evencie(w komentarzach albo call script) to wystarczy zrobić żeby po zabiciu potwora włączał się przełącznik A. Następna strona ma startować na ten przełącznik. Następnie wybierasz opcję wait a potem przełącznik A off

Powered by phpBB modified by Przemo © 2003 phpBB Group