Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Enemy Additions

Save-Point

Full Version: Enemy Additions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm looking for a script that randomly adds 1 to 4 enemies of my choosing depending on the battleback. For example, say you are on a forest battle background, then 1-4 forest enemies would spawn (on top of the already loaded enemies) even if there's already 8 enemies on the field.
This would have to work with Charlie Fleed's CTB. If anyone is willing to work on this, I would really appreciate it. Thanks you!

Oh yeah, and for where they are supposed to be on the screen, I should be able to put in the coordinates myself.
We discussed something like that two years ago...

Random Monster Groups

Guess if you had certain 'monsters' that only appear in certain terrains. Those monsters could generate your random guys...
I mean an additional 1-4 enemies on top of the ones already generated. So I have 4 frogs on the field in a forest, since I am in a forest, I want treants to randomly spawn on top of those. So, one out of a few battles, 1-4 treants will spawn along with the frogs.
Any takers?
Kinda.

I did this as a rush job. You tell the battlesystem to add another TROOP to the fight in addition to the existing troop. So it's like... if you're fighting ghosts (troop 1) and you tell it that you also want to add troop #3 (basilisks), the battle will have BOTH. But all control will be governed by the events for Troop 1.

You set the second troop by setting $game_system.troop_id to the id of the troop

Code:
#==============================================================================
# ** Yin's Extra Troops
#==============================================================================
#    DerVVulfman
#    Version 0.9
#    December 19, 2011
#    RMXP Compatible
#==============================================================================
#  
# With this, you can make a battle have more than two troops engaged at the
# same time.
#
# All actions in the troops window are based on the initial troop that's called
# when entering a battle  (random battles,  map event 'Battle Processing').  So
# the battle conditions in the second troop will not come into play.   The only
# caveat to this is that the enemies in the second troop will not be controlled
# or a part of the first troop's event system.
#
#  Script Call:  $game_system.troop_id = new_troop_id
#                     Where the new_troop_id is the ID of the second
#                     troop in your RPGMaker XP database.
#
#==============================================================================



#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of
#  this class.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :troop_id                 # secondary troop ID
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias second_troop_initialize initialize
  def initialize
    second_troop_initialize
    @troop_id = 0
  end
end


#==============================================================================
# ** Game_Troop
#------------------------------------------------------------------------------
#  This class deals with troops. Refer to "$game_troop" for the instance of
#  this class.
#==============================================================================

class Game_Troop
  #--------------------------------------------------------------------------
  # * Setup
  #     troop_id : troop ID
  #--------------------------------------------------------------------------
  alias new_setup setup
  def setup(troop_id)
    # Ye classic Alias
    new_setup(troop_id)
    # Only if a valid troop ID
    return if $game_system.troop_id.nil?
    return if $game_system.troop_id == 0
    return if $data_troops[$game_system.troop_id] == nil
    # Pretty much redo a new troop
    new_troop_id = $game_system.troop_id
    troop = $data_troops[new_troop_id]
    for i in 0...troop.members.size
      enemy = $data_enemies[troop.members[i].enemy_id]
      if enemy != nil
        @enemies.push(Game_Enemy.new(new_troop_id, i))
      end
    end
  end
end

Version 0.9 as I don't consider it finished. Winking
Just curious but couldn't you do this quite easily with events and conditional branches, Yin? :)

Sexy script DerVV, nice work.
(12-20-2011, 10:20 AM)MetalRenard Wrote: [ -> ]Just curious but couldn't you do this quite easily with events and conditional branches, Yin? :)

Sexy script DerVV, nice work.
OMG Thanks DerVV you are a freaking life saver. You just keep coming to my rescue! :) And you did it in a WAY better way than I was thinking about it. I thought I'd have to position them in the script, but adding another troop id to the battle is way easier.

And yes Renard, I could do it with events (I think), but not if I never know exactly who is going to be on the field. See, I've got this script called random monster groups in and it makes a random amount of enemies in the troop pop up on the field. So everything will vary.

I'm going to test this out right after work!
Thanks again DerVV!
It works perfectly, now how would I use the other troop as a condition? (Like if an enemy from the second troop dies, make this happen)

And also, how would I make it so that if the first (original troop) is killed, that the battle is over as a win?
Revised version that can be automated based on terrain tags and different maps found (>HERE!<)
This is solved for the most part! Thank you Dervvulfman, this is actually a vital part of my game. I'll ask my other questions in the main post.