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.

Need help with mode 7 worldmap.

Hi there... me again... ;)

I need help with my scripts...

I am using the XAS Hero Edition 2.0
class Game_Event < Game_Character 
  def enemy_defeat_process(enemy)
    last_level = $game_player.battler.level
    $game_party.gain_exp(enemy.exp)
    $game_party.gain_gold(enemy.gold)
    if last_level < $game_player.battler.level
      $game_system.se_play(XAS_BA::LEVEL_UP_SE)
      $game_player.battler.damage = "Level Up!"
      $game_player.battler.damage_pop = true
      $game_player.need_refresh = true
    end
    id = XAS_BA::DEFEAT_NUMBER_ID
    $game_variables[id] += 1 if id != 0
    switch_id = XAS_BA_ENEMY::DEFEAT_SWITCH_IDS[self.enemy_id]
    if switch_id != nil
      $game_switches[switch_id] = true
      $game_map.refresh
    end
  end
end
class Game_Party
  def gain_exp(exp)
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      if actor.cant_get_exp? == false
        actor.exp += exp
      end
    end
  end
end
class Game_Player < Game_Character
  attr_accessor :need_refresh
end
module XAS_BA_BULLET_SP_COST
  def shoot_bullet(action_id)
    skill_id = action_id
    skill    = skill_id == nil ? nil : $data_skills[skill_id]
    if skill != nil
      sp_cost  = skill.sp_cost
      if self.battler.sp < sp_cost
        $game_system.se_play($data_system.buzzer_se)
        return false
      end
      self.battler.sp -= sp_cost
      if self.battler.is_a?(Game_Actor)
      $game_temp.skill_refresh = true 
      end
      if $mogscript["mpstelen"] == true       
      $game_player.wref = true         
      end     
      self.need_refresh = true
    end
    return super
  end
end
class Game_Player < Game_Character
  include XAS_BA_BULLET_SP_COST
end
module XRXS_EnemySensor
  def update_sensor
    distance = ($game_player.x - self.x).abs + ($game_player.y - self.y).abs
    enable   = (distance <= $game_variables[XAS_BA::SENSOR_VAR])
    key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
    last_enable = $game_self_switches[key]
    last_enable = false if last_enable == nil
    if enable != last_enable
      $game_self_switches[key] = enable
      $game_map.need_refresh = true
    end
  end
end
class Game_Event < Game_Character
  include XRXS_EnemySensor
end
class Game_Character
  attr_writer   :eek:pacity
