Prexus' Scripts

Cool, man, I might use that Job thing, then :)

Depends upon how my storyline is going.. I'm actually working on that now. Have been the last couple days.
[QUOTE=Prexus]Study the demo, learn from it. I'm not offering support on that script.
[/QUOTE]

Understood.

Edit- Found the problem. I gotta have the animation system on (I.E. @p_animations/@e_animations) for the game to refresh correctly.

Don't know if this will be a major problem for anyone else, but this is what I came up with.
World Objects Version 2.0

An upgrade on my World Objects script.

New Features Include:
  • A window which reflects skill data.
  • Randomly spawning nodes (specific densities)
  • Multiple item results/chances/types
  • Easy setup using event comments.

The Demo
Click Here

Screenshots

Screenshot1 Spoiler
http://rm-dev.org/Scripts/World%20Objects%20Version%202.0/Screenshot1.png[/img]

Screenshot2 Spoiler
http://rm-dev.org/Scripts/World%20Objects%20Version%202.0/Screenshot2.png[/img]

Screenshot3 Spoiler
http://rm-dev.org/Scripts/World%20Objects%20Version%202.0/Screenshot3.png[/img]


The Script
Content Hidden Spoiler
#------------------------------------------------------------
# World Objects version 2.0 - by Prexus
#------------------------------------------------------------
# Instructions:
#   When setting up World Objects, create an event on the map
# with the name 'World Setup'. It doesn't have to be parallel
# process or autostart, it just needs to be on the map.
#   To create an object to be placed, you'll need to add some
# comments to the World Setup event.
#   The comments look like this format:
#
# Comment: Object
# Comment: <density> <type_id> <node_level>
# Comment: <item type> ...
# Comment: <item id> ...
# Comment: <item chance> ...
# Comment: <node_graphic> <node_graphic_expired>
#
#   Here is the breakdown:
# <density>    : replace this with either DENSE, MEDIUM, or SPARSE.
#                They determine the amount of nodes that will spawn
#                on the map. The constants can be changed in the
#                World Constants module below these instructions.
# <type_id>    : This is the ID of the skill, which is generally the
#                order you create them in. In the case of the demo,
#                Herbalism is id 0, Mining is id 1, Fishing is id 2
#                and Lockpicking is id 3.
# <node_level> : This is the level required to harvest the node,
#                and corresponds with the type_id.
#
# <item_type>  : replace this with either ITEM, WEAPON, or ARMOR.
#                It determines which database it'll pull the result
#                from, depending on the ID given in <item_id>.
#                The ... signifies that you can add multiple
#                <item_type>, as long as there are an equal amount of
#                <item_id> and <item_chance>.
# <item_id>    : This is the ID of the item in the database.
#                The ... signifies that you can add multiple
#                <item_id>, as long as there are an equal amount of
#                <item_type> and <item_chance>.
# <item_chance>: This number represents the chance that you'll find
#                the item (out of 100, a percentage, so 50 = 50% chance)
#                It checks the item chances in the order they are presented,
#                  ie if you input Comment: 70 90 100
#                You have a 70 percent chance to find the first item, and
#                --FAILING THAT-- you have a 90% chance to find the next
#                item, and failing that you have a 100% chance to find the
#                last item (this doesn't have to be 100, you can find nothing.)
#                The ... signifies that you can add multiple
#                <item_chance>, as long as there are an equal amount of
#                <item_type> and <item_id>.
#
# <node_graphic> : This is the name of the graphic you want to use for the
#                  node -before- it is harvested. For example you might put
#                  001-Fighter01.
# <node_graphic_expired> : This is the name of the graphic you want to use
#                  for the node -after- it is harvested.
#
# You can have subsequent Objects commented, such as:
#  Comment: Object
#  Comment: "blah blah"
#  Comment: "blah blah etc."
#  Comment: Object
#  Comment: "blah blah blah blah" etc..
#
# This will result in two types of nodes appearing on the same map.
#
# To teach a skill to a player, use this command in a Call Script:
# anActor.train_skill("skill_name")

# for example:
# $game_party.actors[0].train_skill("Herbalism")

# You can also add the extra parameter to define the starting level of the skill:
# $game_party.actors[0].train_skill("Herbalism", 10)

