Posted by: Near Fantastica - 03-02-2008, 07:43 AM - Forum: Scripts Database
- No Replies
NPC Interactions
by Jaime 'Near Fantastica' Webster Not DerVVulfman
Introduction
"First off I know this script is going to confuse more of you then I would like but that's the way it has to be just sit down and think about it for a second... About what it is, what it dose and how it works... I am sure you will get it think of Morrowind NPC interaction system..." - Near Fantastica
By the poster
I didn't create the script, and as of now the links that Near Fantastica put up are down (and he can't get to them) and his RMXP system is down. Given that he posted the original (though broken) demo links here, there should be no problem to post the script.
However as I didn't create the script, I cannot offer support.
Instructions
This script works in the following way...
The script starts a scene...
It opens the text file you tell it too or if you leave it blank opens the file with the event name...
Displays the text in the window and add any keywords to the menus list key words are defined in the text file and display as a different color...
When you select and new item form the list the script opens and displays that text file repeating step 3 over again...
Instructions
Keywords are linking words the name of another text file you want to link to for more information about a topic a keyword is placed with square brackets and any spaces are replaced by underscores...
[Key_Words]
[NPC]
[Interactions]
These are all valid keywords...
Text Files
The text files need to be saved with the ending .rxdata and the name should be in all CAPS... As well is the keyword uses an underscore the file name dose not it uses a space... Also to open and read .rxdata file do an open with notepad... Don't forget to make an NPC Interactions folder which the text files are placed in...
Commands:
Code:
$scene = Scene_NPC_Interaction.new(self, "START")
Self is a must so don't remove it.
"START" is the name of the first text you want to call if start is left out then it takes the event name and displays that file.
Posted by: Near Fantastica - 03-02-2008, 07:40 AM - Forum: Scripts Database
- No Replies
Keyboard Input Module (Revised)
Revision 1.2
based on Jaime 'Near Fantastica' Webster's system
Introduction
"I know there is a few keyboard input scripts out there but not like this one... this one works fundamentally different then the others you press and key and it returns what was pressed... which lets you easily have string input for names, conversations, or what ever you see fit." - Near Fantastica
Pretty much what he said. :thumb:
This system is not a name input module, a message system or menu system that uses keyboard input. This is the basic module that you would use to CREATE such systems. It reads keyboard presses, be they letter characters, shift keys, or whatnot and allows you to access them in place of the default systems' routines.
Now far be it from me to just post my own system without acknowleding Near Fantastica's original work. Without his work, this wouldn't be available. As such, I am posting his script in this topic along with the newly revised system.
Script Keyboard Input Module (Revised)
NOTE:
In this 'revised' version, I have included [Caps Lock] for determining capital letters and [NumLock] for changing the functions on the numeric keypad. I have also revised the code and added the ability to detect individual 'left' and 'right' function keys (left shift, right shift, left alt, etc.). Even with the inclusions, it is still smaller than Near Fantastica's system.
...and the original v3 script Keyboard Input Module (Original Version)
NOTE:
This system (when acquired) referred to a 'wow' method that was not included in this system. It was used to generate the actual alphanumeric character/number (from the ascii value) to be returned. Somehow it was a 'mis'-copy and the actual method used was a 'chr'. This has been corrected.
Presented in the original format (minus the 'wow' error) I was able to obtain from 'Creation Asylum.'
Instructions
This script is used to detect keys being pressed and return them for use in your scripts... whether it is a message script, a custom menu system or advanced battlesystem. This script alone accomplishes nothing unless you create a system that utilizes the calls within:
Syntax (Just like Near Fantastica's - with one addition.)
Code:
if Input.get_function == "function" # Keys like [Esc], [Ctrl], [Tab]
if Input.get_letters == "letter" # The alphabet keys (augmented by (Shift] or [Caps])
if Input.get_numbers == "number" # The number keys (disabled if [Shift] is being pressed)
if Input.get_key == "char" # All other printable keys (and top-row number keys [shift]ed)
if Input.get_direction == "number" # Number Pad & [Home], [PgUp] and etc.
and
if Input.get_individual == "function" # Keys like [Left Alt], [Right Alt], [Left Shift]
Input.get_function
[SIZE="1]This call allows you to detect specialized keys such as 'Esc', 'Ctrl', 'Backspace' , 'Print Screen' and the 'F1 to F12' keys
[/SIZE] Input.get_letters
This call allows you to detect the alphabetic characters being returned, and whether they are 'shifted' or not. Unlike cybersam's system, this detects whether the left and/or right shift buttons are being pressed so generation of capital and lowercase characters can be produced.
Input.get_numbers
This call allows you to detect the number keys (0 to 9) along the TOP of the keyboard. It does not detect any 'shifted' characters and does not detect the number keys on the keypad.
Input.get_key
This call returns most other alpha-numeric characters such as the space key, brackets and parenthesis, equals and the 'shifted' characters along the top of the keyboard.
Input.get_direction
This call returns the number keys on the directional keypad when the Numberlock is on and directional keys when it is off. It also returns keys such as PgUp, PgDown, Home and etc.
Input.get_individual
This call returns the specialized function keys of [CapsLock], [NumberLock] and [ScrollLock]. But it also detects the unique keys such as [Lf Ctrl] and [Rt Cntl] and matching ones for Alt and Shift. The pressing of [CapsLock] and [NumberLock] automatically alters the returned values of the other functions, but this function is useful if you want to detect and return the button as part of your special menu/battle/whatever system.
FAQ
Again, this system is used to detect keypresses but it is up to the end-user to create system(s) that use these key-detection functions.
Keys to NOT Consider (Unless you're real good)
As the [F1], [F2] and [F12] keys are most likely hardwired into Game.Exe or cleverly concealed within the RGSS default coding, I would not recommend testing and writing code for these. This is under the assumption that an advanced script has not been made that could disable these key's built-in functions.
Also, while detection of the Left and Right Windows key (for the Microsoft Natural keyboard) is now available, these are not recommended given as well. Not unless you can disable Windows's key reactions themselves.
Compatibility
As it adds routines to the INPUT module, it should be compatible with nearly any system. The only exception being systems that also add or edit the INPUT module that may use the same routine names... rare instances.
Example Code
Based on a small submission by GoldenShadow in N.F's post in Creation Asylum, this example shows how you can detect certain keys with this system. Just press [Esc] from the field map to bring up a 'butchered' main menu screen and press keys to your heart's content. :D
Example
Requires the Keyboard Input Module.
Code:
#==============================================================================
# ** Window_Test
#------------------------------------------------------------------------------
# This window is used to test Near Fantastica's keyboard script
#==============================================================================
class Window_Test < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Detect function keys
key1 = Input.get_function
if key1 != nil
self.contents.clear
self.contents.draw_text(4, 32, self.width - 40, 32, key1)
end
# Detect individually placed function keys
key2 = Input.get_individual
if key2 != nil
self.contents.clear
self.contents.draw_text(4, 32, self.width - 40, 32, key2)
end
# Detect alphabetic keypresses
key3 = Input.get_letters
if key3 != nil
self.contents.clear
self.contents.draw_text(4, 32, self.width - 40, 32, key3)
end
# Detect numeric keypresses
key4 = Input.get_numbers
if key4 != nil
self.contents.clear
self.contents.draw_text(4, 32, self.width - 40, 32, key4)
end
# Detect character keypresses
key5 = Input.get_key
if key5 != nil
self.contents.clear
self.contents.draw_text(4, 32, self.width - 40, 32, key5)
end
# Detect direction pad presses
key6 = Input.get_direction
if key6 != nil
self.contents.clear
self.contents.draw_text(4, 32, self.width - 40, 32, key6)
end
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make play time window
@playtime_window = Window_Test.new
@playtime_window.x = 0
@playtime_window.y = 224
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@playtime_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@playtime_window.update
end
end
Posted by: Near Fantastica - 03-02-2008, 07:38 AM - Forum: Scripts Database
- No Replies
Anti Event Lag Script
Version 3
by Jaime 'Near Fantastica' Webster not DerVVulfman
Introduction "This script uses my view range script to limit which events are being updated... therefore a large map with lots of events 300 + can still run at 40 fps... this is probably not a final version as I can think of a few more ways to limit event lag...
It removes the events from updating and the events sprites from updating when it is out side the screen (2 titles out side) auto start and parallel are not included in this though." - Near Fantastica
By the poster
I didn't create the script, and as of now the links that Near Fantastica put up are down (and he can't get to them) and his RMXP system is down. Given that he posted the original (though broken) demo links here, there should be no problem to post the script.
However as I didn't create the script, I cannot offer support.
Posted by: Near Fantastica - 03-02-2008, 07:36 AM - Forum: Scripts Database
- No Replies
Advanced Event Triggers
Version: 1
by Jaime 'Near Fantastica' Webster Not DerVVulfman
Introduction
"This script give you control over events like you never had before..." - Near Fantastica
Features
You can now use script calls to trigger events...
You can use as many calls as you need...
You can use Logic opperators like AND OR NOR NAND XOR XNOR
By the poster
I didn't create the script, and as of now the links that Near Fantastica put up are down (and he can't get to them) and his RMXP system is down. Given that he posted the original (though broken) demo links here, there should be no problem to post the script.
However as I didn't create the script, I cannot offer support.
How it works
The below describes how you create additional triggers within events. This is done by creating 'Comments' within the map event's 'Event Code' like below:
Comment: Event Trigger
Comment: Logic NUMBER
Comment: SCRIPT TEST
Comment: EndTrigger
Boolean Logic
NUMBER = 0 :: NO Logic
NUMBER = 1 :: AND Logic
NUMBER = 2 :: OR Logic
NUMBER = 3 :: NOR Logic
NUMBER = 4 :: NAND Logic
NUMBER = 5 :: XOR Logic
NUMBER = 6 :: XNOR Logic
Visual Equipment version 2.2.31
update 14 february 2007
Updates: New in version 2.2.X
Added: guill_trick_*: Compatible with tricks multi-equip New in version 2.1.X
Added: Can now return false and [false]
Fixed: Not updating version 2.0.X
Added: Now Compatible with N+ 2.X.X + version 1.2.X
Added: Now possible to use other maps then Visual Equipment
Fixed: Unable to load bug
Fixed: Guillaume update bug
Fixed: Guillaume Weapon not showing bug
Demo: Added version 1.1.X
Added: Guillaume777's script support
Added: Equipment in windows visible
Introduction
Today I strumbled over the internet looking fro some good Visual Equipment scripts, beacuse I was goign to make an only one. I stumbled on more then one script, so I studied them all. The two best by my meanings where those from Rataime and the one from Geso Chiku. However the lack on proper coding (not that I did that myself) and the methods outside objects (top-level methods) where bugging me... So, I started wrinting a new one, with features from both, and some from myself.
Features:
Shows the players equipment on map and in windows
Initial body value possible (skin, eyes and hair)
Up to 5 types of equipment (visual). From weapons to accesoiry's
Shows NPC equipment on the map events if set
Compatible with Caterpillar and Squad Based Action Battle System
Compatible with Half Kaizer- and other different size-sprites
Instructions
Just place the script above main, under the SDK
Detailed instructions are in the first part of the script!
FAQ Q: I need special character sets right? A: What would be the point if you would not need it. This script was made for those sets...
Q: I have X script that modifies Sprite_Character? A: Place it below this script.
Compatibility
? Known compatibility issues
[*]SDK required
[*]With extra equipments scripts, does not shows things in the extra slots
[*]With Raitaimes shadow script, only shows character sprite, not equipments
[*]With Only scripts like Netplay and Netplay+, only shows head/does not work
[*]Only works with SDK version of Caterpillar
[*]Only works with Guillaime777's Script version 6.X.X +
[*]Works with Trickster Multi-Equip version 2.X.X +
[/list]
Credits and Thanks
- Rataime for the idea
- Geso Chiku for the method constructions
Author's Notes
What features should I add?
New: I know the Guillaume thing could have been done with fewer lines, but I thought to keep it clean, I coded it this way.
This is a rewrite of a script I created a few months ago. It is much simpler, and much more likely to successfully integrate with other battle systems (I have tested it on a few). It has actually come a long way since I posted it. I've gotten some good suggestions, and would definately love some more.
The different settings are at the top of Timed_Hit found in the section titled Timed_Hit. I decided that it would make the most sense to construct character and skill data by using arrays.
Descriptions of the settings:
Content Hidden
@damage_mods
This is an array of the percentages that are added together to determine the final damage. If the hit is made on a marker, the corresponding percentage is added to the final damage calculation. Also note that the closer the hit is to the center of a marker the greater the damage dealt, and by being very close to the center bonus damage is dealt.
@markers
This is an array of the length of each bar in the set of markers. The total should add up to the length of the main bar, which in this case is 600.
@keys
This is an array of the keys that are to be pressed to make a hit when a marker is active.
Replace actor_id or skill_id with the id of the actor or skill that the data should apply to.
For @actor_data[actor_id] = [...], replace the ... with the id's used in @actor_attack_data seperated by commas.
These lines define the data for each actor or skill. The elements are as follows:
[Max Wait, Wait Increment, Damage Mod, Keys, Targets, Markers]
Max Wait - A number like 1000 (recommended)
Wait Increment - Another number like 20 (20 or lower recommended)
1000 / 20 = 50 Frames. So it takes 50 frames for the bar to fill. This is pretty quick, and does not allow much time to react.
Damage Mod - @damage_mods[index]. Where the index is the element of the array to be used as the hit timing data.
EX @damage_mods[1] = [33,33,33]
The average of each marker is worth 33% in this case. A hit in the very center of a marker would result in an aditional 33% damage.
Keys - @keys[index]. Where the index is the element of the array to be used as the target keys.
EX @keys[1] = [a,b,c]
The key combination for this setup is the A, B and C buttons (or Z, X, and C)
Targets - @targets[index]. Where the index is the element of the array to be used as the target images.
EX @targets[1] = [target_z,target_x,target_c]
The images shown for the key combination are "target_z", "target_x", and "target_c"
Markers - @markers[index]. Where the index is the element of the array to be used as the marker images.
EX @markers[1] = [200,200,200]
Using Custom Images
There are four images in the pictures folder. Feel free to edit them to your liking (I tried to make them simple to understand). The system makes calculations based on the width of each image, so different things can be changed by changing the with of the images. For example: in the demo project, the "marker_on" and "marker_off" images are short, giving the player just a little time to hit them. If you made both of the images bigger, then the player would have more time to hit the markers. The same applies to changing the size of the target.
Compatibility
I have tested this with a few other systems, which all worked. The exception is Trickster's RTAB, but that is because other things happen in the background while a character is making an action. This add-on should work as long as the battle system pauses when it is a characters turn to preform an action.
This is an update to the first script that I posted. I would love to make it as compatible with as many systems as possible. My next focus is to work on commenting the script and adding any new suggested features.
Updates:
Content Hidden
Version 1.30:
Rearranged the script (again), to make it a little easier to read/modify
Included the option for a DDR style bar (from Rayn's suggestion), which can bee seen by playing the demo
Version 1.20:
Changed the inner workings, so that changes made durring runtime are saved when the game is saved
You can now change the attacks for each actor through a one line event script (Ex in the demo)
Cleaned up the script a bit more
Version 1.10:
The bar system calculates the placement of the marker bars so you don't have to
Actors can be set up to select a "random" pattern for the bar, when using an attack
Changed the images used for the bars.
Cleaned up the script a bit
Version 1.01:
Changed the usage for specifying bar usage. Skills and characters do not require the use of a bar.
Removed dependency on Scene_Battle:: update_phase4_step6.
Added status effect to weapons, depending on accuracy
Multi-Slot Equipment Script
Version: 6.2.2
by Guillaume777
(February 14, 2006) not DerVVulfman
Introduction
Quote:Do you want :
To equip more than one weapon ?
To attack once with each weapon you have equiped ?
To equip new armor types beyond shield, helmet, armor and amulet ?
To equip 2 handed weapons, which either take your shield or weapon slot ?
To customize your slots and slot name so no character is alike ?
If so then I highly suggest you try my multi-equipment script. It is very powerful and adds a lot of features to the equipment screen. Download my demo for quick try :D
The Multi-Slot script has gone through a number of changes since it's original incarnation. The inclusion of cursed weapons... RTAB compatability... SKD 1.3 compatability (possibly still?)... multiple strike weapons.
Here, you will find what is possibly the last version of Guillaume777's great work.
Features
Can go beyond the default five equipment slots
Can wield multiple weapons (demo shows 4 weapon slots possible!)
Can add 'Cursed' (unremovable) armors and weapons
Can make two-handed weapons
Can make weapons that deliver multiple strikes
Can set up off-hand weapon values
Can rename your equipment slots to your choosing
Can display the enhanced list in your Status window
Can show 1 more actor parameter (evade), assuming you've created it already
Screenshots
Well, a pic of Gloria's equipment going BEYOND the normal 5 items.
Script
This script has been formatted to more-closely match the standard formatting of RGSS scripts in RPGMaker XP. At no point has any of Guillaume777's functions been removed.
NOTE: The EVADE switch in the configuration section assumes that you've created an additional parameter (strength/dexterity/etc) which you want to have displayed in the status window. If you have not created this additional parameter yourself, or are not using a script that adds an 8th parameter, then turning this switch to 'true' will give you an error. Multi-Slot (Section 1: Modules) Multi-Slot (Section 2: Actor) Multi-Slot (Section 3: Windows) Multi-Slot (Section 4: Other)
Instructions
So many features, so little time. It IS pretty much plug 'n' play. To use, paste it just above main (like normal). When using with the RTAB system, paste it just below RTAB (and any Cogwheel script with it).
Features such as multi-hit weapons, or double-attacking weapons can be created by tagging it with a so-named element (made in your Database's System page), entering it's .id values in their hashes in the script, or entering strings like '(2handed)' in their names.
Cursed weapons, cursed armors and off-hand weapons can be made by entering strings like (cursed) or the like into their names or adding their .id numbers in their hash values too.
Other features like these are all explained in the script (thank god ':| ), cause I didn't make it... I just use it :D.
FAQ
While I posted this topic at HBGames.Org in September '06... I didn't expect to hear from Guillaume777 himself since his sabatical after RMXP.net went down. I received the followup 6.2.2 directly from him on May 19, '07. Now THAT is an honor. I expect this to BE the final version and do not expect it to be updated.
Compatibility
It may be incompatible with scripts that has anything to do with the actor's equipment (weapon modifications, window edits, etc.). It was designed for use with the default battle, default menu system and apparently the RTAB system in mind.
If used with the Animated Battlers script, it's advised to use battle-system add-ons like Connected Attacking (for RTAB) or Multi-Attack (by Trickster) to perform multiple strikes with a weapon or skill. Using this system's multiple-attacking system 'does' work, but appears strange in that the heroes run to attack... strike... retreat... run to attack (again)... strike... retreat... rinse and repeat. Kinda awkward looking.
There is (as far as I know) only one topic for a Guillaume777-based shop script. I made it guys... If you are the owner of a shop, please add your support. ;)
Credits and Thanks
Obvious credits goes to Guillaume777 for creating this script, and his eMailing me his newest version. Additional credits goes to Cygnea of HBGames.Org for saving a previous 'fixed' version from RMXP.net before it went down (which also spawned my interest and Guillaume777's eMail).
Posted by: Wachunga - 03-02-2008, 07:19 AM - Forum: Scripts Database
- No Replies
Fog of War
Ver 2.01
by Wachunga Not DerVVulfman
Text within the post was written by Wachunga, Dec. 6, 2005.
Summary
A map specified as having "fog of war" has tiles that are (fully or partially) obscured until the player gets within visual range. The amount of fog of war to disappear as the player moves depends on the visual range specified. Gamers with experience playing Real Time Strategy games like Warcraft, Age of Empires, etc. should be quite familiar with the concept.
This script supports two kinds of fog of war: static and dynamic.
Static fog of war is the kind that typically hides terrain in RTS games. It covers the entire map until the player explores the area, discovering the underlying terrain. Once static fog of war disappears from an area of the map, it stays gone indefinitely (even if loading a saved game, leaving the map and returning later, going to the menu, etc).
Dynamic fog of war is identical to the static kind except that it doesn't stay gone forever: as soon as the player leaves visual range of an explored tile, dynamic fog of war covers it again. This kind is typically used to hide enemy units in RTS games.
Features
both types of fog of war supported
customizable view range
customizable fog autotile (plug in your own if you wish)
Resources
You'll need this custom fog of war autotile, unless you choose to make your own.
Demo
Featuring a cantankerous old man:
FOG OF WAR DEMO.zip (Size: 955 KB / Downloads: 5)
-- Instructions are within the script --
Compatibility
For compatbility with Cogwheel's Pixel Movement script, place Cog's script ABOVE the Fog of War script. Then replace Cog's Game_Player/update method with the following version (or just copy and paste the section preceded by a "FoW" comment):
Compatability Patch
Code:
alias :update_original :update
def update
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
if @walk != @dash
if Input.press?(Input::C)
if @move_speed != @dash
@move_speed = @dash
end
else
if @move_speed != @walk
@move_speed = @walk
end
end
end
end
if @revise_x == nil and @revise_y == nil
@revise_x = 0
@revise_y = 0
end
unless @dot_m
update_original
return
end
if @move_route_forcing
last_moving = moving?
last_real_x = @real_x
last_real_y = @real_y
if (@revise_x != 0 or @revise_y != 0) and not jumping? and @move == true
if @revise_x != @real_x - @x * 128 or @revise_y != @real_y - @y * 128
@revise_x = @real_x - @x * 128
@revise_y = @real_y - @y * 128
end
distance1 = 2 ** @move_speed
distance2 = Math.sqrt(@revise_x ** 2 + @revise_y ** 2)
if distance1 > distance2
@real_x = @real_x - @revise_x
@real_y = @real_y - @revise_y
@revise_x = 0
@revise_y = 0
anime_update
else
@real_x -= (distance1 * @revise_x / distance2).round
@real_y -= (distance1 * @revise_y / distance2).round
@revise_x = @real_x - @x * 128
@revise_y = @real_y - @y * 128
anime_update
end
else
super
end
else
@move = false
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
@event_run = false
case Input.dir8
when 1
move_lower_left_p
when 2
move_down_p
when 3
move_lower_right_p
when 4
move_left_p
when 6
move_right_p
when 7
move_upper_left_p
when 8
move_up_p
when 9
move_upper_right_p
end
end
last_real_x = @real_x
last_real_y = @real_y
@real_x = @x * 128 + @revise_x
@real_y = @y * 128 + @revise_y
last_moving = moving?
move_on
if (last_real_x != @real_x or last_real_y != @real_y)
@move_distance = 0 if @move_distance == nil
@move_distance += Math.sqrt((last_real_x - @real_x) ** 2 +
(last_real_y - @real_y) ** 2)
if @move_distance >= 128
@move_distance %= 128
increase_steps
end
anime_update
elsif @walk_anime
@pattern = @original_pattern
end
end
# FoW
if $game_map.fow and (@x != @last_x or @y != @last_y)
unless jumping?
$game_map.update_fow_grid
$scene.spriteset.update_event_transparency if $game_map.fow_dynamic
$scene.spriteset.update_fow_tilemap
end
end
@last_x = @x
@last_y = @y
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
end
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
end
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
end
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
if last_moving
result = check_event_trigger_here([1,2])
if result == true
if (last_real_x / 128.0).round != @x and
(last_real_y / 128.0).round != @y
if @direction == 2 or @direction == 8
if (last_real_x / 128.0).round > @x
turn_left
else
turn_right
end
else
if (last_real_y / 128.0).round > @y
turn_up
else
turn_down
end
end
elsif (last_real_x / 128.0).round > @x
turn_left
elsif (last_real_x / 128.0).round < @x
turn_right
elsif (last_real_y / 128.0).round > @y
turn_up
elsif (last_real_y / 128.0).round < @y
turn_down
end
end
if result == false
unless $DEBUG and Input.press?(Input::CTRL)
# ?????? ???????
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
if Input.trigger?(Input::C)
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
Note: this is a repost. There were many pages of discussion in the original thread at RMXP.net that you would have liked to look through. Site no longer available.
Posted by: SephirothSpawn - 03-02-2008, 07:18 AM - Forum: Scripts Database
- No Replies
Enemy Troop Extender
by SephirothSpawn
Originally posted in Creation Asylum
Version: 1.1 Not by DerVVulfman
Introduction
This system extends the number of enemy battlers for a single TROOPS beyond the default maximum of eight. Yes, beyond eight in a single battle.
While your default system allows you to have only eight battlers in battle, this allows you to have nine... ten... even seventeen enemies at a time in battle.
This system cannot alter the RPGMaker XP editor itself so you must add the enemy battlers into your TROOPS through this script. You will be required to declare the ID number(s) of each enemy you add, as well as the horizontal and vertical position of the battler on the screen.
Features
Add battlers beyond the 8 enemy max
Global Compatability (Edits the RGSS class)
Screenshots
None. But you WOULD see more enemies on the screen than normal.
Instructions
Paste this below Scene_Debug and above main. After that, you have to add your 'additional' enemy battlers to your TROOPS through editing the script's configuration section.
More instructions inside the script.
FAQ
This script was part of a request made at Creation Asylum that SephirothSpawn answered almost immediately. The instructions within the script came about from the posts and paraphrased a little here and there.
I asked whether I could post it here. He said it was cool. :thumb:
Compatibility
As it edits the default RGSS 'TROOPS' class, you should have no problems with it at all.
Credits and Thanks
SephirothSpawn for making it in the first place. And to scoates for asking it in Creation Asylum.
Author's Notes
Well, Seph... Got anything to say?? ;)
Terms and Conditions
Um, he wrote it for someone as part of a request and he said I could post it. My guess is it's free for use. :D
#--------------------------------------------------------------------------
# * Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1])
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.enabled?("Window Sprites")
class Window_Base
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
if @trick_sprites_windowbase.nil?
alias_method :trick_sprites_base_x=, :x=
alias_method :trick_sprites_base_y=, :y=
alias_method :trick_sprites_base_z=, :z=
alias_method :trick_sprites_base_ox=, :ox=
alias_method :trick_sprites_base_oy=, :oy=
alias_method :trick_sprites_base_width=, :width=
alias_method :trick_sprites_base_height=, :height=
alias_method :trick_sprites_base_contents_opacity=, :contents_opacity=
alias_method :trick_sprites_base_back_opacity=, :back_opacity=
alias_method :trick_sprites_base_opacity=, :opacity=
alias_method :trick_sprites_base_visible=, :visible=
@trick_sprites_windowbase = true
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias_method :trick_sprites_base_initialize, :initialize
def initialize(x, y, width, height)
# Setup Sprites Array
@window_sprites = []
# The Usual
trick_sprites_base_initialize(x, y, width, height)
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
alias_method :trick_sprites_base_dispose, :dispose
def dispose
# The Usual
trick_sprites_base_dispose
# Dispose all Sprites
@window_sprites.each {|sprite| sprite.dispose}
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias_method :trick_sprites_base_update, :update
def update
# The Usual
trick_sprites_base_update
# Update
@window_sprites.each {|sprite| sprite.update}
end
#--------------------------------------------------------------------------
# * Set X
#--------------------------------------------------------------------------
def x=(x)
# Run through each window sprite
@window_sprites.each do |sprite|
# If Has Method sprite type
if sprite.respond_to?(:sprite_type)
# Branch by Type
case sprite.sprite_type
when 'content', 'content2', 'cover', 'background', 'background2'
# Include Scroll Calculation Set X
sprite.x = sprite.x - self.x + x + ox
when 'border'
# Exclude Scroll Calculation Set X
sprite.x = sprite.x - self.x + x
end
else
# Default is Content Sprite
sprite.x = sprite.x - self.x + x + ox
end
end
# The Usual
self.trick_sprites_base_x = x
end
#--------------------------------------------------------------------------
# * Set Y
#--------------------------------------------------------------------------
def y=(y)
# Update All Y's
@window_sprites.each do |sprite|
# If Has Method sprite type
if sprite.respond_to?(:sprite_type)
# Branch by Type
case sprite.sprite_type
when 'content', 'content2', 'cover', 'background', 'background2'
# Include Scroll Calculation Set Y
sprite.y = sprite.y - self.y + y + oy
when 'border'
# Exclude Scroll Calculation Set Y
sprite.y = sprite.y - self.y + y
end
else
# Default is Content Sprite
sprite.y = sprite.y - self.y + y + oy
end
end
# The Usual
self.trick_sprites_base_y = y
end
#--------------------------------------------------------------------------
# * Set Z
#--------------------------------------------------------------------------
def z=(z)
# Update All Z's
@window_sprites.each do |sprite|
# If Has Method sprite type
if sprite.respond_to?(:sprite_type)
# Branch By Sprite Type
case sprite.sprite_type
when 'content'
sprite.z = self.z + 1
when 'content2'
sprite.z = self.z + 2
when 'cover', 'border'
sprite.z = self.z + 3
when 'background'
sprite.z = self.z
when 'background2'
sprite.z = self.z - 1
end
else
# Default is content
sprite.z = self.z + 1
end
end
# The Usual
self.trick_sprites_base_z = z
end
#--------------------------------------------------------------------------
# * Set Origin X
#--------------------------------------------------------------------------
def ox=(ox)
# Get Ox Change
cx = self.ox - ox
# Run Through Each Sprite
@window_sprites.each do |sprite|
# If Has Method sprite type
if sprite.respond_to?(:sprite_type)
# Branch By Sprite Type
case sprite.sprite_type
when 'content', 'content2', 'cover', 'background', 'background2'
# Add to X
sprite.x += cx
# Setup Visibility
sprite.visible = sprite.x.between?(x + 16, x + width - 16) && visible
end
else
# Add to X
sprite.x += cx
# Setup Visibility
sprite.visible = sprite.x.between?(x + 16, x + width - 16) && visible
end
end
# The Usual
self.trick_sprites_base_ox = ox
end
#--------------------------------------------------------------------------
# * Set Origin Y
#--------------------------------------------------------------------------
def oy=(oy)
# Get Oy Change
cy = self.oy - oy
# Run Through Each Sprite
@window_sprites.each do |sprite|
# If Has Method sprite type
if sprite.respond_to?(:sprite_type)
# Branch By Sprite Type
case sprite.sprite_type
when 'content', 'content2', 'cover', 'background', 'background2'
# Add to Y
sprite.y += cy
# Setup Visibility
sprite.visible = sprite.y.between?(y + 16, y + height - 16) && visible
end
else
# Add to Y
sprite.y += cy
# Setup Visibility
sprite.visible = sprite.y.between?(y + 16, y + height - 16) && visible
end
end
# The Usual
self.trick_sprites_base_oy = oy
end
#--------------------------------------------------------------------------
# * Set Width
#--------------------------------------------------------------------------
def width=(width)
# Run Through Each Sprite
@window_sprites.each do |sprite|
# If Has Method sprite type
if sprite.respond_to?(:sprite_type)
# Branch By Sprite Type
case sprite.sprite_type
when 'content', 'content2', 'cover', 'background', 'background2'
# Setup Visibility
sprite.visible = sprite.x.between?(x + 16, x + width - 16) && visible
end
else
# Setup Visibility
sprite.visible = sprite.x.between?(x + 16, x + width - 16) && visible
end
end
# The Usual
self.trick_sprites_base_width = width
end
#--------------------------------------------------------------------------
# * Set Height
#--------------------------------------------------------------------------
def height=(height)
# Run Through Each Sprite
@window_sprites.each do |sprite|
# If Has Method sprite type
if sprite.respond_to?(:sprite_type)
# Branch By Sprite Type
case sprite.sprite_type
when 'content', 'content2', 'cover', 'background', 'background2'
# Setup Visibility
sprite.visible = sprite.y.between?(y + 16, y + height - 16) && visible
end
else
# Setup Visibility
sprite.visible = sprite.y.between?(y + 16, y + height - 16) && visible
end
end
# The Usual
self.trick_sprites_base_height = height
end
#--------------------------------------------------------------------------
# * Set Contents Opacity
#--------------------------------------------------------------------------
def contents_opacity=(opacity)
# Run Through Each Sprite and Setup Opacity
@window_sprites.each do |sprite|
# If Has Method sprite type
if sprite.respond_to?(:sprite_type)
# Branch By Sprite Type
case sprite.sprite_type
when 'content', 'content2', 'cover'
# Setup Opacity
sprite.opacity = opacity
end
else
# Setup Opacity
sprite.opacity = opacity
end
end
# The Usual
self.trick_sprites_base_contents_opacity = opacity
end
#--------------------------------------------------------------------------
# * Set Back Opacity
#--------------------------------------------------------------------------
def back_opacity=(opacity)
# Run Through Each Sprite and Setup Opacity
@window_sprites.each do |sprite|
# Skip if not Has Method sprite type
next if not sprite.respond_to?(:sprite_type)
# Branch By Sprite Type
case sprite.sprite_type
when 'background', 'background2'
# Setup Opacity
sprite.opacity = opacity
end
end
# The Usual
self.trick_sprites_base_back_opacity = opacity
end
#--------------------------------------------------------------------------
# * Set Opacity
#--------------------------------------------------------------------------
def opacity=(opacity)
# Run Through Each Sprite and Setup Opacity
@window_sprites.each do |sprite|
# Skip if not Has Method sprite type
next if not sprite.respond_to?(:sprite_type)
# Branch By Sprite Type
case sprite.sprite_type
when 'border', 'tagged'
# Setup Opacity
sprite.opacity = opacity
end
end
# The Usual
self.trick_sprites_base_opacity = opacity
end
#--------------------------------------------------------------------------
# * Set Visibility
#--------------------------------------------------------------------------
def visible=(bool)
# Get Rect
rect = Rect.new(x + 16, y + 16, width - 32, height - 32)
# Run Through Each Sprite
@window_sprites.each do |sprite|
# If Has Method sprite type
if sprite.respond_to?(:sprite_type)
# Branch By Sprite Type
case sprite.sprite_type
when 'content', 'content2', 'cover', 'background', 'background2'
sprite.visible = bool && sprite.in_rect?(rect)
when 'border', 'tagged'
sprite.visible = visible
end
else
sprite.visible = bool && sprite.in_rect?(rect)
end
end
# Update Visibility
self.trick_sprites_base_visible = bool
end
end
class Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sprite_type
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
if @trick_sprites_sprite.nil?
alias_method :trick_sprites_sprite_initialize, :initialize
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(*args)
# The Usual
trick_sprites_sprite_initialize(*args)
# Setup Default for sprite_type - 'content'
@sprite_type = 'content'
end
#--------------------------------------------------------------------------
# * Tag
#--------------------------------------------------------------------------
def tag(window)
# Get Attributes
x, y, width, height = window.x, window.y, window.width, window.height
# Setup Rect
rect = Rect.new(x + 16, y + 16, width - 32, height - 32)
# Branch by Sprite Type
case sprite_type
when 'content'
# Set Visibility
self.visible = in_rect?(rect) && window.visible
# Set Z Between Window
self.z = window.z + 1
# Setup Opacity
self.opacity = window.contents_opacity
when 'content2'
# Set Visibility
self.visible = in_rect?(rect) && window.visible
# Set Z Between Window
self.z = window.z + 2
# Setup Opacity
self.opacity = window.contents_opacity
when 'cover'
# Set Visibility
self.visible = in_rect?(rect) && window.visible
# Set Z Between Window
self.z = window.z + 3
# Setup Opacity
self.opacity = window.contents_opacity
when 'border'
# Set Visibility
self.visible = window.visible
# Set Z Between Window
self.z = window.z + 3
# Setup Opacity
self.opacity = window.opacity
when 'background'
# Set Visibility
self.visible = in_rect?(rect) && window.visible
# Set Z at Window
self.z = window.z
# Setup Opacity
self.opacity = window.back_opacity
when 'background2'
# Set Visibility
self.visible = in_rect?(rect) && window.visible
# Set Z at Window
self.z = window.z - 1
# Setup Opacity
self.opacity = window.back_opacity
when 'tagged'
# Set Visibility
self.visible = window.visible
# Setup Opacity
self.opacity = window.opacity
end
end
#--------------------------------------------------------------------------
# * In Rect?
#--------------------------------------------------------------------------
def in_rect?(*rect)
# If 1 Argument Sent
if rect.size == 1
# Get Rect
rect = rect[0]
# Return in rect state
return (x.between?(rect.x, rect.x + rect.width) &&
y.between?(rect.y, rect.y + rect.height))
else
# Get variables sent
x, y, width, height = rect
# If In Rect
return self.x.between?(x, x + width) && self.y.between?(y, y + height)
end
end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end
Instructions
Add Above Main
Then in any window class (By this I mean any child of Window_Base) just do this:
Code:
@window_sprites <<
.tag(
where is a Sprite object
and window is the window you want to tag the sprite to
NEW types have been added
to change the type of tagging used on a sprite just call
.sprite_type = type
where type is either content, content2, cover, border, background, background2 tagged
content and contents2 are the same except contents2 is positioned higher than content
content.z = window.z + 1 contents2.z = window.z + 2
cover is like contents but is positioned over the window
cover.z = window.z + 3
border is like cover but it can be positioned outside the contents of the window
background is like contents but is positioned below the window
background2 is like background but it is positioned below background
background.z = window.z, background2.z = window.z - 1
tagged is just a tagged sprite to a window you are free to position it anywhere
Also the default for all sprites is content
Note you can also add other objects to the window sprite array, but the object you push must respond to methods x=, y=, z=, visible=, opacity=
if you define a method called sprite_type within the object's class you can set the type of tagging used, but if you don't define it the script will use content tagging.
FAQ Note:Permission granted by Trickster to post:
Quote:And if you post what you have now of my stuff then you don't have the latest versions. I'm too lazy/busy to post stuff.
As this is his material, it is deletable upon his request. Due to his current absense, no support is available. Please do not PM or eMail him for support.
Compatibility
Should be compatible with any other script
Requires SDK Part 1
Author's Notes
Please do not post saying you don't know what this does, if you can't figure it out then chances are you won't have a use for this. If you do post you will be getting a surprise from me (and it will not be a good surprise)
Terms and Conditions
Hey, I posted this publicly. You can use it. What do you expect? But if you do use it, I do expect you to spell my name correctly in your game. And yes you can use it in commercial games too.