Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - samsonite789

1
RPG Maker Scripts / Re: General RGSS/RGSS2/RGSS3 Help
November 16, 2009, 10:18:53 pm
Quote from: Fantasist on November 16, 2009, 01:58:57 am
@samsonite789: The $data_BLAH stuff are loaded in Scene_Title#main. So if you want to do anything, look for where they are loaded and do your magic after they are loaded.


Rock on.  Thank you!
2
RPG Maker Scripts / Re: General RGSS/RGSS2/RGSS3 Help
November 15, 2009, 07:29:35 pm
I haveth a question...

How doth one change thine global variables in thine scripts before the main processing occurreth? 

In other, modern english words:

How do I set something like &data_enemies[1].exp in the script editor instead of in a map event?  If I try to do it, it tells me the following:

undefined method [] for nil:NilClass

3
Welcome! / Re: What's up everyone?
November 15, 2009, 02:20:31 pm
Heeelllloooooo
4
RMXP Script Database / Re: [XP] Threat System v1.0
November 15, 2009, 02:02:25 pm
Quote from: Fantasist on November 14, 2009, 01:56:27 pm
You, sir, just earned a levelup, for testing for the problem and coming up with a workaround. *levels up*


What does that mean?  If it means I get skill points, I put them all in intelligence so I can understand battle systems and how to reprogram RTAB.

Quote from: Fantasist on November 14, 2009, 01:56:27 pm
About the threat system for the RTAB, I should've mentioned that it's not called that, it's just one of the addons. Try searching for all RTAB addons and read their descriptions. I'm 100% positive because that's where I saw it first.


I'm pretty sure I checked them all and didn't find anything like the aggro-esque threat system you made.  I could very well be wrong, but it's beside the point; RTAB is incompatible with a lot of things I want to use on a fundamental level and I don't have the time or patience to try and figure such labyrinthine code out.  So, I just switched to another battle system that works very well with many things. 

Regardless, thanks for the level up!  *heads off to mindlessly kill hordes of orcs*
5
RMXP Script Database / Re: [XP] Moving Windows v1.0
November 13, 2009, 08:14:57 pm
THAT'S IT!  It's like a big fist with the letters "DUH" written on the knuckles just punched me in the face.

Quote from: Fantasist on November 13, 2009, 01:46:59 pm
I hope that clears things up.


It did.  Thank you very much.  Unfortunately, there's a compatability issue with another script, so moving windows might have to wait...*le sigh*...

6
RMXP Script Database / Re: [XP] Threat System v1.0
November 13, 2009, 08:02:49 pm
Quote from: Fantasist on November 08, 2009, 10:23:31 am
Wait, doesn't the RTAB already have something like this? That's what inspired me to do this in the first place. If it's not in the RTAB by default, look for its addons, I'm sure you'll find it.


I scoured the internet and couldn't find any addons.  I've come to realize that very few things work with RTAB.  Ah, well...

Quote from: Fantasist on November 13, 2009, 01:52:18 pm
Thanks for that mate :)

No, thank you.  This script adds a lot of strategy and depth to battles.

Quote from: Talglys
I'm having a problem with the threat system here. After I implemented it into my game, I cannot force a monster to do a skill. Quite basically, the force action function doesn't work any more. Any suggestions?
Quote from: Fantasist
I still haven't fixed that problem ._. I haven't even tested it actually. I know, it's bad on my part but he never seems to return and I didn't get around fixing it. Since I'm lazy, please post if it's really an issue and I'll try to fix it.



@Fantasist: I, for one, wouldn't mind it at all if you fixed that problem.  But it's your time, your life, your prerogative.  Hooowwweeevvveeerrrr...

@Talglys:  There is a workaround to this problem.  One, I tested the force action command out and it works for actors, but not enemies.  This is good, because enemies can have their action forced another way than the Force Action command, and that is this:

Go to the Enemies tab in the database and enter whatever skill or action you want to force in their skill list and set the conditions to whatever turn you want to force that skill or action on.  Voila - same thing as the force action command.  And, luckily for us, the condition for using that skill can be a switch, so if you want more specific conditions, just make an event page for the troop, set the condition for the event to turn whatever-the-hell, make a conditional branch(es) for whatever special conditions you want to check, and then if those are met throw a switch which is then used as the condition for the monster using that skill.  Ta-da...


7
RPG Maker Scripts / Re: General RGSS/RGSS2/RGSS3 Help
November 12, 2009, 08:47:33 pm
So, I'm using a view range script for my game, and I was wondering how to do the following:

The script calls a method like so:

$view_range_enemies_view(a, b, c, d, e)
Where:
a = event_id (the monster's ID)
b = the view range in tiles
c = switch thrown when player is within view range
d = self switch thrown when player is within view range
e = whether impassable tiles are taken into account (block enemy view)

Here's an example:
$view_range_enemies_view(4, 5, nil, 'A', true)

However, I use a lot of these script calls in the enemy event and I'm going to make a lot of enemy events.  Instead of having to go through each page for each event and type in the enemy's event ID for each script call, I'd like to be able to set some sort of variable that will do that for me.

I tried PK8's Self Variables script to do that.  That does the following:

self_variable(variable_id, value, operation(i.e set, add, etc.))
And to call the variable, you use: self_variable(variable_id) in a call script.

So I tried this:

self_variable('monster', 4, 0) #set variable to monster's ID which is 4
$view_range_enemies_view(self_variable('monster'), 5, nil, 'A', true)

And I get an error telling me:
Script 'Self Variables' line 127: NoMethodError occurred
undefined method for '[]=' for nil:NilClass

That points to the following line in the script:
Spoiler: ShowHide


class Interpreter
  def self_variable(id, value = nil, oper = nil)
    if @event_id > 0
      key = [@map_id, @event_id, id]
      if value != nil
        case oper
        when nil, 0, 'equal', 'set', '='                     # Setting
          $game_self_variables[key] = value   <------------------THIS LINE
        when 1, 'add', '+'                                   # Adding
          $game_self_variables[key] += value
        when 2, 'sub', 'subtract', '-'                       # Subtracting
          $game_self_variables[key] -= value
        when 3, 'mul', 'multiply', 'x', '*'                  # Multiplying
          $game_self_variables[key] *= value
        when 4, 'div', 'divide', '/'                         # Dividing
          $game_self_variables[key] /= value if value != 0
        when 5, 'mod', 'modular', '%'                        # Modulating
          $game_self_variables[key] %= value if value != 0
        end
      else
        return $game_self_variables[key]
      end
      if value != nil
        $game_map.need_refresh = true
        return true
      end
    end
  end
end



I have a feeling it's just the syntax I'm messing up on.  Any ideas?
8
Script Requests / Re: Have these been done?
November 12, 2009, 08:30:27 pm
Damage shield is sort of like counter.  Instead of the character actually attacking, the enemy just takes damage when they land an attack on the character with the damage shield.  Script-wise, it's probably much the same.  I'll take a look at it...
9
Script Requests / Have these been done?
November 12, 2009, 01:44:44 pm
Note:  This is not actually a request but rather sharing an idea.  But if someone wants to script these ideas, then by all means...

I thought of a few script ideas and I'm wondering if they've been done before...

Damage Shield:  A state that deals damage to an enemy if they attack the character with the damage shield.

Sacrifice:  The opposite of drain.  Takes some of the caster's HP/SP and transfers it to an ally or all allies.
10
Welcome! / Re: 'Ello
November 11, 2009, 09:23:16 pm
Quote from: Starrodkirby86 on November 11, 2009, 03:15:45 pm
Kindness is definitely awesome. :3 Just don't take too much advantage or dependence on it~


Believe me, I don't ask a question until I've thoroughly beat my head bloody against a brick wall trying to figure out the problem myself.  So, no worries  :)
11
Welcome! / 'Ello
November 11, 2009, 01:01:17 pm
Hello everyone.  I've already posted on these forums several times, but I figured that I'd formally introduce myself instead of merely making an annoying ass of myself asking scripting questions  :)

I'm currently working on a game (as are we all) and getting back into the whole RPG Maker thing.  Back in the days of RM2k I was a pretty active member of some community (can't remember the name), but then girls happened and distracted me from what's really important in life, which is staying up 'til 4 in the morning trying to figure out how to make a window move.  :O.o:

Anyhoo, this forum is great and I look forward to posting and reading more!  Hopefully I'll have something unique and totally awesome to contribute at some point, but it sure as hell won't be a script...

P.S. I also want to say THANK YOU! to those who've helped me out with script troubles so far.  Kindness on the internet is a rare, rare thing indeed.  It does not go unappreciated.
12
RMXP Script Database / Re: [XP] Threat System v1.0
November 11, 2009, 12:50:30 pm
This script is amazing.  The end.
13
RMXP Script Database / Re: [XP] Moving Windows v1.0
November 11, 2009, 12:49:51 pm
So I've been trying to figure this out for a while, but it's just not computing...