# You can also use the .untrain_skill() method to forget a skill:
# $game_party.actors[0].untrain_skill("Herbalism")
#
# To setup skills, go in the script where it says @skills = [] and add after it:
# @skills.push(World::Skills.new('<name of skill>'[, <weapon_required>, <max_level>]))
# <name of skill> being the name of the skill in single quotes.
# <weapon_required> being the ID of an item that has to be equipped (such as an axe)
# <max_level> being the maximum level of the skill.
# the Weapon and the Max Level aren't required.

module World_Constants
  DENSE = 0.05
  MEDIUM = 0.03
  SPARSE = 0.01
  TYPES = ['Herbalism', 'Mining', 'Fishing', 'Lockpicking']
end

class World
  attr_accessor :objects
  attr_accessor :skills
  #----------------------------------------------------------------------
  def initialize
    @objects = {}
    @skills = []
    @skills.push(World::Skills.new('Herbalism'))
    @skills.push(World::Skills.new('Mining', 2))
    @skills.push(World::Skills.new('Fishing', 3))
    @skills.push(World::Skills.new('Lockpicking'))
  end
  #----------------------------------------------------------------------
  def setup(events)
    @objects = {}
    for event in events.values
      if event.name == 'World Setup'
        list = event.list
        next if list == nil
        next unless list.is_a?(Array)
        for item in list
          next if item.code != 108
          if item.parameters[0] == 'Object'
            item1 = list[list.index(item) + 1]
            item2 = list[list.index(item) + 2]
            item3 = list[list.index(item) + 3]
            item4 = list[list.index(item) + 4]
            item5 = list[list.index(item) + 5]
            next unless item1 and item2 and item3 and item4 and item5
            add_objects(item1.parameters[0], item2.parameters[0],
                        item3.parameters[0], item4.parameters[0],
                        item5.parameters[0])
            $game_map.update_last_event_id
          end
        end
      end
    end
  end
  # item1
  # density, type, level
  # item2
  # result_types
  # item3
  # result_indices
  # item4
  # result_chances
  # item5
  # graphic_name1, graphic_name2
  #----------------------------------------------------------------------
  def add_objects(item1, item2, item3, item4, item5)
    creation_info = item1.split
    resulttype_info = item2.split
    results_info = item3.split
    resultchance_info = item4.split
    graphic_info = item5.split
    map_w = $game_map.width
    map_h = $game_map.height
    map_tiles = map_w * map_h
    case creation_info[0]
    when 'Dense'
      num_objects = map_tiles * World_Constants::DENSE
    when 'Medium'
      num_objects = map_tiles * World_Constants::MEDIUM
    when 'Sparse'
      num_objects = map_tiles * World_Constants::SPARSE
    else
      num_objects = 0
    end
    for i in 0...num_objects
      id = @objects.size + 1
      @objects[id] = World::Object.new(id,
                      World_Constants::TYPES[creation_info[1].to_i], creation_info[2],
                      resulttype_info, results_info, resultchance_info,
                      graphic_info[0], graphic_info[1])
    end
  end
  #----------------------------------------------------------------------
  def check_gather
    for object in @objects
      #print "#{$game_map.events[object.event_id].name} #{$game_map.events[object.event_id].x}, #{$game_map.events[object.event_id].y}"
      next unless check_range(object[1].event_id)
      event = $game_map.events[object[1].event_id]
      key = [event.map_id, event.id, 'A']
      next if $game_self_switches[key]
      object[1].gather($game_party.actors[0])
      return
    end
  end
  #----------------------------------------------------------------------
  def check_range(event_id, range = 1)
    element = $game_player
    object = $game_map.events[event_id]
    x = (object.x - element.x) * (object.x - element.x)
    y = (object.y - element.y) * (object.y - element.y)
    r = x + y
    if r <= (range * range)
      if element.direction == 2 # Down
        return true if (object.x == element.x) and (object.y > element.y)
      end
      if element.direction == 4 # Left
        return true if (object.y == element.y) and (object.x < element.x)
      end
      if element.direction == 6 # Right
        return true if (object.y == element.y) and (object.x > element.x)
      end
      if element.direction == 8 # Up
        return true if (object.x == element.x) and (object.y < element.y)
      end
    end
    return false
  end
  #----------------------------------------------------------------------
  def erase_object(object)
    event = $game_map.events[object.event_id]
    key = [event.map_id, event.id, 'A']
    $game_self_switches[key] = true
    $game_map.refresh
    #@objects.delete(object.event_id)
  end
  #----------------------------------------------------------------------
  def reset_objects
    for obj in @objects.values
      next unless obj
      event = $game_map.events[obj.event_id]
      next unless event
      key = [event.map_id, event.id, 'A']
      $game_self_switches[key] = false
    end
    $game_map.refresh
  end
  #----------------------------------------------------------------------
  # * Object
  #----------------------------------------------------------------------
  # This handles the objects by making them into 'special events' which
  # are managed and interacted with via. the World class.
  #----------------------------------------------------------------------
  class Object
    attr_accessor :event_id
    attr_accessor :type
    attr_accessor :level
    attr_accessor :result_types
    attr_accessor :results
    attr_accessor :result_chances
    #--------------------------------------------------------------------
    def initialize(id, type, level, result_types, results, result_chances, graphic1, graphic2)
      for ski in $world.skills
        if ski.name == type
          @type = ski
        end
        break if @type
      end
      $world.erase_object(self) unless @type
      @level = level.to_i
      @result_types = result_types
      @results = results
      @result_chances = result_chances
      @id = id
      @event_id = $game_map.add_event(@id, graphic1, graphic2)
    end
    #--------------------------------------------------------------------
    def gather(actor)
      skill_level = actor.gather_skill[@type]
      unless skill_level
        $game_system.se_play($data_system.cancel_se)
        $scene.get_window.start("You require the skill #{@type.name}.")
        return
      end
      text1 = ""
      text2 = ""
      if @type.item_id != 0
        if @type.item_id != $game_party.actors[0].weapon_id
          $game_system.se_play($data_system.buzzer_se)
          text1 = "You must equip a #{$data_weapons[@type.item_id].name}."
          $scene.get_window.start(text1, text2)
          return
        end
      end
      if skill_level < @level
        $game_system.se_play($data_system.buzzer_se)
        text1 = "#{@type.name} skill not sufficient."
        $scene.get_window.start(text1, text2)
        return
      end
      if rand(100) < (100 - @level)
        result = rand(100) + 1
        end_result = -1
        for i in 0...@result_chances.size
          next unless @result_chances[i]
          end_result = i if @result_chances[i].to_i >= result
          break if end_result != -1
        end
        if end_result == -1
          text1 = "You failed to find any usable materials."
        end
        case @result_types[end_result].upcase
        when "ITEM"
          $game_party.gain_item(@results[end_result].to_i, 1)
          text1 = "Gathered #{$data_items[@results[end_result].to_i].name}."
        when "WEAPON"
          $game_party.gain_weapon(@results[end_result].to_i, 1)
          text1 = "Gathered #{$data_weapons[@results[end_result].to_i].name}."
        when "ARMOR"
          $game_party.gain_armor(@results[end_result].to_i, 1)
          text1 = "Gathered #{$data_armors[@results[end_result].to_i].name}."
        end
        if skill_level < @type.max_level
          if (skill_level < @level + 10) and (rand(100)+@level > skill_level)
            actor.gather_skill[@type] += 1
            text2 = "(#{@type.name} skill up!)"
          end
        end
        $game_system.se_play($data_system.decision_se)
      else
        text1 = "You failed to find any usable materials."
        $game_system.se_play($data_system.cancel_se)
      end
      $scene.get_window.start(text1, text2)
      $world.erase_object(self)
    end
  end
  #----------------------------------------------------------------------
  # * Skills
  #----------------------------------------------------------------------
  # This object is a container that holds the values for skills and
  # organizes them for future reference. These are not RMXP's default
  # 'skills' but instead gathering skills which are used to seperate
  # different kinds of gathering points.
  #----------------------------------------------------------------------
  class Skills
    attr_accessor :name
    attr_accessor :max_level
    attr_accessor :item_id
    #--------------------------------------------------------------------
    def initialize(name, item_id = 0, max_level = 100)
      @name = name.to_s
      @max_level = max_level.to_i
      @item_id = item_id.to_i
    end
  end
  #----------------------------------------------------------------------
  # * Window_Get
  #----------------------------------------------------------------------
  # This is a special window, similar to the Help Window in RMXP's
  # non-extended code. However it will appear and fade automatically when
  # new text is added. It is the standard way for World Objects to display
  # information to the player.
  #----------------------------------------------------------------------
  class Window_Get < Window_Base
    def initialize
      super(16, 16, 608, 64)
      self.contents = Bitmap.new(width - 32, height - 32)
      self.opacity = 0
      self.back_opacity = 0
      self.contents_opacity = 0
      @text = ""
      @text2 = ""
    end
    #--------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.draw_text(4, 0, self.contents.width - 8, 32,
        "#{@text.to_s} #{@text2.to_s}", 1)
    end
    #--------------------------------------------------------------------
    def start(text, text2 = "")
      @text = text
      @text2 = text2
      @timer = 0
      refresh
    end
    #--------------------------------------------------------------------
    def update
      if @text != "" and self.opacity != 0
        if $game_player.y <= 5
          self.y = 400 if self.y == 16
        else
          self.y = 16 if self.y == 400
        end
      end
      if @text != "" and self.opacity != 255
        self.opacity += 20 unless self.opacity >= 255
        self.back_opacity += 10 unless self.back_opacity >= 120
        self.contents_opacity += 20 unless self.contents_opacity >= 255
      elsif @text == "" and self.opacity != 0
        self.opacity -= 20 unless self.opacity <= 0
        self.back_opacity -= 10 unless self.back_opacity <= 0
        self.contents_opacity -= 20 unless self.contents_opacity <= 0
      elsif @text != "" and self.opacity >= 255
        @timer += 1
        @text = "" if @timer == 100
        @text2 = "" if @timer == 100
      end
    end
  end
  #----------------------------------------------------------------------
  # * Window_WorldSkills
  #----------------------------------------------------------------------
  # This is a special window, designed to display information about your
  # world skills.
  #----------------------------------------------------------------------
  class Window_WorldSkills < Window_Selectable
    def initialize(actor = $game_party.actors[0])
      super(0, 0, 640, 480)
      self.contents = Bitmap.new(width - 32, height - 32)
      @actor = actor
      refresh
    end
    def refresh
      self.contents.clear
      i = 0
      for ski in $world.skills
        next unless ski
        skill_level = @actor.gather_skill[ski]
        self.contents.draw_text(4, 32 * i, 600, 32, ski.name)
        if ski.item_id != 0
          self.contents.draw_text(4, 32 * i, 600, 32, "Requires: " + $data_weapons[ski.item_id].name, 2)
        end
        if skill_level
          self.contents.draw_text(4, 32 * (i + 1), 600, 32, "#{skill_level}/#{ski.max_level}")
        else
          self.contents.draw_text(4, 32 * (i + 1), 600, 32, "Skill not trained.")
        end
        i += 2
      end
    end
  end