end
module XRXS_BattlerAttachment
  def attack_effect(attacker)
    return super if self.battler.nil? or attacker.nil?
    result = (not self.battler.dead? and self.battler.hiblink_duration.to_i <= 0)
    if result
      $game_temp.in_battle = true
      self.battler.attack_effect(attacker.battler)
      self.battler.damage_pop = true
      $game_temp.in_battle = false
      if self.battler.damage.to_i > 0
        self.blow(attacker.direction, 1)
      end
      self.battler.hiblink_duration = self.damage_hiblink_duration
      if self.is_a?(Game_Player)
        self.need_refresh = true
      end
    end
    @xrxs64c_defeat_done = false if @xrxs64c_defeat_done == nil
    if not @xrxs64c_defeat_done and self.battler.dead?
      defeat_process
      @xrxs64c_defeat_done = true
    end
  end
  def action_effect(bullet, action_id)
    return super if self.battler.nil?
    if self.battler.hiblink_duration.to_i > 0 and
       not bullet.action.ignore_invincible
      return false
    end
    if self.battler.hit_it.to_i > 0
      return false
    end
    skill_id = action_id
    return if skill_id == nil
    user = bullet.action.user
    attacker = (user == nil ? nil : user.battler)
    if self.battler.is_a?(Game_Enemy) and XAS_BA::ENEMY_OBJECT.include?(self.enemy_id)
    return
    end
    result = (user != nil and not self.battler.dead?)
    skill_id = action_id
    dirset    = [2,6,8,4]
    dir_index = (dirset.index(bullet.direction) + 2) % 4
    shield    = self.shield_actions.include?(action_id)
    for direction in self.shield_directions
      dir_index2 = (dirset.index(self.direction) + dirset.index(direction)) % 4
      shield    |= dirset[dir_index2] == dirset[dir_index]
    end
    if shield
      if user.is_a?(Game_Player)
      self.battler.damage = XAS_BA::SHIELD_TEXT
      self.battler.damage_pop = true         
      $game_system.se_play(XAS_BA::SHIELD_SE)
      user.blow(dirset[dir_index])
      end
      super
      return true     
    end
    if result
      skill = $data_skills[skill_id]
      if skill_id == 2 and $game_switches[120]
        skill = skill.dup
        skill.power = 8
      end
      $game_temp.in_battle = true
      self.battler.skill_effect(attacker, skill)
      self.battler.damage_pop = true
      $game_temp.in_battle = false
      if self.battler.damage.to_i > 0
      if XAS_BA::ATTACK_SKILL_SHAKE.include?(skill_id)
      $game_screen.start_shake(5,10,20)
      end   
      hit_skill_anime = XAS_BA::ATTACK_ANI_HIT[skill_id]   
      if hit_skill_anime != nil
      self.animation_id = hit_skill_anime 
      else
      self.animation_id = XAS_BA::DEFAULT_ATTACK_ANI_HIT
      end         
        d = bullet.direction
        p = bullet.action.blow_power.to_i
        self.blow(d, p)
        self.battler.hiblink_duration = self.damage_hiblink_duration
      end
      if self.is_a?(Game_Player)
        self.need_refresh = true
      end
    end
    if not @xrxs64c_defeat_done and self.battler.dead?
      defeat_process
      @xrxs64c_defeat_done = true
    end
    return (super or result)
  end
  def shield_directions
    return []
  end
  def shield_actions
    return []
  end
  def knock_back_disable
    return false
  end
  def hit_it
  return 80 
  end
  def damage_hiblink_duration
  actor = $game_party.actors[0]
  if self.is_a?(Game_Player) and self.battler.damage.to_i > 0
  if XAS_BA::JUMP_HIT_HERO == true
  jump(0,0)
  $game_system.se_play(XAS_BA::HERO_HIT_SE) 
  end   
  else
  if self.battler.damage.to_i > 0   
  unless XAS_BA::JUMP_HIT_ENEMY_DISABLE.include?(self.enemy_id)
  jump(0,0)
  end
  end 
  end
  if self.is_a?(Game_Player)
  return XAS_BA::INVICIBLE_DURATION_HERO
  else
  enemy_invicible_duration = XAS_BA::INVICIBLE_DURATION_ENEMY[enemy_id]
  if enemy_invicible_duration != nil
  return enemy_invicible_duration
  else
  return XAS_BA::DEFAULT_INVICIBLE_DURATION_ENEMY
  end 
  end 
  end
  def dead?
    return self.battler == nil ? false : self.battler.dead?
  end
  def defeat_process
  end
end
class Game_Player < Game_Character
  include XRXS_BattlerAttachment
  def battler
    return $game_party.actors[0]
  end
  def defeat_process
    super 
    if XAS_BA::AUTOGAMEOVER == true
    $scene = Scene_Gameover.new rescue nil
    else   
    $game_switches[XAS_BA::GAMEOVER_SWITCH_ID] = true
    $game_map.refresh
    end
  end
  alias xrxs64c_update update
  def update
    xrxs64c_update
    self.battler.remove_states_auto if self.battler != nil
    if self.collapse_done
      self.collapse_done        = false
      @xrxs64c_defeat_done      = false
    end
  end