I understand how to make windows fly when you enter the menu from looking at your demo script, but how do you make them fly out again when you exit the menu?  I figured that it would be as simple as just moving them out before the menu scene ends, but that doesn't seem to work...
14
I'm actually not using any scripts for them.  I've tried the ones in Tons of Addons, but they just don't work.

The problem I'm having is with the command window re-drawing and setting the cursor back to the top option every time the event (which has a span of Turn) is re-iterated.  Since RTAB keeps track of "turns" based on number of actions taken, I'm guessing that the problem is a conflict of interests between RTAB and the event system.  However, I'm not knowledgeable enough at scripting to know exactly how to circumvent the RTAB script resetting the command window each time an event is executed (such as a Regen event).

To clarify, the Regen system I'm using is simply an event system that detects if a player's state is Regen.  It does this every turn in the battle, and if their state IS Regen, then it heals them a little bit.  And it also draws the command window, which I don't want it to do.
15
I am having a bit of a strange problem with RTAB and I'm not sure how to solve it...

So, I'm using battle event systems for certain kinds of skills, such as regeneration or doom.  I've tried various scripts for those, but they don't work with RTAB.  Using event systems DOES work, but there's a catch.  I'll explain...

So, for Regen, I have an event system that checks each turn (Span: Turn) whether or not each character has the state [Regen] inflicted.  This state is "inflicted" using the Regen skill, of course.  I tried setting the condition for the event to "Don't Run" but for some reason it doesn't work.  So, I set a switch (RegenUsed) to ON in a common event called when Regen is cast, and the event runs if RegenUsed is ON.  It works: the character regenerates X hp every turn when they have regen. 

However (and here is my problem), if the state Regen is inflicted, the command window redraws every time it's a new turn.  This is the same for Doom, Auto Life, etc.  The problem with the command window redrawing is that it resets the cursor to the top command which will get really annoying really fast when you're in the middle of a fast-paced battle and BOOM the cursor resets each turn. 

Does anyone have any idea how I can fix this irritating problem?
16
RMXP Script Database / Re: [XP] Threat System v1.0
November 06, 2009, 02:52:22 pm
Tested this on RTAB...didn't quite work.

Has anyone been able to get it to work with RTAB?  Or have any ideas on how to?  Thanks!
17
I'm using NearFantastica's View Range script for enemy detection purposes and I've run into a strange little bug.  I've pored over it for a long time but I can't figure it out.  I was hoping someone might be able to help me with it.

In case anyone isn't familiar with the script, one of the usages of it is Enemies_View, which is a script call which detects if a player is within the VIEW range of an enemy.  Essentially, it draws a semi-circle in the direction the enemy is looking and if the player is in that semi-circle, it flips a self-switch or a switch.  Additionally, this function can determine whether or not the player is behind an impassable tile (which an enemy couldn't see through) and if so, does not detect the player.  This is done by setting the "block" parameter to "true".

Here is the script call:  
$view_range.enemies_view(ev_id, v_range, sw_id, s_sw_id, block)

So, when I use this script call, I notice something screwed up:  the enemy event will detect the player almost all the time, but strangely enough, it will NOT detect the player if the player is in a straight line from the enemy.  In other words, if the player is directly to the left, right, top, or bottom of the event, the player will not be detected even if the player is within the specified view range.  However, if the player steps OUT of the straight line from the event's view, the event will suddenly detect the player.  In both cases, there are no actual impassable tiles in the way of the enemy's view range, but this bug only occurs when the impassability parameter (block) is set to true.  I need this set to true, however, for the whole thing to work.

I realize this is hard to explain with just words, so I took a few screenshots to illustrate the problem:

For the enemy event, I have the following script call:
$view_range.enemies_view(12, 5, nil, "A", true)

When I'm well within the range and in a straight line from the event, nothing happens...


But when I step OUT of that line, all of a sudden it works:


As I said before, this only happens when the passability check is turned to true.  So, I looked at the method in the View Range script involving that check, and I have no idea what the problem might be.  Here's the method:
Spoiler: ShowHide
def vr_in_range?(element, object, range, pass_block = false)
   # Obtain Range
   x = (element.x - object.x) * (element.x - object.x)
   y = (element.y - object.y) * (element.y - object.y)
   # Obtain values to loop and counter value
   x_loops = x_count = (object.x - element.x).abs
   y_loops = y_count = (object.y - element.y).abs
   # Reset player's check location
   check_player_x = -1
   check_player_y = -1
   r = x + y
   if r <= (range * range)
     # Set the return flag
     rflag = true
     # If tiles can block view
     if pass_block
       # Horizontal Checks
       x_loops.times {
         x_playerchk = ((object.x - element.x) >= 0 ? element.x + x_count : element.x - x_count)
         x_passingchk = ((object.x - element.x) >= 0 ? (element.x + x_count)-1 : (element.x - x_count)+1)
         unless $game_player.passable?(x_passingchk, element.y , element.direction)
           # Change flag
           rflag = false
           # Set player check location
           check_player_x = object.x if x_playerchk == object.x
         end
         # Decrease counter
         x_count -= 1
       }      
       # Vertical Checks
       y_loops.times {
         y_playerchk = ((object.y - element.y) >= 0 ? element.y + y_count : element.y - y_count)
         y_passingchk = ((object.y - element.y) >= 0 ? (element.y + y_count)-1 : (element.y - y_count)+1)
         unless $game_player.passable?(element.x, y_passingchk , element.direction)
           # Change flag
           rflag = false
           # Set player check location
           check_player_y = object.y if y_playerchk == object.y
         end
         # Decrease counter
         y_count -= 1
       }                  
     end
     # Re-enable flag based on player position
     if check_player_x == object.x && check_player_y == object.y
       #print "uyui"
       r_flag = true
     end
     # Return system-determined flag      
     return rflag
   else
     # Return default flag
     return false
   end
 end