end

#------------------------------------------------------------------------
# * Scene_Map
#------------------------------------------------------------------------
# RMXP's Default Scene_Map editted via aliases to include the Window_Get
# subclass of the World class and to take proper input to control the
# World class and the Objects within it.
#------------------------------------------------------------------------
class Scene_Map
  attr_accessor :get_window
  #----------------------------------------------------------------------
  alias prx_world_s_map_main_draw main
  #----------------------------------------------------------------------
  def main
    @get_window = World::Window_Get.new
    prx_world_s_map_main_draw
    @get_window.dispose
  end
  #----------------------------------------------------------------------
  alias prx_world_s_map_update update
  #----------------------------------------------------------------------
  def update
    $world.check_gather if (Input.trigger?(Input::A) and
                           @get_window.opacity <= 0)
    @get_window.update
    prx_world_s_map_update
  end
end

#------------------------------------------------------------------------
# * Game_Actor
#------------------------------------------------------------------------
# RMXP's Default Game_Actor editted via aliases to initialize the
# @gather_skill hash properly. Also includes the train_skill() method to
# update that hash accordingly when learning new skills, and the
# untrain_skill() method which does the same.
#------------------------------------------------------------------------
class Game_Actor
  attr_accessor :gather_skill
  #----------------------------------------------------------------------
  alias prx_world_g_actor_setup setup
  #----------------------------------------------------------------------
  def setup(actor_id)
    prx_world_g_actor_setup(actor_id)
    @gather_skill = Hash.new(nil)
  end
  #----------------------------------------------------------------------
  def train_skill(name, level = 1)
    for ski in $world.skills
      if ski.name == name
        @gather_skill[ski] = level
        if $scene.is_a?(Scene_Map)
          $scene.get_window.start("#{@name} learned #{ski.name}!")
        end
        return
      end
    end
  end
  #----------------------------------------------------------------------
  def untrain_skill(name)
    for ski in $world.skills
      if ski.name == name
        @gather_skill[ski] = nil
        @gather_skill.flatten
        if $scene.is_a?(Scene_Map)
          $scene.get_window.start("#{@name} forgot #{ski.name}!")
        end
        return
      end
    end
  end