end
class Game_Event < Game_Character
  include XRXS_BattlerAttachment
  def battler
    return @battler
  end
  alias xrxs64c_refresh refresh
  def refresh
    xrxs64c_refresh
    self.battler_recheck
  end
  def battler_recheck
    return if @battler != nil
    if @page == nil
      return
    end
    @enemy_id = 0
    for page in @event.pages.reverse
      condition = page.condition
      if condition.variable_valid and
         condition.variable_id == XAS_BA::ENEMY_ID_VARIABLE_ID and
       (!condition.switch1_valid or $game_switches[condition.switch1_id]) and
       (!condition.switch2_valid or $game_switches[condition.switch2_id])
        @enemy_id = condition.variable_value
        break
      end
    end
    if @enemy_id == 0
      return
    end
    troop_id     = -1
    member_index = -1
    for troop in $data_troops
      next if troop == nil
      for enemy in troop.members
        if enemy.enemy_id == @enemy_id
          troop_id     = $data_troops.index(troop)
          member_index = troop.members.index(enemy)
          break
        end
      end
    end
    if troop_id != -1 and member_index != -1
      @battler = Game_Enemy.new(troop_id, member_index)
    end
  end
  def enemy_id
    self.battler
    return @enemy_id
  end
  alias xrxs64c_update update
  def update
    if @collapse_wait_count.to_i > 0
      @collapse_wait_count -= 1
      if @collapse_wait_count == 0
        @collapse_wait_count = nil
        $game_map.remove_token(self)   
      end
      return
    end
    update_sensor
    xrxs64c_update
    if self.battler != nil
      self.battler.remove_states_auto
    end
    if self.collapse_duration.to_i > 0
      @through = true
    end
    if self.collapse_done
      @opacity = 0
      @collapse_wait_count = 32
      return
    end
  end
  def shield_enable!
    @shield_disable = nil
  end
  def shield_disable!
    @shield_disable = true
  end
  def shield_directions
    set = @shield_disable ? [] : XAS_BA_ENEMY::SHILED_DIRECTIONS[self.enemy_id]
    set = [] if set == nil
    return set
  end
  def shield_actions
    set = @shield_disable ? [] : XAS_BA_ENEMY::SHILED_ACTIONS[self.enemy_id]
    set = [] if set == nil
    return set
  end
  def knock_back_disable
    return XAS_BA_ENEMY::KNOCK_BACK_DISABLES.include?(self.enemy_id)
  end
  def body_size
    return XAS_BA_ENEMY::BODY_SQUARE[self.enemy_id].to_i
  end
  def defeat_process
    super
    enemy_defeat_process(self.battler)
    enemy_defeat_animation = XAS_BA_ENEMY::DEF_ANI[enemy_id]
    if XAS_BA_ENEMY::DEF_ANI[enemy_id] != nil
    self.animation_id = enemy_defeat_animation
    end
  end
end
class Game_Event < Game_Character
  attr_reader   :collision_attack
  def img_act_exist?
  begin
  RPG::Cache.character(@page.graphic.character_name + "_Act" , @page.graphic.character_hue)
  rescue
  return false
  end
  return true
  end
  def attack_on
    @collision_attack = true
    if img_act_exist?   
    @character_name = @page.graphic.character_name + "_Act"
    end
  end
  def attack_off
    @collision_attack = false   
    @character_name = @page.graphic.character_name
  end
end
class Game_Player < Game_Character
  alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  def check_event_trigger_touch(x, y)
    xrxs64c_check_event_trigger_touch(x, y)
    if $game_system.map_interpreter.running?
      return
    end
    for event in $game_map.events.values
      next unless event.collision_attack
      unless [1,2].include?(event.trigger)
        if event.battler != nil and event.x == x and event.y == y
          $game_player.attack_effect(event)
          $game_player.animation_id = XAS_BA::DEFAULT_ATTACK_ANI_HIT
        end
      end
    end
  end
end
class Game_Event < Game_Character
  alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
  def check_event_trigger_touch(x, y)
    xrxs64c_check_event_trigger_touch(x, y)
    if $game_system.map_interpreter.running?
      return
    end
    return unless self.collision_attack
    if self.battler != nil and x == $game_player.x and y == $game_player.y
      $game_player.attack_effect(self)
    end
  end
end
module XAS_BA_BATTLEEVENT_NONPREEMPT
  def update
    return if self.battler != nil and $game_system.map_interpreter.running?
    super
  end
end
class Game_Event < Game_Character
  include XAS_BA_BATTLEEVENT_NONPREEMPT
end
class Game_Battler
  attr_accessor :hiblink_duration 
  attr_accessor :hit_it
