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.

Taunting/provoking script needed for Tank class

I plan on making a tanking class... But the thing is, a tanking class is pretty useless unless it can keep enemies attacking it. I need a Taunt-like script that causes enemies to attack the user of it. I've tried trickster's but the scripts needed to use it screwed up the RTAB script that I'm using- oh yes, I need it compatible with that too. Thank you in advance. Lets hope my tank will soon look like this: :box:
 
Here you go.
I've tested it with cogwheel's RTAB 1.16
Everything is aliased, so in theory, it should work in other battle systems too.
set SKILL_ID to your taunt skill's id.

[rgss]module Taunt
 
  SKILL_ID = 96
  module_function
 
  # index  : the taunter's index in the party/ troop.
  def self.user=(taunter)
    @taunter = taunter
    @index = $game_party.actors.index(taunter)
    @active = true
  end
 
#--------------------------------------------------
#  Did anyone use Taunt
#--------------------------------------------------
  def active?
    return (@active)
  end
 
  def clear
    @active = false
    @index = @taunter = nil
  end
 
  def skill?(sk)
    return sk.id == SKILL_ID
  end
 
  def index
    @index
  end
 
end
 
class Scene_Battle
  alias clear_Taunt_main main
  def main
    Taunt::clear
    clear_Taunt_main
  end
 
end
 
class Game_Battler
 
  alias taunt_effect skill_effect
 
  def skill_effect(user, skill)
    if Taunt::skill?(skill)
      Taunt.user = user
    end
    taunt_effect(user, skill)
  end
 
end
 
class Game_BattleAction
 
  def for_one_enemy?
    # If kind = attack (basic)
    if @kind == 0
      return true
    end
    # If kind = skill, and effect scope is for enemy
    if @kind == 1 and $data_skills[@skill_id].scope == 1
      return true
    end
    # If kind = item, and effect scope is for one enemy
    if @kind == 2 and $data_items[@item_id].scope == 1
      return true
    end
    return false
  end
 
  #--------------------------------------------------------------------------
  # * Random Target (for Enemy)
  #--------------------------------------------------------------------------
  alias taunt_decide_random_target decide_random_target_for_enemy
  def decide_random_target_for_enemy
    # Target the taunter if the skill's scope is 1 foe.
    if Taunt::active? and for_one_enemy?
      @target_index = Taunt::index
    else
      taunt_decide_random_target
    end
   
  end
 
end
[/rgss]
 

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