end

#------------------------------------------------------------------------
# * Game_Map
#------------------------------------------------------------------------
# RMXP's Default Game_Map class, aliased to add some initialization
# features and given the method 'add event' to add a blank event to the
# map. add_event also returns the id of the newly created event (as the id
# sent to the method is offset from the original events)
#------------------------------------------------------------------------
class Game_Map
  alias px_g_map_setup setup
  #----------------------------------------------------------------------
  def setup(map_id)
    $world.reset_objects if $world
    px_g_map_setup(map_id)
    @events.sort
    @last_event_id = @events.values[-1].id
    $world = World.new if !$world
    $world.setup(@events)
  end
  #----------------------------------------------------------------------
  def update_last_event_id
    @events.sort
    @last_event_id = @events.values[-1].id
  end
  #----------------------------------------------------------------------
  def add_event(id, graphic1, graphic2)
    event = RPG::Event.new(-1, -1)
    event.id = @last_event_id + id
    event.name = 'World Object'
    loop {
      event.x = rand(width)
      event.y = rand(height)
      break if valid?(event.x, event.y) and passable?(event.x, event.y, 0) and
        passable?(event.x, event.y, 2) and passable?(event.x, event.y, 4) and
        passable?(event.x, event.y, 6) and passable?(event.x, event.y, 8)
    }
    page1 = RPG::Event::Page.new
    page1.direction_fix = true
    page1graphic = RPG::Event::Page::Graphic.new
    page1graphic.character_name = graphic1
    page1.graphic = page1graphic
    page2 = RPG::Event::Page.new
    page2.direction_fix = true
    page2graphic = RPG::Event::Page::Graphic.new
    page2graphic.character_name = graphic2
    page2.graphic = page2graphic
    page2condition = RPG::Event::Page::Condition.new
    page2condition.self_switch_valid = true
    page2condition.self_switch_ch = "A"
    page2.condition = page2condition
    event.pages = [page1, page2]
    $game_map.events[event.id] = Game_Event.new(@map_id, event)
    return event.id
  end