end
class Sprite_Character < RPG::Sprite
  alias xrxs64c_update update
  def update
    if @battler == nil
      @battler = @character.battler
    end
    xrxs64c_update
    if @battler == nil
      return
    end
    if @_collapse_duration > 0
      return
    end
    if @character.collapse_done
      return
    end
    if @battler.hiblink_duration.is_a?(Numeric)
      if XAS_BA::BLINK_ON == true
      @character.opacity = (@character.opacity + 70) % 190 + 40
      end
      @battler.hiblink_duration -= 1
      if @battler.hiblink_duration <= 0
        @battler.hiblink_duration = nil
        @character.opacity = 255
      end
    end
  end
end
module XAS_BA_ItemDrop
  def defeat_process
    super
    if self.battler.is_a?(Game_Enemy) and self.battler.dead?
      treasure = nil
      enemy = self.battler
      if rand(100) < enemy.treasure_prob
        if enemy.item_id > 0
          treasure = $data_items[enemy.item_id]
        end
        if enemy.weapon_id > 0
          treasure = $data_weapons[enemy.weapon_id]
        end
        if enemy.armor_id > 0
          treasure = $data_armors[enemy.armor_id]
        end
      end
      if treasure != nil
        item_se = XAS_BA::ITEMDROP_SE
        opecode = treasure.is_a?(RPG::Item) ? 126 :
                  treasure.is_a?(RPG::Weapon) ? 127 :
                  treasure.is_a?(RPG::Armor) ? 128 :
                  nil
        list = []
        if opecode != nil
          list[0] = RPG::EventCommand.new(opecode, 0, [treasure.id,0,0,1])
          list[1] = RPG::EventCommand.new(250, 0, [item_se])
          list[2] = RPG::EventCommand.new(116, 0, [])
        end
        list.push(RPG::EventCommand.new)
        command = RPG::MoveCommand.new
        command.code = 14
        command.parameters = [0,0]
        route = RPG::MoveRoute.new
        route.repeat = false
        route.list = [command, RPG::MoveCommand.new]
        page = RPG::Event::Page.new
        page.move_type = 3
        page.move_route = route
        page.move_frequency = 6
        page.always_on_top = true
        page.trigger = 1
        page.list = list
        event = RPG::Event.new(self.x, self.y)
        event.pages = [page]
        token = Token_Event.new($game_map.id, event)
        token.icon_name = treasure.icon_name
        $game_map.add_token(token)
      end
    end
  end
end
class Game_Event < Game_Character
  include XAS_BA_ItemDrop
end
class Game_Character
  attr_accessor :icon_name
end
class Sprite_Character < RPG::Sprite
  alias xrxs_charactericon_update update
  def update
    xrxs_charactericon_update
    if @character.icon_name != nil #and @icon_name != @character.icon_name
      @icon_name = @character.icon_name
      self.bitmap = RPG::Cache.icon(@icon_name)
      self.src_rect.set(0, 0, 24, 24)
      self.ox = 12
      self.oy = 24
      self.z = 1
    end
  end
