LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



Go to page : 1, 2, 3, 4  Next

View previous topic View next topic Go down Message [Page 1 of 4]

EVENTALIST
EVENTALIST
#1 XAS - Respawn Timer Empty XAS - Respawn Timer
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
XAS - Respawn Timer
Version: 3.0
Author: Mr Wiggles
Date: November 3, 2011

Version History




  • Version 3.0 11/3/11 - New System.
  • Version 2.5 7/1/10 - Fixed some minor bugs
  • Version 2.2 6/27/10 - Cleaned code up. Added new installation instructions.
  • version 2.0 6/25/10 - Updated script to work with both the new and old versions of XAS (3.6 and 3.7)
  • Version 1.3 6/11/10 - Removed dependency on self variables script. Added new feature, never re-spawn.
  • Version 1.0 4/19/10 - Original Release


Planned Future Versions


  • Maybe more features, like individual re-spawn times depending on enemy id.


Description


Makes the enemies in XAS re-spawn after a set time instead of after a map change, or make the the enemies never re-spawn.

Features

  • Enemies can be tagged so that they will never re-spawn
  • Set the time it takes to re-spawn
  • Lag prevention by limiting updates
  • Can set the re-spawn time for item enemies like crates and such as well.



Instructions
Paste this script in your script data base above your add on scripts but bellow XAS System scripts (in the add on section). Set up the the constants in the script header.

script



Code:

#===============================================================================
#                      XAS - Respawn Timer
#-------------------------------------------------------------------------------
# By, Mr_Wiggles
# Version 3.0
# 11/3/11
#-------------------------------------------------------------------------------
# Directions -
#  Paste script in the data base above main and below all of XAS System
#  Scripts. Then fill in the constants bellow.
#
#  To make an enemy never respawn, make a comment on the first page of the
#  enemy event that says: (case sensitive)
#  NEVER_RESPAWN
#
module Respawn_Settings
#===============================================================================
#                          ** EDIT AREA **
#===============================================================================
# Any value bellow set to -1 will never respawn.
#-------------------------------------------------------------------------------
# Respawn template...
#            when (id of enemy)
#              return (number of seconds)
def Respawn_Settings.enemy_time(id)
  case id
  when 2 # When the enemy id is this
    return 15 # return this number of seconds
  when 6
    return 50
  else # Other wise return the default respawn time
    return 20 # number of seconds for the default time
  end
end
#-------------------------------------------------------------------------------
# Number of seconds until an item Enemy will respawn
ITEM_RESPAWN_TIME = 30
#===============================================================================
#                          ** END EDIT **
#===============================================================================
end

#===============================================================================
class Game_Event < Game_Character
  alias respawn_init initialize
  def initialize(*args)
    respawn_init(*args)
    @never_respawn = false
    unless @page.nil?
      for i in @page.list
        if (i.code == 108 or i.code == 408) and
            i.parameters[0].upcase[/NEVER_RESPAWN/] != nil
          @never_respawn = true
        end
      end
    end
    mid = $game_map.map_id
    key = [mid, @id]
    return if $game_respawns.empty?(key)
    if $game_respawns.dead?(key)
      self.opacity = 0
      self.erase
      $game_map.need_refresh = true
    end
  end
 
  alias respawn_update update
  def update
    respawn_update
    return if self.battler.nil? or !self.battler.is_a?(Game_Enemy)
    mid = $game_map.map_id
    key = [mid, @id]
    return if $game_respawns.dead?(key)
    if self.battler.hp <= 0
      if @never_respawn
        respawn = -1
      elsif XAS_BA_ENEMY::ITEM_ENEMY.include?(self.battler.id)
        respawn = Respawn_Settings::ITEM_RESPAWN_TIME
      else
        respawn = Respawn_Settings.enemy_time(self.battler.id)
      end
      $game_respawns.respawn(key, respawn)
      print("Dead and added id #{key.join(', ')} = #{respawn}")
    end
  end
end

#===============================================================================
class Scene_Map 
  alias :abs_spawn_up :update
  def update
    $game_respawns.update_spawns
    abs_spawn_up
  end
end