And here is the entire script for reference:
Spoiler: ShowHide
#==============================================================================
#  ** View Range Script v3 gamma
#------------------------------------------------------------------------------
#  Original version by:     Near Fantastica
#  Original date:           June 14, 2005
#
#  Modifications/edit by:   DerVVulfman
#  Modification date:       November 25, 2007
#
#==============================================================================
#
#  INTRODUCTION:
#  The original v3 View Range system allowed a more detailed detection between
#  player and event ranges than version 2. Adding the ability to use events to
#  detect the player  as well as enemy events  facing the player  added to its
#  usefullness.
#
#  Unfortunately, when version 2 was released (at least where I found it), the
#  instructions for the system's use  were only partially correct  and did not
#  inform the users that the system no longer used  the event's self-switches.
#  The newer version now used the RMXP Database's regular switches instead.
#
#  Though it was not my intention  to tangle with  the View Range system, luck
#  (and a few friends) nudged me into experimenting with this system.  As such
#  I have not only combined the use  of SelfSwitches 'AND' regular switches in
#  to the system, I have also added a couple more features for use.
#
#  The system now includes a routine  to check the range between two different
#  events which may be useful for 'collision detection' purposes. Also, I have
#  also altered the Event_Sound routine  so the user can set a lower volume or
#  pitch setting for targettable events.
#
#==============================================================================
#
#  THE FUNCTIONS:
#  
#  There are now four routines that you can use with this system  (or 5 if you
#  script a routine to use the vr_in_range? method). The four are listed below
#  detailing usage and proper syntax for you.
#
#--------------------------------------------------------------------------
#
#     Event View
#     ==========
#     This function checks to see if the player is within the range of an event
#     and turns on the properly designated switch.
#
#     Syntax:
#     $view_range.event_view(ev_id, v_range, sw_id, s_sw_id, block)
#
#     ev_id     - (Event ID)      
#                  This is the ID number of the event that the radius/range is
#                  based on.   If the player comes within the range of  'this'
#                  event, the system is triggered.
#
#     ev2_id    - (Event2 ID)
#                  This is the ID number of the event
#
#     v_range   - (View Range)    
#                  This is the range(in tiles) in which to perform the check.
#
#     sw_id     - (Switch ID) - Defaulted to 'nil'    
#                  The RMXP switch number to turn ON.  By default, this is set
#                  to 'nil'.  You must enter a valid Switch number to use.
#
#     s_sw_id   - (Self Switch ID) - Defaulted to 'nil'
#                  The 'Self-Switch' for the event to turn ON.   Proper values  
#                  to set are "A", "B", "C", or "D".   By default, this is set
#                  to 'nil'.  You must enter a valid Self-Switch to use.
#
#     block     - (Blocked by Tiles) - Defaulted to 'false'
#                  This is a 'true/false' switch  that determines  if the view
#                  range system is unable to see around impassable tiles.   By
#                  default,  this is set to 'false'.   If it is set to 'true',
#                  the view range system will not detect  the player  if it is
#                  behind an impassable tile or tiles.
#
#--------------------------------------------------------------------------
#
#     Event to Event View
#     ===================
#     This function checks to see if a single event is within the range of
#     another event and turns on the properly designated switch.  This new
#     routine may be useful for collision detection between events.
#
#     Syntax:
#     $view_range.event2event_view(ev_id, ev2_id, v_range, sw_id, s_sw_id, block)
#
#     ev_id     - (Event ID)      
#                  This is the ID number of the event that the radius/range is
#                  based on.   If the target event moves or appears within the
#                  range of 'this' event, the system is triggered.
#
#     ev2_id    - (Event2 ID)
#                  This is the  ID number  of the target event which to check.
#                  If  this  event finds  itself  within  range of  the  other
#                  event's area of effect, the system is triggered.
#
#     v_range   - (View Range)    
#                  This is the range(in tiles) in which to perform the check.
#
#     sw_id     - (Switch ID) - Defaulted to 'nil'    
#                  The RMXP switch number to turn ON.  By default, this is set
#                  to 'nil'.  You must enter a valid Switch number to use.
#
#     s_sw_id   - (Self Switch ID) - Defaulted to 'nil'
#                  The 'Self-Switch' for the event to turn ON.   Proper values  
#                  to set are "A", "B", "C", or "D".   By default, this is set
#                  to 'nil'.  You must enter a valid Self-Switch to use.
#
#     block     - (Blocked by Tiles) - Defaulted to 'false'
#                  This is a 'true/false' switch  that determines  if the view
#                  range system is unable to see around impassable tiles.   By
#                  default,  this is set to 'false'.   If it is set to 'true',
#                  the view range system  will not detect  the target event if
#                  it is behind an impassable tile or tiles.
#
#
#--------------------------------------------------------------------------
#
#     Enemies View
#     ============
#     This function checks to see if the player is within range of an event
#     that is facing him/her, and turns on the properly designated switch.
#
#     Syntax:
#     $view_range.enemies_view(ev_id, v_range, sw_id, s_sw_id, block)
#
#     ev_id     - (Event ID)      
#                  This is the ID number of the event that the radius/range is
#                  based on.   If the player is in front of 'this' event and
#                  within the set range, the system is triggered.
#
#     v_range   - (View Range)    
#                  This is the range(in tiles) in which to perform the check.
#
#     sw_id     - (Switch ID) - Defaulted to 'nil'    
#                  The RMXP switch number to turn ON.  By default, this is set
#                  to 'nil'.  You must enter a valid Switch number to use.
#
#     s_sw_id   - (Self Switch ID) - Defaulted to 'nil'
#                  The 'Self-Switch' for the event to turn ON.   Proper values  
#                  to set are "A", "B", "C", or "D".   By default, this is set
#                  to 'nil'.  You must enter a valid Self-Switch to use.
#
#     block     - (Blocked by Tiles) - Defaulted to 'false'
#                  This is a 'true/false' switch  that determines  if the view
#                  range system is unable to see around impassable tiles.   By
#                  default,  this is set to 'false'.   If it is set to 'true',
#                  the view range system will not detect  the player  if it is
#                  behind an impassable tile or tiles.
#
#--------------------------------------------------------------------------
#
#     Event Sound
#     ===========
#     This function checks  to see if the player  is within range  of an event
#     that is linked to a sound effect. The closer the player is to the event,
#     the louder the effect is played.
#
#     The maximum sound range  of this routine is eight (8) tiles.   It is not
#     recommended to overlap these events as this can cause massive lag on the
#     game/project as the system will attempt  to cycle through the overlapped
#     calls. Also note that this routine will override the map's default back-
#     ground sound effect.
#
#     Syntax:
#     $view_range.event_sound(ev_id, bgs_name, bgs_vol = 100, bgs_pitch = 100)
#
#     ev_id     - (Event ID)      
#                  This is the ID number of the event that the radius/range is
#                  based on.   If the player is in front of 'this' event and
#                  within the set range, the system is triggered.
#
#     bgs_name  - (Background Effect's Name)
#                  This is the filename of the background effect.  This effect
#                  is stored in the Audio\BGS folder.
#
#     bgs_vol   - (Background Effect's Volume)
#                  This is the volume setting of the background effect within
#                  a range of 1 to 100, with 100 being the loudest.
#
#     bgs_pitch - (Background Effect's Pitch)
#                  This is the pitch setting of the background effect within a
#                  range of 50 to 150, with 150 being the highest setting.
#
#==============================================================================
#
#  HOW IT DETERMINES THE RANGE:
#
#  The Range system works  by searching the area  of a circle for the player's
#  'x' and 'y' position.   The view range  is set in each event and is the ra-
#  dius of a circle.
#
#  The equation used is: radius^2 = (Px-Ex)^2 + (Py-Ey)^2
#  Where P = player, and E = event
#
#  If the radius  is less than or equal to the view range,  then the player is
#  inside the circular area.
#
#==============================================================================

 