end

#------------------------------------------------------------------------
# * Game_Event
#------------------------------------------------------------------------
# RMXP's Default Game_Event with a map_id attribute and a definition to
# return the name of an event. Used to locate the World Objects initialization
# event.
#------------------------------------------------------------------------
class Game_Event < Game_Character
  attr_reader :map_id
  attr_reader :page
  #----------------------------------------------------------------------
  def name
    return @event.name
  end
end

#------------------------------------------------------------------------
# * Scene_WorldSkills
#------------------------------------------------------------------------
# A small class made to demonstrate the World Skill information window.
#------------------------------------------------------------------------
class Scene_WorldSkills
  def initialize(actor = $game_party.actors[0])
    @actor = actor
  end
  def main
    @skills_window = World::Window_WorldSkills.new(@actor)
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @skills_window.dispose
  end
  def update
    @skills_window.update
    if Input.trigger?(Input::B)
      $scene = Scene_Map.new
      $game_system.se_play($data_system.decision_se)
      return
    end
  end
end
Expand to see the code.


Compatibility

No longer required the RMXP SDK (never needed it in the first place).
Prexus.. you are the man.


I get a sprite error:

'Sprite_Character' 41 NoMethodError
undefined method 'name' for nil:NilClass

And the code it is refering to in Sprite_Character is:
        if character.is_a?(Game_Event)
          [COLOR=Red]charname = load_data(sprintf("Data/Map%03d.rxdata", $game_map.map_id)).events[character.id].name[/COLOR]
        end