#===============================================================================
class Respawn_Hash
  def initialize
    @data = {}
    @spawn_wait = 0
  end
 
  def respawn(key, value)
    @data[key] = value
  end
 
  def dead?(key)
    time = @data[key].nil? ? 0 : @data[key]
    return (time != 0)
  end
 
  def update_spawns
    @spawn_wait -= 1
    return if @spawn_wait > 0
    @data.each{|key, value|
      respawn = value.nil? ? 0 : value
      respawn -= 1 if respawn > 0
      @data[key] = respawn
    }
    @spawn_wait = 40
  end
 
  def remove(key)
    @data.delete(key)
  end
 
  def empty?(key)
    return @data[key].nil?
  end
end

#==============================================================================
class Scene_Title
  alias :resp_main :main
  def main
    $game_respawns = Respawn_Hash.new
    resp_main
  end
end

#==============================================================================
class Scene_Save < Scene_File
  alias :resp_save :write_save_data
  def write_save_data(file)
    resp_save(file)
    Marshal.dump($game_respawns, file)
  end
end

#==============================================================================
class Scene_Load < Scene_File
  alias :resp_save :read_save_data
  def read_save_data(file)
    resp_save(file)
    $game_respawns = Marshal.load(file)
  end
end
OUTDATED Demo v2.5

Support


Post any problems you may encounter, or a suggestion for a future update here in this topic.

Known Compatibility Issues
This script will not work with SDK.

Restrictions
DO not post this any where with out my permission, you are free to edit in any way you see fit, but i must be credited some place.
EVENTALIST
Show Signature
EVENTALIST
WORDSMITH
WORDSMITH
#2 XAS - Respawn Timer Empty Re: XAS - Respawn Timer
Loading

Cardboard Square

Cardboard Square
WORDSMITH
WORDSMITH
profile
This is great! I should have been using this program all along. It's funny, a lot of the scripts you post are things I've had to event myself with RM2K.
WORDSMITH
Show Signature
WORDSMITH
Administrator
Administrator
#3 XAS - Respawn Timer Empty Re: XAS - Respawn Timer
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
@wiggles- man this kix @$$! more control as to how the enemy re-spawns?
I'm using this. Other than your XAS difficulties script, this makes for another enemy twist. Thanks for sharing!!!

(G@/\/\(e|F/A\(C|=
Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#4 XAS - Respawn Timer Empty Re: XAS - Respawn Timer
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
I guess im script happy... lol

this was one of 2 i wrote in one night. The other made the weapon damage the skill's power, and i can directly effect the weapons damage so i can make it do more damage depending on the players skill with that type of weapon.
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
#5 XAS - Respawn Timer Empty Re: XAS - Respawn Timer
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
i'm going to make this script more of a stand alone after i finish with a requested update.
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
#6 XAS - Respawn Timer Empty Re: XAS - Respawn Timer
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
*updated*
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#7 XAS - Respawn Timer Empty Re: XAS - Respawn Timer
Loading

rpg-dutch

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
I don't understand I created a new script field and pasted the script under the XAS System and I get a message saying...

Line 63 NoMethodError Occured
Undefined Method 'push' for nil:NilClass

Please help this script sounds like what I've been after all this time
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#8 XAS - Respawn Timer Empty Re: XAS - Respawn Timer
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
How are you using the script? i can't replicate this error, and if i can't replicate it i can't fix.
can you give more details?
What other scripts are you using?
Is this script above or bellow those?
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#9 XAS - Respawn Timer Empty Re: XAS - Respawn Timer
Loading

rpg-dutch

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
I use a few different add-ons see below.

Spoiler:

Spoiler:

Spoiler:

Spoiler:

Spoiler:
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#10 XAS - Respawn Timer Empty Re: XAS - Respawn Timer
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
It shouldn't be conflicting with those scripts, and the error just told me that the array i have set up in system did not get set up. so that i why i was wondering what other script you where using.

Is the re-spawn script above or bellow those?
EVENTALIST
Show Signature
EVENTALIST

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 4]

Go to page : 1, 2, 3, 4  Next

 

Chatbox system disabled
Personal messaging disabled