end
class Game_Character
  def blow(d, power = 1)
    return if self.knock_back_disable
    @knock_back_prespeed = @move_speed if @knock_back_prespeed == nil
    power.times do
      if passable?(self.x, self.y, d)
        @x += ([3,6,9].include?(d) ? 1 : [1,4,7].include?(d) ? -1 : 0)
        @y += ([1,2,3].include?(d) ? 1 : [7,8,9].include?(d) ? -1 : 0)
      end
    end
    if self.battler.is_a?(Game_Enemy)   
    enemy_knock_duration = XAS_BA::INVICIBLE_DURATION_ENEMY[enemy_id]
    if enemy_knock_duration != nil
    @knock_back_duration = enemy_knock_duration
    else
    @knock_back_duration = XAS_BA::DEFAULT_INVICIBLE_DURATION_ENEMY   
    end     
    else
    @knock_back_duration = XAS_BA::KNOCK_BACK_DURATION_HERO
    end   
    @move_speed = XAS_BA::KNOCK_BACK_SPEED
  end
  alias xrxs64c_nb_update update
  def update
    @stop_count = -1 if self.knockbacking? or self.dead?
    xrxs64c_nb_update
  def img_hit_enemy_exist?
  begin
  RPG::Cache.character(@page.graphic.character_name + "_Hit" , @page.graphic.character_hue)
  rescue
  return false
  end
  return true
  end   
  def img_hit_actor_exist?
  begin
  actor = $game_party.actors[0] 
  RPG::Cache.character(actor.character_name + "_Hit" , actor.character_hue)
  rescue
  return false
  end
  return true
  end   
    if self.knockbacking?
      if self.battler.is_a?(Game_Enemy)   
      if img_hit_enemy_exist?
      @character_name = @page.graphic.character_name + "_Hit"
      @collision_attack = false
      end
      else
      if img_hit_actor_exist?
      actor = $game_party.actors[0] 
      @character_name = actor.character_name + "_Hit"
      end
    end
      @pattern = 0
      @knock_back_duration -= 1
      if @knock_back_duration <= 0
        if self.battler.is_a?(Game_Enemy) 
        @character_name = @page.graphic.character_name
        else
        actor = $game_party.actors[0] 
        @character_name = actor.character_name       
        end
        @knock_back_duration = nil
        @move_speed = @knock_back_prespeed
        @knock_back_prespeed = nil
      end
      return
    end
  end
  def knockbacking?
    return @knock_back_duration != nil
  end
  def collapsing?
    return self.collapse_duration.to_i > 0
  end
end
module XAS_DamageStop
  def acting?
    return (super or self.knockbacking? or self.collapsing?)
  end
end
class Game_Player < Game_Character
  include XAS_DamageStop
end
class Game_Event < Game_Character
  include XAS_DamageStop
end
module RPG
class Sprite < ::Sprite
def dispose_animation
if @_animation_sprites != nil
sprite = @_animation_sprites[0]
if sprite != nil
@@_reference_count[sprite.bitmap] -= 1
end
for sprite in @_animation_sprites
sprite.dispose
end
@_animation_sprites = nil
@_animation = nil
end
end
end
end

It's not the whole script just the "Action Battle System" part.. I've marked Line 1739 in red... :)

And I am using this script: http://www.rmxp.org/forums/index.php?topic=49698.0
And every time I'm entering the airship it says:
Script 'XRXS - XAS' line 1739: NoMethodError occured.
undefinied method `dead?' for # <Game_Airship:0x3cb8270>

Please help me
 
Hi SephirothSpawn...

thanx for your answer.... but I've got the error again...
The error is the XRXS-XAS Script, where it (I think) is trying to extract the kickback tiles for the airship.
I don't know ruby-scripting very well, but i think so.... and with your codes it won't work... *sniff*  :cry:
Maybe it's possible to change the airship script so it's not generating a new class... or does this not work?

Hope you can help me.... it would be very nice, if I can use it in my game.... :)

Greetz from Germany....
DarkWonder
 
i am no longer getting the  XRXS-XAS Script error i am now getting a XAS-Potion Error i will continue looking at it to see if i can get it bug free for you

EDIT: had the game running up unitl the airship is aquired
 
ok i got your error fixed :)

all you need to do is this

change this
def update
    if @battler == nil
      @battler = @character.battler
to

def update
    if @battler == true
      @battler = @character.battler
and it will work for you

so you can find this part easier

this is the line number you need to look for 1621 - 1623
 
Hi there ninetailnaruto 

Thanx for your help....

I've tried your fix but it won't work for me... :(

I've tried my own demo with it and tried it in my game, but in both games it doesn't work.

Now I've updated my game to XAS 3.0 Hero Edition, there you'll find your lines in 3425 - 3428 and I've tried to change it, but also an error inside.
The error says:
Script 'XAS - SYSTEM' line 3768 NoMethodError occured.
undefinied method `dead?' for #<Game_Airship:0x41d71b0>

I've uploaded a new Demo with the new XAS 3.0 Hero Edition in it...
Maybe you've got time to look inside?
I've also fixed the missing airship charset from the demo... now theres all inside I need in my game. :)

http://rapidshare.com/files/158273712/S ... u.rar.html

Greetz and thanx for all,
Darkwonder
 

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