Expand to see the code.



EDIT: Of course, this error is with your World Objects v2.0.
Nevermind, I fixed it, but I don't know if it will cause errors with other scripts.
Well the error would result in the fact that the events for the world objects aren't in the map data file, and are created as RPG::Events and made into Game_Event objects each time you load up the map. I don't know what script that is that you are using that would require you to use the map data like that.
Like I said, I finally got it to work, but now I have this other problem. When I put the "World Objects" event on a map, and make it generate the herbs, it sometimes erases my other events, and also sometimes puts the herbs on top of other events.. I don't think that's intentional?

I love this script, dude, and I really would like to use it. If there's a way to make it not generate an herb over other events, then that would be perfect.
Its not supposed to put the nodes on top of events, but it has a tendancy to do it. I'll maybe run it by someone else and see why its doing it, because its coded specifically not to.
If i press Q a window pops out and never stops coming can you fix it?
How do i have it that if you die, you just either lose a couple of items and 1/2 your gold, or if that would take too much time just be teleported to a certain place?
Reaper: That was a test thing I forgot to take out, i'll do that in a minute (won't remove it from the demo as it takes too much effort to compile and reupload that.)

Edit: Posted script is fixed, about to fix the one on my website.
Just an FYI, Prexus; The reason why I was getting that sprite error from before is because I'm also using Tiberius' "Interactive NPC's" script, which requires you to redo the whole script for Sprite_Character.. So, obviously, when I put the old Sprite_Character script back in there, yours works like a charm, but then Interactive NPC's doesn't. What could I do to go around the change in the sprite script, if any? Could an alias be added or something?

Tiberius' alteration to Sprite_Character:
Content Hidden Spoiler
#==============================================================================
#     Sprite_Character
#------------------------------------------------------------------------------
#     The sprites of characters.
#==============================================================================

