RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Flying Enemies

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 84
Yes, hoh my gawd!
Flying Enemies
Authors: game_guy
Version: 1.0
Type: Adds Realism
Key Term: Battle Add-on

Introduction

Script was created completely from inspiration.

Flying Enemies adds some realism to your game. It basically gives the appearance and feel that enemies are floating off the ground. Only weapons with the "flying" element can attack enemies that aren't on the ground. e.g. a gun or a bow. A guy with a sword couldn't very well jump 20 feet and kill something could they? (maybe, it is just a game)

Features

  • Flying Enemies
  • Specific Spells and Weapons can hurt
  • Floating animation for enemies

Screenshots

Spoiler for:

Demo

N/A

Script

Spoiler for:
Code: [Select]
#===============================================================================
# Flying Enemies
# Version 1.0
# Author game_guy
#-------------------------------------------------------------------------------
# Intro:
# Flying Enemies adds some realism to your game. It basically gives the
# appearance and feel that enemies are floating off the ground. Only weapons
# with the "flying" element can attack enemies that aren't on the ground. e.g.
# a gun or a bow. A guy with a sword couldn't very well jump 20 feet and kill
# something could they? (maybe, it is just a game)
#
# Features:
# -Flying Enemies
# -Specific Spells and Weapons can hurt
# -Floating animation for enemies
#
# Instructions:
# -Go to the config, set the following data there. To make a weapon hit a flying
#  enemy, you must give it the flying element you specified below. The same for
#  skills, except some skills get exceptions. Read Notes.
#
# Notes:
# -Only weapons marked with the Flying_Element can hit a flying enemy.
# -Skills with a higher INT F then ATK F will hit a flying enemy since these
#  skills are considered "Magic". (Think Fire over Double Slash or something)
# -Skills with a higher ATK F will need to be marked with the Flying Element in
#  order to hit a flying enemy.
#
# Compatibility:
# -Not tested with SDK.
# -Not tested with any custom battle systems.
# -Attacking flying enemies (and missing) will most likely work throughout all
#  custom battle systems.
# -Animating enemy up and down may or may not work in any custom battle system.
#
# Credits:
# -game_guy ~ For creating it.
# -Final Fantasy X ~ Started playing this game again and Tidus was unable to
#  hit any flying enemies. ;_; Hence inspiration. :3
#===============================================================================

module GG_Fly
  #---------------------------------------------
  # Weapons and skill must have this element
  # in order to attack flying enemies.
  #---------------------------------------------
  Flying_Element  = 17
  #---------------------------------------------
  # Place enemy ids in the array below to mark
  # them as flying enemies.
  #---------------------------------------------
  Flying_Enemies  = [1, 2]
  #---------------------------------------------
  # The 'miss' message displayed when an out of
  # reach attacker attempts to hit a flying
  # enemy.
  #---------------------------------------------
  Miss_Message    = "Out of reach!"
  #---------------------------------------------
  # Moves flying enemies up and down to give
  # the "floating" feeling.
  #---------------------------------------------
  Animate_Enemy   = true
end

class Game_Enemy
  
  def flying?
    return GG_Fly::Flying_Enemies.include?(self.id)
  end
  
end

class Game_Battler
  
  alias gg_fly_attack_effect_lat attack_effect
  def attack_effect(attacker)
    if self.is_a?(Game_Enemy) && attacker.is_a?(Game_Actor)
      if self.flying? && !attacker.element_set.include?(GG_Fly::Flying_Element)
        self.damage = GG_Fly::Miss_Message
        return true
      end
    end
    return gg_fly_attack_effect_lat(attacker)
  end
  
  alias gg_fly_skill_effect_lat skill_effect
  def skill_effect(user, skill)
    if self.is_a?(Game_Enemy) && user.is_a?(Game_Actor)
      if self.flying? && !skill.element_set.include?(GG_Fly::Flying_Element)
        if skill.atk_f >= skill.int_f
          self.damage = GG_Fly::Miss_Message
          return true
        end
      end
    end
    return gg_fly_skill_effect_lat(user, skill)
  end
  
end

class Sprite_Battler < RPG::Sprite
  
  alias gg_init_flying_enemy_lat initialize
  def initialize(viewport, battler = nil)
    gg_init_flying_enemy_lat(viewport, battler)
    if battler != nil && battler.is_a?(Game_Enemy)
      @update_frame = 0
      @speed = 2
      @new_y = battler.screen_y
    end
  end
  
  alias gg_animate_flying_enemy_lat update
  def update
    gg_animate_flying_enemy_lat
    if GG_Fly::Animate_Enemy && @battler.is_a?(Game_Enemy) && @battler.flying?
      @update_frame += 1
      if @update_frame == 2
        @update_frame = 0
        @new_y += @speed
        if @new_y == @battler.screen_y
          @speed = 1
        elsif @new_y == @battler.screen_y + 16
          @speed = -1
        end
      end
      self.y = @new_y
    end
  end
  
end

Instructions

In the script. In fact there is even a small notes section you should read. In fact, here are the notes visually explained.

Skills with a higher INT F then ATK F are considered "Magic" skills. So therefore skills like these will hit flying enemies regardless if they have the Flying element or not. Any skill that does not meet this condition must have the Flying element in order to attack Flying enemies. However, all weapons

Note how fire does not have the flying element, it can still hit flying enemies since in a sense its magic and you don't need to be next to the enemy
Spoiler for:
This is a skill used by a hunter with his bow. In a sense it should be able to hit flying enemies, but since its not "magic" it needs to have the flying element.
Spoiler for:

Any weapon you want to hit flying enemies with must have the Flying element.

Compatibility

  • Not tested with SDK.
  • Not tested with any custom battle systems.
  • Attacking flying enemies (and missing) will most likely work throughout all custom battle systems.
  • Animating enemy up and down may or may not work in any custom battle system.

Credits and Thanks

  • game_guy ~ For creating it.
  • Final Fantasy X ~ Started playing this game again and Tidus was unable to hit any flying enemies. ;_; Hence inspiration. :3

Author's Notes

Enjoy!

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Best IRC Quote2014 Zero to Hero2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Teehee, nice stuff g_g. I can see nothing wrong with that code.
I've always randomly wanted to do something really useless, tedious and just stupid, like
Code: [Select]
return GG_Fly::Flying_Enemies.include?(self.id) ? true : false
Because I can.
it's like a metaphor or something i don't know

***
Rep:
Level 84
Yes, hoh my gawd!
Teehee, nice stuff g_g. I can see nothing wrong with that code.
I've always randomly wanted to do something really useless, tedious and just stupid, like
Code: [Select]
return GG_Fly::Flying_Enemies.include?(self.id) ? true : false
Because I can.

Very redundant! *achievement unlocked: redundant coding*