#==============================================================================
# ** View Range
#------------------------------------------------------------------------------
#  This class is Near Fantastica's which checks distances between events.
#==============================================================================

class View_Range
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   @playing_bgs = []
   @bgs = BGS.new
   @event_local_switch = ""
 end
 #--------------------------------------------------------------------------
 # * In Range?
 #     element     : element
 #     object      : object
 #     range       : range in tiles
 #     pass_block  : if terrain tiles can block view
 #--------------------------------------------------------------------------
 def vr_in_range?(element, object, range, pass_block = false)
   # Obtain Range
   x = (element.x - object.x) * (element.x - object.x)
   y = (element.y - object.y) * (element.y - object.y)
   # Obtain values to loop and counter value
   x_loops = x_count = (object.x - element.x).abs
   y_loops = y_count = (object.y - element.y).abs
   # Reset player's check location
   check_player_x = -1
   check_player_y = -1
   r = x + y
   if r <= (range * range)
     # Set the return flag
     rflag = true
     # If tiles can block view
     if pass_block
       # Horizontal Checks
       x_loops.times {
         x_playerchk = ((object.x - element.x) >= 0 ? element.x + x_count : element.x - x_count)
         x_passingchk = ((object.x - element.x) >= 0 ? (element.x + x_count)-1 : (element.x - x_count)+1)
         unless $game_player.passable?(x_passingchk, element.y , element.direction)
           # Change flag
           rflag = false
           # Set player check location
           check_player_x = object.x if x_playerchk == object.x
         end
         # Decrease counter
         x_count -= 1
       }      
       # Vertical Checks
       y_loops.times {
         y_playerchk = ((object.y - element.y) >= 0 ? element.y + y_count : element.y - y_count)
         y_passingchk = ((object.y - element.y) >= 0 ? (element.y + y_count)-1 : (element.y - y_count)+1)
         unless $game_player.passable?(element.x, y_passingchk , element.direction)
           # Change flag
           rflag = false
           # Set player check location
           check_player_y = object.y if y_playerchk == object.y
         end
         # Decrease counter
         y_count -= 1
       }                  
     end
     # Re-enable flag based on player position
     if check_player_x == object.x && check_player_y == object.y
       #print "uyui"
       r_flag = true
     end
     # Return system-determined flag      
     return rflag
   else
     # Return default flag
     return false
   end
 end
 #--------------------------------------------------------------------------
 # * View Switch
 #     ev_id       : event ID
 #     sw_id       : switch ID
 #     s_sw_id     : event's self switch ID
 #--------------------------------------------------------------------------  
 def view_switch(ev_id, sw_id = nil, s_sw_id = nil)
   $game_switches[sw_id] = true if sw_id != nil
   if s_sw_id != nil
     key=[$game_map.map_id, ev_id, s_sw_id]
     $game_self_switches[key] = true          
   end
   $game_map.need_refresh = true    
 end
 #--------------------------------------------------------------------------
 # * Event Sound
 #     ev_id       : Event ID
 #     bgs_name    : filename of background sound effect
 #     bgs_vol     : background effect's volume
 #     bgs_pitch   : background effect's pitch
 #--------------------------------------------------------------------------
 def event_sound(ev_id, bgs_name, bgs_vol = 100, bgs_pitch = 100)
   event = $game_map.events[ev_id]
   @bgs.name   = bgs_name
   @bgs.pitch  = bgs_pitch
   radius = ($game_player.x-event.x) * ($game_player.x-event.x) +
            ($game_player.y-event.y) * ($game_player.y-event.y)
   if radius > 64
     if @playing_bgs[event.id] !=  nil
        @playing_bgs[event.id] =   nil
        $game_system.bgs_fade(1)
       return
     end
   elsif radius <= 64 and radius > 49
     if @playing_bgs[event.id] == nil
       @bgs.volume = (bgs_vol * 30)/100
       @playing_bgs[event.id] = @bgs
       $game_system.bgs_play(@bgs)
       return
     end
     @bgs.volume = (bgs_vol * 30)/100
     if @bgs.volume != @playing_bgs[event.id].volume or
         @bgs.name != @playing_bgs[event.id].name
       @playing_bgs[event.id] = @bgs
       $game_system.bgs_play(@bgs)
       return
     end
   elsif radius <= 49 and radius > 36
     @bgs.volume = (bgs_vol * 40)/100
     @playing_bgs[event.id] = @bgs
     $game_system.bgs_play(@bgs)
     return
   elsif radius <= 36 and radius > 25
     @bgs.volume = (bgs_vol * 50)/100
     @playing_bgs[event.id] = @bgs
     $game_system.bgs_play(@bgs)
     return
   elsif radius <= 25 and radius > 16
     @bgs.volume = (bgs_vol * 60)/100
     @playing_bgs[event.id] = @bgs
     $game_system.bgs_play(@bgs)
     return
   elsif radius <= 16 and radius > 9
     @bgs.volume = (bgs_vol * 70)/100
     @playing_bgs[event.id] = @bgs
     $game_system.bgs_play(@bgs)
     return
   elsif radius <= 9 and radius > 4
     @bgs.volume = (bgs_vol * 80)/100
     @playing_bgs[event.id] = @bgs
     $game_system.bgs_play(@bgs)
     return
   elsif radius <= 4 and radius > 1
     @bgs.volume = (bgs_vol * 90)/100
     @playing_bgs[event.id] = @bgs
     $game_system.bgs_play(@bgs)
     return
   elsif radius = 1
     @bgs.volume = (bgs_vol * 100)/100
     @playing_bgs[event.id] = @bgs
     $game_system.bgs_play(@bgs)
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Event View
 #     ev_id       : event ID
 #     v_range     : range in tiles
 #     sw_id       : switch ID
 #     s_sw_id     : event's self switch ID
 #     block       : View block (true/false)
 #--------------------------------------------------------------------------
 def event_view(ev_id, v_range, sw_id = nil, s_sw_id = nil, block = false)
   event = $game_map.events[ev_id]
   if vr_in_range?(event, $game_player, v_range, block)
     view_switch(ev_id, sw_id, s_sw_id)
   end
 end
 #--------------------------------------------------------------------------
 # * Event to Event View
 #     ev_id       : event ID
 #     ev2_id      : event ID of target
 #     v_range     : range in tiles
 #     sw_id       : switch ID
 #     s_sw_id     : event's self switch ID
 #     block       : View block (true/false)  
 #--------------------------------------------------------------------------
 def event2event_view(ev_id, ev2_id, v_range, sw_id = nil, s_sw_id = nil, block = false)
   event   = $game_map.events[ev_id]
   target  = $game_map.events[ev2_id]
   if vr_in_range?(event, target, v_range, block)
     view_switch(ev_id, sw_id, s_sw_id)
   end
 end
 #--------------------------------------------------------------------------
 # * Enemies View
 #     ev_id       : event ID
 #     v_range     : range in tiles
 #     sw_id       : switch ID
 #     s_sw_id     : event's self switch ID
 #     block       : View block (true/false)  
 #--------------------------------------------------------------------------
 def enemies_view(ev_id, v_range, sw_id= nil, s_sw_id = nil, block = false)
   event = $game_map.events[ev_id]
   if event.direction == 2 &&  $game_player.y >= event.y
     if vr_in_range?(event, $game_player, v_range, block)
       view_switch(ev_id, sw_id, s_sw_id)
     end
   end
   if event.direction == 4 &&  $game_player.x <= event.x
     if vr_in_range?(event, $game_player, v_range, block)
       view_switch(ev_id, sw_id, s_sw_id)
     end
   end
   if event.direction == 6 &&  $game_player.x >= event.x
     if vr_in_range?(event, $game_player, v_range, block)
       view_switch(ev_id, sw_id, s_sw_id)
     end
   end
   if event.direction == 8 &&  $game_player.y <= event.y
     if vr_in_range?(event, $game_player, v_range, block)
       view_switch(ev_id, sw_id, s_sw_id)
     end
   end
 end