class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  #     Attributes
  #--------------------------------------------------------------------------
  attr_accessor :character
  #--------------------------------------------------------------------------
  #     Initialize
  #--------------------------------------------------------------------------
  def initialize(viewport, character = nil)
    super(viewport)
    @character = character
    update
  end
  #--------------------------------------------------------------------------
  #     Update
  #--------------------------------------------------------------------------
  def update
    super
    if @tile_id != @character.tile_id or
       @character_name != @character.character_name or
       @character_hue != @character.character_hue
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_hue = @character.character_hue
      if @tile_id >= 384
        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
          @tile_id, @character.character_hue)
        self.src_rect.set(0, 0, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        charname1 = @character.character_name
        charname = ""
        if character.is_a?(Game_Event)
          charname = load_data(sprintf("Data/Map%03d.rxdata", $game_map.map_id)).events[character.id].name
        end
        if charname[0..2] == "NPC"
          charname1 = $game_npc.char(charname[3..charname.length].to_f)
        end
        self.bitmap = RPG::Cache.character(charname1, @character.character_hue)
        @cw = bitmap.width / 4
        @ch = bitmap.height / 4
        self.ox = @cw / 2
        self.oy = @ch
      end
    end
    self.visible = (not @character.transparent)
    if @tile_id == 0
      sx = @character.pattern * @cw
      sy = (@character.direction - 2) / 2 * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
    self.x = @character.screen_x
    self.y = @character.screen_y
    self.z = @character.screen_z(@ch)
    self.opacity = @character.opacity
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      animation(animation, true)
      @character.animation_id = 0
    end
  end
end
Expand to see the code.
Ask Tiberius, my script won't work by changing it to fix Tiberius'. It looks like he's picked a really retarded way of doing that part of Sprite_Character, and should change it regardless.
Alright, thanks anyway man, and keep up the awesome freakin' work :)


EDIT: Ugh, now I just have the problem that it simply erases all my other events on the map, period. If I change the # associated with "sparse", "medium" and "dense", I can make it so it doesn't erase my events, but then the herbs are so scarce it's not even worth it..

EDIT: Is there a maximum number of events allowed to be on every map, or am I missing something?
For the Sketch script is there anyway to stop sketch from mimicing certain enemy skills?
[QUOTE=psiclone]Alright, thanks anyway man, and keep up the awesome freakin' work :)


EDIT: Ugh, now I just have the problem that it simply erases all my other events on the map, period. If I change the # associated with "sparse", "medium" and "dense", I can make it so it doesn't erase my events, but then the herbs are so scarce it's not even worth it..

EDIT: Is there a maximum number of events allowed to be on every map, or am I missing something?[/QUOTE]

No there is no maximum, it takes the last event ID available (highest) and adds events on the end of that. It shouldn't be erasing events at all. Its probably some sort of incompatibility with one of your other scripts.
Hi, i have a question about the ABS script, is there a way for when you die not to have it go to game over? moreas be telied to another area, and if so how would you have it so you lose 1/2 your gold or like some of your items you are carrying?

Also your script sorta cancels out Additional Item Drops Version: 1, is there anyway to link the two? have it for when you kill the creature it links to A.I.D. for the items?
You go to the Request forum and make a request. That isn't a support question.
[QUOTE=Shadow Lich]For the Sketch script is there anyway to stop sketch from mimicing certain enemy skills?[/QUOTE]
Seeing as I got overlooked.
kk, sorry bout that
Sorry Shadow Lich. I'll take a look at it tomorrow morning and post a solution for you. Its been a while since I looked at that script.
Sketch v1.1

Made to mimic Relm's Sketch ability from Final Fantasy 6. Its not completely accurate, instead of pulling abilities from a specific list it just picks on of the monster's abilities at random and uses it. Great for adding dynamics to battles.

Changes in v1.1:
  • Changed the $SKETCH_ID variable into a module variable.
  • Added NO_SKETCH array, this array contains the IDs of skills that can't be sketched.


Note: Change the Sketch skill at the top of the script (SKETCH_ID = 81)
Change the NO_SKETCH array to include variables of skills that can't be sketched.

The Demo
Click Here (version 1.0, just c/p this script over the one in the demo)

The Script
Content Hidden Spoiler
#------------------
# Sketch
# by Prexus
# Mimics the ability Sketch by Relm in Final Fantasy 6
# Randomly selects one of the monster's abilities and uses it
# http://rm-dev.org/
#------------------

module Sketch
  SKETCH_ID = 81 # The id of the sketch skill in the database.
  NO_SKETCH = [] # An array of the skill ids of skills you don't want to be sketchable.
end

class Scene_Battle
 
  # Do not edit any of the following:
  def make_skill_action_result
    # Get skill
    @skill = $data_skills[@active_battler.current_action.skill_id]
    if @skill.id == Sketch::SKETCH_ID
      set_target_battlers(@skill)
      for target in @target_battlers
        enemy = $data_enemies[target.id]
        skills = []
        for i in 0...enemy.actions.size
          next unless enemy.actions[i].kind = 1
          next if Sketch::NO_SKETCH.include?(enemy.actions[i].skill_id)
          next unless enemy.actions[i].condition_level <= @active_battler.level
          skills.push($data_skills[enemy.actions[i].skill_id])
        end
        if skills.size != 0
          # Randomly picks an enemy's skill
          @skill = skills[rand(skills.size)-1]
        else
          # Clear battler being forced into action
          $game_temp.forcing_battler = nil
          # Shift to step 1
          @phase4_step = 1
          return
        end
      end
    end
    # If not a forcing action
    unless @active_battler.current_action.forcing
      # If unable to use due to SP running out
      unless @active_battler.skill_can_use?(@skill.id)
        # Clear battler being forced into action
        $game_temp.forcing_battler = nil
        # Shift to step 1
        @phase4_step = 1
        return
      end
    end
    # Use up SP
    if skills != nil
      skills = []
      skills = nil
      @target_battlers = []
      sketch = true
    else
      @active_battler.sp -= @skill.sp_cost
      sketch = false
    end
    # Refresh status window
    @status_window.refresh
    # Show skill name on help window
    @help_window.set_text(@skill.name, 1)
    # Set animation ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # Set command event ID
    @common_event_id = @skill.common_event_id
    # Set target battlers
    set_target_battlers(@skill, sketch)
    # Apply skill effect
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end
 
  alias stb set_target_battlers
  def set_target_battlers(skill, sketch = false)
    if sketch
      if @active_battler.is_a?(Game_Enemy)
        case skill.scope
        when 1
          index = rand($game_party.actors.size)-1
          @target_battlers.push($game_party.smooth_target_actor(index))
        when 2
          for actor in $game_party.actors
            if actor.exist?
              @target_battlers.push(actor)
            end
          end
        when 3
          index = rand($game_troop.enemies.size)-1
          @target_battlers.push($game_troop.smooth_target_enemy(index))
        when 4
          for enemy in $game_troop.enemies
            if enemy.exist?
              @target_battlers.push(enemy)
            end
          end
        when 5
          index = rand($game_troop.enemies.size)-1
          enemy = $game_troop.enemies[index]
          if enemy != nil and enemy.hp0?
            @target_battlers.push(enemy)
          end
        when 6
          for enemy in $game_troop.enemies
            if enemy != nil and enemy.hp0?
              @target_battlers.push(enemy)
            end
          end
        when 7
          @target_battlers.push(@active_battler)
        end
      end
      if @active_battler.is_a?(Game_Actor)
        case skill.scope
        when 1
          index = rand($game_troop.enemies.size)-1
          @target_battlers.push($game_troop.smooth_target_enemy(index))
        when 2
          for enemy in $game_troop.enemies
            if enemy.exist?
              @target_battlers.push(enemy)
            end
          end
        when 3
          index = rand($game_party.actors.size)-1
          @target_battlers.push($game_party.smooth_target_actor(index))
        when 4
          for actor in $game_party.actors
            if actor.exist?
              @target_battlers.push(actor)
            end
          end
        when 5
          index = rand($game_party.actors.size)-1
          actor = $game_party.actors[index]
          if actor != nil and actor.hp0?
            @target_battlers.push(actor)
          end
        when 6
          for actor in $game_party.actors
            if actor != nil and actor.hp0?
              @target_battlers.push(actor)
            end
          end
        when 7
          @target_battlers.push(@active_battler)
        end
      end
      return
    end
    stb(skill.scope)
  end
end

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Determine if Skill can be Used
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def skill_can_use?(skill_id)
    #if not skill_learn?(skill_id)
    #  return false
    #end
    return super
  end
end
Expand to see the code.
Hi!

I know IÂÂÂ ´m very annoying, but I really like your ABS and I really want it to work for me. The Chest, Local och Switch triggers wonÂÂÂ ´t work. Trigger Erase works just fine, but not the others. The enemy is still walking around, but you canÂÂÂ ´t attack it...
Did you make a second page to the event, with the trigger's condition as the precondition for the page?

Why not try and copy and paste a monster event out of my demo into your game and see if it works.
Alright, so I'm sad to say I can't use your World Objects script, Prexus. As you have probably seen in my thread about my "Read error", it's due to your script. Even commenting the entire script still causes my game to crash. I tried deleting the script, it and it works fine, now.. So, I can't use it. :-\ I'm not asking you to fix it, because obviously it's just my computer doing that, but I just wanted to make sure that you knew I thought the script was badass, and I would use it if I could. Keep up the good work, dude.
I don't understand how my script would cause an error even if it was commented out. But if thats the case, so be it. Thanks for the kind words though.
Already tried the copy/paste-thing, all kinds of ways, it just wonÂÂÂ ´t work. And yes, I know how Local Switches works... Hmm.
When I load my game with ur abs, it sez 'File Graphics/HUD/Background not found :(
Sorry for a outdated reply, but these codes are awesome. Now theres one problem with them though. I'm using a customed Menu Screen and stuff can't be added to it, so is there any way that you can get these scripts to work by call screen only and not through the Menu Screen? If you will do this for me I would be greatfull.

Edit: Ok Now I fixed that problem me self, and have another one. Everytime I try to switch out a member of my party, that member disappears completely. What did I do wrong and can it be fixed?
What script are you using?

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=8671