end



#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs title screen processing.
#==============================================================================

class Scene_Title
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 alias vr_scene_title_update update
 def update
   $view_range = View_Range.new
   vr_scene_title_update
 end
end



#==============================================================================
# ** 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 :playing_bgs
end
 


#==============================================================================
# ** Background Sounds
#------------------------------------------------------------------------------
#  Data class for Background SE files.
#==============================================================================
class BGS
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :name
 attr_accessor :volume
 attr_accessor :pitch
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   @name
   @volume
   @pitch
 end
end


I hope that clarifies that clarifies the problem as much as possible.  Anyone have any idea what's going on?

EDIT:  Solved by getting the newest version...doh...

18
RPG Maker Scripts / Re: General RGSS/RGSS2/RGSS3 Help
October 06, 2009, 07:29:35 pm
Question:

How do I detect player/event collision through a script call?

I have a little dilemma. I'm making an enemy detection system using a view range script. Right now, I've got it set up so that the first event page for an enemy is a parallel process in which they are constantly scanning to see if the player is within range via a script call - when they are, a self switch goes on and they chase the player down, etc., etc. However, there's a little problem: the few times I've tested it where the enemies DON'T see me, I can walk right up behind them and into them but nothing happens. Obviously, whether or not the enemy sees the player or not, I want a battle to start when the player touches the enemy. However, I can't do this simply by making an 'Event Touch' condition for battle processing because I need a parallel process to check for when the enemy DOES see the player.

So, all that rambling preamble is to this question: Is there a way to make a script call that will detect whether or not a player is in collision with an event? If I could use a conditional branch on the first parallel process page, that would bypass the problem completely.

Thanks!
19
RMXP Script Database / Re: [XP] Tons of Add-ons
October 06, 2009, 12:07:29 pm
Blizzard,

No, thank YOU  :)

Anyway, it works!  You rock!  I can now place it underneath RTAB and all my other scripts and it doesn't bug out in battle.

However, another problem remains...the majority of the status and skill scripts don't work.  Most of them don't output any errors, they just simply don't do anything even when turned on and properly configured.  I have a LOT of scripts, so this makes me think it's just a general compatability/overwriting error.  I've managed to duplicate the effects of a lot of these skill add-ons using event systems anyway, so it shouldn't be a huge problem.  There is one add-on, Unique Battle Commands, that I wanted to use so very much but that also doesn't do anything.  I'd like to ask you if you could help fix that but without a frame of reference (i.e. an error message) it seems like it'd be like finding a needle in a haystack.

Here's one error for you...when I use the Regen Status add-on, as soon as I cast Regen on a character, it gives me the following error:

Script 'Tons of Addons' line 359: NoMethodError occurred
undefined method '+' for {}:Hash

That is this code:

Spoiler: ShowHide

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler

  alias slip_damage_regen_later? slip_damage?
  def slip_damage?
    if $game_system.REGEN_STATUS && !$scene.is_a?(Scene_Map) &&
        (HP_REGEN_IDS + SP_REGEN_IDS + SP_POISON_IDS).any? {|i| @states.include?(i)}
      return true
    end
    return slip_damage_regen_later?
  end
 
  alias slip_damage_effect_regen_later slip_damage_effect
  def slip_damage_effect
    if $game_system.REGEN_STATUS
      if !(HP_REGEN_IDS.any? {|i| @states.include?(i)}) &&
          slip_damage_regen_later?
        slip_damage_effect_regen_later
      elsif (HP_REGEN_IDS.any? {|i| @states.include?(i)}) &&
          !slip_damage_regen_later?
        dam = -self.maxhp / 10
        if dam.abs > 0
          amp = [dam.abs * 15 / 100, 1].max
          dam -= rand(amp+1) + rand(amp+1) - amp
        end
        self.hp -= dam
        self.damage = 0 if self.damage == nil
        self.damage += dam   <---THIS LINE
      end
      if (SP_REGEN_IDS.any? {|i| @states.include?(i)}) !=
          (SP_POISON_IDS.any? {|i| @states.include?(i)})
        dam = self.maxsp / 10
        if dam > 0
          amp = [dam * 15 / 100, 1].max
          dam += rand(amp+1) + rand(amp+1) + amp
        end
        dam = -dam if SP_REGEN_IDS.any? {|i| @states.include?(i)}
        self.sp -= dam
        self.damage = 0 if self.damage == nil
        self.damage += dam
      end
    else
      slip_damage_effect_regen_later
    end
  end


I tried setting the Regen skill to using Slip Damage, and then the error went away but it simply didn't do anything like the other skill add-ons.

I'm guessing this is just conflicts with my multitude of other scripts, but is there something I'm missing?  Thanks again!
20
RPG Maker Scripts / Re: General RGSS/RGSS2/RGSS3 Help
October 06, 2009, 02:39:14 am
Rock on.  Thanks, man.  I will post in the Tons sticky in the future.  In fact, I just did because I found another bug.  Computers suck.

And thank you for all your help.  You are very helpful.