[RMVX ACE] NPCS MOVING BETWEEN MAPS?
Posts
Pearl documentation:
#==============================================================================#
# * Falcao Pearl ABS Liquid v3 #
# #
# The easiest ABS System for RPG Maker! #
# #
# Website: http://falcaorgss.wordpress.com/ #
# Foro: www.makerpalace.com Release date: December 2 2012 #
# updated: December 13 2012 #
# updated: January 22 2014 #
# updated: April 1 2014 #
#==============================================================================#
=begin
Pearl v3 change log
- Injected Pearl abs path
- Fixed dead posses issue
- Implemented respawn timer for enemies
- Fixed vehicle issue
- Enemies cannot longer attack you while in vehicle
- fixed stuck issue when borading a a vehicle while a follower is deadposing
- added low hp switches for enemies
- Added item quantity to enemy drops
- Fixed enemy touch damage issue
- Fixed custom graphics display issue
## New Notetags!##
** Enemies
Enemy Respawn Seconds = x - Time in seconds the enemy can respawn
Enemy Respawn Animation = x - Respawn animation id
Enemy Knockback Disable = true - Make enemy unable to be knocked back
Enemy Lowhp 75% Switch = x - when enemy hp is below 75% turn on switch id x
Enemy Lowhp 50% Switch = x - when enemy hp is below 50% turn on switch id x
Enemy Lowhp 25% Switch = x - when enemy hp is below 25% turn on switch id x
Enemy Lowhp 10% Switch = x - when enemy hp is below 10% turn on switch id x
# Enemies characters notetags
now you set up more than one tool at the time for enemies. this will make the
enemies less repetitive, this simple commands work as follows. it pick up one
random tool id from the list each time the command is executed. the list can be
infinite.
rand_skill(x,x,x) ramdom skill ids the enemy going to use
rand_item(x,x,x) ramdom item ids the enemy going to use
rand_weapon(x,x,x) ramdom weapon ids the enemy going to use
rand_armor(x,x,x) ramdom armor ids the enemy going to use
* Item notetags
Exclude From Tool Menu = true - Exclude item from tool selection menu
Drop Quantity = x - Enemy drop item quantity (item, weapon, armor)
--------------------------------------------------------------------------------
## The Fantastic Pearl ABS Patch injection notetags ##
This options allows you use icons from iconset to perform animations for the
tools, it is usefull for those peoples who are terrible at creating graphics.
* User and projectiles iconset graphic instructions
Tag any weapon, armor, item or skill with the followings note tags
User Iconset = animated - You have 3 options available:
animated, static, shielding. animated plays
3 patterns swing effect. static plays only one
and shielding for shield usage effect
note: User iconsets are compatible with default small sprites form the rmvx ace
engine
Projectile Iconset = animated - you have 2 options available
animated and static.
animated play a zoom in and zoom out effect
static plays no effect
Note: Projectile iconset can be used with default and big characters
================================================================================
Version liquid v2 change log
- Anime speed Enchanted
- New dead poses for actors and enemies
- Combo feature now support infinite combo chains (rather than 2)
- Added compatibility with bigger characters actors,
- New Universal molde provided for bigger characters and normal ones
- added more configuration to the modules
- Hp and Mp bars now has the option to display pictures instead script drawing
- New single player option (disable the M Key and K is used to call tool menu)
- Added TP display to the damage pop mechanism
- Fixed minor bug when allowing tool usage while using the shield
- Added new note tag for actors and enemies, Hit Voices = se, se, se
- Added new note tag to avoid battler voices when using specific skills
- added new notetag for enemies, Enemy Dead Pose = true , use it if you want
the enemy to show the knockdown pattern when die rather than erase it
- Hidden note tags revealed (read the documentation manual ^^)
- Added new stage Falcao son (just to show up how to create debasting tools)
Do you already have liquid v1 installed? just remove your old pearl scripts and
and replece it with liquid v2 (core script remains the same)
================================================================================
* Manual
The first thing you need to know is this script uses all the database
parameters to work, same as the default battle engine with few exemptions
Read this documentation and learn about the great features this script has
for a professional game development.
This script comes with 9 separate script pieces (excluding the documentation)
You can find some customization modules at the top of each piece.
* Installation
Copy and paste all the script shelf to an empty slot below main
Export the graphics provided in Character, Animation and pictures folder (few
graphics provided) Take a look at the database and see what is note tagged,
export the animations and the tools, exporting the databse is optional but it
may help you for samples. done!.
If you are using my FA Interactive system 2.0 make sure you have the lite
version and paste it ABOVE this sytem
If you are using my Mouse System buttons script make sure you have the latest
version. Get the latest version at. http://falcaorgss.wordpress.com/
If you are using my Pets Servants paste the pet script ABOVE the 10 pieces
* Terms and license
- Do credit me Falcao as the creator of this ABS system
- You can modify anything you want
- You are allowed to distribute this material in any webpage
- Do not remove the header of any script shelf
- You are free to use this script in non-comercial projects, for comercial
projects contact me falmc99@gmail.com
* Features
- Full and easy to use ABS engine
- Create any tool from your imagination most easy than ever
- Universal anime graphics, any character can use the graphics including enemies
- Advance Projectile system
- Knockdown feature enable (you give the tool a chance to knockdown a target)
- Tool casting time enabled
- Tool Cooldown enable (the time you have to wait before use the tool again)
- Cooldown coutdown displayed on the toolbar
- Ammo system
- Tool special movements (able to load a moveroute from a common event)
- Tool multiprojectiles enable, you can load upto 8 projectiles at the time
- Bombs, axes, hooshots, magis, shields, boomerangs, anything can be created
- States animation anable (up to 5 icons displayed on map)
- Buffs and debuffs enable (up to 5 icons displayed on map)
- You can assing up to 8 tools to the skillbar (overpowered dont?)
- Input module, default keys are no used by this system
- Area, ranged, spin attacks, target selection enabled
- Invoke skills for weapon and armors enabled
- Interactive enemies with knockdown, sensor enabled
- Enemies use any tool that the player or follower does
- Enemy battler enabled, so you decide if you want display the battler graphic
- Enemies are able to heal themselfs, have allies enemies etc
- Enemy die commands, collapse animations etc.
- Party system! your followers have a command to start figting
- Followers are able to heal allies, player etc
- Smart targeting system, followers choose an individual enemy to attack
- Agro system, followers and player have a chance to get the agro of the enemy
- Token system (you tag any event to start when was hit by a tool)
- Tool targeting system, autotarget, etc
- Player selection scene enabled
- Quick skill bar enabled
- Item pop up enabled
- Antilag enabled
- Lag free
- Summon system. you can command the tool to use tools by using a common event
move route as manager action.
- Enemies states, buff and debuff display
- Combo system for the tools ( you can create an epic combo chain)
- Mouse support! you can trigger tools by cliking the skillbar icons!
* I didnt mention all the features this script comes with, find the rest by
yourself
-----------------------
* Things you need to know
What is a knockdown? Knockdown is a parameters included with this system,
tools have a chance to knock an enemy down, if an user is casting a spell
the knockdown can interrupt it, and also stop the movement for few frames,
the knock down needs a graphic to make the effect, the RTP comes with tons
of knockdownned sprites use them or create your owns with the generator
What is Agro? agro is a parameter of Pearl abs, when the player or follower hit
an enemy they provoke the enemy to attack them, the player by default has more
agro than followers. Its is more probably that enemies attacks the player
The followers can use only one tool while in battle, why? becouse you dont want
to win all the battles, just imagine your folllowers using all theirs tools,
that will be overpowered, the player has eight tools right in the skill bar so..
There is a menu in game where you decide which tool slot use as a follower
Benefical items and skills can be used without any note tags, meaning
that you can use them freely, benefical tools are those who have
scopes for one ally, all allies, dead allies etc. apply to enemies too
Weapons and armors needs the note tag system to work since they dont have
scopes. is they are not note tagged simple you will not able to use them in map
Enemies can use weapons armors and items too. ammo system is infinite for enemie
since they are suppose to have their own munition wallet. Weapon parameters
apply to enemies when use it but features are ignored
You can convert a weapon and armor to a skill using the Invoke skill feature
meaning that you will use the weapon but with the properies of the invoked skill
This script is completely free of lag, it have a well worked optimized kernel
but do not abuse and use everything with moderation.
#===============================================================================
* Actors Notetags
Knockdown Graphic = Damage3 - Knockdown graphic
Knockdown Index = 6 - Graphic index
Knockdown pattern = 0 - Graphic pattern
Knockdown Direction = 2 - Graphic direction
The example above shows Ericks knockdown graphic set up, you can leave it blank
but, it is better to have a knock down graphic in order to make the effect work
Battler Voices = se, se, se - If you want to play actor voices when attac
puts se files name separate by commas
Hit Voices = se, se, se - Do you want to play voices when was hit?
replace se with the sound file name
#===============================================================================
* Enemies
To create an enemy first create an event then in the name box writte
<enemy: x> - Change x for the enemy id in the database
There are 3 types of events enemies you can create in Pearl ABS
Type one BASIC:
Just tag the event name as enemy and there you go
Type two SENSORIAL
This type needs a second event page as a condition the self switch 'B' on
When the player is near the enemy, the enemy will activate that self switch and
there you can give the enemy attacks etc
Type three ACTION
This include the basic and sensorial, but requireds a third page to show up the
Knockdown graphic or whatever ir order to make the knockdown to make effect.
At third page put as condition Self switch 'C' by default
See game demo for examples, the most used is the Type ACTION
How to commands enemies to attack?
It is very simple, From the event enemy 'Autonomous Movement' use the
followings mini script calls.
use_weapon(x)
use_armor(x)
use_item(x)
use_skill(x)
Change x for the tool id
---------------------------------
* Enemies Notetags (in databse)
First thing to know is enemies notetags in the database are optional, this note
tags are used for some extra customization in the enemies.
Enemy Touch Damage Range = x - If you want the enemy to damage actor by contact
use this tag, change x for the distance in tiles
Enemy Sensor = x - Distance in tiles the enemy can see the player,
the default value is 6
Enemy Object = true - The enemy becomes an object, damage pop is no
showed, and some features has been disable
this is used to create enemies like traps or,
objects like grass where you can get some drop
Enemy Boss Bar = true - This make the enemy to display a big boss HP bar
Enemy Battler = true - Do you want the enemy to show battler graphic?
Enemy Breath = true - Do you want the enemy to breath?
Enemy Die Animation = x - Change x for animation id
Enemy Kill With Weapon = a,b,c - The enemy becomes invulnerable for all tools an
can be killed only by the given tool ids, you
can puts all the ids you want separated by comma
Enemy Kill With Armor = a,b,c - Samething than weapons
Enemy Kill With Item = a,b,c - Samething than weapons
Enemy Kill With Skill = a,b,c - Samething than weapons
Enemy Collapse Type = x - Change x for one of this 4 options available
zoom_vertical
zoom_horizontal
zoom_maximize
zoom_minimize
Enemy Body Increase x - By default all enemies has 1 tile of size but that
can be changed with this command, you have only two
sizes available, 1 = increase doble, 2 = triple.
change x for 1 or 2. (this is used for big enemies)
Enemy Die Switch = x - Change x for switch id to activate when enemy die
Enemy Die Variable = x - Change x for variable id you want to increase + 1
when enemy die
Enemy Die Self Switch x - Change x for the self switch capital letter you
want to activate when enemy die
Hit Jump = false Disable enemy jump when was hit
Battler Voices = se, se, se - If you want to play enemy voices when attack
puts se files name separate by commas
Enemy Dead Pose = true - Do you want the enemy to display the knockdown
graphic when die? this is the dead pose and it only
work when a knockdown graphic is defined
Hit Voices = se, se, se - Do you want to play voices when was hit?
replace se with the sound file name
Enemy Die Transform = x - Do you want to transform the enemy when die?
change x for the enemy id
================================================================================
* States, buffs and debuffs
States notetags are optional, few changes has been made listed below.
State Animation = x - State animation id
State Effect Rand Rate = x - This apply only for HP, MP and TP regen Exparam
this calculate how often the state will affect
the target. change x for a number between 100
and 1000.
How states are removed?
As you know this is an ABS system NOT turn battle system, to remove the states
check the boxes 'Remove by Damage' or 'Remove by Walking' in the databse
If you choose remove by walking the steps will be equal to seconds, 10 steps
equal to 10 seconds of duration, doesnt matter if the target is moving or not
* Buffs and Debuffs
If you create a skill that gives buffs or debuffs, the turns stated in databse
will be equal to seconds of duration, 10 turns equal to 10 seconds
================================================================================
- Events Tags
* Token tags
This tags goes into event comment and are mostly used for normal events to
create some puzzles.
<start_with_weapon: a,b,c>
<start_with_armor: a,b,c> - Puts tool ids you want the event to start with
<start_with_item: a,b,c> you can put as many ids needed
<start_with_skill: a,b,c>
* Hookshot tags
This tags are used with the hookshot special tools, here some options available
<hook_grab: true> - The hook can grab this event
<hook_pull: true> - The hook will pull the user from x to event position
* Boomerang tags
<boom_grab: true> - The event can be grabbed by the boomerang
<boomed_start: true> - The event start when you succes grabbed the event
Note: Boomerangs can grab drops automatically
================================================================================
* Pearl ABS Input System
Pearl ABS Skillbar has 9 buttons available, here the list of the default ones
- F key trigger weapons attacks
- G key trigger armor tool (shields types)
- H, J trigger items tools
- R, T, Y, U trigger skill attacks
- K trigger follower attacks, keep pressing for 3 seconds to cancel
the battle
Note: the Player is reponsible for command the followers to attack, sometimes
the followers stop fighting when his target dies, you are responsible to
command the follower to attack again.
- N key call the quick tool selection window
- M key call the Player selection window, there you set up the follower
tool slot usage too.
- B key Same as cancel key X
================================================================================
* Useful script calls
- $game_party.set_item(actor, item, slot)
Use this command if you want to set automatically an item to the skillbar
change actor for actor id, item for item id, slot for the slot name symbol
Exp: $game_party.set_item(1, 20, :H)
- $game_party.set_skill(actor, skill, slot) - samething as items
- SceneManager.call(Scene_QuickTool) - call the quick tool window manually
- SceneManager.call(Scene_CharacterSet) - call the player slection manually
- $game_player.pop_damage('something') - display pop text over the player
- $game_map.events.pop_damage('') - display pop text over the event id
================================================================================
* Tools Notetags
Tools are the weapon, armor, items and skills used in the map to damage enemies
Here i going to explain you how to create your own tools to be used on map, and
the explanation of each term definition, The example below how to create a
usable Axe on map.
Copy this tool settings to any Weapon, Armor, Item, Skill note tags
User Graphic = $Axe
User Anime Speed = 30
Tool Cooldown = 30
Tool Graphic = nil
Tool Index = 0
Tool Size = 1
Tool Distance = 1
Tool Effect Delay = 10
Tool Destroy Delay = 20
Tool Speed = 5
Tool Cast Time = 0
Tool Cast Animation = 0
Tool Blow Power = 1
Tool Piercing = true
Tool Animation When = end
Tool Animation Repeat = false
Tool Special = nil
Tool Target = false
Tool Invoke Skill = 0
Tool Guard Rate = 0
Tool Knockdown Rate = 70
Tool Sound Se = nil
Tool Cooldown Display = false
Tool Item Cost = 0
Tool Short Jump = false
Tool Through = true
Tool Priority = 1
Tool Hit Shake = false
Tool Self Damage = false
Tool Combo Tool = nil
Important!: You CANNOT leave extra empty spaces between the tool variables
definition, just copy and paste that variables to the note tags and edit values
Here the terms explanation
User Graphic = $Axe
- This define the user graphic displayed when the tool is used, if you dont want
to show graphic puts nil. If you want to show a COSTUMED graphic for the user
writte the keyword custom then graphic name ex: custom $Hero_Skill
User Anime Speed = 30
- This define the user graphic animation speed when using the tool, the user
stop movemnet and do step anime, time in frames
Tool Cooldown = 30
- Cooldown is the time you have to wait before using the tool, this gives
balance to the tool system, time measured in frames
Tool Graphic = nil
- This define the tool graphic projectile showed when using the tool, in this
case no graphic will be displayed, puts nil for not graphic showing
Tool Index = 0
- This defines graphic index of the tool graphic, so you can use a full sheet.
and set the index of the used graphic
Tool Size = 1
- This defines the tool size measured in tiles, this tool has 1 tile size,
Set greater numbers when you create big tools or area attacks
Tool Distance = 1
- This is the distance the projectile going to do, distance is measured in tiles
this tools has only 1 tile of trajectory.
Tool Effect Delay = 10
- How long the tool going to take to make effect over a target? time measured in
frames, tools such as bombs take a longer time to make effect so...
Tool Destroy Delay = 20
- How long the tool going to take to be destroyed? the time start counting when
the tool distance is done, time measured in tiles.
Tool Speed = 5
- This defines the tool movement speed, choose a number between 1 to 6
remeber that tools are represented by a character.
Tool Cast Time = 0
- This defines the Tools casting time, time measured in frames, this tool has
not casting time, puts 0 for not casting time
Tool Cast Animation = 0
- Animation played when casting the tool, this is displayed if there is cas time
obviously, change integer for the animation id
Tool Blow Power = 1
- This defines the target steps backwars when was hit by the tool, change the
integer for tiles distance
Tool Piercing = true
- The tool going to pierce the enemy? change true or false
Tool Animation When = end
- This defines when the animation going to be played, you have 4 options
end - Animation is played righ before destroyed
acting - Animation is played when the tool is used
hit - Animation is played when hit the target
delay x - Animation is played when the tool detroy delay reachs
the x integer, for example, a bomb display the animation after
some delay before the tools is detroyed. change x for a number
Tool Animation Repeat = false
- This defines whether the animation going to be repeated, this only works
if you set the animation to be played when 'acting'
Tool Special = nil
- This define tool special predefined behavior, you have 11 options available
shield - The tool behave like a shield, this works for tagged armors
and the state guard is applied to the user, when using it
hook - The tools set the hookshot mode, hook can, grab, pull etc.
area - Tool become an area atack around the caster, or target
spiral - The tool become spiral attack, the user going to make some
rounds, the number on rounds is equal to the Tool Distance
boomerang - Tool becomes a boomerang, boomerang can grab drops, tagged
events, and can be redirectioned with the input keys
triple - Loads 3 projectiles at the time, 2 diagonals and 1 straigh
quintuple - Loads 5 projectiles at the time, 2 diagonals, 2 cross and
one straight forward
octuple - Loads 8 projectiles in all direction including diagonals
autotarget - The tool move straight and looks for a random target
near the user
random - Tool moves 2 steps forward and them make random movements
common_event x - This is one of the most powerfull features of Pearl ABS
this extract the move route from a common event to be used
by the tool, everything you delcare in the move route will
affect the tool, you can use the attack script calls inside
the move route. (used to create tools such as summons)
change x for the common event id
Note: Tool special take some default values, for example the tool distance
is reseted, tool targeting may be disabled, destroy delay reseted etc.
Tool Target = false
- This defines if the tool needs a target to be triggered, A scene selection is
showed for the player, the followers picks a random target, enemies takes agro
Tool Invoke Skill = 0
- Deafault battle system for weapons invoke skill 1,for defending invoke skill 2
So Pearl abs lets you invoke any skill when using a weapon or armor.
set 0 if you want to take the defaults, skills and items invoke themself so...
Tool Guard Rate = 0
- This only work for armors tagged with tool special 'shield', this define
the rate of guard of the shield, puts a number between 1 and 100
when gaurd succes the user takes no damage, otherwise, take block damage
Tool Knockdown Rate = 70
- This is a great feature of pearl abs, tools are able to knock the target down
for a short time in order to cancel casting spells etc, puts a number
between 1 and 100
Tool Sound Se = nil
- Sound SE played when using the tool, if you dont want sounds puts nil
Tool Cooldown Display = false
- The cool down time is displayed on the skillbar when using a tool
puts false if you dont want to display the cooldown
Tool Item Cost = 0
- This is the Pearl ABS ammo system, every single armor, weapon, item skills can
have an item cost, puts the item id the tools needs to be triggered
this is used to create tools likes, bows that consume arrows, bombs etc.
Tool Short Jump = false
- The tool going to guve a shor jump when triggered, change true or false
Tool Through = true
- Tools go through walls, trees, rocks etc?
Tool Priority = 1
- Priority of the tool, 0 = below characters, 1 = same as characters,
2 = above characters
Tool Hit Shake = false
- Do you want the screen to shake when the tool hit a target? true / false
Tool Self Damage = false
- Do you want the tool to damage the user? (example bombs can have self damage)
Tool Combo Tool = nil
- tools can have a combo chain, this tool has not a combo cuz is defined to nil
if you want to make combos you have to put this parameters to define it
type, id, chance, jump? . type is tool type: weapon, armor, item or skill
id is the tool id, chance must be a number between 1 and 100, write jump if
you want the user to jump if you dont want to jump writte nil
here an example: weapon, 63, 75, jump
uses weapon id 63 with a 75% chance and a jump will be performed (simple)
* Optionals tools notetags
<ignore_voices> When using the tool no battler voices are played
<ignore_followers> The tool ignore damage to the followers
================================================================================
=end
#==============================================================================#
# * Falcao Pearl ABS Liquid v3 #
# #
# The easiest ABS System for RPG Maker! #
# #
# Website: http://falcaorgss.wordpress.com/ #
# Foro: www.makerpalace.com Release date: December 2 2012 #
# updated: December 13 2012 #
# updated: January 22 2014 #
# updated: April 1 2014 #
#==============================================================================#
=begin
Pearl v3 change log
- Injected Pearl abs path
- Fixed dead posses issue
- Implemented respawn timer for enemies
- Fixed vehicle issue
- Enemies cannot longer attack you while in vehicle
- fixed stuck issue when borading a a vehicle while a follower is deadposing
- added low hp switches for enemies
- Added item quantity to enemy drops
- Fixed enemy touch damage issue
- Fixed custom graphics display issue
## New Notetags!##
** Enemies
Enemy Respawn Seconds = x - Time in seconds the enemy can respawn
Enemy Respawn Animation = x - Respawn animation id
Enemy Knockback Disable = true - Make enemy unable to be knocked back
Enemy Lowhp 75% Switch = x - when enemy hp is below 75% turn on switch id x
Enemy Lowhp 50% Switch = x - when enemy hp is below 50% turn on switch id x
Enemy Lowhp 25% Switch = x - when enemy hp is below 25% turn on switch id x
Enemy Lowhp 10% Switch = x - when enemy hp is below 10% turn on switch id x
# Enemies characters notetags
now you set up more than one tool at the time for enemies. this will make the
enemies less repetitive, this simple commands work as follows. it pick up one
random tool id from the list each time the command is executed. the list can be
infinite.
rand_skill(x,x,x) ramdom skill ids the enemy going to use
rand_item(x,x,x) ramdom item ids the enemy going to use
rand_weapon(x,x,x) ramdom weapon ids the enemy going to use
rand_armor(x,x,x) ramdom armor ids the enemy going to use
* Item notetags
Exclude From Tool Menu = true - Exclude item from tool selection menu
Drop Quantity = x - Enemy drop item quantity (item, weapon, armor)
--------------------------------------------------------------------------------
## The Fantastic Pearl ABS Patch injection notetags ##
This options allows you use icons from iconset to perform animations for the
tools, it is usefull for those peoples who are terrible at creating graphics.
* User and projectiles iconset graphic instructions
Tag any weapon, armor, item or skill with the followings note tags
User Iconset = animated - You have 3 options available:
animated, static, shielding. animated plays
3 patterns swing effect. static plays only one
and shielding for shield usage effect
note: User iconsets are compatible with default small sprites form the rmvx ace
engine
Projectile Iconset = animated - you have 2 options available
animated and static.
animated play a zoom in and zoom out effect
static plays no effect
Note: Projectile iconset can be used with default and big characters
================================================================================
Version liquid v2 change log
- Anime speed Enchanted
- New dead poses for actors and enemies
- Combo feature now support infinite combo chains (rather than 2)
- Added compatibility with bigger characters actors,
- New Universal molde provided for bigger characters and normal ones
- added more configuration to the modules
- Hp and Mp bars now has the option to display pictures instead script drawing
- New single player option (disable the M Key and K is used to call tool menu)
- Added TP display to the damage pop mechanism
- Fixed minor bug when allowing tool usage while using the shield
- Added new note tag for actors and enemies, Hit Voices = se, se, se
- Added new note tag to avoid battler voices when using specific skills
- added new notetag for enemies, Enemy Dead Pose = true , use it if you want
the enemy to show the knockdown pattern when die rather than erase it
- Hidden note tags revealed (read the documentation manual ^^)
- Added new stage Falcao son (just to show up how to create debasting tools)
Do you already have liquid v1 installed? just remove your old pearl scripts and
and replece it with liquid v2 (core script remains the same)
================================================================================
* Manual
The first thing you need to know is this script uses all the database
parameters to work, same as the default battle engine with few exemptions
Read this documentation and learn about the great features this script has
for a professional game development.
This script comes with 9 separate script pieces (excluding the documentation)
You can find some customization modules at the top of each piece.
* Installation
Copy and paste all the script shelf to an empty slot below main
Export the graphics provided in Character, Animation and pictures folder (few
graphics provided) Take a look at the database and see what is note tagged,
export the animations and the tools, exporting the databse is optional but it
may help you for samples. done!.
If you are using my FA Interactive system 2.0 make sure you have the lite
version and paste it ABOVE this sytem
If you are using my Mouse System buttons script make sure you have the latest
version. Get the latest version at. http://falcaorgss.wordpress.com/
If you are using my Pets Servants paste the pet script ABOVE the 10 pieces
* Terms and license
- Do credit me Falcao as the creator of this ABS system
- You can modify anything you want
- You are allowed to distribute this material in any webpage
- Do not remove the header of any script shelf
- You are free to use this script in non-comercial projects, for comercial
projects contact me falmc99@gmail.com
* Features
- Full and easy to use ABS engine
- Create any tool from your imagination most easy than ever
- Universal anime graphics, any character can use the graphics including enemies
- Advance Projectile system
- Knockdown feature enable (you give the tool a chance to knockdown a target)
- Tool casting time enabled
- Tool Cooldown enable (the time you have to wait before use the tool again)
- Cooldown coutdown displayed on the toolbar
- Ammo system
- Tool special movements (able to load a moveroute from a common event)
- Tool multiprojectiles enable, you can load upto 8 projectiles at the time
- Bombs, axes, hooshots, magis, shields, boomerangs, anything can be created
- States animation anable (up to 5 icons displayed on map)
- Buffs and debuffs enable (up to 5 icons displayed on map)
- You can assing up to 8 tools to the skillbar (overpowered dont?)
- Input module, default keys are no used by this system
- Area, ranged, spin attacks, target selection enabled
- Invoke skills for weapon and armors enabled
- Interactive enemies with knockdown, sensor enabled
- Enemies use any tool that the player or follower does
- Enemy battler enabled, so you decide if you want display the battler graphic
- Enemies are able to heal themselfs, have allies enemies etc
- Enemy die commands, collapse animations etc.
- Party system! your followers have a command to start figting
- Followers are able to heal allies, player etc
- Smart targeting system, followers choose an individual enemy to attack
- Agro system, followers and player have a chance to get the agro of the enemy
- Token system (you tag any event to start when was hit by a tool)
- Tool targeting system, autotarget, etc
- Player selection scene enabled
- Quick skill bar enabled
- Item pop up enabled
- Antilag enabled
- Lag free
- Summon system. you can command the tool to use tools by using a common event
move route as manager action.
- Enemies states, buff and debuff display
- Combo system for the tools ( you can create an epic combo chain)
- Mouse support! you can trigger tools by cliking the skillbar icons!
* I didnt mention all the features this script comes with, find the rest by
yourself
-----------------------
* Things you need to know
What is a knockdown? Knockdown is a parameters included with this system,
tools have a chance to knock an enemy down, if an user is casting a spell
the knockdown can interrupt it, and also stop the movement for few frames,
the knock down needs a graphic to make the effect, the RTP comes with tons
of knockdownned sprites use them or create your owns with the generator
What is Agro? agro is a parameter of Pearl abs, when the player or follower hit
an enemy they provoke the enemy to attack them, the player by default has more
agro than followers. Its is more probably that enemies attacks the player
The followers can use only one tool while in battle, why? becouse you dont want
to win all the battles, just imagine your folllowers using all theirs tools,
that will be overpowered, the player has eight tools right in the skill bar so..
There is a menu in game where you decide which tool slot use as a follower
Benefical items and skills can be used without any note tags, meaning
that you can use them freely, benefical tools are those who have
scopes for one ally, all allies, dead allies etc. apply to enemies too
Weapons and armors needs the note tag system to work since they dont have
scopes. is they are not note tagged simple you will not able to use them in map
Enemies can use weapons armors and items too. ammo system is infinite for enemie
since they are suppose to have their own munition wallet. Weapon parameters
apply to enemies when use it but features are ignored
You can convert a weapon and armor to a skill using the Invoke skill feature
meaning that you will use the weapon but with the properies of the invoked skill
This script is completely free of lag, it have a well worked optimized kernel
but do not abuse and use everything with moderation.
#===============================================================================
* Actors Notetags
Knockdown Graphic = Damage3 - Knockdown graphic
Knockdown Index = 6 - Graphic index
Knockdown pattern = 0 - Graphic pattern
Knockdown Direction = 2 - Graphic direction
The example above shows Ericks knockdown graphic set up, you can leave it blank
but, it is better to have a knock down graphic in order to make the effect work
Battler Voices = se, se, se - If you want to play actor voices when attac
puts se files name separate by commas
Hit Voices = se, se, se - Do you want to play voices when was hit?
replace se with the sound file name
#===============================================================================
* Enemies
To create an enemy first create an event then in the name box writte
<enemy: x> - Change x for the enemy id in the database
There are 3 types of events enemies you can create in Pearl ABS
Type one BASIC:
Just tag the event name as enemy and there you go
Type two SENSORIAL
This type needs a second event page as a condition the self switch 'B' on
When the player is near the enemy, the enemy will activate that self switch and
there you can give the enemy attacks etc
Type three ACTION
This include the basic and sensorial, but requireds a third page to show up the
Knockdown graphic or whatever ir order to make the knockdown to make effect.
At third page put as condition Self switch 'C' by default
See game demo for examples, the most used is the Type ACTION
How to commands enemies to attack?
It is very simple, From the event enemy 'Autonomous Movement' use the
followings mini script calls.
use_weapon(x)
use_armor(x)
use_item(x)
use_skill(x)
Change x for the tool id
---------------------------------
* Enemies Notetags (in databse)
First thing to know is enemies notetags in the database are optional, this note
tags are used for some extra customization in the enemies.
Enemy Touch Damage Range = x - If you want the enemy to damage actor by contact
use this tag, change x for the distance in tiles
Enemy Sensor = x - Distance in tiles the enemy can see the player,
the default value is 6
Enemy Object = true - The enemy becomes an object, damage pop is no
showed, and some features has been disable
this is used to create enemies like traps or,
objects like grass where you can get some drop
Enemy Boss Bar = true - This make the enemy to display a big boss HP bar
Enemy Battler = true - Do you want the enemy to show battler graphic?
Enemy Breath = true - Do you want the enemy to breath?
Enemy Die Animation = x - Change x for animation id
Enemy Kill With Weapon = a,b,c - The enemy becomes invulnerable for all tools an
can be killed only by the given tool ids, you
can puts all the ids you want separated by comma
Enemy Kill With Armor = a,b,c - Samething than weapons
Enemy Kill With Item = a,b,c - Samething than weapons
Enemy Kill With Skill = a,b,c - Samething than weapons
Enemy Collapse Type = x - Change x for one of this 4 options available
zoom_vertical
zoom_horizontal
zoom_maximize
zoom_minimize
Enemy Body Increase x - By default all enemies has 1 tile of size but that
can be changed with this command, you have only two
sizes available, 1 = increase doble, 2 = triple.
change x for 1 or 2. (this is used for big enemies)
Enemy Die Switch = x - Change x for switch id to activate when enemy die
Enemy Die Variable = x - Change x for variable id you want to increase + 1
when enemy die
Enemy Die Self Switch x - Change x for the self switch capital letter you
want to activate when enemy die
Hit Jump = false Disable enemy jump when was hit
Battler Voices = se, se, se - If you want to play enemy voices when attack
puts se files name separate by commas
Enemy Dead Pose = true - Do you want the enemy to display the knockdown
graphic when die? this is the dead pose and it only
work when a knockdown graphic is defined
Hit Voices = se, se, se - Do you want to play voices when was hit?
replace se with the sound file name
Enemy Die Transform = x - Do you want to transform the enemy when die?
change x for the enemy id
================================================================================
* States, buffs and debuffs
States notetags are optional, few changes has been made listed below.
State Animation = x - State animation id
State Effect Rand Rate = x - This apply only for HP, MP and TP regen Exparam
this calculate how often the state will affect
the target. change x for a number between 100
and 1000.
How states are removed?
As you know this is an ABS system NOT turn battle system, to remove the states
check the boxes 'Remove by Damage' or 'Remove by Walking' in the databse
If you choose remove by walking the steps will be equal to seconds, 10 steps
equal to 10 seconds of duration, doesnt matter if the target is moving or not
* Buffs and Debuffs
If you create a skill that gives buffs or debuffs, the turns stated in databse
will be equal to seconds of duration, 10 turns equal to 10 seconds
================================================================================
- Events Tags
* Token tags
This tags goes into event comment and are mostly used for normal events to
create some puzzles.
<start_with_weapon: a,b,c>
<start_with_armor: a,b,c> - Puts tool ids you want the event to start with
<start_with_item: a,b,c> you can put as many ids needed
<start_with_skill: a,b,c>
* Hookshot tags
This tags are used with the hookshot special tools, here some options available
<hook_grab: true> - The hook can grab this event
<hook_pull: true> - The hook will pull the user from x to event position
* Boomerang tags
<boom_grab: true> - The event can be grabbed by the boomerang
<boomed_start: true> - The event start when you succes grabbed the event
Note: Boomerangs can grab drops automatically
================================================================================
* Pearl ABS Input System
Pearl ABS Skillbar has 9 buttons available, here the list of the default ones
- F key trigger weapons attacks
- G key trigger armor tool (shields types)
- H, J trigger items tools
- R, T, Y, U trigger skill attacks
- K trigger follower attacks, keep pressing for 3 seconds to cancel
the battle
Note: the Player is reponsible for command the followers to attack, sometimes
the followers stop fighting when his target dies, you are responsible to
command the follower to attack again.
- N key call the quick tool selection window
- M key call the Player selection window, there you set up the follower
tool slot usage too.
- B key Same as cancel key X
================================================================================
* Useful script calls
- $game_party.set_item(actor, item, slot)
Use this command if you want to set automatically an item to the skillbar
change actor for actor id, item for item id, slot for the slot name symbol
Exp: $game_party.set_item(1, 20, :H)
- $game_party.set_skill(actor, skill, slot) - samething as items
- SceneManager.call(Scene_QuickTool) - call the quick tool window manually
- SceneManager.call(Scene_CharacterSet) - call the player slection manually
- $game_player.pop_damage('something') - display pop text over the player
- $game_map.events.pop_damage('') - display pop text over the event id
================================================================================
* Tools Notetags
Tools are the weapon, armor, items and skills used in the map to damage enemies
Here i going to explain you how to create your own tools to be used on map, and
the explanation of each term definition, The example below how to create a
usable Axe on map.
Copy this tool settings to any Weapon, Armor, Item, Skill note tags
User Graphic = $Axe
User Anime Speed = 30
Tool Cooldown = 30
Tool Graphic = nil
Tool Index = 0
Tool Size = 1
Tool Distance = 1
Tool Effect Delay = 10
Tool Destroy Delay = 20
Tool Speed = 5
Tool Cast Time = 0
Tool Cast Animation = 0
Tool Blow Power = 1
Tool Piercing = true
Tool Animation When = end
Tool Animation Repeat = false
Tool Special = nil
Tool Target = false
Tool Invoke Skill = 0
Tool Guard Rate = 0
Tool Knockdown Rate = 70
Tool Sound Se = nil
Tool Cooldown Display = false
Tool Item Cost = 0
Tool Short Jump = false
Tool Through = true
Tool Priority = 1
Tool Hit Shake = false
Tool Self Damage = false
Tool Combo Tool = nil
Important!: You CANNOT leave extra empty spaces between the tool variables
definition, just copy and paste that variables to the note tags and edit values
Here the terms explanation
User Graphic = $Axe
- This define the user graphic displayed when the tool is used, if you dont want
to show graphic puts nil. If you want to show a COSTUMED graphic for the user
writte the keyword custom then graphic name ex: custom $Hero_Skill
User Anime Speed = 30
- This define the user graphic animation speed when using the tool, the user
stop movemnet and do step anime, time in frames
Tool Cooldown = 30
- Cooldown is the time you have to wait before using the tool, this gives
balance to the tool system, time measured in frames
Tool Graphic = nil
- This define the tool graphic projectile showed when using the tool, in this
case no graphic will be displayed, puts nil for not graphic showing
Tool Index = 0
- This defines graphic index of the tool graphic, so you can use a full sheet.
and set the index of the used graphic
Tool Size = 1
- This defines the tool size measured in tiles, this tool has 1 tile size,
Set greater numbers when you create big tools or area attacks
Tool Distance = 1
- This is the distance the projectile going to do, distance is measured in tiles
this tools has only 1 tile of trajectory.
Tool Effect Delay = 10
- How long the tool going to take to make effect over a target? time measured in
frames, tools such as bombs take a longer time to make effect so...
Tool Destroy Delay = 20
- How long the tool going to take to be destroyed? the time start counting when
the tool distance is done, time measured in tiles.
Tool Speed = 5
- This defines the tool movement speed, choose a number between 1 to 6
remeber that tools are represented by a character.
Tool Cast Time = 0
- This defines the Tools casting time, time measured in frames, this tool has
not casting time, puts 0 for not casting time
Tool Cast Animation = 0
- Animation played when casting the tool, this is displayed if there is cas time
obviously, change integer for the animation id
Tool Blow Power = 1
- This defines the target steps backwars when was hit by the tool, change the
integer for tiles distance
Tool Piercing = true
- The tool going to pierce the enemy? change true or false
Tool Animation When = end
- This defines when the animation going to be played, you have 4 options
end - Animation is played righ before destroyed
acting - Animation is played when the tool is used
hit - Animation is played when hit the target
delay x - Animation is played when the tool detroy delay reachs
the x integer, for example, a bomb display the animation after
some delay before the tools is detroyed. change x for a number
Tool Animation Repeat = false
- This defines whether the animation going to be repeated, this only works
if you set the animation to be played when 'acting'
Tool Special = nil
- This define tool special predefined behavior, you have 11 options available
shield - The tool behave like a shield, this works for tagged armors
and the state guard is applied to the user, when using it
hook - The tools set the hookshot mode, hook can, grab, pull etc.
area - Tool become an area atack around the caster, or target
spiral - The tool become spiral attack, the user going to make some
rounds, the number on rounds is equal to the Tool Distance
boomerang - Tool becomes a boomerang, boomerang can grab drops, tagged
events, and can be redirectioned with the input keys
triple - Loads 3 projectiles at the time, 2 diagonals and 1 straigh
quintuple - Loads 5 projectiles at the time, 2 diagonals, 2 cross and
one straight forward
octuple - Loads 8 projectiles in all direction including diagonals
autotarget - The tool move straight and looks for a random target
near the user
random - Tool moves 2 steps forward and them make random movements
common_event x - This is one of the most powerfull features of Pearl ABS
this extract the move route from a common event to be used
by the tool, everything you delcare in the move route will
affect the tool, you can use the attack script calls inside
the move route. (used to create tools such as summons)
change x for the common event id
Note: Tool special take some default values, for example the tool distance
is reseted, tool targeting may be disabled, destroy delay reseted etc.
Tool Target = false
- This defines if the tool needs a target to be triggered, A scene selection is
showed for the player, the followers picks a random target, enemies takes agro
Tool Invoke Skill = 0
- Deafault battle system for weapons invoke skill 1,for defending invoke skill 2
So Pearl abs lets you invoke any skill when using a weapon or armor.
set 0 if you want to take the defaults, skills and items invoke themself so...
Tool Guard Rate = 0
- This only work for armors tagged with tool special 'shield', this define
the rate of guard of the shield, puts a number between 1 and 100
when gaurd succes the user takes no damage, otherwise, take block damage
Tool Knockdown Rate = 70
- This is a great feature of pearl abs, tools are able to knock the target down
for a short time in order to cancel casting spells etc, puts a number
between 1 and 100
Tool Sound Se = nil
- Sound SE played when using the tool, if you dont want sounds puts nil
Tool Cooldown Display = false
- The cool down time is displayed on the skillbar when using a tool
puts false if you dont want to display the cooldown
Tool Item Cost = 0
- This is the Pearl ABS ammo system, every single armor, weapon, item skills can
have an item cost, puts the item id the tools needs to be triggered
this is used to create tools likes, bows that consume arrows, bombs etc.
Tool Short Jump = false
- The tool going to guve a shor jump when triggered, change true or false
Tool Through = true
- Tools go through walls, trees, rocks etc?
Tool Priority = 1
- Priority of the tool, 0 = below characters, 1 = same as characters,
2 = above characters
Tool Hit Shake = false
- Do you want the screen to shake when the tool hit a target? true / false
Tool Self Damage = false
- Do you want the tool to damage the user? (example bombs can have self damage)
Tool Combo Tool = nil
- tools can have a combo chain, this tool has not a combo cuz is defined to nil
if you want to make combos you have to put this parameters to define it
type, id, chance, jump? . type is tool type: weapon, armor, item or skill
id is the tool id, chance must be a number between 1 and 100, write jump if
you want the user to jump if you dont want to jump writte nil
here an example: weapon, 63, 75, jump
uses weapon id 63 with a 75% chance and a jump will be performed (simple)
* Optionals tools notetags
<ignore_voices> When using the tool no battler voices are played
<ignore_followers> The tool ignore damage to the followers
================================================================================
=end
Pearl kernel
#===============================================================================
# * Falcao Pearl ABS script shelf # 1
#
# This script is the Heart of Pearl ABS Liquid, it handles all the character
# management, the tools variables and the input module, enemy registration etc.
#===============================================================================
module PearlKernel
# Default enemy sensor self switch
Enemy_Sensor = "B"
# Default enemy sensor (distance in tiles the enemy is able to see the Player
Sensor = 7
# Default enemy knockdown self switch (used to display knockdowned graphic)
KnockdownSelfW = "C"
# Deafault Enemy collapse
DefaultCollapse = 'zoom_vertical'
# While in party battle on map, the game player is the manager of the group
# Which distance the player can see the enemies?, this is used, to determine
# wheter the follower can start fighting. enemy away from this tiles
# whil be ignored untill the player is near them
# distamce measured in tiles
PlayerRange = 7
# When a follower fail an action this balloon is played, runs out of mana etc.
FailBalloon = 1
# Start the game with the ABS huds turned on?
StartWithHud = true
# Do you want to activate the followers dead poses?
FollowerDeadPose = true
# Do you want to activate the single player mode?
# this only avoid you accesing the player slection menu and the K key is used
# to open the quick tool selection menu
SinglePlayer = true
#-----------------------------------------------------------------------------
@gaugeback = Color.new(0, 0, 0, 100)
def self.draw_hp(obj, battler, x, y, w, h, color, name=nil)
tag = 'Hp' ; c = color
name = battler.name if !name.nil?
draw_gauge(obj, battler.hp, battler.mhp, x, y, w, h, c, tag, name)
end
def self.draw_mp(obj, battler, x, y, w, h, color, name=nil)
tag = 'Mp' ; c = color
name = battler.name if !name.nil?
draw_gauge(obj, battler.mp, battler.mmp, x, y, w, h, c, tag, name)
end
def self.draw_exp(obj, battler, x, y, w, h, color, name=nil)
tag = 'Exp' ; c = color
name = battler.name if !name.nil?
draw_gauge(obj,battler.exp, battler.next_level_exp, x, y, w, h, c, tag,name)
end
def self.draw_tp(obj, x, y, actor)
string = 'Tp ' + (actor.tp).to_i.to_s
obj.fill_rect(x, y + 10 , string.length * 9, 12, @gaugeback)
obj.draw_text(x, y, obj.width, 32, string)
end
def self.draw_gauge(obj, nm, max, x, y, w, h, col, tag, name)
obj.font.shadow = true
w2 = w - 2 ; max = 1 if max == 0
obj.fill_rect(x, y - 1, w, h + 2, @gaugeback)
obj.fill_rect(x+1, y+1, w2*nm/max, h/2 - 1, col)
obj.fill_rect(x+1, y + h/2, w2*nm/max, h/2 - 1, col)
obj.draw_text(x, y + h - 22, w, 32, nm.to_s, 2)
obj.draw_text(x + 4, y + h - 22, w, 32, tag)
obj.draw_text(x, y - 25, w, 32, name, 1) if !name.nil?
end
# image based bars definition
def self.image_hp(bitmap, x, y, back, image, battler, name=nil)
tag = 'Hp'
name = battler.name if !name.nil?
draw_i_gauge(bitmap, x, y, back, image, battler.hp, battler.mhp, tag, name)
end
def self.image_mp(bitmap, x, y, back, image, battler, name=nil)
tag = 'Mp'
name = battler.name if !name.nil?
draw_i_gauge(bitmap, x, y, back, image, battler.mp, battler.mmp, tag, name)
end
def self.image_exp(bitmap, x, y, back, image, battler, name=nil)
tag = 'Exp'
name = battler.name if !name.nil?
exp, nexte = battler.exp, battler.next_level_exp
draw_i_gauge(bitmap, x, y, back, image, exp, nexte, tag, name)
end
def self.draw_i_gauge(bitmap, x, y, back, image, nm, max, tag, name)
cw = back.width
ch = back.height
max = 1 if max == 0
src_rect = Rect.new(0, 0, cw, ch)
bitmap.blt(x - 10, y - ch + 30, back, src_rect)
cw = image.width * nm / max
ch = image.height
src_rect = Rect.new(0, 0, cw, ch)
bitmap.blt(x - 10, y - ch + 30, image, src_rect)
bitmap.draw_text(x - 4, y + back.height - 14, back.width, 32, tag)
bitmap.draw_text(x - 12, y + back.height - 14, back.width, 32, nm.to_s, 2)
bitmap.draw_text(x - 6, y - 10, back.width, 32, name, 1) if !name.nil?
end
def self.has_data?
!user_graphic.nil?
end
def self.load_item(item)
@item = item
end
def self.user_graphic() @item.tool_data("User Graphic = ", false) end
def self.user_animespeed() @item.tool_data("User Anime Speed = ") end
def self.tool_cooldown() @item.tool_data("Tool Cooldown = ") end
def self.tool_graphic() @item.tool_data("Tool Graphic = ", false) end
def self.tool_index() @item.tool_data("Tool Index = ") end
def self.tool_size() @item.tool_data("Tool Size = ") end
def self.tool_distance() @item.tool_data("Tool Distance = ") end
def self.tool_effectdelay() @item.tool_data("Tool Effect Delay = ") end
def self.tool_destroydelay() @item.tool_data("Tool Destroy Delay = ") end
def self.tool_speed() @item.tool_float("Tool Speed = ") end
def self.tool_castime() @item.tool_data("Tool Cast Time = ") end
def self.tool_castanimation() @item.tool_data("Tool Cast Animation = ") end
def self.tool_blowpower() @item.tool_data("Tool Blow Power = ") end
def self.tool_piercing() @item.tool_data("Tool Piercing = ", false) end
def self.tool_animation() @item.tool_data("Tool Animation When = ", false) end
def self.tool_anirepeat() @item.tool_data("Tool Animation Repeat = ",false)end
def self.tool_special() @item.tool_data("Tool Special = ", false) end
def self.tool_target() @item.tool_data("Tool Target = ", false) end
def self.tool_invoke() @item.tool_data("Tool Invoke Skill = ") end
def self.tool_guardrate() @item.tool_data("Tool Guard Rate = ") end
def self.tool_knockdown() @item.tool_data("Tool Knockdown Rate = ") end
def self.tool_soundse() @item.tool_data("Tool Sound Se = ", false) end
def self.tool_itemcost() @item.tool_data("Tool Item Cost = ") end
def self.tool_shortjump() @item.tool_data("Tool Short Jump = ", false) end
def self.tool_through() @item.tool_data("Tool Through = ", false) end
def self.tool_priority() @item.tool_data("Tool Priority = ") end
def self.tool_selfdamage() @item.tool_data("Tool Self Damage = ", false) end
def self.tool_hitshake() @item.tool_data("Tool Hit Shake = ", false) end
def self.tool_combo() @item.tool_data("Tool Combo Tool = ", false) end
def self.knock_actor(actor)
a = actor.actor.tool_data("Knockdown Graphic = ", false)
b = actor.actor.tool_data("Knockdown Index = ")
c = actor.actor.tool_data("Knockdown pattern = ")
d = actor.actor.tool_data("Knockdown Direction = ")
return nil if a.nil?
return
end
def self.jump_hit?(target)
t = target.enemy.tool_data("Hit Jump = ", false) if target.is_a?(Game_Enemy)
t = target.actor.tool_data("Hit Jump = ", false) if target.is_a?(Game_Actor)
return true if !t.nil? and t == "true"
return true if t.nil?
return false
end
def self.voices(b)
voices = b.actor.tool_data("Battler Voices = ",false) if b.is_a?(Game_Actor)
voices = b.enemy.tool_data("Battler Voices = ",false) if b.is_a?(Game_Enemy)
voices = voices.split(", ") unless voices.nil?
voices
end
def self.hitvoices(b)
voices = b.actor.tool_data("Hit Voices = ",false) if b.is_a?(Game_Actor)
voices = b.enemy.tool_data("Hit Voices = ",false) if b.is_a?(Game_Enemy)
voices = voices.split(", ") unless voices.nil?
voices
end
# check for iconset
def self.check_iconset(item, tag, object)
data = item.tool_data(tag, false)
return if data.nil?
v = if data == "animated" ||
data == "static" || data == "shielding"
object.is_a?(Projectile) ? object.pro_iconset = v : object.user_iconset = v
end
def self.clean_back?
@clean_back == true
end
end
($imported ||= {}) = true
class RPG::BaseItem
attr_reader :has_data
def tool_data(comment, sw=true)
if @note =~ /#{comment}(.*)/i
@has_data = true
return sw ? $1.to_i : $1.to_s.sub("\r","")
end
end
def tool_float(comment)
return $1.to_f if @note =~ /#{comment}(.*)/i
end
def cool_enabled?
@cd_dis = @note.include?("Tool Cooldown Display = true") if @cd_dis.nil?
@cd_dis
end
def itemcost
if @i_cost.nil?
@note =~ /Tool Item Cost = (.*)/i ? @i_cost = $1.to_i : @i_cost = 0
end
@i_cost
end
end
# Pearl ABS Input module
module PearlKey
# numbers
N0 = 0x30; N1 = 0x31; N2 = 0x32; N3 = 0x33; N4 = 0x34
N5 = 0x35; N6 = 0x36; N7 = 0x37; N8 = 0x38; N9 = 0x39
# keys
A = 0x41; B = 0x42; C = 0x43; D = 0x44; E = 0x45
F = 0x46; G = 0x47; H = 0x48; I = 0x49; J = 0x4A
K = 0x4B; L = 0x4C; M = 0x4D; N = 0x4E; O = 0x4F
P = 0x50; Q = 0x51; R = 0x52; S = 0x53; T = 0x54
U = 0x55; V = 0x56; W = 0x57; X = 0x58; Y = 0x59; Z = 0x5A
@unpack_string = 'b'*256
@last_array = '0'*256
@press = Array.new(256, false)
@trigger = Array.new(256, false)
@release = Array.new(256, false)
@getKeyboardState = Win32API.new('user32', 'GetKeyboardState', , 'V')
@getAsyncKeyState = Win32API.new('user32', 'GetAsyncKeyState', 'i', 'i')
@getKeyboardState.call(@last_array)
@last_array = @last_array.unpack(@unpack_string)
for i in 0...@last_array.size
@press = @getAsyncKeyState.call(i) == 0 ? false : true
end
def self.update
@trigger = Array.new(256, false)
@release = Array.new(256, false)
array = '0'*256
@getKeyboardState.call(array)
array = array.unpack(@unpack_string)
for i in 0...array.size
if array != @last_array
@press = @getAsyncKeyState.call(i) == 0 ? false : true
if !@press
@release = true
else
@trigger = true
end
else
if @press == true
@press = @getAsyncKeyState.call(i) == 0 ? false : true
@release = true if !@press
end
end
end
@last_array = array
end
def self.press?(key)
return @press
end
def self.trigger?(key)
return @trigger
end
end
# Input module update engine
class << Input
alias falcaopearl_abs_cooldown_update update
def Input.update
update_pearl_abs_cooldown
update_popwindow if !$game_temp.nil? and !$game_temp.pop_windowdata.nil?
update_pearl_abs_respawn
falcaopearl_abs_cooldown_update
end
def update_pearl_abs_respawn
$game_map.event_enemies.each do |event|
if event.respawn_count > 0
event.respawn_count -= 1
if event.respawn_count == 0
event.battler.remove_state(event.battler.death_state_id)
event.battler.hp = event.battler.mhp
event.battler.mp = event.battler.mmp
event.apply_respawn
event.animation_id = event.respawn_anim
end
end
end
end
alias falcaopearl_trigger trigger?
def trigger?(constant)
return true if constant == :B and PearlKey.trigger?(PearlKey::B)
falcaopearl_trigger(constant)
end
# pop window global
def update_popwindow
$game_temp.pop_windowdata -= 1 if $game_temp.pop_windowdata > 0
if @temp_window.nil?
tag = $game_temp.pop_windowdata
string = $game_temp.pop_windowdata + tag
width = (string.length * 9) - 10
x, y = Graphics.width / 2 - width / 2, Graphics.height / 2 - 64 / 2
@temp_window = Window_Base.new(x, y, width, 64)
@temp_window.contents.font.size = 20
@temp_window.draw_text(-10, -6, width, 32, tag, 1)
@temp_window.draw_text(-10, 14, width, 32, $game_temp.pop_windowdata,1)
@current_scene = SceneManager.scene.class
end
if $game_temp.pop_windowdata == 0 ||
@current_scene != SceneManager.scene.class
@temp_window.dispose
@temp_window = nil
$game_temp.pop_windowdata = nil
end
end
def update_pearl_abs_cooldown
PearlKey.update
eval_cooldown($game_party.all_members) if !$game_party.nil?
eval_cooldown($game_map.enemies) if !$game_map.nil?
end
# cooldown update
def eval_cooldown(operand)
for sub in operand
sub.skill_cooldown.each {|sid, sv| # skill
if sub.skill_cooldown > 0
sub.skill_cooldown -= 1
sub.skill_cooldown.delete(sid) if sub.skill_cooldown == 0
end}
sub.item_cooldown.each {|iid, iv| # item
if sub.item_cooldown > 0
sub.item_cooldown -= 1
sub.item_cooldown.delete(iid) if sub.item_cooldown == 0
end}
sub.weapon_cooldown.each {|wid, wv| # weapon
if sub.weapon_cooldown > 0
sub.weapon_cooldown -= 1
sub.weapon_cooldown.delete(wid) if sub.weapon_cooldown == 0
end}
sub.armor_cooldown.each {|aid, av| #armor
if sub.armor_cooldown > 0
sub.armor_cooldown -= 1
sub.armor_cooldown.delete(aid) if sub.armor_cooldown == 0
end}
end
end
end
#===============================================================================
#===============================================================================
# Game character
class Game_CharacterBase
attr_accessor :just_hitted, :anime_speed, :blowpower, :targeting, :x, :y
attr_accessor :battler_guarding, :knockdown_data, :colapse_time, :opacity
attr_accessor :zoomfx_x, :zoomfx_y, :targeted_character, :stuck_timer
attr_accessor :send_dispose_signal, :follower_attacktimer, :stopped_movement
attr_accessor :hookshoting, :battler_chain, :pattern, :user_move_distance
attr_accessor :move_speed, :through, :being_grabbed, :making_spiral
attr_accessor :direction, :direction_fix, :zfx_bol, :buff_pop_stack
attr_accessor :die_through, :target_index, :using_custom_g, :combodata
attr_accessor :originalasp, :doingcombo, :angle_fx
attr_accessor :user_iconset, :pro_iconset, :respawn_count
alias falcaopearl_abmain_ini initialize
def initialize
@zfx_bol = false
@just_hitted = 0
@anime_speed = 0
@respawn_count = 0
@blowpower =
@user_casting =
@send_dispose_signal = false
@targeting =
@colapse_time = 0
@stopped_movement = 0
@follower_attacktimer = 0
set_hook_variables
@target_index = 0
@using_custom_g = false
@combodata =
@angle_fx = 0.0
#--------------
@zoomfx_x = 1.0
@zoomfx_y = 1.0
@stuck_timer = 0
@battler_guarding =
@knockdown_data =
@state_poptimer =
@making_spiral = false
@buff_pop_stack =
@doingcombo = 0
@range_view = 2
@originalasp = 0
falcaopearl_abmain_ini
end
def set_hook_variables
@hookshoting =
@battler_chain =
@user_move_distance =
@being_grabbed = false
end
# projectiles at nt
def projectiles_xy_nt(x, y)
$game_player.projectiles.select {|pro| pro.pos_nt?(x, y) }
end
# collide with projectiles
def collide_with_projectiles?(x, y)
projectiles_xy_nt(x, y).any? do |pro|
pro.normal_priority? || self.is_a?(Projectile)
end
end
def zoom(x, y)
@zoomfx_x = x
@zoomfx_y = y
end
alias falcaopearl_collide_with collide_with_characters?
def collide_with_characters?(x, y)
return true if collide_with_projectiles?(x, y)
falcaopearl_collide_with(x, y)
end
# follow character straigh and diagonal
def follow_char(character)
sx = distance_x_from(character.x)
sy = distance_y_from(character.y)
if sx != 0 && sy != 0
move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
elsif sx != 0
move_straight(sx > 0 ? 4 : 6)
elsif sy != 0
move_straight(sy > 0 ? 8 : 2)
end
end
def on_battle_screen?(out = 0)
max_w = (Graphics.width / 32).to_i - 1
max_h = (Graphics.height / 32).to_i - 1
sx = (screen_x / 32).to_i
sy = (screen_y / 32).to_i
if sx.between?(0 - out, max_w + out) and sy.between?(0 - out, max_h + out)
return true
end
return false
end
# jump to specific tiles
def jumpto_tile(x, y)
jumpto(0, )
end
# jumpto character ( 0 = Game Player, 1 and up event id)
def jumpto(char_id, tilexy=nil)
char_id > 0 ? char = $game_map.events : char = $game_player
tilexy.nil? ? condxy = : condxy = [tilexy, tilexy]
jx = + eval_distance(tilexy.nil? ? char : tilexy) if condxy >= @x
jy = - eval_distance(tilexy.nil? ? char : tilexy) if condxy <= @y
jx = - eval_distance(tilexy.nil? ? char : tilexy) if condxy <= @x
jy = - eval_distance(tilexy.nil? ? char : tilexy) if condxy <= @y
jx = - eval_distance(tilexy.nil? ? char : tilexy) if condxy <= @x
jy = + eval_distance(tilexy.nil? ? char : tilexy) if condxy >= @y
jx = + eval_distance(tilexy.nil? ? char : tilexy) if condxy >= @x
jy = + eval_distance(tilexy.nil? ? char : tilexy) if condxy >= @y
jump(jx, jy)
end
# distance
def eval_distance(target)
if target.is_a?(Array)
distance_x = (@x - target).abs
distance_y = (@y - target).abs
else
distance_x = (@x - target.x).abs
distance_y = (@y - target.y).abs
end
return
end
# check if the game player and follower are executing an action
def battler_acting?
return true if @user_casting > 0 || @targeting
return true if @knockdown_data > 0 and battler.deadposing.nil?
return true if @anime_speed > 0
return true if @hookshoting || @making_spiral
if self.is_a?(Game_Player)
$game_player.followers.each {|f| return true if f.battler_acting?}
end
return false
end
def battler
end
#use single tools
def use_weapon(id)
return unless tool_can_use?
process_tool_action($data_weapons)
end
def use_item(id)
return unless tool_can_use?
process_tool_action($data_items)
end
def use_skill(id)
return unless tool_can_use?
process_tool_action($data_skills)
end
def use_armor(id)
return unless tool_can_use?
process_tool_action($data_armors)
end
# use multiple tools
def rand_weapon(*args)
return unless tool_can_use?
process_tool_action($data_weapons[args])
end
def rand_item(*args)
return unless tool_can_use?
process_tool_action($data_items[args])
end
def rand_skill(*args)
return unless tool_can_use?
process_tool_action($data_skills[args])
end
def rand_armor(*args)
return unless tool_can_use?
process_tool_action($data_armors[args])
end
def tool_can_use?
return false if @hookshoting || @making_spiral
return false if @user_casting > 0 || @targeting
return false if battler.nil?
return false if battler.dead?
return false if @doingcombo > 0 || @battler_guarding
return false if $game_message.busy?
return true
end
def load_target_selection(item)
@targeting = true; @targeting = item
if self.is_a?(Game_Player)
$game_player.pearl_menu_call =
elsif self.is_a?(Game_Follower)
@targeting = @targeted_character
@targeting = if @targeting.nil?
elsif self.is_a?(Projectile)
if user.is_a?(Game_Player)
user.targeting = true; user.targeting = item
$game_player.pearl_menu_call =
end
if user.is_a?(Game_Follower)
@targeting = user.targeted_character
@targeting = if @targeting.nil?
end
end
end
def playdead
@angle_fx = 90
end
def resetplaydead
@angle_fx = 0.0
end
#action canceling
def force_cancel_actions
@user_casting = 0
@anime_speed = 0
end
def speed(x)
@move_speed = x
end
def anima(x)
@animation_id = x
end
# aply melee params
def apply_weapon_param(weapon, add)
id = 0
for param in weapon.params
add ? battler.add_param(id, param) : battler.add_param(id, -param)
id += 1
end
end
# Short script call for poping damage text
def pop_damage(custom=nil)
$game_player.damage_pop.push(DamagePop_Obj.new(self, custom))
end
#check if target is unable to move
def force_stopped?
return true if @anime_speed > 0 || @knockdown_data > 0 ||
@stopped_movement > 0 || @hookshoting || @angle_fx != 0.0
return true if @making_spiral
return false
end
# sensor
def obj_size?(target, size)
return false if size.nil?
distance = (@x - target.x).abs + (@y - target.y).abs
enable = (distance <= size-1)
return true if enable
return false
end
# sensor body
def body_size?(target, size)
distance = (@x - target).abs + (@y - target).abs
enable = (distance <= size-1)
return true if enable
return false
end
def faceto_face?(target)
return true if @direction == 2 and target.direction == 8
return true if @direction == 4 and target.direction == 6
return true if @direction == 6 and target.direction == 4
return true if @direction == 8 and target.direction == 2
return false
end
def adjustcxy
push_x, push_y = 0, 1 if @direction == 2
push_x, push_y = - 1, 0 if @direction == 4
push_x, push_y = 1, 0 if @direction == 6
push_x, push_y = 0, - 1 if @direction == 8
return
end
def in_frontof?(target)
return true if @direction == 2 and @x == target.x and (@y+1) == target.y
return true if @direction == 4 and (@x-1) == target.x and @y == target.y
return true if @direction == 6 and (@x+1) == target.x and @y == target.y
return true if @direction == 8 and @x == target.x and (@y-1) == target.y
return false
end
# detect map edges ignoring loop maps
def facing_corners?
case $game_map.map.scroll_type
when 1 then return false if @direction == 2 || @direction == 8
when 2 then return false if @direction == 4 || @direction == 6
when 3 then return false
end
m = $game_map
unless @x.between?(1, m.width - 2) && @y.between?(1, m.height - 2)
return true if @x == 0 and @direction == 4
return true if @y == 0 and @direction == 8
return true if @x == m.width - 1 and @direction == 6
return true if @y == m.height - 1 and @direction == 2
end
return false
end
# item usable test
def usable_test_passed?(item)
return true if battler.is_a?(Game_Enemy) && item.is_a?(RPG::Item)
itemcost = item.tool_data("Tool Item Cost = ")
invoke = item.tool_data("Tool Invoke Skill = ")
if battler.is_a?(Game_Actor) and itemcost != nil and itemcost != 0
return false if !battler.usable?($data_items)
end
if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
return false if !battler.usable?(item)
else
if invoke != nil and invoke != 0
return false if !battler.usable?($data_skills)
else
return false if !battler.attack_usable?
end
end
return true
end
# process the tool and verify wheter can be used
def process_tool_action(item)
PearlKernel.load_item(item)
return if !battler.tool_ready?(item)
unless PearlKernel.has_data?
if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
msgbox('Tool data missing') if $DEBUG
return
end
if item.scope.between?(1, 6)
msgbox('Tool data missing') if $DEBUG
return
elsif item.scope == 0
return
elsif !battler.usable?(item)
RPG::SE.new("Cursor1", 80).play if self.is_a?(Game_Player)
return
end
end
if PearlKernel.has_data? and not usable_test_passed?(item)
RPG::SE.new("Cursor1", 80).play if self.is_a?(Game_Player)
return
end
@user_casting = if PearlKernel.has_data?
if @user_casting > 0
@animation_id = 0
@animation_id = PearlKernel.tool_castanimation
else
load_abs_tool(item)
end
end
# load the abs tool
def load_abs_tool(item)
return if @knockdown_data > 0
PearlKernel.load_item(item)
return if self.is_a?(Game_Follower) and @targeted_character.nil?
if !@targeting and self.battler.is_a?(Game_Actor)
if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
# apply target to skills items
if PearlKernel.tool_target == "true" || item.scope == 7 ||
item.scope == 9
load_target_selection(item)
return
end
else
# apply target parsing the invoked skill to weapons and armors
invoke = PearlKernel.tool_invoke
if invoke != nil && invoke > 0 && invoke != 1 && invoke != 2
invokeskill = $data_skills
if PearlKernel.tool_target == "true" || invokeskill.scope == 7 ||
invokeskill.scope == 9
load_target_selection(item)
return
end
# apply target to normal weapon and armor without invoking
else
if PearlKernel.tool_target == "true"
load_target_selection(item)
return
end
end
end
end
if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
battler.use_item(item)
else
if PearlKernel.tool_invoke != 0
battler.use_item($data_skills)
end
end
# if the tool has data continue
if PearlKernel.has_data?
consume_ammo_item(item) if battler.is_a?(Game_Actor) and
PearlKernel.tool_itemcost != 0
@anime_speed = PearlKernel.user_animespeed
battler.apply_cooldown(item, PearlKernel.tool_cooldown)
end
create_projectile_object(item)
create_anime_sprite_object(item)
end
# projectile creator
def create_projectile_object(item)
if PearlKernel.tool_special == "hook"
PearlKernel.tool_distance.times {|i|
$game_player.projectiles.push(Projectile.new(self, item, i))}
@hookshoting = true
elsif PearlKernel.tool_special == "triple" # loads 3 projectiles
for i in
$game_player.projectiles.push(Projectile.new(self, item, i))
end
elsif PearlKernel.tool_special == "quintuple" #loads 5 projectiles
for i in
$game_player.projectiles.push(Projectile.new(self, item, i))
end
elsif PearlKernel.tool_special == "octuple" # loads 8 projectiles
for i in
$game_player.projectiles.push(Projectile.new(self, item, i))
end
else # load default projectile
$game_player.projectiles.push(Projectile.new(self, item))
end
end
# User anime sprite creation
def create_anime_sprite_object(item)
$game_player.anime_action.each {|i|
if i.user == self
if i.custom_graphic
@transparent = false
i.user.using_custom_g = false
end
$game_player.anime_action.delete(i)
end}
if PearlKernel.user_graphic != "nil"
return if PearlKernel.user_graphic.nil?
$game_player.anime_action.push(Anime_Obj.new(self, item))
end
# using iconset graphic
if PearlKernel.user_graphic == "nil" and
!item.tool_data("User Iconset = ", false).nil?
return if PearlKernel.user_graphic.nil?
$game_player.anime_action.push(Anime_Obj.new(self, item))
end
end
# consume ammo item
def consume_ammo_item(item)
itemcost = $data_items
return if item.is_a?(RPG::Item) and item.consumable and item == itemcost
battler.use_item(itemcost)
end
alias falcaopearl_chaupdate update
def update
update_falcao_pearl_abs
falcaopearl_chaupdate
end
# Falcao pearl abs main update
def update_falcao_pearl_abs
if @user_move_distance > 0 and not moving?
move_forward ; @user_move_distance -= 1
end
return if battler.nil?
update_pearlabs_timing
update_followers_attack if self.is_a?(Game_Follower) && self.visible?
if @targeting != nil
load_abs_tool(@targeting) if battler.is_a?(Game_Actor)
@targeting =
end
update_battler_collapse
update_state_effects
@combodata.each {|combo|
if combo > 0
combo -= 1
if combo == 0
perform_combo(combo, combo, combo)
@combodata.delete(combo)
end
break
end}
end
def perform_combo(kind, id, jumpp)
if jumpp == 'jump'
jump(0, 0)
move_forward
end
case kind
when :weapon then use_weapon(id)
when :armor then use_armor(id)
when :item then use_item(id)
when :skill then use_skill(id)
end
@doingcombo = 12
end
#========================================================================
# * followers attacks engine
def fo_tool
return actor.equips if actor.primary_use == 1
return actor.equips if actor.primary_use == 2
return actor.assigned_item if actor.primary_use == 3
return actor.assigned_item2 if actor.primary_use == 4
return actor.assigned_skill if actor.primary_use == 5
return actor.assigned_skill2 if actor.primary_use == 6
return actor.assigned_skill3 if actor.primary_use == 7
return actor.assigned_skill4 if actor.primary_use == 8
end
# followers attack engine
def update_followers_attack
if fo_tool.nil? || battler.dead?
@targeted_character = nil if @targeted_character != nil
return
end
return if @stopped_movement > 0
if @follower_attacktimer > 0
@follower_attacktimer -= 1
if @follower_attacktimer == 40 and !moving?
r = rand(3)
move_random if r == 0 || r == 1
move_away_from_character(@targeted_character) if
!@targeted_character.nil? and r == 2
end
end
# si la skill es para el player
if @targeted_character != nil and @targeted_character.is_a?(Game_Player)
if all_enemies_dead?
delete_targetf
return
end
use_predefined_tool
return
end
# si la skill es para un enemigo continuar
if @targeted_character != nil
use_predefined_tool
return if @targeted_character.nil?
# reset if the target is dead
if @targeted_character.collapsing?
force_cancel_actions
delete_targetf
end
else
# select a follower slected target
$game_player.followers.each do |follower|
if !follower.targeted_character.nil?
next if follower.targeted_character.is_a?(Game_Player)
if follower.stuck_timer >= 10
follower.targeted_character = nil
return
end
@targeted_character = follower.targeted_character
break
end
end
end
end
# prepare the tool usage
def setup_followertool_usage
@range_view = 2
@range_view = 6 if fo_tool.tool_data("Tool Target = ", false) == "true" ||
fo_tool.tool_data("Tool Special = ", false) == "autotarget"
if fo_tool.is_a?(RPG::Skill) || fo_tool.is_a?(RPG::Item)
if fo_tool.scope.between?(1, 6)
setup_target
else ; @targeted_character = $game_player
@range_view = 6
end
# prepare tool for invoke follower
elsif fo_tool.is_a?(RPG::Weapon) || fo_tool.is_a?(RPG::Armor)
invoke = fo_tool.tool_data("Tool Invoke Skill = ")
if invoke > 0
if $data_skills.scope.between?(1, 6)
setup_target
else ; @targeted_character = $game_player
@range_view = 6
end
else
# no invoke skill just set up an enemy target
setup_target
end
end
end
# use the predifined tool
def use_predefined_tool
update_follower_movement
return if @targeted_character.nil?
if obj_size?(@targeted_character, @range_view) && @follower_attacktimer == 0
turn_toward_character(@targeted_character)
use_weapon(fo_tool.id) if actor.primary_use == 1
use_armor(fo_tool.id) if actor.primary_use == 2
use_item(fo_tool.id) if actor.primary_use == 3 || actor.primary_use == 4
use_skill(fo_tool.id) if actor.primary_use==5 || actor.primary_use==6 ||
actor.primary_use == 7 || actor.primary_use == 8
if fo_tool.tool_data("User Graphic = ", false).nil?
@targeted_character = nil
turn_toward_player
end
@follower_attacktimer = 60
end
delete_targetf if self.actor.dead?
end
def all_enemies_dead?
for event in $game_map.event_enemies
if event.on_battle_screen? && event.enemy_ready?
return false if $game_player.obj_size?(event,PearlKernel::PlayerRange+1)
end
end
return true
end
def delete_targetf
@targeted_character = nil
end
#------------------------
# follower movement attack
def reset_targeting_settings(target)
target.being_targeted = false if target.is_a?(Game_Event)
delete_targetf
turn_toward_player
@stuck_timer = 0
end
def update_follower_movement
target = @targeted_character
if @stuck_timer >= 30
reset_targeting_settings(target)
return
end
# if the follower is unabble to use the tool
unless usable_test_passed?(fo_tool)
if SceneManager.scene_is?(Scene_Map)
reset_targeting_settings(target)
@balloon_id = PearlKernel::FailBalloon
return
end
end
return if target.nil?
@stuck_timer += 1 if !obj_size?(target, @range_view) and !moving?
if moving? || @anime_speed > 0 || @making_spiral || @hookshoting ||
@knockdown_data > 0
@stuck_timer = 0
end
return if moving?
if fo_tool.tool_data("Tool Target = ", false) == "true" ||
fo_tool.tool_data("Tool Special = ", false) == "autotarget" ||
target.is_a?(Game_Player)
# using skill con target true magical
cpu_reactiontype(1, target)
return
# target not exist
else
if fo_tool.is_a?(RPG::Skill) || fo_tool.is_a?(RPG::Item)
fo_tool.scope.between?(1, 6) ? cpu_reactiontype(2, target) : # to enemy
cpu_reactiontype(1, target) # benefical
else
# for weapon armor without target
cpu_reactiontype(2, target)
end
end
return if !obj_size?(target, @range_view)
return if target.is_a?(Game_Player)
case rand(40)
when 4 then move_backward
when 10 then move_random
end
end
# cpu reaction
def cpu_reactiontype(type, target)
unless on_battle_screen?
3.times.each {|i| move_toward_player}
return
end
move_toward_character(target) if !obj_size?(target, @range_view) if type==1
if @follower_attacktimer == 0 || !obj_size?(target, @range_view)
move_toward_character(target) if type == 2
end
end
#-------------------------------------------------
# buff timer
def update_buff_timing
battler.buff_turns.each do |id, value|
if battler.buff_turns > 0
battler.buff_turns -= 1
if battler.buff_turns <= 0
battler.remove_buff(id)
pop_damage
end
end
end
end
#blow power effect
def update_blow_power_effect
if @blowpower > 0
@blowpower -= 1
if @blowpower == 0
@direction_fix = @blowpower
@move_speed = @blowpower
end
end
if @blowpower > 0 and !moving?
@move_speed = 5.5
@direction_fix = true
move_straight(@blowpower); @blowpower -= 1
if @blowpower == 0
@blowpower = 10
end
end
end
# Pearl timing
def update_pearlabs_timing
@just_hitted -= 1 if @just_hitted > 0
@stopped_movement -= 1 if @stopped_movement > 0
@doingcombo -= 1 if @doingcombo > 0
# hookshooting
if @hookshoting > 0
@hookshoting -= 1
if @hookshoting == 0
@hookshoting =
@user_move_distance.being_grabbed = false if
@user_move_distance.is_a?(Game_Event)
@user_move_distance = nil
end
end
update_buff_timing
update_blow_power_effect
# anime
if @anime_speed > 0
@pattern = 0
@anime_speed -= 1
end
# casting
if @user_casting > 0
@user_casting -= 1
load_abs_tool(@user_casting) if @user_casting == 0
end
update_knockdown
end
# Update battler collapse
def check_for_dead_four
return if $game_party.members.size <= 4
SceneManager.goto(Scene_Gameover) if all_fourdead?
end
def all_fourdead?
m = $game_party.battle_members
return true if m.dead? && m.dead? && m.dead? && m.dead?
return false
end
def update_battler_collapse
if @colapse_time > 0
@colapse_time -= 1
force_cancel_actions
if battler.is_a?(Game_Actor)
Sound.play_actor_collapse if @secollapse.nil?
@secollapse = true
if @colapse_time == 0
@secollapse = nil
for event in $game_map.event_enemies
if event.agroto_f == self
event.agroto_f = nil
end
end
check_for_dead_four
member = $game_party.battle_members
# swap and reset player
if self.is_a?(Game_Player)
reset_knockdown_actors
battler.deadposing=$game_map.map_id if PearlKernel::FollowerDeadPose
$game_party.swap_order(0,3) if !member.nil? and !member.dead?
$game_party.swap_order(0,2) if !member.nil? and !member.dead?
$game_party.swap_order(0,1) if !member.nil? and !member.dead?
else
if PearlKernel::FollowerDeadPose
battler.deadposing = $game_map.map_id
if !$game_player.follower_fighting? and member.size > 2
swap_dead_follower
else
$game_player.reserved_swap << battler.id if member.size > 2
end
end
end
end
elsif battler.is_a?(Game_Enemy)
@die_through = @through if @die_through.nil?
@through = true
apply_collapse_anime(battler.collapse_type)
@secollapse = true
battler.object ? @transparent = true : @opacity -= 2 if !@deadposee
if @colapse_time == 0
self.kill_enemy
end
end
end
end
def swap_dead_follower
reset_knockdown_actors
member = $game_party.battle_members
member.each_with_index.each do |actorr, i|
next unless actorr.id == self.actor.id
case member.size
when 3
break if i == 2
$game_party.swap_order(i, 2)
when 4
break if i == 3
if !member.dead?
$game_party.swap_order(i, 3)
break
end
if !member.dead?
$game_party.swap_order(i, 2)
break
end
end
end
end
def apply_collapse_anime(type)
# sound and animation
if battler.die_animation != nil
@animation_id = battler.die_animation if @secollapse.nil?
else
Sound.play_enemy_collapse if @secollapse.nil? and !battler.object
end
return if battler.object
if @deadposee
@knockdown_data = 8
return
end
type = PearlKernel::DefaultCollapse if type.nil?
case type.to_sym
when :zoom_vertical
@zoomfx_x -= 0.03
@zoomfx_y += 0.02
when :zoom_horizontal
@zoomfx_x += 0.03
@zoomfx_y -= 0.02
when :zoom_maximize
@zoomfx_x += 0.02
@zoomfx_y += 0.02
when :zoom_minimize
@zoomfx_x -= 0.02
@zoomfx_y -= 0.02
end
end
# konck down engine update
def update_knockdown
if @knockdown_data > 0
@knockdown_data -= 1
@knockdown_data == 0 ? knowdown_effect(2) : knowdown_effect(1)
if @knockdown_data != nil
@pattern = @knockdown_data
@direction = @knockdown_data
end
end
end
def knowdown_effect(type)
return if self.is_a?(Projectile)
if type == 1
if @knockdown_data == nil
if battler.is_a?(Game_Enemy)
if self.knockdown_enable
force_cancel_actions
self_sw = PearlKernel::KnockdownSelfW
$game_self_switches[] = true
@knockdown_data = self_sw
self.refresh
@knockdown_data = self.page.graphic.pattern
@knockdown_data = self.page.graphic.direction
$game_map.screen.start_shake(7, 4, 20)
end
@knockdown_data = 0 if @knockdown_data == nil
elsif battler.is_a?(Game_Actor)
if PearlKernel.knock_actor(self.actor) != nil and
if @knockdown_data == nil
force_cancel_actions
@knockdown_data = @character_name
@knockdown_data = @character_index
@character_name = PearlKernel.knock_actor(self.actor)
@character_index = PearlKernel.knock_actor(self.actor)
@knockdown_data = PearlKernel.knock_actor(self.actor)
@knockdown_data = PearlKernel.knock_actor(self.actor)
$game_map.screen.start_shake(7, 4, 20) if battler.deadposing.nil?
end
end
@knockdown_data = 0 if @knockdown_data == nil
end
end
elsif type == 2
if battler.is_a?(Game_Enemy)
if @deadposee and battler.dead?
@knockdown_data = nil
return
end
$game_self_switches[[$game_map.map_id, self.id,
@knockdown_data]] = false if @knockdown_data != nil
@knockdown_data = nil
else
@character_name = @knockdown_data
@character_index = @knockdown_data
@knockdown_data = nil
end
end
end
#================================
# states
def primary_state_ani
return nil if battler.states.nil?
return battler.states.tool_data("State Animation = ")
end
# higer priority state animation displayed
def update_state_effects
return if battler.nil?
@state_poptimer += 1 unless primary_state_ani.nil?
if @state_poptimer == 30
@animation_id = primary_state_ani
@animation_id = 0 if @animation_id.nil?
elsif @state_poptimer == 180
@state_poptimer = 0
end
update_state_action_steps
end
# update state actions
def update_state_action_steps
for state in battler.states
if state.remove_by_walking
if !battler.state_steps.nil? &&
battler.state_steps > 0
battler.state_steps -= 1
end
if battler.state_steps == 0
battler.remove_state(state.id)
pop_damage
end
end
if state.restriction == 4
@stopped_movement = 10
@pattern = 2 if @knockdown_data == 0
end
state.features.each do |feature|
if feature.code == 22
@knockdown_data =10 if state.restriction == 4 && feature.data_id==1
next unless feature.data_id.between?(7, 9)
apply_regen_state(state, feature.data_id)
end
end
end
end
# apply regen for hp, mp and tp
def apply_regen_state(state, type)
random = state.tool_data("State Effect Rand Rate = ")
random = 120 if random.nil?
if rand(random) == 1
battler.regenerate_hp if type == 7
battler.regenerate_mp if type == 8
battler.regenerate_tp if type == 9
if type == 7 and battler.result.hp_damage == 0
@colapse_time = 80
battler.add_state(1)
return
end
type == 9 ? pop_damage("Tp Up!") : pop_damage
end
end
alias falcaopearl_update_anime_pattern update_anime_pattern
def update_anime_pattern
return if @anime_speed > 0 || @knockdown_data > 0
falcaopearl_update_anime_pattern
end
#=============================================================================
# Reset Pearl ABS System
# reset from game player call
def reset_knockdown_actors
# reset knock down
if @knockdown_data != nil
@knockdown_data = 0
knowdown_effect(2)
end
# force clear knock down
$game_player.followers.each do |follower|
if follower.knockdown_data != nil
follower.knockdown_data = 0
follower.knowdown_effect(2)
end
end
end
# reset knockdown enemies game player call
def reset_knockdown_enemies
$game_map.events.values.each do |event|
if event.knockdown_data != nil
event.knockdown_data = 0
event.knowdown_effect(2)
end
if event.deadposee and event.killed
$game_self_switches[] = false
end
end
end
# glabal reseting
def pearl_abs_global_reset
force_cancel_actions
battler.remove_state(9) if @battler_guarding
@battler_guarding =
@making_spiral = false
set_hook_variables
@using_custom_g = false
$game_player.followers.each do |f|
f.targeted_character = nil if !f.targeted_character.nil?
f.stuck_timer = 0 if f.stuck_timer > 0
f.follower_attacktimer = 0 if f.follower_attacktimer > 0
f.force_cancel_actions unless f.visible?
f.battler.remove_state(9) if f.battler_guarding
f.battler_guarding =
f.set_hook_variables
f.making_spiral = false
end
reset_knockdown_actors
reset_knockdown_enemies
$game_player.projectiles.clear
$game_player.damage_pop.clear
$game_player.anime_action.clear
$game_player.enemy_drops.clear
@send_dispose_signal = true
end
end
#===============================================================================
# Evets as enemies registration
class Game_Event < Game_Character
attr_accessor :enemy, :move_type, :page, :deadposee
attr_accessor :being_targeted, :agroto_f, :draw_drop, :dropped_items
attr_accessor :start_delay, :epassive, :erased, :killed, :boom_grabdata
attr_reader :token_weapon, :token_armor,:token_item,:token_skill,:boom_start
attr_reader :hook_pull, :hook_grab, :event, :knockdown_enable, :boom_grab
attr_reader :respawn_anim
alias falcaopearlabs_iniev initialize
def initialize(map_id, event)
@inrangeev = nil
@being_targeted = false
@agroto_f = nil
@draw_drop = false
@dropped_items =
@epassive = false
@touch_damage = 0
@start_delay = 0
@touch_atkdelay = 0
@killed = false
@knockdown_enable = false
@deadposee = false
@respawn_anim = 0
create_token_arrays
falcaopearlabs_iniev(map_id, event)
register_enemy(event)
end
def create_token_arrays
@token_weapon =
@token_armor =
@token_item =
@token_skill =
end
alias falcaopearl_setup_page_settings setup_page_settings
def setup_page_settings
create_token_arrays
falcaopearl_setup_page_settings
wtag = string_data("<start_with_weapon: ")
@token_weapon = wtag.split(",").map { |s| s.to_i } if wtag != nil
atag = string_data("<start_with_armor: ")
@token_armor = atag.split(",").map { |s| s.to_i } if atag != nil
itag = string_data("<start_with_item: ")
@token_item = itag.split(",").map { |s| s.to_i } if itag != nil
stag = string_data("<start_with_skill: ")
@token_skill = stag.split(",").map { |s| s.to_i } if stag != nil
@hook_pull = string_data("<hook_pull: ") == "true"
@hook_grab = string_data("<hook_grab: ") == "true"
@boom_grab = string_data("<boom_grab: ") == "true"
@boom_start = string_data("<boomed_start: ") == "true"
@direction_fix = false if @hook_grab
if has_token? || @hook_pull || @hook_grab || @boom_grab || @boom_start
$game_map.events_withtags.push(self) unless
$game_map.events_withtags.include?(self)
end
end
def has_token?
!@token_weapon.empty? || !@token_armor.empty? || !@token_item.empty? ||
!@token_skill.empty?
end
def register_enemy(event)
if !$game_system.remain_killed.nil? and
$game_system.remain_killed.include?(self.id)
return
end
@enemy = Game_Enemy.new(0, $1.to_i) if event.name =~ /<enemy: (.*)>/i
if @enemy != nil
passive = @enemy.enemy.tool_data("Enemy Passive = ", false)
@epassive = true if passive == "true"
touch = @enemy.enemy.tool_data("Enemy Touch Damage Range = ")
@sensor = @enemy.esensor
@touch_damage = touch if touch != nil
$game_map.event_enemies.push(self) # new separate enemy list
$game_map.enemies.push(@enemy) # just enemies used in the cooldown
@event.pages.each do |page|
if page.condition.self_switch_valid and
page.condition.self_switch_ch == PearlKernel::KnockdownSelfW
@knockdown_enable = true
break
end
end
pose = @enemy.enemy.tool_data("Enemy Dead Pose = ", false) == "true"
@deadposee = true if pose and @knockdown_enable
end
end
def update_state_effects
@killed ? return : super
end
def collapsing?
return true if @killed || @colapse_time > 0
return false
end
def enemy_ready?
return false if @enemy.nil? || @page.nil? || collapsing? || @enemy.object
return true
end
def battler
return @enemy
end
def apply_respawn
return if @colapse_time > 0
@draw_drop = false
@dropped_items.clear
@through = @die_through
@through = false if @through.nil?
@die_through = nil
@secollapse = nil
@colapse_time = 0
@erased = false ; @opacity = 255
@zoomfx_x = 1.0 ; @zoomfx_y = 1.0
@killed = false
@priority_type = 1 if @deadposee
resetdeadpose
refresh
end
def resetdeadpose
if @deadposee
$game_self_switches[] = false
end
end
def kill_enemy
@secollapse = nil
@killed = true
@priority_type = 0 if @deadposee
gain_exp
gain_gold
etext = 'Exp ' + @enemy.exp.to_s if @enemy.exp > 0
gtext = 'Gold ' + @enemy.gold.to_s if @enemy.gold > 0
$game_player.pop_damage("#{etext} #{gtext}") if etext || gtext
make_drop_items
run_assigned_commands
end
def run_assigned_commands
transform = @enemy.enemy.tool_data("Enemy Die Transform = ")
switch = @enemy.enemy.tool_data("Enemy Die Switch = ")
$game_switches = true if switch != nil
variable = @enemy.enemy.tool_data("Enemy Die Variable = ")
$game_variables += 1 if variable != nil
self_sw = @enemy.enemy.tool_data("Enemy Die Self Switch = ", false)
#$game_map.event_enemies.delete(self) if @enemy.object
#$game_map.enemies.delete(@enemy) if @enemy.object
if self_sw.is_a?(String)
$game_self_switches[] = true
apply_respawn
$game_map.event_enemies.delete(self)
$game_map.enemies.delete(@enemy)
unless $game_system.remain_killed.has_key?($game_map.map_id)
$game_system.remain_killed =
end
$game_system.remain_killed.push(self.id) unless
$game_system.remain_killed.include?(self.id)
@enemy = nil
else
erase unless @deadposee
respawn = @enemy.enemy.tool_data("Enemy Respawn Seconds = ")
animation = @enemy.enemy.tool_data("Enemy Respawn Animation = ")
@respawn_count = respawn * 60 unless respawn.nil?
@respawn_anim = animation unless animation.nil?
end
if transform != nil
@enemy = Game_Enemy.new(0, transform)
apply_respawn
end
end
def make_drop_items
@dropped_items = @enemy.make_drop_items
unless @dropped_items.empty?
$game_player.enemy_drops.push(self)
$game_map.events_withtags.push(self) unless
$game_map.events_withtags.include?(self)
end
end
def gain_exp
return if @enemy.exp == 0
$game_party.all_members.each do |actor|
actor.gain_exp(@enemy.exp)
end
end
def gain_gold
return if @enemy.gold == 0
$game_party.gain_gold(@enemy.gold)
end
alias falcaopearlabs_updatev update
def update
@start_delay -= 1 if @start_delay > 0
@touch_atkdelay -= 1 if @touch_atkdelay > 0
update_enemy_sensor unless @enemy.nil?
update_enemy_touch_damage unless @enemy.nil?
falcaopearlabs_updatev
end
def update_enemy_touch_damage
return unless @touch_damage > 0
return unless @character_name != ""
return if @epassive || @killed
return if @touch_atkdelay > 0
unless @enemy.object
@agroto_f.nil? ? target = $game_player : target = @agroto_f
else
target = $game_player
$game_player.followers.each do |follower|
next unless follower.visible?
if obj_size?(follower, @touch_damage) and !follower.battler.dead?
execute_touch_damage(follower)
end
end
end
execute_touch_damage(target) if obj_size?(target, @touch_damage)
end
def execute_touch_damage(target)
target.battler.attack_apply(@enemy)
target.pop_damage
@touch_atkdelay = 50
target.colapse_time = 60 if target.battler.dead?
return if target.battler.result.hp_damage == 0
target.jump(0, 0)
end
# enemy sensor
def update_enemy_sensor
return if @hookshoting
return if @epassive
if @sensor != nil
@agroto_f.nil? ? target = $game_player : target = @agroto_f
if obj_size?(target, @sensor)
data =
if @inrangeev.nil? and !$game_self_switches[[data, data,
data]]
$game_self_switches[[data, data, data]] = true
@inrangeev = true
end
elsif @inrangeev != nil
data =
if $game_self_switches[[data, data, data]]
$game_self_switches[[data, data, data]] = false
@inrangeev = nil
end
end
end
end
# on battle pixel, take a lot of time procesing, but it is very exact
def on_battle_pixel?(out=0)
w = Graphics.width + out; h = Graphics.height + out
return true if screen_x.between?(0 - out,w) and screen_y.between?(0 - out,h)
return false
end
def cmt_data(comment)
return 0 if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
return $1.to_i if item.parameters =~ /#{comment}(.*)>/i
end
end
return 0
end
def string_data(comment)
return nil if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
return $1.to_s if item.parameters =~ /#{comment}(.*)>/i
end
end
return nil
end
# stop event movement
alias falcaopearl_update_self_movement update_self_movement
def update_self_movement
return if !@boom_grabdata.nil?
return if force_stopped? || @colapse_time > 0 || @blowpower > 0
falcaopearl_update_self_movement
end
end
class Game_System
attr_accessor :remain_killed
alias falcao_fantastic_store_ini initialize
def initialize
falcao_fantastic_store_ini
@remain_killed = {}
end
end
#===============================================================================
# mist
class Game_Map
attr_reader :map
attr_accessor :event_enemies, :enemies, :events_withtags
alias falcaopearl_enemycontrol_ini initialize
def initialize
@event_enemies =
@enemies =
@events_withtags =
falcaopearl_enemycontrol_ini
end
alias falcaopearl_enemycontrol_setup setup
def setup(map_id)
@event_enemies.clear
@enemies.clear
@events_withtags.clear
falcaopearl_enemycontrol_setup(map_id)
if $game_temp.loadingg != nil
@event_enemies.each do |event|
event.resetdeadpose
end
$game_temp.loadingg = nil
end
end
alias falcaopearl_damage_floor damage_floor?
def damage_floor?(x, y)
return if $game_player.hookshoting
falcaopearl_damage_floor(x, y)
end
end
class Game_Temp
attr_accessor :pop_windowdata, :loadingg
def pop_w(time, name, text)
return unless @pop_windowdata.nil?
@pop_windowdata =
end
end
class Game_Party < Game_Unit
alias falcaopearl_swap_order swap_order
def swap_order(index1, index2)
unless SceneManager.scene_is?(Scene_Map)
if $game_player.in_combat_mode?
$game_temp.pop_w(180, 'Pearl ABS',
'You cannot switch player while in combat!')
return
elsif $game_player.any_collapsing?
$game_temp.pop_w(180, 'Pearl ABS',
'You cannot switch player while collapsing!')
return
elsif $game_party.battle_members.deadposing != nil
$game_temp.pop_w(180, 'Pearl ABS',
'You cannot move a dead ally!')
return
end
end
falcaopearl_swap_order(index1, index2)
end
end
class << DataManager
alias falcaopearl_extract extract_save_contents
def DataManager.extract_save_contents(contents)
falcaopearl_extract(contents)
$game_temp.loadingg = true
end
end
#===============================================================================
# * Falcao Pearl ABS script shelf # 1
#
# This script is the Heart of Pearl ABS Liquid, it handles all the character
# management, the tools variables and the input module, enemy registration etc.
#===============================================================================
module PearlKernel
# Default enemy sensor self switch
Enemy_Sensor = "B"
# Default enemy sensor (distance in tiles the enemy is able to see the Player
Sensor = 7
# Default enemy knockdown self switch (used to display knockdowned graphic)
KnockdownSelfW = "C"
# Deafault Enemy collapse
DefaultCollapse = 'zoom_vertical'
# While in party battle on map, the game player is the manager of the group
# Which distance the player can see the enemies?, this is used, to determine
# wheter the follower can start fighting. enemy away from this tiles
# whil be ignored untill the player is near them
# distamce measured in tiles
PlayerRange = 7
# When a follower fail an action this balloon is played, runs out of mana etc.
FailBalloon = 1
# Start the game with the ABS huds turned on?
StartWithHud = true
# Do you want to activate the followers dead poses?
FollowerDeadPose = true
# Do you want to activate the single player mode?
# this only avoid you accesing the player slection menu and the K key is used
# to open the quick tool selection menu
SinglePlayer = true
#-----------------------------------------------------------------------------
@gaugeback = Color.new(0, 0, 0, 100)
def self.draw_hp(obj, battler, x, y, w, h, color, name=nil)
tag = 'Hp' ; c = color
name = battler.name if !name.nil?
draw_gauge(obj, battler.hp, battler.mhp, x, y, w, h, c, tag, name)
end
def self.draw_mp(obj, battler, x, y, w, h, color, name=nil)
tag = 'Mp' ; c = color
name = battler.name if !name.nil?
draw_gauge(obj, battler.mp, battler.mmp, x, y, w, h, c, tag, name)
end
def self.draw_exp(obj, battler, x, y, w, h, color, name=nil)
tag = 'Exp' ; c = color
name = battler.name if !name.nil?
draw_gauge(obj,battler.exp, battler.next_level_exp, x, y, w, h, c, tag,name)
end
def self.draw_tp(obj, x, y, actor)
string = 'Tp ' + (actor.tp).to_i.to_s
obj.fill_rect(x, y + 10 , string.length * 9, 12, @gaugeback)
obj.draw_text(x, y, obj.width, 32, string)
end
def self.draw_gauge(obj, nm, max, x, y, w, h, col, tag, name)
obj.font.shadow = true
w2 = w - 2 ; max = 1 if max == 0
obj.fill_rect(x, y - 1, w, h + 2, @gaugeback)
obj.fill_rect(x+1, y+1, w2*nm/max, h/2 - 1, col)
obj.fill_rect(x+1, y + h/2, w2*nm/max, h/2 - 1, col)
obj.draw_text(x, y + h - 22, w, 32, nm.to_s, 2)
obj.draw_text(x + 4, y + h - 22, w, 32, tag)
obj.draw_text(x, y - 25, w, 32, name, 1) if !name.nil?
end
# image based bars definition
def self.image_hp(bitmap, x, y, back, image, battler, name=nil)
tag = 'Hp'
name = battler.name if !name.nil?
draw_i_gauge(bitmap, x, y, back, image, battler.hp, battler.mhp, tag, name)
end
def self.image_mp(bitmap, x, y, back, image, battler, name=nil)
tag = 'Mp'
name = battler.name if !name.nil?
draw_i_gauge(bitmap, x, y, back, image, battler.mp, battler.mmp, tag, name)
end
def self.image_exp(bitmap, x, y, back, image, battler, name=nil)
tag = 'Exp'
name = battler.name if !name.nil?
exp, nexte = battler.exp, battler.next_level_exp
draw_i_gauge(bitmap, x, y, back, image, exp, nexte, tag, name)
end
def self.draw_i_gauge(bitmap, x, y, back, image, nm, max, tag, name)
cw = back.width
ch = back.height
max = 1 if max == 0
src_rect = Rect.new(0, 0, cw, ch)
bitmap.blt(x - 10, y - ch + 30, back, src_rect)
cw = image.width * nm / max
ch = image.height
src_rect = Rect.new(0, 0, cw, ch)
bitmap.blt(x - 10, y - ch + 30, image, src_rect)
bitmap.draw_text(x - 4, y + back.height - 14, back.width, 32, tag)
bitmap.draw_text(x - 12, y + back.height - 14, back.width, 32, nm.to_s, 2)
bitmap.draw_text(x - 6, y - 10, back.width, 32, name, 1) if !name.nil?
end
def self.has_data?
!user_graphic.nil?
end
def self.load_item(item)
@item = item
end
def self.user_graphic() @item.tool_data("User Graphic = ", false) end
def self.user_animespeed() @item.tool_data("User Anime Speed = ") end
def self.tool_cooldown() @item.tool_data("Tool Cooldown = ") end
def self.tool_graphic() @item.tool_data("Tool Graphic = ", false) end
def self.tool_index() @item.tool_data("Tool Index = ") end
def self.tool_size() @item.tool_data("Tool Size = ") end
def self.tool_distance() @item.tool_data("Tool Distance = ") end
def self.tool_effectdelay() @item.tool_data("Tool Effect Delay = ") end
def self.tool_destroydelay() @item.tool_data("Tool Destroy Delay = ") end
def self.tool_speed() @item.tool_float("Tool Speed = ") end
def self.tool_castime() @item.tool_data("Tool Cast Time = ") end
def self.tool_castanimation() @item.tool_data("Tool Cast Animation = ") end
def self.tool_blowpower() @item.tool_data("Tool Blow Power = ") end
def self.tool_piercing() @item.tool_data("Tool Piercing = ", false) end
def self.tool_animation() @item.tool_data("Tool Animation When = ", false) end
def self.tool_anirepeat() @item.tool_data("Tool Animation Repeat = ",false)end
def self.tool_special() @item.tool_data("Tool Special = ", false) end
def self.tool_target() @item.tool_data("Tool Target = ", false) end
def self.tool_invoke() @item.tool_data("Tool Invoke Skill = ") end
def self.tool_guardrate() @item.tool_data("Tool Guard Rate = ") end
def self.tool_knockdown() @item.tool_data("Tool Knockdown Rate = ") end
def self.tool_soundse() @item.tool_data("Tool Sound Se = ", false) end
def self.tool_itemcost() @item.tool_data("Tool Item Cost = ") end
def self.tool_shortjump() @item.tool_data("Tool Short Jump = ", false) end
def self.tool_through() @item.tool_data("Tool Through = ", false) end
def self.tool_priority() @item.tool_data("Tool Priority = ") end
def self.tool_selfdamage() @item.tool_data("Tool Self Damage = ", false) end
def self.tool_hitshake() @item.tool_data("Tool Hit Shake = ", false) end
def self.tool_combo() @item.tool_data("Tool Combo Tool = ", false) end
def self.knock_actor(actor)
a = actor.actor.tool_data("Knockdown Graphic = ", false)
b = actor.actor.tool_data("Knockdown Index = ")
c = actor.actor.tool_data("Knockdown pattern = ")
d = actor.actor.tool_data("Knockdown Direction = ")
return nil if a.nil?
return
end
def self.jump_hit?(target)
t = target.enemy.tool_data("Hit Jump = ", false) if target.is_a?(Game_Enemy)
t = target.actor.tool_data("Hit Jump = ", false) if target.is_a?(Game_Actor)
return true if !t.nil? and t == "true"
return true if t.nil?
return false
end
def self.voices(b)
voices = b.actor.tool_data("Battler Voices = ",false) if b.is_a?(Game_Actor)
voices = b.enemy.tool_data("Battler Voices = ",false) if b.is_a?(Game_Enemy)
voices = voices.split(", ") unless voices.nil?
voices
end
def self.hitvoices(b)
voices = b.actor.tool_data("Hit Voices = ",false) if b.is_a?(Game_Actor)
voices = b.enemy.tool_data("Hit Voices = ",false) if b.is_a?(Game_Enemy)
voices = voices.split(", ") unless voices.nil?
voices
end
# check for iconset
def self.check_iconset(item, tag, object)
data = item.tool_data(tag, false)
return if data.nil?
v = if data == "animated" ||
data == "static" || data == "shielding"
object.is_a?(Projectile) ? object.pro_iconset = v : object.user_iconset = v
end
def self.clean_back?
@clean_back == true
end
end
($imported ||= {}) = true
class RPG::BaseItem
attr_reader :has_data
def tool_data(comment, sw=true)
if @note =~ /#{comment}(.*)/i
@has_data = true
return sw ? $1.to_i : $1.to_s.sub("\r","")
end
end
def tool_float(comment)
return $1.to_f if @note =~ /#{comment}(.*)/i
end
def cool_enabled?
@cd_dis = @note.include?("Tool Cooldown Display = true") if @cd_dis.nil?
@cd_dis
end
def itemcost
if @i_cost.nil?
@note =~ /Tool Item Cost = (.*)/i ? @i_cost = $1.to_i : @i_cost = 0
end
@i_cost
end
end
# Pearl ABS Input module
module PearlKey
# numbers
N0 = 0x30; N1 = 0x31; N2 = 0x32; N3 = 0x33; N4 = 0x34
N5 = 0x35; N6 = 0x36; N7 = 0x37; N8 = 0x38; N9 = 0x39
# keys
A = 0x41; B = 0x42; C = 0x43; D = 0x44; E = 0x45
F = 0x46; G = 0x47; H = 0x48; I = 0x49; J = 0x4A
K = 0x4B; L = 0x4C; M = 0x4D; N = 0x4E; O = 0x4F
P = 0x50; Q = 0x51; R = 0x52; S = 0x53; T = 0x54
U = 0x55; V = 0x56; W = 0x57; X = 0x58; Y = 0x59; Z = 0x5A
@unpack_string = 'b'*256
@last_array = '0'*256
@press = Array.new(256, false)
@trigger = Array.new(256, false)
@release = Array.new(256, false)
@getKeyboardState = Win32API.new('user32', 'GetKeyboardState', , 'V')
@getAsyncKeyState = Win32API.new('user32', 'GetAsyncKeyState', 'i', 'i')
@getKeyboardState.call(@last_array)
@last_array = @last_array.unpack(@unpack_string)
for i in 0...@last_array.size
@press = @getAsyncKeyState.call(i) == 0 ? false : true
end
def self.update
@trigger = Array.new(256, false)
@release = Array.new(256, false)
array = '0'*256
@getKeyboardState.call(array)
array = array.unpack(@unpack_string)
for i in 0...array.size
if array != @last_array
@press = @getAsyncKeyState.call(i) == 0 ? false : true
if !@press
@release = true
else
@trigger = true
end
else
if @press == true
@press = @getAsyncKeyState.call(i) == 0 ? false : true
@release = true if !@press
end
end
end
@last_array = array
end
def self.press?(key)
return @press
end
def self.trigger?(key)
return @trigger
end
end
# Input module update engine
class << Input
alias falcaopearl_abs_cooldown_update update
def Input.update
update_pearl_abs_cooldown
update_popwindow if !$game_temp.nil? and !$game_temp.pop_windowdata.nil?
update_pearl_abs_respawn
falcaopearl_abs_cooldown_update
end
def update_pearl_abs_respawn
$game_map.event_enemies.each do |event|
if event.respawn_count > 0
event.respawn_count -= 1
if event.respawn_count == 0
event.battler.remove_state(event.battler.death_state_id)
event.battler.hp = event.battler.mhp
event.battler.mp = event.battler.mmp
event.apply_respawn
event.animation_id = event.respawn_anim
end
end
end
end
alias falcaopearl_trigger trigger?
def trigger?(constant)
return true if constant == :B and PearlKey.trigger?(PearlKey::B)
falcaopearl_trigger(constant)
end
# pop window global
def update_popwindow
$game_temp.pop_windowdata -= 1 if $game_temp.pop_windowdata > 0
if @temp_window.nil?
tag = $game_temp.pop_windowdata
string = $game_temp.pop_windowdata + tag
width = (string.length * 9) - 10
x, y = Graphics.width / 2 - width / 2, Graphics.height / 2 - 64 / 2
@temp_window = Window_Base.new(x, y, width, 64)
@temp_window.contents.font.size = 20
@temp_window.draw_text(-10, -6, width, 32, tag, 1)
@temp_window.draw_text(-10, 14, width, 32, $game_temp.pop_windowdata,1)
@current_scene = SceneManager.scene.class
end
if $game_temp.pop_windowdata == 0 ||
@current_scene != SceneManager.scene.class
@temp_window.dispose
@temp_window = nil
$game_temp.pop_windowdata = nil
end
end
def update_pearl_abs_cooldown
PearlKey.update
eval_cooldown($game_party.all_members) if !$game_party.nil?
eval_cooldown($game_map.enemies) if !$game_map.nil?
end
# cooldown update
def eval_cooldown(operand)
for sub in operand
sub.skill_cooldown.each {|sid, sv| # skill
if sub.skill_cooldown > 0
sub.skill_cooldown -= 1
sub.skill_cooldown.delete(sid) if sub.skill_cooldown == 0
end}
sub.item_cooldown.each {|iid, iv| # item
if sub.item_cooldown > 0
sub.item_cooldown -= 1
sub.item_cooldown.delete(iid) if sub.item_cooldown == 0
end}
sub.weapon_cooldown.each {|wid, wv| # weapon
if sub.weapon_cooldown > 0
sub.weapon_cooldown -= 1
sub.weapon_cooldown.delete(wid) if sub.weapon_cooldown == 0
end}
sub.armor_cooldown.each {|aid, av| #armor
if sub.armor_cooldown > 0
sub.armor_cooldown -= 1
sub.armor_cooldown.delete(aid) if sub.armor_cooldown == 0
end}
end
end
end
#===============================================================================
#===============================================================================
# Game character
class Game_CharacterBase
attr_accessor :just_hitted, :anime_speed, :blowpower, :targeting, :x, :y
attr_accessor :battler_guarding, :knockdown_data, :colapse_time, :opacity
attr_accessor :zoomfx_x, :zoomfx_y, :targeted_character, :stuck_timer
attr_accessor :send_dispose_signal, :follower_attacktimer, :stopped_movement
attr_accessor :hookshoting, :battler_chain, :pattern, :user_move_distance
attr_accessor :move_speed, :through, :being_grabbed, :making_spiral
attr_accessor :direction, :direction_fix, :zfx_bol, :buff_pop_stack
attr_accessor :die_through, :target_index, :using_custom_g, :combodata
attr_accessor :originalasp, :doingcombo, :angle_fx
attr_accessor :user_iconset, :pro_iconset, :respawn_count
alias falcaopearl_abmain_ini initialize
def initialize
@zfx_bol = false
@just_hitted = 0
@anime_speed = 0
@respawn_count = 0
@blowpower =
@user_casting =
@send_dispose_signal = false
@targeting =
@colapse_time = 0
@stopped_movement = 0
@follower_attacktimer = 0
set_hook_variables
@target_index = 0
@using_custom_g = false
@combodata =
@angle_fx = 0.0
#--------------
@zoomfx_x = 1.0
@zoomfx_y = 1.0
@stuck_timer = 0
@battler_guarding =
@knockdown_data =
@state_poptimer =
@making_spiral = false
@buff_pop_stack =
@doingcombo = 0
@range_view = 2
@originalasp = 0
falcaopearl_abmain_ini
end
def set_hook_variables
@hookshoting =
@battler_chain =
@user_move_distance =
@being_grabbed = false
end
# projectiles at nt
def projectiles_xy_nt(x, y)
$game_player.projectiles.select {|pro| pro.pos_nt?(x, y) }
end
# collide with projectiles
def collide_with_projectiles?(x, y)
projectiles_xy_nt(x, y).any? do |pro|
pro.normal_priority? || self.is_a?(Projectile)
end
end
def zoom(x, y)
@zoomfx_x = x
@zoomfx_y = y
end
alias falcaopearl_collide_with collide_with_characters?
def collide_with_characters?(x, y)
return true if collide_with_projectiles?(x, y)
falcaopearl_collide_with(x, y)
end
# follow character straigh and diagonal
def follow_char(character)
sx = distance_x_from(character.x)
sy = distance_y_from(character.y)
if sx != 0 && sy != 0
move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
elsif sx != 0
move_straight(sx > 0 ? 4 : 6)
elsif sy != 0
move_straight(sy > 0 ? 8 : 2)
end
end
def on_battle_screen?(out = 0)
max_w = (Graphics.width / 32).to_i - 1
max_h = (Graphics.height / 32).to_i - 1
sx = (screen_x / 32).to_i
sy = (screen_y / 32).to_i
if sx.between?(0 - out, max_w + out) and sy.between?(0 - out, max_h + out)
return true
end
return false
end
# jump to specific tiles
def jumpto_tile(x, y)
jumpto(0, )
end
# jumpto character ( 0 = Game Player, 1 and up event id)
def jumpto(char_id, tilexy=nil)
char_id > 0 ? char = $game_map.events : char = $game_player
tilexy.nil? ? condxy = : condxy = [tilexy, tilexy]
jx = + eval_distance(tilexy.nil? ? char : tilexy) if condxy >= @x
jy = - eval_distance(tilexy.nil? ? char : tilexy) if condxy <= @y
jx = - eval_distance(tilexy.nil? ? char : tilexy) if condxy <= @x
jy = - eval_distance(tilexy.nil? ? char : tilexy) if condxy <= @y
jx = - eval_distance(tilexy.nil? ? char : tilexy) if condxy <= @x
jy = + eval_distance(tilexy.nil? ? char : tilexy) if condxy >= @y
jx = + eval_distance(tilexy.nil? ? char : tilexy) if condxy >= @x
jy = + eval_distance(tilexy.nil? ? char : tilexy) if condxy >= @y
jump(jx, jy)
end
# distance
def eval_distance(target)
if target.is_a?(Array)
distance_x = (@x - target).abs
distance_y = (@y - target).abs
else
distance_x = (@x - target.x).abs
distance_y = (@y - target.y).abs
end
return
end
# check if the game player and follower are executing an action
def battler_acting?
return true if @user_casting > 0 || @targeting
return true if @knockdown_data > 0 and battler.deadposing.nil?
return true if @anime_speed > 0
return true if @hookshoting || @making_spiral
if self.is_a?(Game_Player)
$game_player.followers.each {|f| return true if f.battler_acting?}
end
return false
end
def battler
end
#use single tools
def use_weapon(id)
return unless tool_can_use?
process_tool_action($data_weapons)
end
def use_item(id)
return unless tool_can_use?
process_tool_action($data_items)
end
def use_skill(id)
return unless tool_can_use?
process_tool_action($data_skills)
end
def use_armor(id)
return unless tool_can_use?
process_tool_action($data_armors)
end
# use multiple tools
def rand_weapon(*args)
return unless tool_can_use?
process_tool_action($data_weapons[args])
end
def rand_item(*args)
return unless tool_can_use?
process_tool_action($data_items[args])
end
def rand_skill(*args)
return unless tool_can_use?
process_tool_action($data_skills[args])
end
def rand_armor(*args)
return unless tool_can_use?
process_tool_action($data_armors[args])
end
def tool_can_use?
return false if @hookshoting || @making_spiral
return false if @user_casting > 0 || @targeting
return false if battler.nil?
return false if battler.dead?
return false if @doingcombo > 0 || @battler_guarding
return false if $game_message.busy?
return true
end
def load_target_selection(item)
@targeting = true; @targeting = item
if self.is_a?(Game_Player)
$game_player.pearl_menu_call =
elsif self.is_a?(Game_Follower)
@targeting = @targeted_character
@targeting = if @targeting.nil?
elsif self.is_a?(Projectile)
if user.is_a?(Game_Player)
user.targeting = true; user.targeting = item
$game_player.pearl_menu_call =
end
if user.is_a?(Game_Follower)
@targeting = user.targeted_character
@targeting = if @targeting.nil?
end
end
end
def playdead
@angle_fx = 90
end
def resetplaydead
@angle_fx = 0.0
end
#action canceling
def force_cancel_actions
@user_casting = 0
@anime_speed = 0
end
def speed(x)
@move_speed = x
end
def anima(x)
@animation_id = x
end
# aply melee params
def apply_weapon_param(weapon, add)
id = 0
for param in weapon.params
add ? battler.add_param(id, param) : battler.add_param(id, -param)
id += 1
end
end
# Short script call for poping damage text
def pop_damage(custom=nil)
$game_player.damage_pop.push(DamagePop_Obj.new(self, custom))
end
#check if target is unable to move
def force_stopped?
return true if @anime_speed > 0 || @knockdown_data > 0 ||
@stopped_movement > 0 || @hookshoting || @angle_fx != 0.0
return true if @making_spiral
return false
end
# sensor
def obj_size?(target, size)
return false if size.nil?
distance = (@x - target.x).abs + (@y - target.y).abs
enable = (distance <= size-1)
return true if enable
return false
end
# sensor body
def body_size?(target, size)
distance = (@x - target).abs + (@y - target).abs
enable = (distance <= size-1)
return true if enable
return false
end
def faceto_face?(target)
return true if @direction == 2 and target.direction == 8
return true if @direction == 4 and target.direction == 6
return true if @direction == 6 and target.direction == 4
return true if @direction == 8 and target.direction == 2
return false
end
def adjustcxy
push_x, push_y = 0, 1 if @direction == 2
push_x, push_y = - 1, 0 if @direction == 4
push_x, push_y = 1, 0 if @direction == 6
push_x, push_y = 0, - 1 if @direction == 8
return
end
def in_frontof?(target)
return true if @direction == 2 and @x == target.x and (@y+1) == target.y
return true if @direction == 4 and (@x-1) == target.x and @y == target.y
return true if @direction == 6 and (@x+1) == target.x and @y == target.y
return true if @direction == 8 and @x == target.x and (@y-1) == target.y
return false
end
# detect map edges ignoring loop maps
def facing_corners?
case $game_map.map.scroll_type
when 1 then return false if @direction == 2 || @direction == 8
when 2 then return false if @direction == 4 || @direction == 6
when 3 then return false
end
m = $game_map
unless @x.between?(1, m.width - 2) && @y.between?(1, m.height - 2)
return true if @x == 0 and @direction == 4
return true if @y == 0 and @direction == 8
return true if @x == m.width - 1 and @direction == 6
return true if @y == m.height - 1 and @direction == 2
end
return false
end
# item usable test
def usable_test_passed?(item)
return true if battler.is_a?(Game_Enemy) && item.is_a?(RPG::Item)
itemcost = item.tool_data("Tool Item Cost = ")
invoke = item.tool_data("Tool Invoke Skill = ")
if battler.is_a?(Game_Actor) and itemcost != nil and itemcost != 0
return false if !battler.usable?($data_items)
end
if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
return false if !battler.usable?(item)
else
if invoke != nil and invoke != 0
return false if !battler.usable?($data_skills)
else
return false if !battler.attack_usable?
end
end
return true
end
# process the tool and verify wheter can be used
def process_tool_action(item)
PearlKernel.load_item(item)
return if !battler.tool_ready?(item)
unless PearlKernel.has_data?
if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
msgbox('Tool data missing') if $DEBUG
return
end
if item.scope.between?(1, 6)
msgbox('Tool data missing') if $DEBUG
return
elsif item.scope == 0
return
elsif !battler.usable?(item)
RPG::SE.new("Cursor1", 80).play if self.is_a?(Game_Player)
return
end
end
if PearlKernel.has_data? and not usable_test_passed?(item)
RPG::SE.new("Cursor1", 80).play if self.is_a?(Game_Player)
return
end
@user_casting = if PearlKernel.has_data?
if @user_casting > 0
@animation_id = 0
@animation_id = PearlKernel.tool_castanimation
else
load_abs_tool(item)
end
end
# load the abs tool
def load_abs_tool(item)
return if @knockdown_data > 0
PearlKernel.load_item(item)
return if self.is_a?(Game_Follower) and @targeted_character.nil?
if !@targeting and self.battler.is_a?(Game_Actor)
if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
# apply target to skills items
if PearlKernel.tool_target == "true" || item.scope == 7 ||
item.scope == 9
load_target_selection(item)
return
end
else
# apply target parsing the invoked skill to weapons and armors
invoke = PearlKernel.tool_invoke
if invoke != nil && invoke > 0 && invoke != 1 && invoke != 2
invokeskill = $data_skills
if PearlKernel.tool_target == "true" || invokeskill.scope == 7 ||
invokeskill.scope == 9
load_target_selection(item)
return
end
# apply target to normal weapon and armor without invoking
else
if PearlKernel.tool_target == "true"
load_target_selection(item)
return
end
end
end
end
if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
battler.use_item(item)
else
if PearlKernel.tool_invoke != 0
battler.use_item($data_skills)
end
end
# if the tool has data continue
if PearlKernel.has_data?
consume_ammo_item(item) if battler.is_a?(Game_Actor) and
PearlKernel.tool_itemcost != 0
@anime_speed = PearlKernel.user_animespeed
battler.apply_cooldown(item, PearlKernel.tool_cooldown)
end
create_projectile_object(item)
create_anime_sprite_object(item)
end
# projectile creator
def create_projectile_object(item)
if PearlKernel.tool_special == "hook"
PearlKernel.tool_distance.times {|i|
$game_player.projectiles.push(Projectile.new(self, item, i))}
@hookshoting = true
elsif PearlKernel.tool_special == "triple" # loads 3 projectiles
for i in
$game_player.projectiles.push(Projectile.new(self, item, i))
end
elsif PearlKernel.tool_special == "quintuple" #loads 5 projectiles
for i in
$game_player.projectiles.push(Projectile.new(self, item, i))
end
elsif PearlKernel.tool_special == "octuple" # loads 8 projectiles
for i in
$game_player.projectiles.push(Projectile.new(self, item, i))
end
else # load default projectile
$game_player.projectiles.push(Projectile.new(self, item))
end
end
# User anime sprite creation
def create_anime_sprite_object(item)
$game_player.anime_action.each {|i|
if i.user == self
if i.custom_graphic
@transparent = false
i.user.using_custom_g = false
end
$game_player.anime_action.delete(i)
end}
if PearlKernel.user_graphic != "nil"
return if PearlKernel.user_graphic.nil?
$game_player.anime_action.push(Anime_Obj.new(self, item))
end
# using iconset graphic
if PearlKernel.user_graphic == "nil" and
!item.tool_data("User Iconset = ", false).nil?
return if PearlKernel.user_graphic.nil?
$game_player.anime_action.push(Anime_Obj.new(self, item))
end
end
# consume ammo item
def consume_ammo_item(item)
itemcost = $data_items
return if item.is_a?(RPG::Item) and item.consumable and item == itemcost
battler.use_item(itemcost)
end
alias falcaopearl_chaupdate update
def update
update_falcao_pearl_abs
falcaopearl_chaupdate
end
# Falcao pearl abs main update
def update_falcao_pearl_abs
if @user_move_distance > 0 and not moving?
move_forward ; @user_move_distance -= 1
end
return if battler.nil?
update_pearlabs_timing
update_followers_attack if self.is_a?(Game_Follower) && self.visible?
if @targeting != nil
load_abs_tool(@targeting) if battler.is_a?(Game_Actor)
@targeting =
end
update_battler_collapse
update_state_effects
@combodata.each {|combo|
if combo > 0
combo -= 1
if combo == 0
perform_combo(combo, combo, combo)
@combodata.delete(combo)
end
break
end}
end
def perform_combo(kind, id, jumpp)
if jumpp == 'jump'
jump(0, 0)
move_forward
end
case kind
when :weapon then use_weapon(id)
when :armor then use_armor(id)
when :item then use_item(id)
when :skill then use_skill(id)
end
@doingcombo = 12
end
#========================================================================
# * followers attacks engine
def fo_tool
return actor.equips if actor.primary_use == 1
return actor.equips if actor.primary_use == 2
return actor.assigned_item if actor.primary_use == 3
return actor.assigned_item2 if actor.primary_use == 4
return actor.assigned_skill if actor.primary_use == 5
return actor.assigned_skill2 if actor.primary_use == 6
return actor.assigned_skill3 if actor.primary_use == 7
return actor.assigned_skill4 if actor.primary_use == 8
end
# followers attack engine
def update_followers_attack
if fo_tool.nil? || battler.dead?
@targeted_character = nil if @targeted_character != nil
return
end
return if @stopped_movement > 0
if @follower_attacktimer > 0
@follower_attacktimer -= 1
if @follower_attacktimer == 40 and !moving?
r = rand(3)
move_random if r == 0 || r == 1
move_away_from_character(@targeted_character) if
!@targeted_character.nil? and r == 2
end
end
# si la skill es para el player
if @targeted_character != nil and @targeted_character.is_a?(Game_Player)
if all_enemies_dead?
delete_targetf
return
end
use_predefined_tool
return
end
# si la skill es para un enemigo continuar
if @targeted_character != nil
use_predefined_tool
return if @targeted_character.nil?
# reset if the target is dead
if @targeted_character.collapsing?
force_cancel_actions
delete_targetf
end
else
# select a follower slected target
$game_player.followers.each do |follower|
if !follower.targeted_character.nil?
next if follower.targeted_character.is_a?(Game_Player)
if follower.stuck_timer >= 10
follower.targeted_character = nil
return
end
@targeted_character = follower.targeted_character
break
end
end
end
end
# prepare the tool usage
def setup_followertool_usage
@range_view = 2
@range_view = 6 if fo_tool.tool_data("Tool Target = ", false) == "true" ||
fo_tool.tool_data("Tool Special = ", false) == "autotarget"
if fo_tool.is_a?(RPG::Skill) || fo_tool.is_a?(RPG::Item)
if fo_tool.scope.between?(1, 6)
setup_target
else ; @targeted_character = $game_player
@range_view = 6
end
# prepare tool for invoke follower
elsif fo_tool.is_a?(RPG::Weapon) || fo_tool.is_a?(RPG::Armor)
invoke = fo_tool.tool_data("Tool Invoke Skill = ")
if invoke > 0
if $data_skills.scope.between?(1, 6)
setup_target
else ; @targeted_character = $game_player
@range_view = 6
end
else
# no invoke skill just set up an enemy target
setup_target
end
end
end
# use the predifined tool
def use_predefined_tool
update_follower_movement
return if @targeted_character.nil?
if obj_size?(@targeted_character, @range_view) && @follower_attacktimer == 0
turn_toward_character(@targeted_character)
use_weapon(fo_tool.id) if actor.primary_use == 1
use_armor(fo_tool.id) if actor.primary_use == 2
use_item(fo_tool.id) if actor.primary_use == 3 || actor.primary_use == 4
use_skill(fo_tool.id) if actor.primary_use==5 || actor.primary_use==6 ||
actor.primary_use == 7 || actor.primary_use == 8
if fo_tool.tool_data("User Graphic = ", false).nil?
@targeted_character = nil
turn_toward_player
end
@follower_attacktimer = 60
end
delete_targetf if self.actor.dead?
end
def all_enemies_dead?
for event in $game_map.event_enemies
if event.on_battle_screen? && event.enemy_ready?
return false if $game_player.obj_size?(event,PearlKernel::PlayerRange+1)
end
end
return true
end
def delete_targetf
@targeted_character = nil
end
#------------------------
# follower movement attack
def reset_targeting_settings(target)
target.being_targeted = false if target.is_a?(Game_Event)
delete_targetf
turn_toward_player
@stuck_timer = 0
end
def update_follower_movement
target = @targeted_character
if @stuck_timer >= 30
reset_targeting_settings(target)
return
end
# if the follower is unabble to use the tool
unless usable_test_passed?(fo_tool)
if SceneManager.scene_is?(Scene_Map)
reset_targeting_settings(target)
@balloon_id = PearlKernel::FailBalloon
return
end
end
return if target.nil?
@stuck_timer += 1 if !obj_size?(target, @range_view) and !moving?
if moving? || @anime_speed > 0 || @making_spiral || @hookshoting ||
@knockdown_data > 0
@stuck_timer = 0
end
return if moving?
if fo_tool.tool_data("Tool Target = ", false) == "true" ||
fo_tool.tool_data("Tool Special = ", false) == "autotarget" ||
target.is_a?(Game_Player)
# using skill con target true magical
cpu_reactiontype(1, target)
return
# target not exist
else
if fo_tool.is_a?(RPG::Skill) || fo_tool.is_a?(RPG::Item)
fo_tool.scope.between?(1, 6) ? cpu_reactiontype(2, target) : # to enemy
cpu_reactiontype(1, target) # benefical
else
# for weapon armor without target
cpu_reactiontype(2, target)
end
end
return if !obj_size?(target, @range_view)
return if target.is_a?(Game_Player)
case rand(40)
when 4 then move_backward
when 10 then move_random
end
end
# cpu reaction
def cpu_reactiontype(type, target)
unless on_battle_screen?
3.times.each {|i| move_toward_player}
return
end
move_toward_character(target) if !obj_size?(target, @range_view) if type==1
if @follower_attacktimer == 0 || !obj_size?(target, @range_view)
move_toward_character(target) if type == 2
end
end
#-------------------------------------------------
# buff timer
def update_buff_timing
battler.buff_turns.each do |id, value|
if battler.buff_turns > 0
battler.buff_turns -= 1
if battler.buff_turns <= 0
battler.remove_buff(id)
pop_damage
end
end
end
end
#blow power effect
def update_blow_power_effect
if @blowpower > 0
@blowpower -= 1
if @blowpower == 0
@direction_fix = @blowpower
@move_speed = @blowpower
end
end
if @blowpower > 0 and !moving?
@move_speed = 5.5
@direction_fix = true
move_straight(@blowpower); @blowpower -= 1
if @blowpower == 0
@blowpower = 10
end
end
end
# Pearl timing
def update_pearlabs_timing
@just_hitted -= 1 if @just_hitted > 0
@stopped_movement -= 1 if @stopped_movement > 0
@doingcombo -= 1 if @doingcombo > 0
# hookshooting
if @hookshoting > 0
@hookshoting -= 1
if @hookshoting == 0
@hookshoting =
@user_move_distance.being_grabbed = false if
@user_move_distance.is_a?(Game_Event)
@user_move_distance = nil
end
end
update_buff_timing
update_blow_power_effect
# anime
if @anime_speed > 0
@pattern = 0
@anime_speed -= 1
end
# casting
if @user_casting > 0
@user_casting -= 1
load_abs_tool(@user_casting) if @user_casting == 0
end
update_knockdown
end
# Update battler collapse
def check_for_dead_four
return if $game_party.members.size <= 4
SceneManager.goto(Scene_Gameover) if all_fourdead?
end
def all_fourdead?
m = $game_party.battle_members
return true if m.dead? && m.dead? && m.dead? && m.dead?
return false
end
def update_battler_collapse
if @colapse_time > 0
@colapse_time -= 1
force_cancel_actions
if battler.is_a?(Game_Actor)
Sound.play_actor_collapse if @secollapse.nil?
@secollapse = true
if @colapse_time == 0
@secollapse = nil
for event in $game_map.event_enemies
if event.agroto_f == self
event.agroto_f = nil
end
end
check_for_dead_four
member = $game_party.battle_members
# swap and reset player
if self.is_a?(Game_Player)
reset_knockdown_actors
battler.deadposing=$game_map.map_id if PearlKernel::FollowerDeadPose
$game_party.swap_order(0,3) if !member.nil? and !member.dead?
$game_party.swap_order(0,2) if !member.nil? and !member.dead?
$game_party.swap_order(0,1) if !member.nil? and !member.dead?
else
if PearlKernel::FollowerDeadPose
battler.deadposing = $game_map.map_id
if !$game_player.follower_fighting? and member.size > 2
swap_dead_follower
else
$game_player.reserved_swap << battler.id if member.size > 2
end
end
end
end
elsif battler.is_a?(Game_Enemy)
@die_through = @through if @die_through.nil?
@through = true
apply_collapse_anime(battler.collapse_type)
@secollapse = true
battler.object ? @transparent = true : @opacity -= 2 if !@deadposee
if @colapse_time == 0
self.kill_enemy
end
end
end
end
def swap_dead_follower
reset_knockdown_actors
member = $game_party.battle_members
member.each_with_index.each do |actorr, i|
next unless actorr.id == self.actor.id
case member.size
when 3
break if i == 2
$game_party.swap_order(i, 2)
when 4
break if i == 3
if !member.dead?
$game_party.swap_order(i, 3)
break
end
if !member.dead?
$game_party.swap_order(i, 2)
break
end
end
end
end
def apply_collapse_anime(type)
# sound and animation
if battler.die_animation != nil
@animation_id = battler.die_animation if @secollapse.nil?
else
Sound.play_enemy_collapse if @secollapse.nil? and !battler.object
end
return if battler.object
if @deadposee
@knockdown_data = 8
return
end
type = PearlKernel::DefaultCollapse if type.nil?
case type.to_sym
when :zoom_vertical
@zoomfx_x -= 0.03
@zoomfx_y += 0.02
when :zoom_horizontal
@zoomfx_x += 0.03
@zoomfx_y -= 0.02
when :zoom_maximize
@zoomfx_x += 0.02
@zoomfx_y += 0.02
when :zoom_minimize
@zoomfx_x -= 0.02
@zoomfx_y -= 0.02
end
end
# konck down engine update
def update_knockdown
if @knockdown_data > 0
@knockdown_data -= 1
@knockdown_data == 0 ? knowdown_effect(2) : knowdown_effect(1)
if @knockdown_data != nil
@pattern = @knockdown_data
@direction = @knockdown_data
end
end
end
def knowdown_effect(type)
return if self.is_a?(Projectile)
if type == 1
if @knockdown_data == nil
if battler.is_a?(Game_Enemy)
if self.knockdown_enable
force_cancel_actions
self_sw = PearlKernel::KnockdownSelfW
$game_self_switches[] = true
@knockdown_data = self_sw
self.refresh
@knockdown_data = self.page.graphic.pattern
@knockdown_data = self.page.graphic.direction
$game_map.screen.start_shake(7, 4, 20)
end
@knockdown_data = 0 if @knockdown_data == nil
elsif battler.is_a?(Game_Actor)
if PearlKernel.knock_actor(self.actor) != nil and
if @knockdown_data == nil
force_cancel_actions
@knockdown_data = @character_name
@knockdown_data = @character_index
@character_name = PearlKernel.knock_actor(self.actor)
@character_index = PearlKernel.knock_actor(self.actor)
@knockdown_data = PearlKernel.knock_actor(self.actor)
@knockdown_data = PearlKernel.knock_actor(self.actor)
$game_map.screen.start_shake(7, 4, 20) if battler.deadposing.nil?
end
end
@knockdown_data = 0 if @knockdown_data == nil
end
end
elsif type == 2
if battler.is_a?(Game_Enemy)
if @deadposee and battler.dead?
@knockdown_data = nil
return
end
$game_self_switches[[$game_map.map_id, self.id,
@knockdown_data]] = false if @knockdown_data != nil
@knockdown_data = nil
else
@character_name = @knockdown_data
@character_index = @knockdown_data
@knockdown_data = nil
end
end
end
#================================
# states
def primary_state_ani
return nil if battler.states.nil?
return battler.states.tool_data("State Animation = ")
end
# higer priority state animation displayed
def update_state_effects
return if battler.nil?
@state_poptimer += 1 unless primary_state_ani.nil?
if @state_poptimer == 30
@animation_id = primary_state_ani
@animation_id = 0 if @animation_id.nil?
elsif @state_poptimer == 180
@state_poptimer = 0
end
update_state_action_steps
end
# update state actions
def update_state_action_steps
for state in battler.states
if state.remove_by_walking
if !battler.state_steps.nil? &&
battler.state_steps > 0
battler.state_steps -= 1
end
if battler.state_steps == 0
battler.remove_state(state.id)
pop_damage
end
end
if state.restriction == 4
@stopped_movement = 10
@pattern = 2 if @knockdown_data == 0
end
state.features.each do |feature|
if feature.code == 22
@knockdown_data =10 if state.restriction == 4 && feature.data_id==1
next unless feature.data_id.between?(7, 9)
apply_regen_state(state, feature.data_id)
end
end
end
end
# apply regen for hp, mp and tp
def apply_regen_state(state, type)
random = state.tool_data("State Effect Rand Rate = ")
random = 120 if random.nil?
if rand(random) == 1
battler.regenerate_hp if type == 7
battler.regenerate_mp if type == 8
battler.regenerate_tp if type == 9
if type == 7 and battler.result.hp_damage == 0
@colapse_time = 80
battler.add_state(1)
return
end
type == 9 ? pop_damage("Tp Up!") : pop_damage
end
end
alias falcaopearl_update_anime_pattern update_anime_pattern
def update_anime_pattern
return if @anime_speed > 0 || @knockdown_data > 0
falcaopearl_update_anime_pattern
end
#=============================================================================
# Reset Pearl ABS System
# reset from game player call
def reset_knockdown_actors
# reset knock down
if @knockdown_data != nil
@knockdown_data = 0
knowdown_effect(2)
end
# force clear knock down
$game_player.followers.each do |follower|
if follower.knockdown_data != nil
follower.knockdown_data = 0
follower.knowdown_effect(2)
end
end
end
# reset knockdown enemies game player call
def reset_knockdown_enemies
$game_map.events.values.each do |event|
if event.knockdown_data != nil
event.knockdown_data = 0
event.knowdown_effect(2)
end
if event.deadposee and event.killed
$game_self_switches[] = false
end
end
end
# glabal reseting
def pearl_abs_global_reset
force_cancel_actions
battler.remove_state(9) if @battler_guarding
@battler_guarding =
@making_spiral = false
set_hook_variables
@using_custom_g = false
$game_player.followers.each do |f|
f.targeted_character = nil if !f.targeted_character.nil?
f.stuck_timer = 0 if f.stuck_timer > 0
f.follower_attacktimer = 0 if f.follower_attacktimer > 0
f.force_cancel_actions unless f.visible?
f.battler.remove_state(9) if f.battler_guarding
f.battler_guarding =
f.set_hook_variables
f.making_spiral = false
end
reset_knockdown_actors
reset_knockdown_enemies
$game_player.projectiles.clear
$game_player.damage_pop.clear
$game_player.anime_action.clear
$game_player.enemy_drops.clear
@send_dispose_signal = true
end
end
#===============================================================================
# Evets as enemies registration
class Game_Event < Game_Character
attr_accessor :enemy, :move_type, :page, :deadposee
attr_accessor :being_targeted, :agroto_f, :draw_drop, :dropped_items
attr_accessor :start_delay, :epassive, :erased, :killed, :boom_grabdata
attr_reader :token_weapon, :token_armor,:token_item,:token_skill,:boom_start
attr_reader :hook_pull, :hook_grab, :event, :knockdown_enable, :boom_grab
attr_reader :respawn_anim
alias falcaopearlabs_iniev initialize
def initialize(map_id, event)
@inrangeev = nil
@being_targeted = false
@agroto_f = nil
@draw_drop = false
@dropped_items =
@epassive = false
@touch_damage = 0
@start_delay = 0
@touch_atkdelay = 0
@killed = false
@knockdown_enable = false
@deadposee = false
@respawn_anim = 0
create_token_arrays
falcaopearlabs_iniev(map_id, event)
register_enemy(event)
end
def create_token_arrays
@token_weapon =
@token_armor =
@token_item =
@token_skill =
end
alias falcaopearl_setup_page_settings setup_page_settings
def setup_page_settings
create_token_arrays
falcaopearl_setup_page_settings
wtag = string_data("<start_with_weapon: ")
@token_weapon = wtag.split(",").map { |s| s.to_i } if wtag != nil
atag = string_data("<start_with_armor: ")
@token_armor = atag.split(",").map { |s| s.to_i } if atag != nil
itag = string_data("<start_with_item: ")
@token_item = itag.split(",").map { |s| s.to_i } if itag != nil
stag = string_data("<start_with_skill: ")
@token_skill = stag.split(",").map { |s| s.to_i } if stag != nil
@hook_pull = string_data("<hook_pull: ") == "true"
@hook_grab = string_data("<hook_grab: ") == "true"
@boom_grab = string_data("<boom_grab: ") == "true"
@boom_start = string_data("<boomed_start: ") == "true"
@direction_fix = false if @hook_grab
if has_token? || @hook_pull || @hook_grab || @boom_grab || @boom_start
$game_map.events_withtags.push(self) unless
$game_map.events_withtags.include?(self)
end
end
def has_token?
!@token_weapon.empty? || !@token_armor.empty? || !@token_item.empty? ||
!@token_skill.empty?
end
def register_enemy(event)
if !$game_system.remain_killed.nil? and
$game_system.remain_killed.include?(self.id)
return
end
@enemy = Game_Enemy.new(0, $1.to_i) if event.name =~ /<enemy: (.*)>/i
if @enemy != nil
passive = @enemy.enemy.tool_data("Enemy Passive = ", false)
@epassive = true if passive == "true"
touch = @enemy.enemy.tool_data("Enemy Touch Damage Range = ")
@sensor = @enemy.esensor
@touch_damage = touch if touch != nil
$game_map.event_enemies.push(self) # new separate enemy list
$game_map.enemies.push(@enemy) # just enemies used in the cooldown
@event.pages.each do |page|
if page.condition.self_switch_valid and
page.condition.self_switch_ch == PearlKernel::KnockdownSelfW
@knockdown_enable = true
break
end
end
pose = @enemy.enemy.tool_data("Enemy Dead Pose = ", false) == "true"
@deadposee = true if pose and @knockdown_enable
end
end
def update_state_effects
@killed ? return : super
end
def collapsing?
return true if @killed || @colapse_time > 0
return false
end
def enemy_ready?
return false if @enemy.nil? || @page.nil? || collapsing? || @enemy.object
return true
end
def battler
return @enemy
end
def apply_respawn
return if @colapse_time > 0
@draw_drop = false
@dropped_items.clear
@through = @die_through
@through = false if @through.nil?
@die_through = nil
@secollapse = nil
@colapse_time = 0
@erased = false ; @opacity = 255
@zoomfx_x = 1.0 ; @zoomfx_y = 1.0
@killed = false
@priority_type = 1 if @deadposee
resetdeadpose
refresh
end
def resetdeadpose
if @deadposee
$game_self_switches[] = false
end
end
def kill_enemy
@secollapse = nil
@killed = true
@priority_type = 0 if @deadposee
gain_exp
gain_gold
etext = 'Exp ' + @enemy.exp.to_s if @enemy.exp > 0
gtext = 'Gold ' + @enemy.gold.to_s if @enemy.gold > 0
$game_player.pop_damage("#{etext} #{gtext}") if etext || gtext
make_drop_items
run_assigned_commands
end
def run_assigned_commands
transform = @enemy.enemy.tool_data("Enemy Die Transform = ")
switch = @enemy.enemy.tool_data("Enemy Die Switch = ")
$game_switches = true if switch != nil
variable = @enemy.enemy.tool_data("Enemy Die Variable = ")
$game_variables += 1 if variable != nil
self_sw = @enemy.enemy.tool_data("Enemy Die Self Switch = ", false)
#$game_map.event_enemies.delete(self) if @enemy.object
#$game_map.enemies.delete(@enemy) if @enemy.object
if self_sw.is_a?(String)
$game_self_switches[] = true
apply_respawn
$game_map.event_enemies.delete(self)
$game_map.enemies.delete(@enemy)
unless $game_system.remain_killed.has_key?($game_map.map_id)
$game_system.remain_killed =
end
$game_system.remain_killed.push(self.id) unless
$game_system.remain_killed.include?(self.id)
@enemy = nil
else
erase unless @deadposee
respawn = @enemy.enemy.tool_data("Enemy Respawn Seconds = ")
animation = @enemy.enemy.tool_data("Enemy Respawn Animation = ")
@respawn_count = respawn * 60 unless respawn.nil?
@respawn_anim = animation unless animation.nil?
end
if transform != nil
@enemy = Game_Enemy.new(0, transform)
apply_respawn
end
end
def make_drop_items
@dropped_items = @enemy.make_drop_items
unless @dropped_items.empty?
$game_player.enemy_drops.push(self)
$game_map.events_withtags.push(self) unless
$game_map.events_withtags.include?(self)
end
end
def gain_exp
return if @enemy.exp == 0
$game_party.all_members.each do |actor|
actor.gain_exp(@enemy.exp)
end
end
def gain_gold
return if @enemy.gold == 0
$game_party.gain_gold(@enemy.gold)
end
alias falcaopearlabs_updatev update
def update
@start_delay -= 1 if @start_delay > 0
@touch_atkdelay -= 1 if @touch_atkdelay > 0
update_enemy_sensor unless @enemy.nil?
update_enemy_touch_damage unless @enemy.nil?
falcaopearlabs_updatev
end
def update_enemy_touch_damage
return unless @touch_damage > 0
return unless @character_name != ""
return if @epassive || @killed
return if @touch_atkdelay > 0
unless @enemy.object
@agroto_f.nil? ? target = $game_player : target = @agroto_f
else
target = $game_player
$game_player.followers.each do |follower|
next unless follower.visible?
if obj_size?(follower, @touch_damage) and !follower.battler.dead?
execute_touch_damage(follower)
end
end
end
execute_touch_damage(target) if obj_size?(target, @touch_damage)
end
def execute_touch_damage(target)
target.battler.attack_apply(@enemy)
target.pop_damage
@touch_atkdelay = 50
target.colapse_time = 60 if target.battler.dead?
return if target.battler.result.hp_damage == 0
target.jump(0, 0)
end
# enemy sensor
def update_enemy_sensor
return if @hookshoting
return if @epassive
if @sensor != nil
@agroto_f.nil? ? target = $game_player : target = @agroto_f
if obj_size?(target, @sensor)
data =
if @inrangeev.nil? and !$game_self_switches[[data, data,
data]]
$game_self_switches[[data, data, data]] = true
@inrangeev = true
end
elsif @inrangeev != nil
data =
if $game_self_switches[[data, data, data]]
$game_self_switches[[data, data, data]] = false
@inrangeev = nil
end
end
end
end
# on battle pixel, take a lot of time procesing, but it is very exact
def on_battle_pixel?(out=0)
w = Graphics.width + out; h = Graphics.height + out
return true if screen_x.between?(0 - out,w) and screen_y.between?(0 - out,h)
return false
end
def cmt_data(comment)
return 0 if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
return $1.to_i if item.parameters =~ /#{comment}(.*)>/i
end
end
return 0
end
def string_data(comment)
return nil if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
return $1.to_s if item.parameters =~ /#{comment}(.*)>/i
end
end
return nil
end
# stop event movement
alias falcaopearl_update_self_movement update_self_movement
def update_self_movement
return if !@boom_grabdata.nil?
return if force_stopped? || @colapse_time > 0 || @blowpower > 0
falcaopearl_update_self_movement
end
end
class Game_System
attr_accessor :remain_killed
alias falcao_fantastic_store_ini initialize
def initialize
falcao_fantastic_store_ini
@remain_killed = {}
end
end
#===============================================================================
# mist
class Game_Map
attr_reader :map
attr_accessor :event_enemies, :enemies, :events_withtags
alias falcaopearl_enemycontrol_ini initialize
def initialize
@event_enemies =
@enemies =
@events_withtags =
falcaopearl_enemycontrol_ini
end
alias falcaopearl_enemycontrol_setup setup
def setup(map_id)
@event_enemies.clear
@enemies.clear
@events_withtags.clear
falcaopearl_enemycontrol_setup(map_id)
if $game_temp.loadingg != nil
@event_enemies.each do |event|
event.resetdeadpose
end
$game_temp.loadingg = nil
end
end
alias falcaopearl_damage_floor damage_floor?
def damage_floor?(x, y)
return if $game_player.hookshoting
falcaopearl_damage_floor(x, y)
end
end
class Game_Temp
attr_accessor :pop_windowdata, :loadingg
def pop_w(time, name, text)
return unless @pop_windowdata.nil?
@pop_windowdata =
end
end
class Game_Party < Game_Unit
alias falcaopearl_swap_order swap_order
def swap_order(index1, index2)
unless SceneManager.scene_is?(Scene_Map)
if $game_player.in_combat_mode?
$game_temp.pop_w(180, 'Pearl ABS',
'You cannot switch player while in combat!')
return
elsif $game_player.any_collapsing?
$game_temp.pop_w(180, 'Pearl ABS',
'You cannot switch player while collapsing!')
return
elsif $game_party.battle_members.deadposing != nil
$game_temp.pop_w(180, 'Pearl ABS',
'You cannot move a dead ally!')
return
end
end
falcaopearl_swap_order(index1, index2)
end
end
class << DataManager
alias falcaopearl_extract extract_save_contents
def DataManager.extract_save_contents(contents)
falcaopearl_extract(contents)
$game_temp.loadingg = true
end
end
Pearl projectile
#===============================================================================
# * Falcao Pearl ABS script shelf # 2
#
# This script handles all the Projectiles in pearl ABS, this class is the
# responsable of manage each tool settings, do not touch anything or your
# pc will explode
#===============================================================================
class Projectile < Game_Character
attr_accessor :draw_it, :destroy_it, :user, :tool_retracting, :customsteps
attr_accessor :tool_distance, :original_distance, :agroto_f, :pick_able
attr_accessor :tool_destroy_delay
def initialize(user, item, custom=nil)
super()
PearlKernel.load_item(item)
@tool_special = PearlKernel.tool_special
@draw_it = false
@destroy_it = false
@user = user
@item = item
@step_anime = true
@through = true if PearlKernel.tool_through == "true"
@through = true if PearlKernel.tool_through.nil?
moveto(user.x, user.y)
set_direction(user.direction)
@customsteps = custom if custom.is_a?(Fixnum)
@original_item = @item
@target_effect =
set_targeting
return if PearlKernel.user_graphic.nil?
load_item_data
jump(0, 0) if @user.passable?(@user.x, @user.y, @user.direction) and
PearlKernel.tool_shortjump == "true"
if @tool_special == "triple"
@triple = custom
move_forward if @tool_distance > 2
elsif @tool_special == "quintuple"
@quintuple = custom
move_forward if @tool_distance > 2
elsif @tool_special == "octuple"
@octuple = custom
if @octuple == :seis || @octuple == :siete || @octuple == :ocho
@direction = 8 if @user.direction == 2
@direction = 6 if @user.direction == 4
@direction = 4 if @user.direction == 6
@direction = 2 if @user.direction == 8
end
elsif @tool_special.split(" ").include?('common_event')
@commonevent_id = @tool_special.sub("common_event ","").to_i
for i in $data_common_events.list
if i.code == 205
force_move_route(i.parameters)
end
end
@tool_distance = 0
end
@move_speed == 6 ? @mini_opacity = 7 : @mini_opacity = 9
@opacity = 0
check_combo_effect
apply_item_transform if @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
end
# combo
def check_combo_effect
c = PearlKernel.tool_combo
return if c == 'nil' || c.nil?
c = c.split(", ")
return unless rand(101) <= c.to_i
case c
when 'weapon' then @user.combodata << [:weapon, c.to_i, c, 20]
when 'armor' then @user.combodata << [:armor, c.to_i, c, 20]
when 'item' then @user.combodata << [:item, c.to_i, c, 20]
when 'skill' then @user.combodata << [:skill, c.to_i, c, 20]
end
@has_combo = true
end
# Get projectile battler, it take the properies of the user
def battler
return nil if @commonevent_id.nil?
return @user.battler
end
# make target
def set_targeting
return if @tool_special == "hook" || @tool_special == "boomerang" ||
@tool_special == "shield" || @tool_special == "spiral" ||
@tool_special == "triple" || @tool_special == "quintuple" ||
@tool_special == "autotarget" || @tool_special == "random" ||
@commonevent_id != nil
if @user.targeting
@target_effect = [@user.targeting, @user.targeting]
@user.turn_toward_character(@target_effect)
end
if PearlKernel.tool_target == "true" and @user.battler.is_a?(Game_Enemy)
target = $game_player
target = @user.agroto_f if @user.agroto_f != nil
@user.targeting =
@target_effect = [@user.targeting, @user.targeting]
@user.turn_toward_character(target)
end
end
# Load item variables
def load_item_data
@character_name = PearlKernel.tool_graphic
if @character_name == "nil"
@character_name = @user.character_name
@transparent = true
end
@character_index = PearlKernel.tool_index
@tool_size = PearlKernel.tool_size
@tool_distance = PearlKernel.tool_distance
@tool_effect_delay = PearlKernel.tool_effectdelay
@tool_destroy_delay = PearlKernel.tool_destroydelay
@move_speed = PearlKernel.tool_speed
@tool_blow_power = PearlKernel.tool_blowpower
@tool_piercing = PearlKernel.tool_piercing
@tool_piercing = PearlKernel.tool_piercing == "true"
@tool_end_anime = PearlKernel.tool_animation
if @tool_end_anime.split(" ").include?('delay')
@tool_end_anime = @tool_end_anime.sub("delay ","").to_i
end
@tool_animerepeat = PearlKernel.tool_anirepeat == "true"
@tool_invoke = PearlKernel.tool_invoke
@tool_guardrate = PearlKernel.tool_guardrate
@tool_knockdownrate = PearlKernel.tool_knockdown
@tool_selfdamage = PearlKernel.tool_selfdamage == "true"
@tool_hitshake = PearlKernel.tool_hitshake == "true"
sound = PearlKernel.tool_soundse
RPG::SE.new(sound, 80).play rescue nil # SOUND
@original_distance = @tool_distance
@mnganime = 0
if @customsteps != nil
@pattern = 0
@tool_distance = @customsteps
@pattern = 1 if @customsteps + 1 == @original_distance
@transparent = true if @customsteps == 0
@user.battler_chain.push(self)
end
@tool_retracting = false
if @tool_special == "area" and @target_effect
@user.turn_toward_character(@target_effect)
moveto(@target_effect.x, @target_effect.y)
end
@originaldestory_delay = @tool_destroy_delay
@priority_type = PearlKernel.tool_priority
if @tool_special == "spiral"
@spintimer = 0
@dir_was = @user.direction
moveto(@user.x + @user.adjustcxy, @user.y + @user.adjustcxy) if
!@user.facing_corners?
@spintimes = @tool_distance
@tool_distance = 0
@user.making_spiral = true
end
PearlKernel.check_iconset(@item, "Projectile Iconset = ", self)
@character_name = "" if @pro_iconset != nil
@pick_able = @item.note.include?('<pick up>')
@ignore_followers = @item.note.include?('<ignore_followers>')
if @tool_special != "shield" and !@item.note.include?('<ignore_voices>')
voices = PearlKernel.voices(@user.battler)
RPG::SE.new(voices, 80).play unless voices.nil?
end
apply_item_transform if @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
end
# After loading tool variables check if the tool can be transformed (w/a)
def apply_item_transform
if @tool_invoke > 0 and @tool_invoke != 1 and @tool_invoke != 2
@item = $data_skills
end
end
def magical_item?
return true if @item.is_a?(RPG::Skill) || @item.is_a?(RPG::Item)
return false
end
# Frame update
def update
super
if magical_item?
case @item.scope
when 0 # scope 0 apply the effect to the user
apply_self_effect(@user, true)
return
when 7 # heal one ally
apply_effectto_selection
return
when 8 # heall all
apply_effectto_all_allies
return
when 9 # revive one ally
apply_effectto_selection
return
when 10 # revive all
apply_effectto_all_allies
return
when 11 # to the user
apply_self_effect(@user, true)
return
end
end
@precombi = @user.doingcombo > 0 if @precombi.nil?
update_tool_token
# continue when the scopes has not benefical effects
if @target_effect
follow_char(@target_effect) if !moving?
@tool_distance = 0
end
@tool_distance = 0 if @tool_special == "area"
update_timer
#---------------------------------------------------------------------------
# Tool special shield engine
if @item.is_a?(RPG::Armor) and @tool_special == "shield"
if !@user.battler_guarding
if @tool_invoke > 0
@user.battler.melee_attack_apply(@user.battler,@tool_invoke)
else
@user.battler.item_apply(@user.battler, $data_skills)
end
@user.battler_guarding = true
@user.battler_guarding = @tool_guardrate
# shield directions
elsif @user.battler_guarding
if @user.battler.is_a?(Game_Actor)
if @user.is_a?(Game_Player)
if PearlKey.press?(Key::Armor) and
@tool_destroy_delay <= @originaldestory_delay - 16
@tool_destroy_delay = 10
@user.anime_speed = 10
end
@user.direction = 2 if Input.dir4 == 2
@user.direction = 4 if Input.dir4 == 4
@user.direction = 6 if Input.dir4 == 6
@user.direction = 8 if Input.dir4 == 8
end
else
if @user.is_a?(Game_Event) and @user.agroto_f != nil
@user.turn_toward_character(@user.agroto_f)
else
@user.turn_toward_character($game_player)
end
end
end
if @tool_destroy_delay == 0
@user.battler.remove_state(9)
@user.battler_guarding =
end
return
end
# if not shield given continue
update_hookshotdef if @customsteps != nil # update hookshot
update_boomerand if @tool_special == "boomerang" # update boomerang
update_spiral if @tool_special == "spiral" # update spiral
return if @transparent and @customsteps != nil # return is tranparent
update_damage # update damage
end
#=============================================================================
# hookshot mode
def update_hookshotdef
@tool_destroy_delay = 1000 ; @tool_size = 1
@move_speed = 6 if @move_speed != 6
@tool_piercing = true if !@tool_piercing
for event in $game_map.events_withtags
if obj_size?(event, @tool_size)
if event.hook_pull && !@user.hookshoting
break if @transparent
break if event.x == @user.x and event.y == @user.y
@user.hookshoting = true
@tool_distance = 0
@user.user_move_distance = @customsteps
@user.user_move_distance = @user.move_speed
@user.user_move_distance = @user.through
@user.user_move_distance =
@user.move_speed = @move_speed
@user.through = true
@user.battler_chain.each {|c| c.tool_distance = 0
if c.customsteps == c.original_distance - 1 # this is the last chain
if c.in_frontof?(self)
self.pattern = c.pattern # pattern change for convenience
c.pattern = 0
end
end
}
elsif event.hook_grab and !@user.hookshoting
break if event.being_grabbed
break if @user.in_frontof?(event)
event.being_grabbed = true
@user.hookshoting = true
@user.battler_chain.each {|i|
i.pattern = 1 if i.customsteps == @customsteps - 2
next if i.customsteps < @customsteps - 1
i.transparent = true} # make trnparent when grabing
event.user_move_distance = @customsteps
event.user_move_distance = event.move_speed
event.user_move_distance = event.through
@user.user_move_distance = event
event.move_speed = @move_speed - 0.3
event.through = true
event.turn_toward_character(@user)
end
end
end
# if the user being pulled
if @user.hookshoting
@user.battler_chain.each do |pr|
if pr.x == @user.x and pr.y == @user.y
pr.destroy_it = true
if @user.user_move_distance == @user.x and
@user.user_move_distance == @user.y
@user.battler_chain.clear
@user.move_speed = @user.user_move_distance
@user.through = @user.user_move_distance
@user.hookshoting = 30
@user.hookshoting = false
if @user.is_a?(Game_Player) and !@user.follower_fighting?
@user.followers.gather
end
end
end
end
return
# if the user is grabbing
elsif @user.hookshoting
event = @user.user_move_distance
if @user.in_frontof?(event)
event.move_speed = event.user_move_distance
event.through = event.user_move_distance
@user.hookshoting = false
event.user_move_distance = 0
@user.hookshoting = 70
end
end
# retracting engine hookshot
if @customsteps + 1 == @original_distance && @tool_distance == 0 && !moving?
@user.battler_chain.each do |projectile|
next if projectile.tool_retracting
projectile.tool_retracting = true
projectile.direction_fix = true
end
end
# retraction
@user.battler_chain.each do |pr|
if pr.tool_retracting
pr.destroy_it = true if @user.facing_corners?
pr.move_toward_character(@user) if !pr.moving?
if pr.x == @user.x and pr.y == @user.y
pr.destroy_it = true
if pr.customsteps == pr.original_distance - 1
@user.battler_chain.clear
@user.hookshoting = 10
end
end
end
end
end
# Special Boomerang
def update_boomerand
$game_map.events_withtags.each do |event|
if event.boom_grab || !event.dropped_items.empty?
if event.boom_grabdata.nil? and obj_size?(event, @tool_size)
event.boom_grabdata =
event.move_speed = 6
event.through = true
end
end
# event being grabbed by boomerang
if !event.boom_grabdata.nil?
event.x, event.y = @x, @y
if event.obj_size?(@user, 2)
reset_boomed(event)
unless event.jumping?
event.jumpto_tile(@user.x, @user.y)
event.direction = event.page.graphic.direction rescue 2
event.start if event.boom_start && !event.killed
end
end
reset_boomed(event) if @tool_destroy_delay == 1 and obj_size?(event, 1)
end
end
# prepare the tool to be destoryed when colliding with user
if @tool_destroy_delay <= @originaldestory_delay - 50
move_toward_character(@user) if !moving?
if @x == @user.x and @y == @user.y
@user.anime_speed = 0
@destroy_it = true
end
end
end
def reset_boomed(event)
event.move_speed = event.boom_grabdata
event.through = event.boom_grabdata
event.boom_grabdata = nil
end
# Special Spiral
def update_spiral
@spintimer += 1
case @spintimer
when 6 then make_rounds(1)
when 12 then make_rounds(2)
when 18 then make_rounds(3)
when 24 then make_rounds(4)
if @spintimes > 1
@spintimer = 0
@spintimes -= 1
end
when 40
@destroy_it = true
@user.anime_speed = 0
end
end
# move the tool and the user to fforn direction
def movetofront(dir, conditional)
@user.direction = dir if @user.direction == conditional
moveto(@user.x + @user.adjustcxy, @user.y + @user.adjustcxy) if
!@user.facing_corners?
@direction = @user.direction
end
# make round depending of the user direction
def make_rounds(type)
case type
when 1
movetofront(4, 2) if @dir_was == 2 ; movetofront(8, 4) if @dir_was == 4
movetofront(2, 6) if @dir_was == 6 ; movetofront(6, 8) if @dir_was == 8
when 2
movetofront(8, 4) if @dir_was == 2 ; movetofront(6, 8) if @dir_was == 4
movetofront(4, 2) if @dir_was == 6 ; movetofront(2, 6) if @dir_was == 8
when 3
movetofront(6, 8) if @dir_was == 2 ; movetofront(2, 6) if @dir_was == 4
movetofront(8, 4) if @dir_was == 6 ; movetofront(4, 2) if @dir_was == 8
when 4
movetofront(2, 6) if @dir_was == 2 ; movetofront(4, 2) if @dir_was == 4
movetofront(6, 8) if @dir_was == 6 ; movetofront(8, 4) if @dir_was == 8
end
end
#============================================================================
# Apply benefical effects to users and allies
# apply effect to a single selection
def apply_effectto_selection
# if the battler is a game actor the effect going to a target
if @user.battler.is_a?(Game_Actor)
apply_self_effect(@target_effect, true)
else
# Enemies choose a random target ally
all =
for event in $game_map.event_enemies
if event.on_battle_screen?
next if event.battler.object
if @item.scope == 9 and event.killed
all.push(event)
apply_self_effect(event, true)
event.apply_respawn
return
end
all.push(event)
end
end
# if scope for the user
if @item.scope == 9
apply_self_effect(@user, true)
return
end
all.push(@user)
target = all
apply_self_effect(target, true) if !target.nil?
apply_self_effect(@user, true) if target.nil?
end
end
# effect to all allies
def apply_effectto_all_allies
# apply effect to all battle menbers actors
if @user.battler.is_a?(Game_Actor)
$game_player.followers.each {|i|
next unless i.visible?
next if i.battler.dead? and @item.scope == 8
apply_self_effect(i, pop=true)}
apply_self_effect($game_player, pop=true)
# Apply effect to all enemies allies
elsif @user.battler.is_a?(Game_Enemy)
for event in $game_map.event_enemies
if event.on_battle_screen?
next if event.battler.object || event.page.nil?
next if @item.scope == 8 and event.battler.dead?
if event.battler.dead?
@item.scope == 10 ? event.apply_respawn : next
end
event.battler.item_apply(event.battler, @item)
$game_player.damage_pop.push(DamagePop_Obj.new(event))
event.animation_id = animation
end
end
apply_self_effect(@user, true)
end
end
# direct effect
def apply_self_effect(target, pop=true)
target.battler.item_apply(target.battler, @item)
target.animation_id = animation
$game_player.damage_pop.push(DamagePop_Obj.new(target))
@destroy_it = true
end
#============================================================================
# update damage depending if the user is an enemy or actor
def update_damage
if @user.battler.is_a?(Game_Actor)
apply_damageto_enemy
if @tool_selfdamage
apply_damageto_player
apply_damageto_followers unless @ignore_followers
end
elsif @user.battler.is_a?(Game_Enemy)
if $game_player.normal_walk?
apply_damageto_player
apply_damageto_followers unless @ignore_followers
end
apply_damageto_enemy if @tool_selfdamage
end
end
# Timer updater
def update_timer
update_tool_movement
@mini_opacity -= 1 if @mini_opacity > 0
@opacity = 255 if @mini_opacity == 1
@tool_effect_delay -= 1 if @tool_effect_delay > 0
if @tool_distance == 0
@tool_destroy_delay -= 1 if @tool_destroy_delay > 0
@destroy_it = true if @tool_destroy_delay == 0
end
update_animation_setting
end
#=============================================================================
# * movement
def make_diagonal_a
move_diagonal(4, 2) if @direction == 2
move_diagonal(4, 8) if @direction == 4
move_diagonal(6, 8) if @direction == 6
move_diagonal(4, 8) if @direction == 8
end
def make_diagonal_b
move_diagonal(6, 2) if @direction == 2
move_diagonal(4, 2) if @direction == 4
move_diagonal(6, 2) if @direction == 6
move_diagonal(6, 8) if @direction == 8
end
def make_direction_a
@direction = 4 if @user.direction == 2
@direction = 8 if @user.direction == 4
@direction = 2 if @user.direction == 6
@direction = 6 if @user.direction == 8
@direction_done = true
end
def make_direction_b
@direction = 6 if @user.direction == 2
@direction = 2 if @user.direction == 4
@direction = 8 if @user.direction == 6
@direction = 4 if @user.direction == 8
@direction_done = true
end
def update_tool_movement
if @tool_distance > 0 and not moving?
if @triple != nil # tripple definition
case @triple
when :uno then make_diagonal_a
when :dos then move_forward
when :tres then make_diagonal_b
end
@tool_distance -= 1
elsif @quintuple != nil # quintuple definition
case @quintuple
when :uno ; make_direction_a if @direction_done.nil?; move_forward
when :dos ; make_diagonal_a
when :tres ; move_forward
when :cuatro ; make_diagonal_b
when :cinco ; make_direction_b if @direction_done.nil? ; move_forward
end
@tool_distance -= 1
elsif @octuple != nil # octuple
case @octuple
when :uno ; make_direction_a if @direction_done.nil?; move_forward
when :dos ; make_diagonal_a
when :tres ; move_forward
when :cuatro ; make_diagonal_b
when :cinco ; make_direction_b if @direction_done.nil? ; move_forward
when :seis ; make_diagonal_a
when :siete ; move_forward
when :ocho ; make_diagonal_b
end
@tool_distance -= 1
elsif @tool_special == "autotarget" # autotarget
if @autotargeting.nil?
@autotargeting =
# chose any event enemy on the map if the user is an actor
if @user.battler.is_a?(Game_Actor)
for event in $game_map.event_enemies
if @user.is_a?(Game_Follower) and @user.targeted_character != nil
@autotargeting =
#@user.turn_toward_character(@user.targeted_character)
move_forward
return
end
if event.enemy_ready? and event.on_battle_screen? and
obj_size?(event, 8)
@autotargeting =
#@user.turn_toward_character(event)
move_forward
return
end
end
# choose a game actor if the user is an enemy
elsif @user.battler.is_a?(Game_Enemy)
@user.agroto_f.nil? ? target =$game_player : target = @user.agroto_f
@autotargeting = if obj_size?(target, 8)
end
end
if @autotargeting
follow_char(@autotargeting)
@autotargeting.clear if @autotargeting.x == @x and
@autotargeting.y == @y
else
move_forward
end
@tool_distance -= 1
# random
elsif @tool_special == "random"
move_forward if @tool_distance == @original_distance - 1
move_forward if @tool_distance == @original_distance - 2
move_random if @tool_distance <= @original_distance - 3
@tool_distance -= 1
# boomerang redirect movement
elsif @tool_special == "boomerang"
if @user.is_a?(Game_Player)
case Input.dir8
when 1 then move_diagonal(4, 2)
when 3 then move_diagonal(6, 2)
when 7 then move_diagonal(4, 8)
when 9 then move_diagonal(6, 8)
else #not input just move straig
move_forward
end
# not game player just move straight
else
move_forward
end
@tool_distance -= 1
# reserved for common event function
elsif @commonevent_id != nil
else # normal move forward behavior
move_forward ; @tool_distance -= 1
end
end
end
# tool animation
def update_animation_setting
case @tool_end_anime
when "end"
if @tool_destroy_delay >= 8 and @tool_destroy_delay <= 16
@animation_id = animation
end
when "acting"
if @tool_animerepeat
@animation_id = animation if @mnganime == 0
@mnganime += 1
@mnganime = 0 if @mnganime == 12
else
@animation_id = animation if @mnganime == 0
@mnganime = 1
end
end
if @tool_end_anime.is_a?(Fixnum)
@animation_id = animation if @tool_destroy_delay == @tool_end_anime
end
end
# Get the animation to be played
def animation
if @item.is_a?(RPG::Armor)
return $data_skills.animation_id if @tool_invoke > 0
return 0
end
return @item.animation_id
end
# apply damage to enemy
def apply_damageto_enemy
return if @tool_effect_delay > 0
$game_map.event_enemies.each do |event|
next if event.collapsing?
if event.battler.body_sized > 0
enabled = body_size?(, @tool_size)
enabled = body_size?(, @tool_size) if !enabled
enabled = body_size?(, @tool_size) if !enabled
enabled = body_size?(, @tool_size) if !enabled
if event.battler.body_sized == 2
enabled = body_size?(, @tool_size) if !enabled
enabled = body_size?(, @tool_size) if !enabled
enabled = body_size?(, @tool_size) if !enabled
end
else
enabled = body_size?(, @tool_size)
end
if enabled and event.just_hitted == 0
event.just_hitted = 20
next if event.page.nil?
if !enable_dame_execution?(event.battler)
unless event.battler.object
RPG::SE.new(Key::GuardSe, 80).play
event.pop_damage('Guard')
play_hit_animation(event)
end
return
end
#-------------------------
execute_damageto_enemy(event)
end
end
end
# check wheter the enemy is killed by spefific items
def enable_dame_execution?(enemy)
weapon = enemy.kill_weapon if @original_item.is_a?(RPG::Weapon)
armor = enemy.kill_armor if @original_item.is_a?(RPG::Armor)
item = enemy.kill_item if @original_item.is_a?(RPG::Item)
skill = enemy.kill_skill if @original_item.is_a?(RPG::Skill)
if enemy.has_kill_with?
return true if !weapon.nil? && weapon.include?(@original_item.id)
return true if !armor.nil? && armor.include?(@original_item.id)
return true if !item.nil? && item.include?(@original_item.id)
return true if !skill.nil? && skill.include?(@original_item.id)
return false
end
return true
end
# execute damage to enemy
def execute_damageto_enemy(event)
event.being_targeted = false if event.being_targeted
event.epassive = false if event.epassive
if event.agroto_f.nil? and @user.is_a?(Game_Follower)
event.agroto_f = @user if rand(5) == 1
end
if event.agroto_f != nil and @user.is_a?(Game_Player)
event.agroto_f = nil if rand(2) == 1
end
if !event.battler.object
return if guard_success?(event, 1)
end
execute_damage(event)
return if event.battler.object
$game_player.damage_pop.push(DamagePop_Obj.new(event)) unless
guard_success?(event, 2)
apply_blow_power(event) unless event.battler.k_back_dis
case (event.battler.hp.to_f / event.battler.mhp.to_f * 100.0)
when 0..10 then activate_lhp_switch(event.battler.lowhp_10)
when 0..25 then activate_lhp_switch(event.battler.lowhp_25)
when 0..50 then activate_lhp_switch(event.battler.lowhp_50)
when 0..75 then activate_lhp_switch(event.battler.lowhp_75)
end
end
def activate_lhp_switch(switch)
$game_switches = true if !switch.nil? and !$game_switches
end
# apply damage to player
def apply_damageto_player
return if @tool_effect_delay > 0 || $game_player.battler.dead?
if obj_size?($game_player, @tool_size) and $game_player.just_hitted == 0
$game_player.just_hitted = 20
return if guard_success?($game_player, 1)
execute_damage($game_player)
$game_player.damage_pop.push(DamagePop_Obj.new($game_player)) unless
guard_success?($game_player, 2)
apply_blow_power($game_player)
end
end
# Apply damage to followers
def apply_damageto_followers
return if @tool_effect_delay > 0
# followers
for actor in $game_player.followers
next unless actor.visible?
if obj_size?(actor, @tool_size) and actor.just_hitted == 0
actor.just_hitted = 20
next if actor.battler.dead?
return if guard_success?(actor, 1)
execute_damage(actor)
$game_player.damage_pop.push(DamagePop_Obj.new(actor)) unless
guard_success?(actor, 2)
apply_blow_power(actor)
end
end
end
def precombo(sym)
@item.is_a?(RPG::Weapon) ? e=@user.actor.equips : e=@user.actor.equips
return if e.nil?
if sym == :apply
@user.apply_weapon_param(e, false)
@user.apply_weapon_param(@item, true)
elsif sym == :remove
@user.apply_weapon_param(@item, false)
@user.apply_weapon_param(e, true)
end
end
# Execute damage to the target
def execute_damage(target)
if magical_item?
target.battler.item_apply(@user.battler, @item)
else
@user.apply_weapon_param(@item, true) if @user.battler.is_a?(Game_Enemy)
precombo(:apply) if @user.battler.is_a?(Game_Actor) && @precombi
if @tool_invoke > 0
target.battler.melee_attack_apply(@user.battler, @tool_invoke)
else
target.battler.attack_apply(@user.battler)
end
@user.apply_weapon_param(@item, false) if @user.battler.is_a?(Game_Enemy)
precombo(:remove) if @user.battler.is_a?(Game_Actor) && @precombi
end
target.colapse_time = 60 if target.battler.dead?
return if target.battler.is_a?(Game_Enemy) and target.battler.object
hp_d = target.battler.result.hp_drain
@user.pop_damage() if hp_d > 0
mp_d = target.battler.result.mp_drain
@user.pop_damage() if mp_d > 0
return if target.battler_guarding
return if target.battler.result.hp_damage < 0
return if target.battler.result.hp_damage == 0
target.jump(0, 0) if PearlKernel.jump_hit?(target.battler) and
@tool_blow_power < 2
voices = PearlKernel.hitvoices(target.battler)
RPG::SE.new(voices, 80).play unless voices.nil?
$game_map.screen.start_shake(8, 6, 24) if @tool_hitshake
return if target.hookshoting || @user.making_spiral
return if @tool_knockdownrate == 0
if rand(101) <= @tool_knockdownrate
target.knockdown_data = 60
end
end
# Check guard if the user is using the shield
def guard_success?(userr, type)
if userr.battler_guarding
# guard
if type == 1
if rand(101) <= userr.battler_guarding
return false unless faceto_face?(userr)
RPG::SE.new(Key::GuardSe, 80).play
$game_player.damage_pop.push(DamagePop_Obj.new(userr, 2))
unless @user.making_spiral
@tool_distance = 0
@tool_destroy_delay = 0
end
play_hit_animation(userr)
return true
end
# block
elsif type == 2
return false unless faceto_face?(userr)
$game_player.damage_pop.push(DamagePop_Obj.new(userr, 1))
return true
end
end
return false
end
# this metthod make the tool wait for the animation to be displayed when hit
def apply_passive_state
@transparent = true
@tool_effect_delay = 1000 * 1000
@tool_destroy_delay = 60
@animation_id = animation
@tool_distance = 0
end
# hit animation
def play_hit_animation(target)
if @target_effect || !@tool_piercing
@tool_end_anime == "hit" ? apply_passive_state : @destroy_it = true
else
target.animation_id = animation if @tool_end_anime == "hit"
end
end
# blow powers effects
def apply_blow_power(target)
play_hit_animation(target)
return if target.battler.result.hp_damage < 1
return if target.hookshoting || @user.making_spiral
target.blowpower = if target.blowpower == 0 and
target.blowpower == 0
#follower blow
if target.is_a?(Game_Player)
target.followers.each {|f|
next unless f.visible?
next if f.battler.dead?
f.blowpower = if f.blowpower == 0 and f.blowpower == 0
}
end
end
# pattern
def update_anime_pattern
return if @tool_special == "hook"
super
end
# Activate events by tool token id
def update_tool_token
return if @tool_effect_delay > 0
$game_map.events_withtags.each do |event|
if obj_size?(event, @tool_size) and event.start_delay == 0
wid = event.token_weapon
aid = event.token_armor
iid = event.token_item
sid = event.token_skill
item = @original_item
case item
when RPG::Weapon; start_token(event) if wid.include?(item.id)
when RPG::Armor ; start_token(event) if aid.include?(item.id)
when RPG::Item ; start_token(event) if iid.include?(item.id)
when RPG::Skill ; start_token(event) if sid.include?(item.id)
end
end
end
end
# trigger event
def start_token(event)
$game_map.events_withtags.delete(event)
event.start
event.start_delay = 30
end
def move_straight(d, turn_ok = true)
return if force_stopped?
super
end
end
#===============================================================================
# * Falcao Pearl ABS script shelf # 2
#
# This script handles all the Projectiles in pearl ABS, this class is the
# responsable of manage each tool settings, do not touch anything or your
# pc will explode
#===============================================================================
class Projectile < Game_Character
attr_accessor :draw_it, :destroy_it, :user, :tool_retracting, :customsteps
attr_accessor :tool_distance, :original_distance, :agroto_f, :pick_able
attr_accessor :tool_destroy_delay
def initialize(user, item, custom=nil)
super()
PearlKernel.load_item(item)
@tool_special = PearlKernel.tool_special
@draw_it = false
@destroy_it = false
@user = user
@item = item
@step_anime = true
@through = true if PearlKernel.tool_through == "true"
@through = true if PearlKernel.tool_through.nil?
moveto(user.x, user.y)
set_direction(user.direction)
@customsteps = custom if custom.is_a?(Fixnum)
@original_item = @item
@target_effect =
set_targeting
return if PearlKernel.user_graphic.nil?
load_item_data
jump(0, 0) if @user.passable?(@user.x, @user.y, @user.direction) and
PearlKernel.tool_shortjump == "true"
if @tool_special == "triple"
@triple = custom
move_forward if @tool_distance > 2
elsif @tool_special == "quintuple"
@quintuple = custom
move_forward if @tool_distance > 2
elsif @tool_special == "octuple"
@octuple = custom
if @octuple == :seis || @octuple == :siete || @octuple == :ocho
@direction = 8 if @user.direction == 2
@direction = 6 if @user.direction == 4
@direction = 4 if @user.direction == 6
@direction = 2 if @user.direction == 8
end
elsif @tool_special.split(" ").include?('common_event')
@commonevent_id = @tool_special.sub("common_event ","").to_i
for i in $data_common_events.list
if i.code == 205
force_move_route(i.parameters)
end
end
@tool_distance = 0
end
@move_speed == 6 ? @mini_opacity = 7 : @mini_opacity = 9
@opacity = 0
check_combo_effect
apply_item_transform if @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
end
# combo
def check_combo_effect
c = PearlKernel.tool_combo
return if c == 'nil' || c.nil?
c = c.split(", ")
return unless rand(101) <= c.to_i
case c
when 'weapon' then @user.combodata << [:weapon, c.to_i, c, 20]
when 'armor' then @user.combodata << [:armor, c.to_i, c, 20]
when 'item' then @user.combodata << [:item, c.to_i, c, 20]
when 'skill' then @user.combodata << [:skill, c.to_i, c, 20]
end
@has_combo = true
end
# Get projectile battler, it take the properies of the user
def battler
return nil if @commonevent_id.nil?
return @user.battler
end
# make target
def set_targeting
return if @tool_special == "hook" || @tool_special == "boomerang" ||
@tool_special == "shield" || @tool_special == "spiral" ||
@tool_special == "triple" || @tool_special == "quintuple" ||
@tool_special == "autotarget" || @tool_special == "random" ||
@commonevent_id != nil
if @user.targeting
@target_effect = [@user.targeting, @user.targeting]
@user.turn_toward_character(@target_effect)
end
if PearlKernel.tool_target == "true" and @user.battler.is_a?(Game_Enemy)
target = $game_player
target = @user.agroto_f if @user.agroto_f != nil
@user.targeting =
@target_effect = [@user.targeting, @user.targeting]
@user.turn_toward_character(target)
end
end
# Load item variables
def load_item_data
@character_name = PearlKernel.tool_graphic
if @character_name == "nil"
@character_name = @user.character_name
@transparent = true
end
@character_index = PearlKernel.tool_index
@tool_size = PearlKernel.tool_size
@tool_distance = PearlKernel.tool_distance
@tool_effect_delay = PearlKernel.tool_effectdelay
@tool_destroy_delay = PearlKernel.tool_destroydelay
@move_speed = PearlKernel.tool_speed
@tool_blow_power = PearlKernel.tool_blowpower
@tool_piercing = PearlKernel.tool_piercing
@tool_piercing = PearlKernel.tool_piercing == "true"
@tool_end_anime = PearlKernel.tool_animation
if @tool_end_anime.split(" ").include?('delay')
@tool_end_anime = @tool_end_anime.sub("delay ","").to_i
end
@tool_animerepeat = PearlKernel.tool_anirepeat == "true"
@tool_invoke = PearlKernel.tool_invoke
@tool_guardrate = PearlKernel.tool_guardrate
@tool_knockdownrate = PearlKernel.tool_knockdown
@tool_selfdamage = PearlKernel.tool_selfdamage == "true"
@tool_hitshake = PearlKernel.tool_hitshake == "true"
sound = PearlKernel.tool_soundse
RPG::SE.new(sound, 80).play rescue nil # SOUND
@original_distance = @tool_distance
@mnganime = 0
if @customsteps != nil
@pattern = 0
@tool_distance = @customsteps
@pattern = 1 if @customsteps + 1 == @original_distance
@transparent = true if @customsteps == 0
@user.battler_chain.push(self)
end
@tool_retracting = false
if @tool_special == "area" and @target_effect
@user.turn_toward_character(@target_effect)
moveto(@target_effect.x, @target_effect.y)
end
@originaldestory_delay = @tool_destroy_delay
@priority_type = PearlKernel.tool_priority
if @tool_special == "spiral"
@spintimer = 0
@dir_was = @user.direction
moveto(@user.x + @user.adjustcxy, @user.y + @user.adjustcxy) if
!@user.facing_corners?
@spintimes = @tool_distance
@tool_distance = 0
@user.making_spiral = true
end
PearlKernel.check_iconset(@item, "Projectile Iconset = ", self)
@character_name = "" if @pro_iconset != nil
@pick_able = @item.note.include?('<pick up>')
@ignore_followers = @item.note.include?('<ignore_followers>')
if @tool_special != "shield" and !@item.note.include?('<ignore_voices>')
voices = PearlKernel.voices(@user.battler)
RPG::SE.new(voices, 80).play unless voices.nil?
end
apply_item_transform if @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
end
# After loading tool variables check if the tool can be transformed (w/a)
def apply_item_transform
if @tool_invoke > 0 and @tool_invoke != 1 and @tool_invoke != 2
@item = $data_skills
end
end
def magical_item?
return true if @item.is_a?(RPG::Skill) || @item.is_a?(RPG::Item)
return false
end
# Frame update
def update
super
if magical_item?
case @item.scope
when 0 # scope 0 apply the effect to the user
apply_self_effect(@user, true)
return
when 7 # heal one ally
apply_effectto_selection
return
when 8 # heall all
apply_effectto_all_allies
return
when 9 # revive one ally
apply_effectto_selection
return
when 10 # revive all
apply_effectto_all_allies
return
when 11 # to the user
apply_self_effect(@user, true)
return
end
end
@precombi = @user.doingcombo > 0 if @precombi.nil?
update_tool_token
# continue when the scopes has not benefical effects
if @target_effect
follow_char(@target_effect) if !moving?
@tool_distance = 0
end
@tool_distance = 0 if @tool_special == "area"
update_timer
#---------------------------------------------------------------------------
# Tool special shield engine
if @item.is_a?(RPG::Armor) and @tool_special == "shield"
if !@user.battler_guarding
if @tool_invoke > 0
@user.battler.melee_attack_apply(@user.battler,@tool_invoke)
else
@user.battler.item_apply(@user.battler, $data_skills)
end
@user.battler_guarding = true
@user.battler_guarding = @tool_guardrate
# shield directions
elsif @user.battler_guarding
if @user.battler.is_a?(Game_Actor)
if @user.is_a?(Game_Player)
if PearlKey.press?(Key::Armor) and
@tool_destroy_delay <= @originaldestory_delay - 16
@tool_destroy_delay = 10
@user.anime_speed = 10
end
@user.direction = 2 if Input.dir4 == 2
@user.direction = 4 if Input.dir4 == 4
@user.direction = 6 if Input.dir4 == 6
@user.direction = 8 if Input.dir4 == 8
end
else
if @user.is_a?(Game_Event) and @user.agroto_f != nil
@user.turn_toward_character(@user.agroto_f)
else
@user.turn_toward_character($game_player)
end
end
end
if @tool_destroy_delay == 0
@user.battler.remove_state(9)
@user.battler_guarding =
end
return
end
# if not shield given continue
update_hookshotdef if @customsteps != nil # update hookshot
update_boomerand if @tool_special == "boomerang" # update boomerang
update_spiral if @tool_special == "spiral" # update spiral
return if @transparent and @customsteps != nil # return is tranparent
update_damage # update damage
end
#=============================================================================
# hookshot mode
def update_hookshotdef
@tool_destroy_delay = 1000 ; @tool_size = 1
@move_speed = 6 if @move_speed != 6
@tool_piercing = true if !@tool_piercing
for event in $game_map.events_withtags
if obj_size?(event, @tool_size)
if event.hook_pull && !@user.hookshoting
break if @transparent
break if event.x == @user.x and event.y == @user.y
@user.hookshoting = true
@tool_distance = 0
@user.user_move_distance = @customsteps
@user.user_move_distance = @user.move_speed
@user.user_move_distance = @user.through
@user.user_move_distance =
@user.move_speed = @move_speed
@user.through = true
@user.battler_chain.each {|c| c.tool_distance = 0
if c.customsteps == c.original_distance - 1 # this is the last chain
if c.in_frontof?(self)
self.pattern = c.pattern # pattern change for convenience
c.pattern = 0
end
end
}
elsif event.hook_grab and !@user.hookshoting
break if event.being_grabbed
break if @user.in_frontof?(event)
event.being_grabbed = true
@user.hookshoting = true
@user.battler_chain.each {|i|
i.pattern = 1 if i.customsteps == @customsteps - 2
next if i.customsteps < @customsteps - 1
i.transparent = true} # make trnparent when grabing
event.user_move_distance = @customsteps
event.user_move_distance = event.move_speed
event.user_move_distance = event.through
@user.user_move_distance = event
event.move_speed = @move_speed - 0.3
event.through = true
event.turn_toward_character(@user)
end
end
end
# if the user being pulled
if @user.hookshoting
@user.battler_chain.each do |pr|
if pr.x == @user.x and pr.y == @user.y
pr.destroy_it = true
if @user.user_move_distance == @user.x and
@user.user_move_distance == @user.y
@user.battler_chain.clear
@user.move_speed = @user.user_move_distance
@user.through = @user.user_move_distance
@user.hookshoting = 30
@user.hookshoting = false
if @user.is_a?(Game_Player) and !@user.follower_fighting?
@user.followers.gather
end
end
end
end
return
# if the user is grabbing
elsif @user.hookshoting
event = @user.user_move_distance
if @user.in_frontof?(event)
event.move_speed = event.user_move_distance
event.through = event.user_move_distance
@user.hookshoting = false
event.user_move_distance = 0
@user.hookshoting = 70
end
end
# retracting engine hookshot
if @customsteps + 1 == @original_distance && @tool_distance == 0 && !moving?
@user.battler_chain.each do |projectile|
next if projectile.tool_retracting
projectile.tool_retracting = true
projectile.direction_fix = true
end
end
# retraction
@user.battler_chain.each do |pr|
if pr.tool_retracting
pr.destroy_it = true if @user.facing_corners?
pr.move_toward_character(@user) if !pr.moving?
if pr.x == @user.x and pr.y == @user.y
pr.destroy_it = true
if pr.customsteps == pr.original_distance - 1
@user.battler_chain.clear
@user.hookshoting = 10
end
end
end
end
end
# Special Boomerang
def update_boomerand
$game_map.events_withtags.each do |event|
if event.boom_grab || !event.dropped_items.empty?
if event.boom_grabdata.nil? and obj_size?(event, @tool_size)
event.boom_grabdata =
event.move_speed = 6
event.through = true
end
end
# event being grabbed by boomerang
if !event.boom_grabdata.nil?
event.x, event.y = @x, @y
if event.obj_size?(@user, 2)
reset_boomed(event)
unless event.jumping?
event.jumpto_tile(@user.x, @user.y)
event.direction = event.page.graphic.direction rescue 2
event.start if event.boom_start && !event.killed
end
end
reset_boomed(event) if @tool_destroy_delay == 1 and obj_size?(event, 1)
end
end
# prepare the tool to be destoryed when colliding with user
if @tool_destroy_delay <= @originaldestory_delay - 50
move_toward_character(@user) if !moving?
if @x == @user.x and @y == @user.y
@user.anime_speed = 0
@destroy_it = true
end
end
end
def reset_boomed(event)
event.move_speed = event.boom_grabdata
event.through = event.boom_grabdata
event.boom_grabdata = nil
end
# Special Spiral
def update_spiral
@spintimer += 1
case @spintimer
when 6 then make_rounds(1)
when 12 then make_rounds(2)
when 18 then make_rounds(3)
when 24 then make_rounds(4)
if @spintimes > 1
@spintimer = 0
@spintimes -= 1
end
when 40
@destroy_it = true
@user.anime_speed = 0
end
end
# move the tool and the user to fforn direction
def movetofront(dir, conditional)
@user.direction = dir if @user.direction == conditional
moveto(@user.x + @user.adjustcxy, @user.y + @user.adjustcxy) if
!@user.facing_corners?
@direction = @user.direction
end
# make round depending of the user direction
def make_rounds(type)
case type
when 1
movetofront(4, 2) if @dir_was == 2 ; movetofront(8, 4) if @dir_was == 4
movetofront(2, 6) if @dir_was == 6 ; movetofront(6, 8) if @dir_was == 8
when 2
movetofront(8, 4) if @dir_was == 2 ; movetofront(6, 8) if @dir_was == 4
movetofront(4, 2) if @dir_was == 6 ; movetofront(2, 6) if @dir_was == 8
when 3
movetofront(6, 8) if @dir_was == 2 ; movetofront(2, 6) if @dir_was == 4
movetofront(8, 4) if @dir_was == 6 ; movetofront(4, 2) if @dir_was == 8
when 4
movetofront(2, 6) if @dir_was == 2 ; movetofront(4, 2) if @dir_was == 4
movetofront(6, 8) if @dir_was == 6 ; movetofront(8, 4) if @dir_was == 8
end
end
#============================================================================
# Apply benefical effects to users and allies
# apply effect to a single selection
def apply_effectto_selection
# if the battler is a game actor the effect going to a target
if @user.battler.is_a?(Game_Actor)
apply_self_effect(@target_effect, true)
else
# Enemies choose a random target ally
all =
for event in $game_map.event_enemies
if event.on_battle_screen?
next if event.battler.object
if @item.scope == 9 and event.killed
all.push(event)
apply_self_effect(event, true)
event.apply_respawn
return
end
all.push(event)
end
end
# if scope for the user
if @item.scope == 9
apply_self_effect(@user, true)
return
end
all.push(@user)
target = all
apply_self_effect(target, true) if !target.nil?
apply_self_effect(@user, true) if target.nil?
end
end
# effect to all allies
def apply_effectto_all_allies
# apply effect to all battle menbers actors
if @user.battler.is_a?(Game_Actor)
$game_player.followers.each {|i|
next unless i.visible?
next if i.battler.dead? and @item.scope == 8
apply_self_effect(i, pop=true)}
apply_self_effect($game_player, pop=true)
# Apply effect to all enemies allies
elsif @user.battler.is_a?(Game_Enemy)
for event in $game_map.event_enemies
if event.on_battle_screen?
next if event.battler.object || event.page.nil?
next if @item.scope == 8 and event.battler.dead?
if event.battler.dead?
@item.scope == 10 ? event.apply_respawn : next
end
event.battler.item_apply(event.battler, @item)
$game_player.damage_pop.push(DamagePop_Obj.new(event))
event.animation_id = animation
end
end
apply_self_effect(@user, true)
end
end
# direct effect
def apply_self_effect(target, pop=true)
target.battler.item_apply(target.battler, @item)
target.animation_id = animation
$game_player.damage_pop.push(DamagePop_Obj.new(target))
@destroy_it = true
end
#============================================================================
# update damage depending if the user is an enemy or actor
def update_damage
if @user.battler.is_a?(Game_Actor)
apply_damageto_enemy
if @tool_selfdamage
apply_damageto_player
apply_damageto_followers unless @ignore_followers
end
elsif @user.battler.is_a?(Game_Enemy)
if $game_player.normal_walk?
apply_damageto_player
apply_damageto_followers unless @ignore_followers
end
apply_damageto_enemy if @tool_selfdamage
end
end
# Timer updater
def update_timer
update_tool_movement
@mini_opacity -= 1 if @mini_opacity > 0
@opacity = 255 if @mini_opacity == 1
@tool_effect_delay -= 1 if @tool_effect_delay > 0
if @tool_distance == 0
@tool_destroy_delay -= 1 if @tool_destroy_delay > 0
@destroy_it = true if @tool_destroy_delay == 0
end
update_animation_setting
end
#=============================================================================
# * movement
def make_diagonal_a
move_diagonal(4, 2) if @direction == 2
move_diagonal(4, 8) if @direction == 4
move_diagonal(6, 8) if @direction == 6
move_diagonal(4, 8) if @direction == 8
end
def make_diagonal_b
move_diagonal(6, 2) if @direction == 2
move_diagonal(4, 2) if @direction == 4
move_diagonal(6, 2) if @direction == 6
move_diagonal(6, 8) if @direction == 8
end
def make_direction_a
@direction = 4 if @user.direction == 2
@direction = 8 if @user.direction == 4
@direction = 2 if @user.direction == 6
@direction = 6 if @user.direction == 8
@direction_done = true
end
def make_direction_b
@direction = 6 if @user.direction == 2
@direction = 2 if @user.direction == 4
@direction = 8 if @user.direction == 6
@direction = 4 if @user.direction == 8
@direction_done = true
end
def update_tool_movement
if @tool_distance > 0 and not moving?
if @triple != nil # tripple definition
case @triple
when :uno then make_diagonal_a
when :dos then move_forward
when :tres then make_diagonal_b
end
@tool_distance -= 1
elsif @quintuple != nil # quintuple definition
case @quintuple
when :uno ; make_direction_a if @direction_done.nil?; move_forward
when :dos ; make_diagonal_a
when :tres ; move_forward
when :cuatro ; make_diagonal_b
when :cinco ; make_direction_b if @direction_done.nil? ; move_forward
end
@tool_distance -= 1
elsif @octuple != nil # octuple
case @octuple
when :uno ; make_direction_a if @direction_done.nil?; move_forward
when :dos ; make_diagonal_a
when :tres ; move_forward
when :cuatro ; make_diagonal_b
when :cinco ; make_direction_b if @direction_done.nil? ; move_forward
when :seis ; make_diagonal_a
when :siete ; move_forward
when :ocho ; make_diagonal_b
end
@tool_distance -= 1
elsif @tool_special == "autotarget" # autotarget
if @autotargeting.nil?
@autotargeting =
# chose any event enemy on the map if the user is an actor
if @user.battler.is_a?(Game_Actor)
for event in $game_map.event_enemies
if @user.is_a?(Game_Follower) and @user.targeted_character != nil
@autotargeting =
#@user.turn_toward_character(@user.targeted_character)
move_forward
return
end
if event.enemy_ready? and event.on_battle_screen? and
obj_size?(event, 8)
@autotargeting =
#@user.turn_toward_character(event)
move_forward
return
end
end
# choose a game actor if the user is an enemy
elsif @user.battler.is_a?(Game_Enemy)
@user.agroto_f.nil? ? target =$game_player : target = @user.agroto_f
@autotargeting = if obj_size?(target, 8)
end
end
if @autotargeting
follow_char(@autotargeting)
@autotargeting.clear if @autotargeting.x == @x and
@autotargeting.y == @y
else
move_forward
end
@tool_distance -= 1
# random
elsif @tool_special == "random"
move_forward if @tool_distance == @original_distance - 1
move_forward if @tool_distance == @original_distance - 2
move_random if @tool_distance <= @original_distance - 3
@tool_distance -= 1
# boomerang redirect movement
elsif @tool_special == "boomerang"
if @user.is_a?(Game_Player)
case Input.dir8
when 1 then move_diagonal(4, 2)
when 3 then move_diagonal(6, 2)
when 7 then move_diagonal(4, 8)
when 9 then move_diagonal(6, 8)
else #not input just move straig
move_forward
end
# not game player just move straight
else
move_forward
end
@tool_distance -= 1
# reserved for common event function
elsif @commonevent_id != nil
else # normal move forward behavior
move_forward ; @tool_distance -= 1
end
end
end
# tool animation
def update_animation_setting
case @tool_end_anime
when "end"
if @tool_destroy_delay >= 8 and @tool_destroy_delay <= 16
@animation_id = animation
end
when "acting"
if @tool_animerepeat
@animation_id = animation if @mnganime == 0
@mnganime += 1
@mnganime = 0 if @mnganime == 12
else
@animation_id = animation if @mnganime == 0
@mnganime = 1
end
end
if @tool_end_anime.is_a?(Fixnum)
@animation_id = animation if @tool_destroy_delay == @tool_end_anime
end
end
# Get the animation to be played
def animation
if @item.is_a?(RPG::Armor)
return $data_skills.animation_id if @tool_invoke > 0
return 0
end
return @item.animation_id
end
# apply damage to enemy
def apply_damageto_enemy
return if @tool_effect_delay > 0
$game_map.event_enemies.each do |event|
next if event.collapsing?
if event.battler.body_sized > 0
enabled = body_size?(, @tool_size)
enabled = body_size?(, @tool_size) if !enabled
enabled = body_size?(, @tool_size) if !enabled
enabled = body_size?(, @tool_size) if !enabled
if event.battler.body_sized == 2
enabled = body_size?(, @tool_size) if !enabled
enabled = body_size?(, @tool_size) if !enabled
enabled = body_size?(, @tool_size) if !enabled
end
else
enabled = body_size?(, @tool_size)
end
if enabled and event.just_hitted == 0
event.just_hitted = 20
next if event.page.nil?
if !enable_dame_execution?(event.battler)
unless event.battler.object
RPG::SE.new(Key::GuardSe, 80).play
event.pop_damage('Guard')
play_hit_animation(event)
end
return
end
#-------------------------
execute_damageto_enemy(event)
end
end
end
# check wheter the enemy is killed by spefific items
def enable_dame_execution?(enemy)
weapon = enemy.kill_weapon if @original_item.is_a?(RPG::Weapon)
armor = enemy.kill_armor if @original_item.is_a?(RPG::Armor)
item = enemy.kill_item if @original_item.is_a?(RPG::Item)
skill = enemy.kill_skill if @original_item.is_a?(RPG::Skill)
if enemy.has_kill_with?
return true if !weapon.nil? && weapon.include?(@original_item.id)
return true if !armor.nil? && armor.include?(@original_item.id)
return true if !item.nil? && item.include?(@original_item.id)
return true if !skill.nil? && skill.include?(@original_item.id)
return false
end
return true
end
# execute damage to enemy
def execute_damageto_enemy(event)
event.being_targeted = false if event.being_targeted
event.epassive = false if event.epassive
if event.agroto_f.nil? and @user.is_a?(Game_Follower)
event.agroto_f = @user if rand(5) == 1
end
if event.agroto_f != nil and @user.is_a?(Game_Player)
event.agroto_f = nil if rand(2) == 1
end
if !event.battler.object
return if guard_success?(event, 1)
end
execute_damage(event)
return if event.battler.object
$game_player.damage_pop.push(DamagePop_Obj.new(event)) unless
guard_success?(event, 2)
apply_blow_power(event) unless event.battler.k_back_dis
case (event.battler.hp.to_f / event.battler.mhp.to_f * 100.0)
when 0..10 then activate_lhp_switch(event.battler.lowhp_10)
when 0..25 then activate_lhp_switch(event.battler.lowhp_25)
when 0..50 then activate_lhp_switch(event.battler.lowhp_50)
when 0..75 then activate_lhp_switch(event.battler.lowhp_75)
end
end
def activate_lhp_switch(switch)
$game_switches = true if !switch.nil? and !$game_switches
end
# apply damage to player
def apply_damageto_player
return if @tool_effect_delay > 0 || $game_player.battler.dead?
if obj_size?($game_player, @tool_size) and $game_player.just_hitted == 0
$game_player.just_hitted = 20
return if guard_success?($game_player, 1)
execute_damage($game_player)
$game_player.damage_pop.push(DamagePop_Obj.new($game_player)) unless
guard_success?($game_player, 2)
apply_blow_power($game_player)
end
end
# Apply damage to followers
def apply_damageto_followers
return if @tool_effect_delay > 0
# followers
for actor in $game_player.followers
next unless actor.visible?
if obj_size?(actor, @tool_size) and actor.just_hitted == 0
actor.just_hitted = 20
next if actor.battler.dead?
return if guard_success?(actor, 1)
execute_damage(actor)
$game_player.damage_pop.push(DamagePop_Obj.new(actor)) unless
guard_success?(actor, 2)
apply_blow_power(actor)
end
end
end
def precombo(sym)
@item.is_a?(RPG::Weapon) ? e=@user.actor.equips : e=@user.actor.equips
return if e.nil?
if sym == :apply
@user.apply_weapon_param(e, false)
@user.apply_weapon_param(@item, true)
elsif sym == :remove
@user.apply_weapon_param(@item, false)
@user.apply_weapon_param(e, true)
end
end
# Execute damage to the target
def execute_damage(target)
if magical_item?
target.battler.item_apply(@user.battler, @item)
else
@user.apply_weapon_param(@item, true) if @user.battler.is_a?(Game_Enemy)
precombo(:apply) if @user.battler.is_a?(Game_Actor) && @precombi
if @tool_invoke > 0
target.battler.melee_attack_apply(@user.battler, @tool_invoke)
else
target.battler.attack_apply(@user.battler)
end
@user.apply_weapon_param(@item, false) if @user.battler.is_a?(Game_Enemy)
precombo(:remove) if @user.battler.is_a?(Game_Actor) && @precombi
end
target.colapse_time = 60 if target.battler.dead?
return if target.battler.is_a?(Game_Enemy) and target.battler.object
hp_d = target.battler.result.hp_drain
@user.pop_damage() if hp_d > 0
mp_d = target.battler.result.mp_drain
@user.pop_damage() if mp_d > 0
return if target.battler_guarding
return if target.battler.result.hp_damage < 0
return if target.battler.result.hp_damage == 0
target.jump(0, 0) if PearlKernel.jump_hit?(target.battler) and
@tool_blow_power < 2
voices = PearlKernel.hitvoices(target.battler)
RPG::SE.new(voices, 80).play unless voices.nil?
$game_map.screen.start_shake(8, 6, 24) if @tool_hitshake
return if target.hookshoting || @user.making_spiral
return if @tool_knockdownrate == 0
if rand(101) <= @tool_knockdownrate
target.knockdown_data = 60
end
end
# Check guard if the user is using the shield
def guard_success?(userr, type)
if userr.battler_guarding
# guard
if type == 1
if rand(101) <= userr.battler_guarding
return false unless faceto_face?(userr)
RPG::SE.new(Key::GuardSe, 80).play
$game_player.damage_pop.push(DamagePop_Obj.new(userr, 2))
unless @user.making_spiral
@tool_distance = 0
@tool_destroy_delay = 0
end
play_hit_animation(userr)
return true
end
# block
elsif type == 2
return false unless faceto_face?(userr)
$game_player.damage_pop.push(DamagePop_Obj.new(userr, 1))
return true
end
end
return false
end
# this metthod make the tool wait for the animation to be displayed when hit
def apply_passive_state
@transparent = true
@tool_effect_delay = 1000 * 1000
@tool_destroy_delay = 60
@animation_id = animation
@tool_distance = 0
end
# hit animation
def play_hit_animation(target)
if @target_effect || !@tool_piercing
@tool_end_anime == "hit" ? apply_passive_state : @destroy_it = true
else
target.animation_id = animation if @tool_end_anime == "hit"
end
end
# blow powers effects
def apply_blow_power(target)
play_hit_animation(target)
return if target.battler.result.hp_damage < 1
return if target.hookshoting || @user.making_spiral
target.blowpower = if target.blowpower == 0 and
target.blowpower == 0
#follower blow
if target.is_a?(Game_Player)
target.followers.each {|f|
next unless f.visible?
next if f.battler.dead?
f.blowpower = if f.blowpower == 0 and f.blowpower == 0
}
end
end
# pattern
def update_anime_pattern
return if @tool_special == "hook"
super
end
# Activate events by tool token id
def update_tool_token
return if @tool_effect_delay > 0
$game_map.events_withtags.each do |event|
if obj_size?(event, @tool_size) and event.start_delay == 0
wid = event.token_weapon
aid = event.token_armor
iid = event.token_item
sid = event.token_skill
item = @original_item
case item
when RPG::Weapon; start_token(event) if wid.include?(item.id)
when RPG::Armor ; start_token(event) if aid.include?(item.id)
when RPG::Item ; start_token(event) if iid.include?(item.id)
when RPG::Skill ; start_token(event) if sid.include?(item.id)
end
end
end
end
# trigger event
def start_token(event)
$game_map.events_withtags.delete(event)
event.start
event.start_delay = 30
end
def move_straight(d, turn_ok = true)
return if force_stopped?
super
end
end
also, the NPC now moves and turns on a switch, however i don't know how to put a timer on waiting for an event to appear, however if that's how you'd explain it.
#===============================================================================
# * Falcao Pearl ABS script shelf # 3
#
# This script handles some battler settings and the keys definitions
#===============================================================================
module Key
# Pearl ABS Input system, there is a full keayboard build in with this system,
# you can use keys from A throught Z, and number between 1 throught 9
# Type Key Display name
Weapon = # Weapon usage
Armor = # Armor usage
Item = # Item usage
Item2 = # Item2 usage
Skill = # Skill usage
Skill2 = # Skill2 usage
Skill3 = # Skill3 usage
Skill4 = # Skill4 usage
# Follower attack toggle
Follower =
# Quick tool selection key
QuickTool = PearlKey::N
# Player select call key
PlayerSelect = PearlKey::M
# Sound played when success guarding
GuardSe = "Hammer"
end
module Vocab
# Buff/Debuff
BuffAdd = "%s's %s up!"
DebuffAdd = "%s's %s down!"
BuffRemove = "%s's %s to normal."
end
#-------------------------------------------------------------------------------
# Game player adds
class Game_Player < Game_Character
attr_accessor :projectiles, :damage_pop, :anime_action, :enemy_drops
attr_accessor :refresh_status_icons, :refresh_buff_icons, :mouse_over
attr_accessor :refresh_skillbar, :pearl_menu_call, :reserved_swap
attr_accessor :new_map_id
alias falcaopearl_initialize initialize
def initialize
@projectiles =
@damage_pop =
@anime_action =
@enemy_drops =
@press_timer = 0
@mouse_over = 0
@mouse_exist = defined?(Map_Buttons).is_a?(String)
@refresh_skillbar = 0
@pearl_menu_call =
@reserved_swap =
falcaopearl_initialize
end
alias falcaopearl_poses_refresh refresh
def refresh
return if @knockdown_data > 0
falcaopearl_poses_refresh
end
def any_collapsing?
return true if @colapse_time > 0
@followers.each {|f| return true if f.visible? and f.colapse_time > 0}
return false
end
# check if any follower is fighting
def follower_fighting?
@followers.each do |f|
next unless f.visible?
return true if f.targeted_character != nil
end
return false
end
# check if game party in combat mode
def in_combat_mode?
return true if follower_fighting? || battler_acting?
return false
end
# get battler
def battler
return actor
end
def update_state_effects
battler.dead? ? return : super
end
def trigger_tool?(key, type)
return true if type == :keys && PearlKey.trigger?(key)
return true if @mouse_exist && Mouse.trigger?(0) && type == :mouse &&
@mouse_over == key
return false
end
def all_jump(x, y)
jumpto_tile(x, y)
@followers.each {|f| f.jumpto_tile(x, y)}
end
alias falcaopearl_it_update update
def update
update_pearl_battle_set
falcaopearl_it_update
end
# pearl battle update
def update_pearl_battle_set
@projectiles.each {|projectile| projectile.update}
@pearl_menu_call -= 1 if @pearl_menu_call > 0
update_tool_usage
update_menu_buttons
end
if $imported
alias falcaopearl_int player_start_falling
def player_start_falling
return if @hookshoting
falcaopearl_int
end
end
# get on vehicle
alias falcaopearl_get_on_vehicle get_on_vehicle
def get_on_vehicle
return if follower_fighting?
falcaopearl_get_on_vehicle
end
def update_tool_usage
return if PearlSkillBar.hidden?
return unless normal_walk?
unless actor.equips.nil?
use_weapon(actor.equips.id) if trigger_tool?(Key::Weapon, :keys)
use_weapon(actor.equips.id) if trigger_tool?(1, :mouse)
end
unless actor.equips.nil?
use_armor(actor.equips.id) if trigger_tool?(Key::Armor, :keys)
use_armor(actor.equips.id) if trigger_tool?(2, :mouse)
end
unless actor.assigned_item.nil?
use_item(actor.assigned_item.id) if trigger_tool?(Key::Item, :keys)
use_item(actor.assigned_item.id) if trigger_tool?(3, :mouse)
end
unless actor.assigned_item2.nil?
use_item(actor.assigned_item2.id) if trigger_tool?(Key::Item2, :keys)
use_item(actor.assigned_item2.id) if trigger_tool?(4, :mouse)
end
unless actor.assigned_skill.nil?
use_skill(actor.assigned_skill.id) if trigger_tool?(Key::Skill, :keys)
use_skill(actor.assigned_skill.id) if trigger_tool?(5, :mouse)
end
unless actor.assigned_skill2.nil?
use_skill(actor.assigned_skill2.id) if trigger_tool?(Key::Skill2,:keys)
use_skill(actor.assigned_skill2.id) if trigger_tool?(6, :mouse)
end
unless actor.assigned_skill3.nil?
use_skill(actor.assigned_skill3.id) if trigger_tool?(Key::Skill3,:keys)
use_skill(actor.assigned_skill3.id) if trigger_tool?(7, :mouse)
end
unless actor.assigned_skill4.nil?
use_skill(actor.assigned_skill4.id) if trigger_tool?(Key::Skill4,:keys)
use_skill(actor.assigned_skill4.id) if trigger_tool?(8, :mouse)
end
update_followers_trigger unless $game_map.interpreter.running?
end
def update_followers_trigger
if PearlKernel::SinglePlayer and trigger_tool?(Key::Follower, :keys)
return if @knockdown_data > 0
force_cancel_actions
@pearl_menu_call =
return
end
make_battle_followers if trigger_tool?(Key::Follower, :keys)
make_battle_followers if trigger_tool?(9, :mouse)
if PearlKey.press?(Key::Follower) || @mouse_exist && Mouse.press?(0) &&
@mouse_over == 9
@press_timer += 1
if @press_timer == 3 * 60
@followers.each do |f|
next unless f.visible?
next if f.targeted_character.nil?
f.turn_toward_player
f.targeted_character = nil
f.pop_damage('Scape')
end
end
else
@press_timer = 0 if @press_timer != 0
end
end
def make_battle_followers
@followers.each do |f|
next unless f.visible?
next if f.fo_tool.nil? || f.battler.dead?
if f.targeted_character.nil?
if f.fo_tool.tool_data("User Graphic = ", false).nil?
if f.fo_tool.is_a?(RPG::Skill) || fo_tool.is_a?(RPG::Item)
# has no data but is a benefical skill
if f.fo_tool.scope == 0 || f.fo_tool.scope.between?(7, 11)
f.setup_followertool_usage
else
f.balloon_id = PearlKernel::FailBalloon
end
else
f.balloon_id = PearlKernel::FailBalloon
next
end
else
#has data
f.setup_followertool_usage
end
end
end
end
# menu buttons update
def update_menu_buttons
return if $game_map.interpreter.running?
return if @pearl_menu_call > 0
if PearlKey.trigger?(Key::QuickTool)
return if @knockdown_data > 0
force_cancel_actions
@pearl_menu_call =
end
if !PearlKernel::SinglePlayer and PearlKey.trigger?(Key::PlayerSelect)
@pearl_menu_call =
end
end
def set_skill(id)
actor.assigned_skill = $data_skills
end
alias falcao_pearl_movable movable?
def movable?
return if force_stopped? || @blowpower > 0
falcao_pearl_movable
end
alias falcaopearl_perform_transfer perform_transfer
def perform_transfer
if $game_map.map_id != @new_map_id
pearl_abs_global_reset
end
falcaopearl_perform_transfer
@followers.each {|f|
next unless f.visible?
if f.battler.deadposing != nil
f.battler.deadposing != $game_map.map_id ? f.transparent = true :
f.transparent = false
f.knockdown_data = 10 #if follower.battler.deadposing != nil
f.knowdown_effect(1)
end}
end
alias falcaopearl_start_map start_map_event
def start_map_event(x, y, triggers, normal)
$game_map.events_xy(x, y).each do |event|
return if event.has_token?
end
falcaopearl_start_map(x, y, triggers, normal)
end
end
# game party
class Game_Party < Game_Unit
attr_accessor :actors
def set_skill(actor_id, sid, slot)
actor = $game_actors ; skill = $data_skills
return unless actor.skill_learn?(skill)
case slot
when Key::Skill.to_sym then actor.assigned_skill = skill
when Key::Skill2.to_sym then actor.assigned_skill2 = skill
when Key::Skill3.to_sym then actor.assigned_skill3 = skill
when Key::Skill4.to_sym then actor.assigned_skill4 = skill
end
end
def set_item(actor_id, item_id, slot)
actor = $game_actors ; item = $data_items
return unless has_item?(item)
case slot
when Key::Item.to_sym then actor.assigned_item = item
when Key::Item2.to_sym then actor.assigned_item2 = item
end
end
end
#--------------------------------------------------------
class Game_Battler < Game_BattlerBase
attr_reader :state_steps
attr_accessor :buff_turns, :buffs, :used_item, :deadposing
attr_accessor :skill_cooldown,:item_cooldown,:weapon_cooldown, :armor_cooldown
alias falcaopearl_battler_ini initialize
def initialize
@skill_cooldown = {}
@item_cooldown = {}
@weapon_cooldown = {}
@armor_cooldown = {}
falcaopearl_battler_ini
end
alias falcaopearl_revive revive
def revive
if SceneManager.scene_is?(Scene_Item) || SceneManager.scene_is?(Scene_Skill)
$game_temp.pop_w(180, 'Pearl ABS',
'You cannot revive from menu!')
return
end
falcaopearl_revive
@deadposing = nil
end
alias falcaopearl_addnew add_new_state
def add_new_state(state_id)
falcaopearl_addnew(state_id)
if self.is_a?(Game_Actor)
$game_player.refresh_skillbar = 4
end
end
def tool_ready?(item)
return false if item.is_a?(RPG::Skill) and @skill_cooldown
return false if item.is_a?(RPG::Item) and @item_cooldown
return false if item.is_a?(RPG::Weapon) and @weapon_cooldown
return false if item.is_a?(RPG::Armor) and @armor_cooldown
return true
end
def apply_cooldown(item, value)
@skill_cooldown = value if item.is_a?(RPG::Skill)
@item_cooldown = value if item.is_a?(RPG::Item)
@weapon_cooldown = value if item.is_a?(RPG::Weapon)
@armor_cooldown = value if item.is_a?(RPG::Armor)
end
# Make the steps settings to seconds for states if used in the scene map
alias falcaopearl_stepsset reset_state_counts
def reset_state_counts(state_id)
falcaopearl_stepsset(state_id)
state = $data_states
@state_steps = state.steps_to_remove * 60 if
SceneManager.scene_is?(Scene_Map)
end
# make the buff turns per seconds if used in the scene map
alias falcaopearl_buffs overwrite_buff_turns
def overwrite_buff_turns(param_id, turns)
if SceneManager.scene_is?(Scene_Map)
time = turns * 60
@buff_turns = time if @buff_turns.to_i < time
return
end
falcaopearl_buffs(param_id, turns)
end
# make the item occasion to always in the map
alias falcaopearl_occasion_ok occasion_ok?
def occasion_ok?(item)
return true if SceneManager.scene_is?(Scene_Map) ||
SceneManager.scene_is?(Scene_QuickTool) ||
SceneManager.scene_is?(Scene_CharacterSet)
falcaopearl_occasion_ok(item)
end
# apply the usability settings (used to refresh the skill bar icons)
alias falcaopearl_usablecheck use_item
def use_item(item)
falcaopearl_usablecheck(item)
self.apply_usability if self.is_a?(Game_Actor)
end
# melee attack apply used with invoked tools
def melee_attack_apply(user, item_id)
item_apply(user, $data_skills)
end
alias falcaopearl_itemapply item_apply
def item_apply(user, item)
@used_item = item
falcaopearl_itemapply(user, item)
end
end
#-------------------------------------------------------------------------------
# Game followers adds
class Game_Follower < Game_Character
def battler
return actor
end
alias falcaopearl_f_poses_refresh refresh
def refresh
return if @knockdown_data > 0
falcaopearl_f_poses_refresh
end
def update_state_effects
battler.dead? ? return : super
end
# Make the followers inpassable if they are in battle state
alias falcaopearl_follower_update update
def update
if $game_player.followers.gathering? || $game_player.hookshoting ||
@hookshoting
@through = true
else
@through = false if @through
end
falcaopearl_follower_update
@transparent = lying_down? if visible? and $game_player.normal_walk?
@transparent = false if $game_player.using_custom_g
end
def lying_down?
return true if !battler.deadposing.nil? &&
battler.deadposing != $game_map.map_id
return false
end
# avoid the followers to chase the preceding character in battle
alias falcaopearl_chase_preceding_character chase_preceding_character
def chase_preceding_character
return if @blowpower > 0
return if @targeted_character != nil
if visible? and $game_player.follower_fighting?
return if fo_tool.nil?
return if battler.dead?
end
$game_player.reserved_swap.each {|i|
if i == battler.id
swap_dead_follower
$game_player.reserved_swap.delete(i)
end}
jumpto(0) if @targeted_character.nil? && !obj_size?($game_player, 6) &&
!stopped_any?
falcaopearl_chase_preceding_character
end
def stopped_any?
$game_player.followers.each do |follower|
return true if follower.force_stopped?
end
return false
end
# set up a target for followers
def setup_target
for event in $game_map.event_enemies
if event.on_battle_screen? && event.enemy_ready?
if $game_player.obj_size?(event, PearlKernel::PlayerRange) and
!event.being_targeted
@targeted_character = event
event.being_targeted = true
break
end
end
end
end
def move_straight(d, turn_ok = true)
return if force_stopped?
super
end
def move_diagonal(horz, vert)
return if force_stopped?
super
end
alias falcaoabs_gather gather?
def gather?
return true if !battler.deadposing.nil?
falcaoabs_gather
end
end
#-------------------------------------------------------------------------------
# Game Actor adds
class Game_Actor < Game_Battler
attr_accessor :assigned_skill, :assigned_item, :primary_use
attr_accessor :assigned_skill2, :assigned_item2, :usability
attr_accessor :assigned_skill3, :assigned_skill4
alias falcaopearl_cooldown_setup setup
def setup(actor_id)
@usability =
@primary_use = 1
falcaopearl_cooldown_setup(actor_id)
end
# player walk
alias falcaopearl_on_player_walk on_player_walk
def on_player_walk
@result.clear
check_floor_effect
return
falcaopearl_on_player_walk
end
#usability refresher
def apply_usability
apply_usabilityto_melee(0) # weapon
apply_usabilityto_melee(1) # armor
@usability = usable?(@assigned_item) if !@assigned_item.nil?
@usability = usable?(@assigned_item2) if !@assigned_item2.nil?
@usability = usable?(@assigned_skill) if !@assigned_skill.nil?
@usability = usable?(@assigned_skill2) if !@assigned_skill2.nil?
@usability = usable?(@assigned_skill3) if !@assigned_skill3.nil?
@usability = usable?(@assigned_skill4) if !@assigned_skill4.nil?
end
def apply_usabilityto_melee(index)
if !equips.nil?
invoke = equips.tool_data("Tool Invoke Skill = ")
if invoke != nil and invoke != 0 and index == 0
@usability = usable?($data_skills)
elsif index == 0
@usability = usable?($data_skills)
end
if invoke != nil and invoke != 0 and index == 1
@usability = usable?($data_skills)
elsif index == 1
@usability = usable?($data_skills)
end
end
end
end
#-------------------------------------------------------------------------------
# Game character adds, the agro system
class Game_Character < Game_CharacterBase
# agro to follower turn towars player
alias pearlagro_turn_toward_player turn_toward_player
def turn_toward_player
if self.is_a?(Game_Event) and self.agroto_f != nil
turn_toward_character(self.agroto_f)
return
end
pearlagro_turn_toward_player
end
# agro to follower turn away from player
alias pearlagro_turn_away_from_player turn_away_from_player
def turn_away_from_player
if self.is_a?(Game_Event) and self.agroto_f != nil
turn_away_from_character(self.agroto_f)
return
end
pearlagro_turn_away_from_player
end
# agro to game follower move toward player
alias pearlagro_move_toward_player move_toward_player
def move_toward_player
if self.is_a?(Game_Event) and self.agroto_f != nil
move_toward_character(self.agroto_f)
return
end
pearlagro_move_toward_player
end
# agro away from follower
alias pearlagro_move_away_from_player move_away_from_player
def move_away_from_player
if self.is_a?(Game_Event) and self.agroto_f != nil
move_away_from_character(self.agroto_f)
return
end
pearlagro_move_away_from_player
end
end
# enemy
class Game_Enemy < Game_Battler
attr_accessor :battler_graphic, :breath_enable, :object, :collapse_type
attr_accessor :die_animation, :kill_weapon, :kill_armor, :kill_item
attr_accessor :kill_skill, :body_sized, :esensor, :boss_hud, :k_back_dis
attr_reader :lowhp_10, :lowhp_25, :lowhp_50, :lowhp_75
alias falcaopearl_enemy_ini initialize
def initialize(index, enemy_id)
falcaopearl_enemy_ini(index, enemy_id)
@kill_weapon =
@kill_armor =
@kill_item =
@kill_skill =
@battler_graphic = enemy.tool_data("Enemy Battler = ",false) == "true"
@breath_enable = enemy.tool_data("Enemy Breath = ",false) == "true"
@object = enemy.tool_data("Enemy Object = ", false) == "true"
@collapse_type = enemy.tool_data("Enemy Collapse Type = ", false)
@die_animation = enemy.tool_data("Enemy Die Animation = ")
@body_sized = enemy.tool_data("Enemy Body Increase = ")
@boss_hud = enemy.tool_data("Enemy Boss Bar = ", false) == "true"
@esensor = enemy.tool_data("Enemy Sensor = ")
@esensor = PearlKernel::Sensor if @esensor.nil?
@body_sized = 0 if @body_sized.nil?
@k_back_dis = enemy.tool_data("Enemy Knockback Disable = ",false) == "true"
@lowhp_75 = enemy.tool_data("Enemy Lowhp 75% Switch = ")
@lowhp_50 = enemy.tool_data("Enemy Lowhp 50% Switch = ")
@lowhp_25 = enemy.tool_data("Enemy Lowhp 25% Switch = ")
@lowhp_10 = enemy.tool_data("Enemy Lowhp 10% Switch = ")
apply_kill_with_settings
end
def apply_kill_with_settings
wtag = enemy.tool_data("Enemy Kill With Weapon = ", false)
@kill_weapon = wtag.split(",").map { |s| s.to_i } if wtag != nil
atag = enemy.tool_data("Enemy Kill With Armor = ", false)
@kill_armor = atag.split(",").map { |s| s.to_i } if atag != nil
itag = enemy.tool_data("Enemy Kill With Item = ", false)
@kill_item = itag.split(",").map { |s| s.to_i } if itag != nil
stag = enemy.tool_data("Enemy Kill With Skill = ", false)
@kill_skill = stag.split(",").map { |s| s.to_i } if stag != nil
end
def has_kill_with?
!@kill_weapon.empty? || !@kill_armor.empty? || !@kill_item.empty? ||
!@kill_skill.empty?
end
end
# make refresh
class Game_BattlerBase
alias falcaopearl_erasestate erase_state
def erase_state(state_id)
falcaopearl_erasestate(state_id)
if self.is_a?(Game_Actor)
$game_player.refresh_skillbar = 4
end
end
end
class Game_Followers
def synchronize(x, y, d)
each do |follower|
next if follower.visible? and follower.battler.deadposing != nil
follower.moveto(x, y)
follower.set_direction(d)
end
end
end
class Game_Interpreter
alias falcaopearl_intsystem_command_201 command_201
def command_201
return if $game_player.any_collapsing?
falcaopearl_intsystem_command_201
end
end
#-------------------------------------------------------------------------------
# * Falcao Pearl ABS script shelf # 3
#
# This script handles some battler settings and the keys definitions
#===============================================================================
module Key
# Pearl ABS Input system, there is a full keayboard build in with this system,
# you can use keys from A throught Z, and number between 1 throught 9
# Type Key Display name
Weapon = # Weapon usage
Armor = # Armor usage
Item = # Item usage
Item2 = # Item2 usage
Skill = # Skill usage
Skill2 = # Skill2 usage
Skill3 = # Skill3 usage
Skill4 = # Skill4 usage
# Follower attack toggle
Follower =
# Quick tool selection key
QuickTool = PearlKey::N
# Player select call key
PlayerSelect = PearlKey::M
# Sound played when success guarding
GuardSe = "Hammer"
end
module Vocab
# Buff/Debuff
BuffAdd = "%s's %s up!"
DebuffAdd = "%s's %s down!"
BuffRemove = "%s's %s to normal."
end
#-------------------------------------------------------------------------------
# Game player adds
class Game_Player < Game_Character
attr_accessor :projectiles, :damage_pop, :anime_action, :enemy_drops
attr_accessor :refresh_status_icons, :refresh_buff_icons, :mouse_over
attr_accessor :refresh_skillbar, :pearl_menu_call, :reserved_swap
attr_accessor :new_map_id
alias falcaopearl_initialize initialize
def initialize
@projectiles =
@damage_pop =
@anime_action =
@enemy_drops =
@press_timer = 0
@mouse_over = 0
@mouse_exist = defined?(Map_Buttons).is_a?(String)
@refresh_skillbar = 0
@pearl_menu_call =
@reserved_swap =
falcaopearl_initialize
end
alias falcaopearl_poses_refresh refresh
def refresh
return if @knockdown_data > 0
falcaopearl_poses_refresh
end
def any_collapsing?
return true if @colapse_time > 0
@followers.each {|f| return true if f.visible? and f.colapse_time > 0}
return false
end
# check if any follower is fighting
def follower_fighting?
@followers.each do |f|
next unless f.visible?
return true if f.targeted_character != nil
end
return false
end
# check if game party in combat mode
def in_combat_mode?
return true if follower_fighting? || battler_acting?
return false
end
# get battler
def battler
return actor
end
def update_state_effects
battler.dead? ? return : super
end
def trigger_tool?(key, type)
return true if type == :keys && PearlKey.trigger?(key)
return true if @mouse_exist && Mouse.trigger?(0) && type == :mouse &&
@mouse_over == key
return false
end
def all_jump(x, y)
jumpto_tile(x, y)
@followers.each {|f| f.jumpto_tile(x, y)}
end
alias falcaopearl_it_update update
def update
update_pearl_battle_set
falcaopearl_it_update
end
# pearl battle update
def update_pearl_battle_set
@projectiles.each {|projectile| projectile.update}
@pearl_menu_call -= 1 if @pearl_menu_call > 0
update_tool_usage
update_menu_buttons
end
if $imported
alias falcaopearl_int player_start_falling
def player_start_falling
return if @hookshoting
falcaopearl_int
end
end
# get on vehicle
alias falcaopearl_get_on_vehicle get_on_vehicle
def get_on_vehicle
return if follower_fighting?
falcaopearl_get_on_vehicle
end
def update_tool_usage
return if PearlSkillBar.hidden?
return unless normal_walk?
unless actor.equips.nil?
use_weapon(actor.equips.id) if trigger_tool?(Key::Weapon, :keys)
use_weapon(actor.equips.id) if trigger_tool?(1, :mouse)
end
unless actor.equips.nil?
use_armor(actor.equips.id) if trigger_tool?(Key::Armor, :keys)
use_armor(actor.equips.id) if trigger_tool?(2, :mouse)
end
unless actor.assigned_item.nil?
use_item(actor.assigned_item.id) if trigger_tool?(Key::Item, :keys)
use_item(actor.assigned_item.id) if trigger_tool?(3, :mouse)
end
unless actor.assigned_item2.nil?
use_item(actor.assigned_item2.id) if trigger_tool?(Key::Item2, :keys)
use_item(actor.assigned_item2.id) if trigger_tool?(4, :mouse)
end
unless actor.assigned_skill.nil?
use_skill(actor.assigned_skill.id) if trigger_tool?(Key::Skill, :keys)
use_skill(actor.assigned_skill.id) if trigger_tool?(5, :mouse)
end
unless actor.assigned_skill2.nil?
use_skill(actor.assigned_skill2.id) if trigger_tool?(Key::Skill2,:keys)
use_skill(actor.assigned_skill2.id) if trigger_tool?(6, :mouse)
end
unless actor.assigned_skill3.nil?
use_skill(actor.assigned_skill3.id) if trigger_tool?(Key::Skill3,:keys)
use_skill(actor.assigned_skill3.id) if trigger_tool?(7, :mouse)
end
unless actor.assigned_skill4.nil?
use_skill(actor.assigned_skill4.id) if trigger_tool?(Key::Skill4,:keys)
use_skill(actor.assigned_skill4.id) if trigger_tool?(8, :mouse)
end
update_followers_trigger unless $game_map.interpreter.running?
end
def update_followers_trigger
if PearlKernel::SinglePlayer and trigger_tool?(Key::Follower, :keys)
return if @knockdown_data > 0
force_cancel_actions
@pearl_menu_call =
return
end
make_battle_followers if trigger_tool?(Key::Follower, :keys)
make_battle_followers if trigger_tool?(9, :mouse)
if PearlKey.press?(Key::Follower) || @mouse_exist && Mouse.press?(0) &&
@mouse_over == 9
@press_timer += 1
if @press_timer == 3 * 60
@followers.each do |f|
next unless f.visible?
next if f.targeted_character.nil?
f.turn_toward_player
f.targeted_character = nil
f.pop_damage('Scape')
end
end
else
@press_timer = 0 if @press_timer != 0
end
end
def make_battle_followers
@followers.each do |f|
next unless f.visible?
next if f.fo_tool.nil? || f.battler.dead?
if f.targeted_character.nil?
if f.fo_tool.tool_data("User Graphic = ", false).nil?
if f.fo_tool.is_a?(RPG::Skill) || fo_tool.is_a?(RPG::Item)
# has no data but is a benefical skill
if f.fo_tool.scope == 0 || f.fo_tool.scope.between?(7, 11)
f.setup_followertool_usage
else
f.balloon_id = PearlKernel::FailBalloon
end
else
f.balloon_id = PearlKernel::FailBalloon
next
end
else
#has data
f.setup_followertool_usage
end
end
end
end
# menu buttons update
def update_menu_buttons
return if $game_map.interpreter.running?
return if @pearl_menu_call > 0
if PearlKey.trigger?(Key::QuickTool)
return if @knockdown_data > 0
force_cancel_actions
@pearl_menu_call =
end
if !PearlKernel::SinglePlayer and PearlKey.trigger?(Key::PlayerSelect)
@pearl_menu_call =
end
end
def set_skill(id)
actor.assigned_skill = $data_skills
end
alias falcao_pearl_movable movable?
def movable?
return if force_stopped? || @blowpower > 0
falcao_pearl_movable
end
alias falcaopearl_perform_transfer perform_transfer
def perform_transfer
if $game_map.map_id != @new_map_id
pearl_abs_global_reset
end
falcaopearl_perform_transfer
@followers.each {|f|
next unless f.visible?
if f.battler.deadposing != nil
f.battler.deadposing != $game_map.map_id ? f.transparent = true :
f.transparent = false
f.knockdown_data = 10 #if follower.battler.deadposing != nil
f.knowdown_effect(1)
end}
end
alias falcaopearl_start_map start_map_event
def start_map_event(x, y, triggers, normal)
$game_map.events_xy(x, y).each do |event|
return if event.has_token?
end
falcaopearl_start_map(x, y, triggers, normal)
end
end
# game party
class Game_Party < Game_Unit
attr_accessor :actors
def set_skill(actor_id, sid, slot)
actor = $game_actors ; skill = $data_skills
return unless actor.skill_learn?(skill)
case slot
when Key::Skill.to_sym then actor.assigned_skill = skill
when Key::Skill2.to_sym then actor.assigned_skill2 = skill
when Key::Skill3.to_sym then actor.assigned_skill3 = skill
when Key::Skill4.to_sym then actor.assigned_skill4 = skill
end
end
def set_item(actor_id, item_id, slot)
actor = $game_actors ; item = $data_items
return unless has_item?(item)
case slot
when Key::Item.to_sym then actor.assigned_item = item
when Key::Item2.to_sym then actor.assigned_item2 = item
end
end
end
#--------------------------------------------------------
class Game_Battler < Game_BattlerBase
attr_reader :state_steps
attr_accessor :buff_turns, :buffs, :used_item, :deadposing
attr_accessor :skill_cooldown,:item_cooldown,:weapon_cooldown, :armor_cooldown
alias falcaopearl_battler_ini initialize
def initialize
@skill_cooldown = {}
@item_cooldown = {}
@weapon_cooldown = {}
@armor_cooldown = {}
falcaopearl_battler_ini
end
alias falcaopearl_revive revive
def revive
if SceneManager.scene_is?(Scene_Item) || SceneManager.scene_is?(Scene_Skill)
$game_temp.pop_w(180, 'Pearl ABS',
'You cannot revive from menu!')
return
end
falcaopearl_revive
@deadposing = nil
end
alias falcaopearl_addnew add_new_state
def add_new_state(state_id)
falcaopearl_addnew(state_id)
if self.is_a?(Game_Actor)
$game_player.refresh_skillbar = 4
end
end
def tool_ready?(item)
return false if item.is_a?(RPG::Skill) and @skill_cooldown
return false if item.is_a?(RPG::Item) and @item_cooldown
return false if item.is_a?(RPG::Weapon) and @weapon_cooldown
return false if item.is_a?(RPG::Armor) and @armor_cooldown
return true
end
def apply_cooldown(item, value)
@skill_cooldown = value if item.is_a?(RPG::Skill)
@item_cooldown = value if item.is_a?(RPG::Item)
@weapon_cooldown = value if item.is_a?(RPG::Weapon)
@armor_cooldown = value if item.is_a?(RPG::Armor)
end
# Make the steps settings to seconds for states if used in the scene map
alias falcaopearl_stepsset reset_state_counts
def reset_state_counts(state_id)
falcaopearl_stepsset(state_id)
state = $data_states
@state_steps = state.steps_to_remove * 60 if
SceneManager.scene_is?(Scene_Map)
end
# make the buff turns per seconds if used in the scene map
alias falcaopearl_buffs overwrite_buff_turns
def overwrite_buff_turns(param_id, turns)
if SceneManager.scene_is?(Scene_Map)
time = turns * 60
@buff_turns = time if @buff_turns.to_i < time
return
end
falcaopearl_buffs(param_id, turns)
end
# make the item occasion to always in the map
alias falcaopearl_occasion_ok occasion_ok?
def occasion_ok?(item)
return true if SceneManager.scene_is?(Scene_Map) ||
SceneManager.scene_is?(Scene_QuickTool) ||
SceneManager.scene_is?(Scene_CharacterSet)
falcaopearl_occasion_ok(item)
end
# apply the usability settings (used to refresh the skill bar icons)
alias falcaopearl_usablecheck use_item
def use_item(item)
falcaopearl_usablecheck(item)
self.apply_usability if self.is_a?(Game_Actor)
end
# melee attack apply used with invoked tools
def melee_attack_apply(user, item_id)
item_apply(user, $data_skills)
end
alias falcaopearl_itemapply item_apply
def item_apply(user, item)
@used_item = item
falcaopearl_itemapply(user, item)
end
end
#-------------------------------------------------------------------------------
# Game followers adds
class Game_Follower < Game_Character
def battler
return actor
end
alias falcaopearl_f_poses_refresh refresh
def refresh
return if @knockdown_data > 0
falcaopearl_f_poses_refresh
end
def update_state_effects
battler.dead? ? return : super
end
# Make the followers inpassable if they are in battle state
alias falcaopearl_follower_update update
def update
if $game_player.followers.gathering? || $game_player.hookshoting ||
@hookshoting
@through = true
else
@through = false if @through
end
falcaopearl_follower_update
@transparent = lying_down? if visible? and $game_player.normal_walk?
@transparent = false if $game_player.using_custom_g
end
def lying_down?
return true if !battler.deadposing.nil? &&
battler.deadposing != $game_map.map_id
return false
end
# avoid the followers to chase the preceding character in battle
alias falcaopearl_chase_preceding_character chase_preceding_character
def chase_preceding_character
return if @blowpower > 0
return if @targeted_character != nil
if visible? and $game_player.follower_fighting?
return if fo_tool.nil?
return if battler.dead?
end
$game_player.reserved_swap.each {|i|
if i == battler.id
swap_dead_follower
$game_player.reserved_swap.delete(i)
end}
jumpto(0) if @targeted_character.nil? && !obj_size?($game_player, 6) &&
!stopped_any?
falcaopearl_chase_preceding_character
end
def stopped_any?
$game_player.followers.each do |follower|
return true if follower.force_stopped?
end
return false
end
# set up a target for followers
def setup_target
for event in $game_map.event_enemies
if event.on_battle_screen? && event.enemy_ready?
if $game_player.obj_size?(event, PearlKernel::PlayerRange) and
!event.being_targeted
@targeted_character = event
event.being_targeted = true
break
end
end
end
end
def move_straight(d, turn_ok = true)
return if force_stopped?
super
end
def move_diagonal(horz, vert)
return if force_stopped?
super
end
alias falcaoabs_gather gather?
def gather?
return true if !battler.deadposing.nil?
falcaoabs_gather
end
end
#-------------------------------------------------------------------------------
# Game Actor adds
class Game_Actor < Game_Battler
attr_accessor :assigned_skill, :assigned_item, :primary_use
attr_accessor :assigned_skill2, :assigned_item2, :usability
attr_accessor :assigned_skill3, :assigned_skill4
alias falcaopearl_cooldown_setup setup
def setup(actor_id)
@usability =
@primary_use = 1
falcaopearl_cooldown_setup(actor_id)
end
# player walk
alias falcaopearl_on_player_walk on_player_walk
def on_player_walk
@result.clear
check_floor_effect
return
falcaopearl_on_player_walk
end
#usability refresher
def apply_usability
apply_usabilityto_melee(0) # weapon
apply_usabilityto_melee(1) # armor
@usability = usable?(@assigned_item) if !@assigned_item.nil?
@usability = usable?(@assigned_item2) if !@assigned_item2.nil?
@usability = usable?(@assigned_skill) if !@assigned_skill.nil?
@usability = usable?(@assigned_skill2) if !@assigned_skill2.nil?
@usability = usable?(@assigned_skill3) if !@assigned_skill3.nil?
@usability = usable?(@assigned_skill4) if !@assigned_skill4.nil?
end
def apply_usabilityto_melee(index)
if !equips.nil?
invoke = equips.tool_data("Tool Invoke Skill = ")
if invoke != nil and invoke != 0 and index == 0
@usability = usable?($data_skills)
elsif index == 0
@usability = usable?($data_skills)
end
if invoke != nil and invoke != 0 and index == 1
@usability = usable?($data_skills)
elsif index == 1
@usability = usable?($data_skills)
end
end
end
end
#-------------------------------------------------------------------------------
# Game character adds, the agro system
class Game_Character < Game_CharacterBase
# agro to follower turn towars player
alias pearlagro_turn_toward_player turn_toward_player
def turn_toward_player
if self.is_a?(Game_Event) and self.agroto_f != nil
turn_toward_character(self.agroto_f)
return
end
pearlagro_turn_toward_player
end
# agro to follower turn away from player
alias pearlagro_turn_away_from_player turn_away_from_player
def turn_away_from_player
if self.is_a?(Game_Event) and self.agroto_f != nil
turn_away_from_character(self.agroto_f)
return
end
pearlagro_turn_away_from_player
end
# agro to game follower move toward player
alias pearlagro_move_toward_player move_toward_player
def move_toward_player
if self.is_a?(Game_Event) and self.agroto_f != nil
move_toward_character(self.agroto_f)
return
end
pearlagro_move_toward_player
end
# agro away from follower
alias pearlagro_move_away_from_player move_away_from_player
def move_away_from_player
if self.is_a?(Game_Event) and self.agroto_f != nil
move_away_from_character(self.agroto_f)
return
end
pearlagro_move_away_from_player
end
end
# enemy
class Game_Enemy < Game_Battler
attr_accessor :battler_graphic, :breath_enable, :object, :collapse_type
attr_accessor :die_animation, :kill_weapon, :kill_armor, :kill_item
attr_accessor :kill_skill, :body_sized, :esensor, :boss_hud, :k_back_dis
attr_reader :lowhp_10, :lowhp_25, :lowhp_50, :lowhp_75
alias falcaopearl_enemy_ini initialize
def initialize(index, enemy_id)
falcaopearl_enemy_ini(index, enemy_id)
@kill_weapon =
@kill_armor =
@kill_item =
@kill_skill =
@battler_graphic = enemy.tool_data("Enemy Battler = ",false) == "true"
@breath_enable = enemy.tool_data("Enemy Breath = ",false) == "true"
@object = enemy.tool_data("Enemy Object = ", false) == "true"
@collapse_type = enemy.tool_data("Enemy Collapse Type = ", false)
@die_animation = enemy.tool_data("Enemy Die Animation = ")
@body_sized = enemy.tool_data("Enemy Body Increase = ")
@boss_hud = enemy.tool_data("Enemy Boss Bar = ", false) == "true"
@esensor = enemy.tool_data("Enemy Sensor = ")
@esensor = PearlKernel::Sensor if @esensor.nil?
@body_sized = 0 if @body_sized.nil?
@k_back_dis = enemy.tool_data("Enemy Knockback Disable = ",false) == "true"
@lowhp_75 = enemy.tool_data("Enemy Lowhp 75% Switch = ")
@lowhp_50 = enemy.tool_data("Enemy Lowhp 50% Switch = ")
@lowhp_25 = enemy.tool_data("Enemy Lowhp 25% Switch = ")
@lowhp_10 = enemy.tool_data("Enemy Lowhp 10% Switch = ")
apply_kill_with_settings
end
def apply_kill_with_settings
wtag = enemy.tool_data("Enemy Kill With Weapon = ", false)
@kill_weapon = wtag.split(",").map { |s| s.to_i } if wtag != nil
atag = enemy.tool_data("Enemy Kill With Armor = ", false)
@kill_armor = atag.split(",").map { |s| s.to_i } if atag != nil
itag = enemy.tool_data("Enemy Kill With Item = ", false)
@kill_item = itag.split(",").map { |s| s.to_i } if itag != nil
stag = enemy.tool_data("Enemy Kill With Skill = ", false)
@kill_skill = stag.split(",").map { |s| s.to_i } if stag != nil
end
def has_kill_with?
!@kill_weapon.empty? || !@kill_armor.empty? || !@kill_item.empty? ||
!@kill_skill.empty?
end
end
# make refresh
class Game_BattlerBase
alias falcaopearl_erasestate erase_state
def erase_state(state_id)
falcaopearl_erasestate(state_id)
if self.is_a?(Game_Actor)
$game_player.refresh_skillbar = 4
end
end
end
class Game_Followers
def synchronize(x, y, d)
each do |follower|
next if follower.visible? and follower.battler.deadposing != nil
follower.moveto(x, y)
follower.set_direction(d)
end
end
end
class Game_Interpreter
alias falcaopearl_intsystem_command_201 command_201
def command_201
return if $game_player.any_collapsing?
falcaopearl_intsystem_command_201
end
end
#-------------------------------------------------------------------------------
#===============================================================================
# * Falcao Pearl ABS script shelf # 4
#
# This script handles the Skillbar funtions
# it is designed to support the 'Mouse System Buttons script 1.6 and above too
# you can trigger tools by clicking the icons on the toolbar!
#===============================================================================
module PearlSkillBar
# Skillbar X position in tiles
Tile_X = 4
# Skillbar Y position in tiles
Tile_Y = 11
# Layout graphic
LayOutImage = "Pearl Skillbar"
# Follower attack command icon index
ToggleIcon = 116
# * Commands
#
# PearlSkillBar.hide - hide the skillbar
# PearlSkillBar.show - show the skillbar
#-----------------------------------------------------------------------------
def self.hide
$game_system.skillbar_enable = true
end
def self.show
$game_system.skillbar_enable = nil
end
def self.hidden?
!$game_system.skillbar_enable.nil?
end
end
class Game_System
attr_accessor :skillbar_enable, :pearlbars, :enemy_lifeobject
alias falcaopearl_abs_hud initialize
def initialize
unless PearlKernel::StartWithHud
@skillbar_enable = true
@pearlbars = true
end
falcaopearl_abs_hud
end
end
class Sprite_PearlTool < Sprite
include PearlSkillBar
attr_accessor :actor
def initialize(view, custom_pos=nil)
super(view)
@layout = ::Sprite.new(view)
@layout.bitmap = Cache.picture(LayOutImage)
@icons = ::Sprite.new(view)
@icons.bitmap = Bitmap.new(@layout.bitmap.width, @layout.bitmap.height)
self.bitmap = Bitmap.new(@layout.bitmap.width+32, @layout.bitmap.height+32)
if custom_pos.nil?
@layout.x = Tile_X * 32
@layout.y = Tile_Y * 32
else
@layout.x = custom_pos
@layout.y = custom_pos
end
@icons.x = @layout.x
@icons.y = @layout.y
self.x = @layout.x - 16
self.y = @layout.y - 12
self.z = self.z + 1
@actor = $game_player.actor
@actor.apply_usability
@old_usability =
8.times.each {|i| @old_usability = @actor.usability}
@framer = 0
@info_keys = ::Sprite.new(view)
@info_keys.bitmap = Bitmap.new(self.bitmap.width, self.bitmap.height)
@info_keys.x = self.x; @info_keys.y = self.y; @info_keys.z = self.z
draw_key_info
refresh_icons
refresh_texts
@view = view
@on_map = SceneManager.scene_is?(Scene_Map)
@mouse_exist = defined?(Map_Buttons).is_a?(String)
@mouse_exist = false if @mouse_exist && !SceneManager.scene_is?(Scene_Map)
update
end
def draw_key_info
@info_keys.bitmap.font.size = 15
letters = [Key::Weapon, Key::Armor, Key::Item, Key::Item2,
Key::Skill,Key::Skill2,Key::Skill3,Key::Skill4,Key::Follower]
x = 28
for i in letters
@info_keys.bitmap.draw_text(x, -2, @info_keys.bitmap.width, 32, i)
x += 32
end
end
def refresh_texts
self.bitmap.clear
self.bitmap.font.size = 15
refresh_cooldown
refresh_ammo
end
def number(operand)
return (operand / 60).to_i + 1
end
def flagged(item, type)
return :false if !item.cool_enabled? and type == 1
return item.itemcost if type == 2
end
# Refresh toolbar icons
def refresh_icons
@icons.bitmap.clear
icon = [@actor.equips, @actor.equips, @actor.assigned_item,
@actor.assigned_item2, @actor.assigned_skill, @actor.assigned_skill2,
@actor.assigned_skill3, @actor.assigned_skill4, ToggleIcon]
x = 4
icon.each {|i|
if !i.nil? and !i.is_a?(Fixnum)
if i.is_a?(RPG::Item) || i.is_a?(RPG::Skill)
draw_icon(i.icon_index, x, 6, @actor.usable?(i))
else
if i.is_a?(RPG::Weapon)
enable = @actor.usability ; enable = true if enable.nil?
draw_icon(i.icon_index, x, 6, enable)
elsif i.is_a?(RPG::Armor)
enable = @actor.usability ; enable = true if enable.nil?
draw_icon(i.icon_index, x, 6, enable)
end
end
end
draw_icon(i, x, 6) if i.is_a?(Fixnum) ; x += 32}
@now_equip = [@actor.equips, @actor.equips, @actor.assigned_item,
@actor.assigned_item2, @actor.assigned_skill, @actor.assigned_skill2,
@actor.assigned_skill3, @actor.assigned_skill4]
end
def update
update_mouse_tiles if @mouse_exist
update_cooldown
update_ammo_tools
update_usability_enable
refresh_icons if @now_equip != @actor.equips
refresh_icons if @now_equip != @actor.equips
refresh_icons if @now_equip != @actor.assigned_item
refresh_icons if @now_equip != @actor.assigned_item2
refresh_icons if @now_equip != @actor.assigned_skill
refresh_icons if @now_equip != @actor.assigned_skill2
refresh_icons if @now_equip != @actor.assigned_skill3
refresh_icons if @now_equip != @actor.assigned_skill4
update_fade_effect
end
# fade effect when player is behind the toolbar
def update_fade_effect
if behind_toolbar?
if self.opacity >= 60
self.opacity -= 10
@layout.opacity = @icons.opacity = @info_keys.opacity = self.opacity
end
elsif self.opacity != 255
self.opacity += 10
@layout.opacity = @icons.opacity = @info_keys.opacity = self.opacity
end
end
def behind_toolbar?
return false unless @on_map
px = ($game_player.screen_x / 32).to_i
py = ($game_player.screen_y / 32).to_i
9.times.each {|x| return true if px == Tile_X + x and py == Tile_Y}
return false
end
# refresh the icons when the usability change
def update_usability_enable
8.times.each {|i| refresh_icons if @old_usability != @actor.usability}
end
#-----------------------------------------------
# ammunition engine
def ammo_ready?(item)
return false if item.nil?
return true if item.has_data.nil? && item.is_a?(RPG::Item) &&
item.consumable
return false if flagged(item, 2).nil?
return true if flagged(item, 2) != 0
return false
end
# get item cost
def itemcost(item)
return $game_party.item_number(item) if item.has_data.nil? &&
item.is_a?(RPG::Item) && item.consumable
if !flagged(item, 2).nil? and flagged(item, 2) != 0
return $game_party.item_number($data_items)
end
return 0
end
# Ammo refresher
def refresh_ammo
if ammo_ready?(@actor.equips)
@wnumber = itemcost(@actor.equips)
self.bitmap.draw_text(18, 24, 32,32, @wnumber.to_s, 1)
end
if ammo_ready?(@actor.equips)
@anumber = itemcost(@actor.equips)
self.bitmap.draw_text(50, 24, 32,32, @anumber.to_s, 1)
end
if ammo_ready?(@actor.assigned_item)
@inumber = itemcost(@actor.assigned_item)
self.bitmap.draw_text(82, 24, 32,32, @inumber.to_s, 1)
end
if ammo_ready?(@actor.assigned_item2)
@inumber2 = itemcost(@actor.assigned_item2)
self.bitmap.draw_text(112, 24, 32,32, @inumber2.to_s, 1) # item 2
end
if ammo_ready?(@actor.assigned_skill)
@snumber = itemcost(@actor.assigned_skill)
self.bitmap.draw_text(144, 24, 32,32, @snumber.to_s, 1)
end
if ammo_ready?(@actor.assigned_skill2)
@snumber2 = itemcost(@actor.assigned_skill2)
self.bitmap.draw_text(176, 24, 32,32, @snumber2.to_s, 1) # skill 2
end
if ammo_ready?(@actor.assigned_skill3)
@snumber3 = itemcost(@actor.assigned_skill3)
self.bitmap.draw_text(208, 24, 32,32, @snumber3.to_s, 1) # skill 3
end
if ammo_ready?(@actor.assigned_skill4)
@snumber4 = itemcost(@actor.assigned_skill4)
self.bitmap.draw_text(240, 24, 32,32, @snumber4.to_s, 1) # skill 4
end
end
def update_ammo_tools
refresh_texts if ammo_ready?(@actor.equips) &&
@wnumber != itemcost(@actor.equips)
refresh_texts if ammo_ready?(@actor.equips) &&
@anumber != itemcost(@actor.equips)
if ammo_ready?(@actor.assigned_item) &&
@inumber != itemcost(@actor.assigned_item)
refresh_texts
end
refresh_texts if ammo_ready?(@actor.assigned_item2) && #@inumber2
@inumber2 != itemcost(@actor.assigned_item2)
refresh_texts if ammo_ready?(@actor.assigned_skill) &&
@snumber != itemcost(@actor.assigned_skill)
refresh_texts if ammo_ready?(@actor.assigned_skill2) && #@snumber2
@snumber2 != itemcost(@actor.assigned_skill2)
# new anmmo
refresh_texts if ammo_ready?(@actor.assigned_skill3) && #@snumber3
@snumber3 != itemcost(@actor.assigned_skill3)
refresh_texts if ammo_ready?(@actor.assigned_skill4) && #@snumber4
@snumber4 != itemcost(@actor.assigned_skill4)
end
#--------------------------------------
# cooldown engine
def cool_down_active?
return true if skill_cooldown > 0 || weapon_cooldown > 0 ||
armor_cooldown > 0 || item_cooldown > 0 || skill_cooldown2 > 0 ||
item_cooldown2 > 0 || skill_cooldown3 > 0 || skill_cooldown4 > 0
return false
end
def weapon_cooldown
if !@actor.equips.nil?
return 0 if flagged(@actor.equips, 1) == :false
cd = @actor.weapon_cooldown[@actor.equips.id]
return cd unless cd.nil?
end
return 0
end
def armor_cooldown
if !@actor.equips.nil?
return 0 if flagged(@actor.equips, 1) == :false
cd = @actor.armor_cooldown[@actor.equips.id]
return cd unless cd.nil?
end
return 0
end
def item_cooldown
if !@actor.assigned_item.nil?
return 0 if flagged(@actor.assigned_item, 1) == :false
cd = @actor.item_cooldown
return cd unless cd.nil?
end
return 0
end
def item_cooldown2
if !@actor.assigned_item2.nil?
return 0 if flagged(@actor.assigned_item2, 1) == :false
cd = @actor.item_cooldown
return cd unless cd.nil?
end
return 0
end
def skill_cooldown
if !@actor.assigned_skill.nil?
return 0 if flagged(@actor.assigned_skill, 1) == :false
cd = @actor.skill_cooldown
return cd unless cd.nil?
end
return 0
end
def skill_cooldown2
if !@actor.assigned_skill2.nil?
return 0 if flagged(@actor.assigned_skill2, 1) == :false
cd = @actor.skill_cooldown
return cd unless cd.nil?
end
return 0
end
# two new skillls
def skill_cooldown3
if !@actor.assigned_skill3.nil?
return 0 if flagged(@actor.assigned_skill3, 1) == :false
cd = @actor.skill_cooldown
return cd unless cd.nil?
end
return 0
end
def skill_cooldown4 # 4
if !@actor.assigned_skill4.nil?
return 0 if flagged(@actor.assigned_skill4, 1) == :false
cd = @actor.skill_cooldown
return cd unless cd.nil?
end
return 0
end
# Cooldown refresher
def refresh_cooldown
wcd = number(weapon_cooldown)
self.bitmap.draw_text(18, 36,32,32, wcd.to_s, 1) if weapon_cooldown > 10
acd = number(armor_cooldown)
self.bitmap.draw_text(50, 36,32,32, acd.to_s, 1) if armor_cooldown > 10
icd = number(item_cooldown)
self.bitmap.draw_text(82, 36,32,32, icd.to_s, 1) if item_cooldown > 10
icd2 = number(item_cooldown2)
self.bitmap.draw_text(112, 36,32,32, icd2.to_s, 1) if item_cooldown2 > 10
scd = number(skill_cooldown)
self.bitmap.draw_text(144, 36,32,32, scd.to_s, 1) if skill_cooldown > 10
scd2 = number(skill_cooldown2)
self.bitmap.draw_text(176, 36,32,32, scd2.to_s, 1) if skill_cooldown2 > 10
scd3 = number(skill_cooldown3)
self.bitmap.draw_text(208, 36,32,32, scd3.to_s, 1) if skill_cooldown3 > 10
scd4 = number(skill_cooldown4)
self.bitmap.draw_text(240, 36,32,32, scd4.to_s, 1) if skill_cooldown4 > 10
end
def update_cooldown
if @on_map and @actor != $game_player.actor
@actor = $game_player.actor
refresh_icons
refresh_texts
end
if $game_player.refresh_skillbar > 0
$game_player.refresh_skillbar -= 1
if $game_player.refresh_skillbar == 0
@actor.apply_usability
refresh_icons
end
end
if cool_down_active?
refresh_texts if @framer == 0
@framer += 1; @framer = 0 if @framer == 10
else
@framer = 0
end
end
# if mouse exist update the mouse settings
def update_mouse_tiles
mx = (Mouse.pos / 32) ; my = (Mouse.pos / 32)
case
when then $game_player.mouse_over = 1
when then $game_player.mouse_over = 2
when then $game_player.mouse_over = 3
when then $game_player.mouse_over = 4
when then $game_player.mouse_over = 5
when then $game_player.mouse_over = 6
when then $game_player.mouse_over = 7
when then $game_player.mouse_over = 8
when then $game_player.mouse_over = 9
else
$game_player.mouse_over = 0 if $game_player.mouse_over != 0
end
if $game_player.mouse_over > 0
create_mouse_blink
update_mouse_blink_position
@mouse_blink.opacity -= 3
@mouse_blink.opacity = 70 if @mouse_blink.opacity <= 6
else
dispose_mouse_blink
end
end
# update mouse blink position
def update_mouse_blink_position
case $game_player.mouse_over
when 1 then @mouse_blink.x = @layout.x + (5)
when 2 then @mouse_blink.x = @layout.x + (5 + 32)
when 3 then @mouse_blink.x = @layout.x + (5 + 64)
when 4 then @mouse_blink.x = @layout.x + (5 + 96)
when 5 then @mouse_blink.x = @layout.x + (5 + 128)
when 6 then @mouse_blink.x = @layout.x + (5 + 160)
when 7 then @mouse_blink.x = @layout.x + (5 + 192)
when 8 then @mouse_blink.x = @layout.x + (5 + 224)
when 9 then @mouse_blink.x = @layout.x + (5 + 256)
end
end
def create_mouse_blink
return if !@mouse_blink.nil?
@mouse_blink = ::Sprite.new(@view)
@mouse_blink.bitmap = Bitmap.new(22, 22)
@mouse_blink.bitmap.fill_rect(0, 0, 22, 22, Color.new(255,255,255))
@mouse_blink.y = @layout.y + 8
@mouse_blink.z = self.z
@mouse_blink.opacity = 70
end
def dispose_mouse_blink
return if @mouse_blink.nil?
@mouse_blink.dispose
@mouse_blink = nil
end
#--------- end of mouse settings
def dispose
self.bitmap.dispose
@layout.bitmap.dispose
@layout.dispose
@icons.bitmap.dispose
@icons.dispose
@info_keys.bitmap.dispose
@info_keys.dispose
super
end
def draw_icon(icon_index, x, y, enabled = true)
bit = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
@icons.bitmap.blt(x, y, bit, rect, enabled ? 255 : 150)
end
end
# * Falcao Pearl ABS script shelf # 4
#
# This script handles the Skillbar funtions
# it is designed to support the 'Mouse System Buttons script 1.6 and above too
# you can trigger tools by clicking the icons on the toolbar!
#===============================================================================
module PearlSkillBar
# Skillbar X position in tiles
Tile_X = 4
# Skillbar Y position in tiles
Tile_Y = 11
# Layout graphic
LayOutImage = "Pearl Skillbar"
# Follower attack command icon index
ToggleIcon = 116
# * Commands
#
# PearlSkillBar.hide - hide the skillbar
# PearlSkillBar.show - show the skillbar
#-----------------------------------------------------------------------------
def self.hide
$game_system.skillbar_enable = true
end
def self.show
$game_system.skillbar_enable = nil
end
def self.hidden?
!$game_system.skillbar_enable.nil?
end
end
class Game_System
attr_accessor :skillbar_enable, :pearlbars, :enemy_lifeobject
alias falcaopearl_abs_hud initialize
def initialize
unless PearlKernel::StartWithHud
@skillbar_enable = true
@pearlbars = true
end
falcaopearl_abs_hud
end
end
class Sprite_PearlTool < Sprite
include PearlSkillBar
attr_accessor :actor
def initialize(view, custom_pos=nil)
super(view)
@layout = ::Sprite.new(view)
@layout.bitmap = Cache.picture(LayOutImage)
@icons = ::Sprite.new(view)
@icons.bitmap = Bitmap.new(@layout.bitmap.width, @layout.bitmap.height)
self.bitmap = Bitmap.new(@layout.bitmap.width+32, @layout.bitmap.height+32)
if custom_pos.nil?
@layout.x = Tile_X * 32
@layout.y = Tile_Y * 32
else
@layout.x = custom_pos
@layout.y = custom_pos
end
@icons.x = @layout.x
@icons.y = @layout.y
self.x = @layout.x - 16
self.y = @layout.y - 12
self.z = self.z + 1
@actor = $game_player.actor
@actor.apply_usability
@old_usability =
8.times.each {|i| @old_usability = @actor.usability}
@framer = 0
@info_keys = ::Sprite.new(view)
@info_keys.bitmap = Bitmap.new(self.bitmap.width, self.bitmap.height)
@info_keys.x = self.x; @info_keys.y = self.y; @info_keys.z = self.z
draw_key_info
refresh_icons
refresh_texts
@view = view
@on_map = SceneManager.scene_is?(Scene_Map)
@mouse_exist = defined?(Map_Buttons).is_a?(String)
@mouse_exist = false if @mouse_exist && !SceneManager.scene_is?(Scene_Map)
update
end
def draw_key_info
@info_keys.bitmap.font.size = 15
letters = [Key::Weapon, Key::Armor, Key::Item, Key::Item2,
Key::Skill,Key::Skill2,Key::Skill3,Key::Skill4,Key::Follower]
x = 28
for i in letters
@info_keys.bitmap.draw_text(x, -2, @info_keys.bitmap.width, 32, i)
x += 32
end
end
def refresh_texts
self.bitmap.clear
self.bitmap.font.size = 15
refresh_cooldown
refresh_ammo
end
def number(operand)
return (operand / 60).to_i + 1
end
def flagged(item, type)
return :false if !item.cool_enabled? and type == 1
return item.itemcost if type == 2
end
# Refresh toolbar icons
def refresh_icons
@icons.bitmap.clear
icon = [@actor.equips, @actor.equips, @actor.assigned_item,
@actor.assigned_item2, @actor.assigned_skill, @actor.assigned_skill2,
@actor.assigned_skill3, @actor.assigned_skill4, ToggleIcon]
x = 4
icon.each {|i|
if !i.nil? and !i.is_a?(Fixnum)
if i.is_a?(RPG::Item) || i.is_a?(RPG::Skill)
draw_icon(i.icon_index, x, 6, @actor.usable?(i))
else
if i.is_a?(RPG::Weapon)
enable = @actor.usability ; enable = true if enable.nil?
draw_icon(i.icon_index, x, 6, enable)
elsif i.is_a?(RPG::Armor)
enable = @actor.usability ; enable = true if enable.nil?
draw_icon(i.icon_index, x, 6, enable)
end
end
end
draw_icon(i, x, 6) if i.is_a?(Fixnum) ; x += 32}
@now_equip = [@actor.equips, @actor.equips, @actor.assigned_item,
@actor.assigned_item2, @actor.assigned_skill, @actor.assigned_skill2,
@actor.assigned_skill3, @actor.assigned_skill4]
end
def update
update_mouse_tiles if @mouse_exist
update_cooldown
update_ammo_tools
update_usability_enable
refresh_icons if @now_equip != @actor.equips
refresh_icons if @now_equip != @actor.equips
refresh_icons if @now_equip != @actor.assigned_item
refresh_icons if @now_equip != @actor.assigned_item2
refresh_icons if @now_equip != @actor.assigned_skill
refresh_icons if @now_equip != @actor.assigned_skill2
refresh_icons if @now_equip != @actor.assigned_skill3
refresh_icons if @now_equip != @actor.assigned_skill4
update_fade_effect
end
# fade effect when player is behind the toolbar
def update_fade_effect
if behind_toolbar?
if self.opacity >= 60
self.opacity -= 10
@layout.opacity = @icons.opacity = @info_keys.opacity = self.opacity
end
elsif self.opacity != 255
self.opacity += 10
@layout.opacity = @icons.opacity = @info_keys.opacity = self.opacity
end
end
def behind_toolbar?
return false unless @on_map
px = ($game_player.screen_x / 32).to_i
py = ($game_player.screen_y / 32).to_i
9.times.each {|x| return true if px == Tile_X + x and py == Tile_Y}
return false
end
# refresh the icons when the usability change
def update_usability_enable
8.times.each {|i| refresh_icons if @old_usability != @actor.usability}
end
#-----------------------------------------------
# ammunition engine
def ammo_ready?(item)
return false if item.nil?
return true if item.has_data.nil? && item.is_a?(RPG::Item) &&
item.consumable
return false if flagged(item, 2).nil?
return true if flagged(item, 2) != 0
return false
end
# get item cost
def itemcost(item)
return $game_party.item_number(item) if item.has_data.nil? &&
item.is_a?(RPG::Item) && item.consumable
if !flagged(item, 2).nil? and flagged(item, 2) != 0
return $game_party.item_number($data_items)
end
return 0
end
# Ammo refresher
def refresh_ammo
if ammo_ready?(@actor.equips)
@wnumber = itemcost(@actor.equips)
self.bitmap.draw_text(18, 24, 32,32, @wnumber.to_s, 1)
end
if ammo_ready?(@actor.equips)
@anumber = itemcost(@actor.equips)
self.bitmap.draw_text(50, 24, 32,32, @anumber.to_s, 1)
end
if ammo_ready?(@actor.assigned_item)
@inumber = itemcost(@actor.assigned_item)
self.bitmap.draw_text(82, 24, 32,32, @inumber.to_s, 1)
end
if ammo_ready?(@actor.assigned_item2)
@inumber2 = itemcost(@actor.assigned_item2)
self.bitmap.draw_text(112, 24, 32,32, @inumber2.to_s, 1) # item 2
end
if ammo_ready?(@actor.assigned_skill)
@snumber = itemcost(@actor.assigned_skill)
self.bitmap.draw_text(144, 24, 32,32, @snumber.to_s, 1)
end
if ammo_ready?(@actor.assigned_skill2)
@snumber2 = itemcost(@actor.assigned_skill2)
self.bitmap.draw_text(176, 24, 32,32, @snumber2.to_s, 1) # skill 2
end
if ammo_ready?(@actor.assigned_skill3)
@snumber3 = itemcost(@actor.assigned_skill3)
self.bitmap.draw_text(208, 24, 32,32, @snumber3.to_s, 1) # skill 3
end
if ammo_ready?(@actor.assigned_skill4)
@snumber4 = itemcost(@actor.assigned_skill4)
self.bitmap.draw_text(240, 24, 32,32, @snumber4.to_s, 1) # skill 4
end
end
def update_ammo_tools
refresh_texts if ammo_ready?(@actor.equips) &&
@wnumber != itemcost(@actor.equips)
refresh_texts if ammo_ready?(@actor.equips) &&
@anumber != itemcost(@actor.equips)
if ammo_ready?(@actor.assigned_item) &&
@inumber != itemcost(@actor.assigned_item)
refresh_texts
end
refresh_texts if ammo_ready?(@actor.assigned_item2) && #@inumber2
@inumber2 != itemcost(@actor.assigned_item2)
refresh_texts if ammo_ready?(@actor.assigned_skill) &&
@snumber != itemcost(@actor.assigned_skill)
refresh_texts if ammo_ready?(@actor.assigned_skill2) && #@snumber2
@snumber2 != itemcost(@actor.assigned_skill2)
# new anmmo
refresh_texts if ammo_ready?(@actor.assigned_skill3) && #@snumber3
@snumber3 != itemcost(@actor.assigned_skill3)
refresh_texts if ammo_ready?(@actor.assigned_skill4) && #@snumber4
@snumber4 != itemcost(@actor.assigned_skill4)
end
#--------------------------------------
# cooldown engine
def cool_down_active?
return true if skill_cooldown > 0 || weapon_cooldown > 0 ||
armor_cooldown > 0 || item_cooldown > 0 || skill_cooldown2 > 0 ||
item_cooldown2 > 0 || skill_cooldown3 > 0 || skill_cooldown4 > 0
return false
end
def weapon_cooldown
if !@actor.equips.nil?
return 0 if flagged(@actor.equips, 1) == :false
cd = @actor.weapon_cooldown[@actor.equips.id]
return cd unless cd.nil?
end
return 0
end
def armor_cooldown
if !@actor.equips.nil?
return 0 if flagged(@actor.equips, 1) == :false
cd = @actor.armor_cooldown[@actor.equips.id]
return cd unless cd.nil?
end
return 0
end
def item_cooldown
if !@actor.assigned_item.nil?
return 0 if flagged(@actor.assigned_item, 1) == :false
cd = @actor.item_cooldown
return cd unless cd.nil?
end
return 0
end
def item_cooldown2
if !@actor.assigned_item2.nil?
return 0 if flagged(@actor.assigned_item2, 1) == :false
cd = @actor.item_cooldown
return cd unless cd.nil?
end
return 0
end
def skill_cooldown
if !@actor.assigned_skill.nil?
return 0 if flagged(@actor.assigned_skill, 1) == :false
cd = @actor.skill_cooldown
return cd unless cd.nil?
end
return 0
end
def skill_cooldown2
if !@actor.assigned_skill2.nil?
return 0 if flagged(@actor.assigned_skill2, 1) == :false
cd = @actor.skill_cooldown
return cd unless cd.nil?
end
return 0
end
# two new skillls
def skill_cooldown3
if !@actor.assigned_skill3.nil?
return 0 if flagged(@actor.assigned_skill3, 1) == :false
cd = @actor.skill_cooldown
return cd unless cd.nil?
end
return 0
end
def skill_cooldown4 # 4
if !@actor.assigned_skill4.nil?
return 0 if flagged(@actor.assigned_skill4, 1) == :false
cd = @actor.skill_cooldown
return cd unless cd.nil?
end
return 0
end
# Cooldown refresher
def refresh_cooldown
wcd = number(weapon_cooldown)
self.bitmap.draw_text(18, 36,32,32, wcd.to_s, 1) if weapon_cooldown > 10
acd = number(armor_cooldown)
self.bitmap.draw_text(50, 36,32,32, acd.to_s, 1) if armor_cooldown > 10
icd = number(item_cooldown)
self.bitmap.draw_text(82, 36,32,32, icd.to_s, 1) if item_cooldown > 10
icd2 = number(item_cooldown2)
self.bitmap.draw_text(112, 36,32,32, icd2.to_s, 1) if item_cooldown2 > 10
scd = number(skill_cooldown)
self.bitmap.draw_text(144, 36,32,32, scd.to_s, 1) if skill_cooldown > 10
scd2 = number(skill_cooldown2)
self.bitmap.draw_text(176, 36,32,32, scd2.to_s, 1) if skill_cooldown2 > 10
scd3 = number(skill_cooldown3)
self.bitmap.draw_text(208, 36,32,32, scd3.to_s, 1) if skill_cooldown3 > 10
scd4 = number(skill_cooldown4)
self.bitmap.draw_text(240, 36,32,32, scd4.to_s, 1) if skill_cooldown4 > 10
end
def update_cooldown
if @on_map and @actor != $game_player.actor
@actor = $game_player.actor
refresh_icons
refresh_texts
end
if $game_player.refresh_skillbar > 0
$game_player.refresh_skillbar -= 1
if $game_player.refresh_skillbar == 0
@actor.apply_usability
refresh_icons
end
end
if cool_down_active?
refresh_texts if @framer == 0
@framer += 1; @framer = 0 if @framer == 10
else
@framer = 0
end
end
# if mouse exist update the mouse settings
def update_mouse_tiles
mx = (Mouse.pos / 32) ; my = (Mouse.pos / 32)
case
when then $game_player.mouse_over = 1
when then $game_player.mouse_over = 2
when then $game_player.mouse_over = 3
when then $game_player.mouse_over = 4
when then $game_player.mouse_over = 5
when then $game_player.mouse_over = 6
when then $game_player.mouse_over = 7
when then $game_player.mouse_over = 8
when then $game_player.mouse_over = 9
else
$game_player.mouse_over = 0 if $game_player.mouse_over != 0
end
if $game_player.mouse_over > 0
create_mouse_blink
update_mouse_blink_position
@mouse_blink.opacity -= 3
@mouse_blink.opacity = 70 if @mouse_blink.opacity <= 6
else
dispose_mouse_blink
end
end
# update mouse blink position
def update_mouse_blink_position
case $game_player.mouse_over
when 1 then @mouse_blink.x = @layout.x + (5)
when 2 then @mouse_blink.x = @layout.x + (5 + 32)
when 3 then @mouse_blink.x = @layout.x + (5 + 64)
when 4 then @mouse_blink.x = @layout.x + (5 + 96)
when 5 then @mouse_blink.x = @layout.x + (5 + 128)
when 6 then @mouse_blink.x = @layout.x + (5 + 160)
when 7 then @mouse_blink.x = @layout.x + (5 + 192)
when 8 then @mouse_blink.x = @layout.x + (5 + 224)
when 9 then @mouse_blink.x = @layout.x + (5 + 256)
end
end
def create_mouse_blink
return if !@mouse_blink.nil?
@mouse_blink = ::Sprite.new(@view)
@mouse_blink.bitmap = Bitmap.new(22, 22)
@mouse_blink.bitmap.fill_rect(0, 0, 22, 22, Color.new(255,255,255))
@mouse_blink.y = @layout.y + 8
@mouse_blink.z = self.z
@mouse_blink.opacity = 70
end
def dispose_mouse_blink
return if @mouse_blink.nil?
@mouse_blink.dispose
@mouse_blink = nil
end
#--------- end of mouse settings
def dispose
self.bitmap.dispose
@layout.bitmap.dispose
@layout.dispose
@icons.bitmap.dispose
@icons.dispose
@info_keys.bitmap.dispose
@info_keys.dispose
super
end
def draw_icon(icon_index, x, y, enabled = true)
bit = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
@icons.bitmap.blt(x, y, bit, rect, enabled ? 255 : 150)
end
end
#===============================================================================
# * Falcao Pearl ABS script shelf # 5
#
# This script handles all sprites of Pearl ABS engine
#===============================================================================
# Anime action enguine
class Anime_Obj < Game_Character
attr_accessor :draw_it, :destroy_it, :item, :user, :original_speed
attr_reader :custom_graphic
def initialize(user, item)
super()
PearlKernel.load_item(item)
@draw_it = false
@destroy_it = false
@item = item
@user = user
@custom_graphic = false
graphic = PearlKernel.user_graphic
if graphic.split(" ").include?('custom')
graphic = graphic.sub("custom ","")
@custom_graphic = true
user.transparent = true
user.using_custom_g = true
end
@character_name = graphic
moveto(@user.x, @user.y)
set_direction(@user.direction)
@original_speed = PearlKernel.user_animespeed
#patch
PearlKernel.check_iconset(@item, "User Iconset = ", self)
@character_name = "" if @user_iconset != nil
end
end
# Sprite character added battlers as enemies and the anime sprites fit
class Sprite_Character < Sprite_Base
alias falcaopearl_update_position update_position
def update_position
if !@character.battler.nil? and @character.battler.is_a?(
Game_Enemy) and @character.battler.breath_enable
apply_breath_effect(@character)
end
self.zoom_x = @character.zoomfx_x
self.zoom_y = @character.zoomfx_y
self.angle = @character.angle_fx
falcaopearl_update_position
update_anime_object_pos
end
# anime object position and action
def update_anime_object_pos
if @character.is_a?(Anime_Obj)
if @character.custom_graphic
add = 0
else
@ch == 128 ? add = 48 : add = (@ch / 2) / 2
end
self.x = @character.user.screen_x
self.y = @character.user.screen_y + add
self.z = @character.user.screen_z + 1
@character.direction = @character.user.direction
if @character.user.anime_speed == 0
if @character.custom_graphic
@character.user.transparent = false
@character.user.using_custom_g = false
end
@character.destroy_it = true
end
if @character.user.making_spiral
@character.direction == 8 ? @character.pattern=1 : @character.pattern=2
return
end
a= @character.user.anime_speed.to_f/@character.original_speed.to_f * 100.0
case a
when 80..100 ; @character.pattern = 0
when 60..80 ; @character.pattern = 1
when 25..60 ; @character.pattern = 2
end
end
end
# Enemy battler graphics engine
alias falcaopearl_battler_bitmap set_character_bitmap
def set_character_bitmap
if battler_graphic?
self.bitmap= Cache.battler(@character_name,@character.battler.battler_hue)
self.ox = self.bitmap.width / 2
self.oy = self.bitmap.height
return
end
falcaopearl_battler_bitmap
end
def battler_graphic?
if !@character.battler.nil? and @character.battler.is_a?(
Game_Enemy) and @character.battler.battler_graphic
return false if @character.page.nil?
@character_name = @character.battler.battler_name
return true
end
return false
end
alias falcaopearl_battler_graphic update_src_rect
def update_src_rect
return if battler_graphic?
falcaopearl_battler_graphic
end
# breath effect
def apply_breath_effect(char)
return if @character.is_a?(Game_Event) and @character.erased
char.zoomfx_x -= 0.0023 if !char.zfx_bol
char.zoomfx_y -= 0.0023 if !char.zfx_bol
char.zoomfx_x += 0.0023 if char.zfx_bol
char.zoomfx_y += 0.0023 if char.zfx_bol
char.zfx_bol = true if char.zoomfx_x <= 0.93
char.zfx_bol = false if char.zoomfx_x >= 1.0
end
end
#sprite characters part 2 (icon graphics feature
class Sprite_Character < Sprite_Base
def iconset_graphic?
!@character.user_iconset.nil? || !@character.pro_iconset.nil?
end
alias falcao_fantastic_bit update_bitmap
def update_bitmap
if iconset_graphic?
if @apply_iconset.nil?
icon = @character.user_iconset if !@character.user_iconset.nil? and
@character.is_a?(Anime_Obj)
icon = @character.pro_iconset if !@character.pro_iconset.nil? and
@character.is_a?(Projectile)
set_iconsetbitmap(icon)
@apply_iconset = true
end
apply_breath_effect2(@character) if !@character.pro_iconset.nil? and
@character.is_a?(Projectile) and @character.pro_iconset == :animated
@enable_angle = @character.user_iconset if
!@character.user_iconset.nil? and @character.is_a?(Anime_Obj)
return
end
falcao_fantastic_bit
end
alias falcao_fantastic_update_position update_position
def update_position
falcao_fantastic_update_position
set_angle_changes(@enable_angle) if @enable_angle != nil
end
def apply_angle_pattern(x_plus, y_plus, angle)
self.x = @character.user.screen_x + x_plus
self.y = @character.user.screen_y + y_plus
self.angle = angle
end
def set_angle_changes(type)
ani= @character.user.anime_speed.to_f/@character.original_speed.to_f * 100.0
case ani
when 80..100
perform_animated(0) if type == :animated
when 60..80
perform_animated(1) if type == :animated
when 0..60
perform_animated(2) if type == :animated
end
if type != :animated
perform_static if type == :static
perform_shielding if type == :shielding
end
end
# animated
def perform_animated(pattern)
case pattern
when 0
apply_angle_pattern(10, -12, -166) if @character.user.direction == 2
if @character.user.direction == 4 || @character.user.direction == 6
apply_angle_pattern(-8, -26, -46)
self.z = @character.user.screen_z - 1
end
apply_angle_pattern(-22, -10, 0) if @character.user.direction == 8
when 1
apply_angle_pattern(0, 0, -266) if @character.user.direction == 2
apply_angle_pattern(-20, -10, 12) if @character.user.direction == 4
apply_angle_pattern(7, -20, -78) if @character.user.direction == 6
if @character.user.direction == 8
apply_angle_pattern(-8, -26, -46)
self.z = @character.user.screen_z - 1
end
when 2
apply_angle_pattern(8, -5, -210) if @character.user.direction == 2
apply_angle_pattern(-10, 2, 52) if @character.user.direction == 4
apply_angle_pattern(8, -15, -126) if @character.user.direction == 6
apply_angle_pattern(10, -16, - 100) if @character.user.direction == 8
end
end
# static
def perform_static
apply_angle_pattern(8, -5, -210) if @character.user.direction == 2
apply_angle_pattern(-10, 2, 52) if @character.user.direction == 4
apply_angle_pattern(8, -15, -126) if @character.user.direction == 6
if @character.user.direction == 8
apply_angle_pattern(-8, -26, -46)
self.z = @character.user.screen_z - 1
end
end
# shielding
def perform_shielding
apply_angle_pattern(2, 4, 0) if @character.user.direction == 2
apply_angle_pattern(-10, 0, 0) if @character.user.direction == 4
if @character.user.direction == 6
apply_angle_pattern(10, 0, 0)
self.z = @character.user.screen_z - 1
elsif @character.user.direction == 8
apply_angle_pattern(11, -9, 0)
self.z = @character.user.screen_z - 1
end
end
def apply_breath_effect2(char)
char.zoomfx_x -= 0.03 if !char.zfx_bol
char.zoomfx_y -= 0.03 if !char.zfx_bol
char.zoomfx_x += 0.03 if char.zfx_bol
char.zoomfx_y += 0.03 if char.zfx_bol
char.zfx_bol = true if char.zoomfx_x <= 0.84
char.zfx_bol = false if char.zoomfx_x >= 1.0
end
alias falcao_fantastic_src update_src_rect
def update_src_rect
return if iconset_graphic?
falcao_fantastic_src
end
def set_iconsetbitmap(icon_index, enabled = true)
self.bitmap = Bitmap.new(24, 24)
bit = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.bitmap.blt(0, 0, bit, rect, enabled ? 255 : 150)
@cw = self.ox = 12
@ch = self.oy = 24
end
end
#===============================================================================
# Drop sprites
class Sprite_EnemyDrop < Sprite
attr_reader :event
def initialize(viewport, event, item)
super(viewport)
@event = event
@item = item
@drop_quantity = @item.tool_data("Drop Quantity = ")
@drop_quantity = 1 if @drop_quantity.nil?
self.z = $game_player.screen_z - 1
@object_zooming = 0
set_bitmap
update
end
def update
super
self.bush_depth = @event.bush_depth
@object_zooming += 1
case @object_zooming
when 1..8 ; self.zoom_x -= 0.01 ; self.zoom_y -= 0.01
when 9..16 ; self.zoom_x += 0.01 ; self.zoom_y += 0.01
when 17..24 ; self.zoom_x = 1.0 ; self.zoom_y = 1.0; @object_zooming = 0
end
self.x = @event.screen_x - 12
self.y = @event.screen_y - 24
if @event.x == $game_player.x and @event.y == $game_player.y and
!$game_player.moving?
complete_action
return
end
complete_action(false) if @event.respawn_count == 1
end
def complete_action(gaining=true)
$game_party.gain_item(@item, @drop_quantity) if gaining
dispose
@event.dropped_items.delete(@item)
$game_map.events_withtags.delete(@event)
end
def dispose
self.bitmap.dispose
super
end
def set_bitmap
self.bitmap = Bitmap.new(26, 38)
bitmap = Cache.system("Iconset")
icon = @item.icon_index
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
self.bitmap.blt(0, 0, bitmap, rect)
##num adds
return if @drop_quantity == 0
self.bitmap.font.size = 14
self.bitmap.font.bold = true
self.bitmap.draw_text(0, 8, 26, 32, @drop_quantity.to_s, 1)
end
end
#===============================================================================
# Dead icon sprites for player and followers
class Sprite_DeadIcon < Sprite
attr_reader :character
def initialize(viewport, character)
super(viewport)
@character = character
self.bitmap = Bitmap.new(24, 24)
bitmap = Cache.system("Iconset")
icon = 1
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
self.bitmap.blt(0, 0, bitmap, rect)
@knok = @character.actor.actor.tool_data("Knockdown Graphic = ",false)!= nil
update
end
def update
super
self.x = @character.screen_x - 10
self.y = @character.screen_y - 54
self.z = @character.screen_z + 1
self.opacity = @character.opacity
self.visible = !@character.transparent
if @knok
@character.knockdown_data = 10 if !@character.battler.deadposing.nil?
else
@character.playdead
@character.direction = 8
self.x = @character.screen_x - 26
end
end
def dispose
self.bitmap.dispose
@character.angle_fx = 0.0 unless @knok
super
end
end
#===============================================================================
# State and buff icons sprites
class StateBuffIcons < Sprite
def initialize(viewport, mode)
super(viewport)
@mode = mode
self.bitmap = Bitmap.new(36, 134)
@picture = Cache.system("Iconset")
if @mode == "States"
self.x = 544 - 36
self.y = 90
else
self.x = 544 - 36
self.y = 230
end
@actor = $game_player.actor
@old_status =
refresh_icons
update
end
def icons
return @actor.state_icons if @mode == 'States'
return @actor.buff_icons if @mode == 'Buffs'
end
def update
5.times.each {|i|
if @old_status != icons
refresh_icons
$game_player.actor.apply_usability
end}
if @actor != $game_player.actor
@actor = $game_player.actor
refresh_icons
end
end
def dispose
self.bitmap.dispose
super
end
def refresh_icons
self.bitmap.clear
self.bitmap.font.size = 15
self.bitmap.draw_text(-2, -8, self.bitmap.width + 6, 32, @mode, 1)
y = 12; count = 0
for i in icons
draw_icon(6, y, i)
y += 24; count += 1
break if count == 5
end
5.times.each {|i| @old_status = icons}
end
def draw_icon(x, y, index)
icon = index
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
self.bitmap.blt(x, y, @picture, rect)
end
end
#===============================================================================
# * Damage pop engine
class DamagePop_Obj < Game_Character
attr_accessor :draw_it, :destroy_it, :target, :dmgcustom, :timingg, :plus_time
attr_accessor :plus_time
def initialize(target, custom=nil)
super()
@draw_it = false
@destroy_it = false
@target = target
@timingg = 70
@plus_time = 0.0
@dmgcustom = custom
moveto(@target.x, @target.y)
end
end
class Sprite_DamagePop < Sprite
attr_reader :target
def initialize(viewport, target)
super(viewport)
@target = target
self.bitmap = Bitmap.new(200, 50)
self.bitmap.font.size = 20
case rand(4)
when 0 then @resto_plus = 0.5
when 1 then @resto_plus = 0.6
when 2 then @resto_plus = 0.7
when 3 then @resto_plus = 0.8
end
create_text_for_display
set_text
update
end
def create_text_for_display
battler = @target.target.battler
value = battler.result.hp_damage
value2 = battler.result.mp_damage
value3 = battler.result.tp_damage
# hp damage texts
if value > 0
battler.result.critical ? @text = 'Critical ' + value.to_s :
@text = value.to_s
elsif value < 0
self.bitmap.font.color = Color.new(10,220,45)
@text = value.to_s.sub("-","")
elsif battler.result.missed
@text = 'Miss'
elsif battler.result.evaded
@text = 'Evaded'
elsif battler.result.success # tanget take no damage but result succes
@text = value.to_s
end
# mp damage text
if value2 < 0
self.bitmap.font.color = Color.new(20,160,225)
@text = value2.to_s.sub("-","")
elsif value2 > 0
@text = 'Mp lose' + value2.to_s
end
# TP damage text
if value3 < 0
self.bitmap.font.color = Color.new(20,160,225)
@text = value3.to_s.sub("-","")
elsif value3 > 0
@text = 'Tp lose' + value3.to_s
end
# states and buff display
if battler.result.status_affected?
display_changed_states(battler)
display_changed_buffs(battler)
end
# Custom text (it has hightest priority
if !@target.dmgcustom.nil?
if @target.dmgcustom == 1
@text = 'Block ' + value.to_s
elsif @target.dmgcustom == 2
@text = 'Guard!'
elsif @target.dmgcustom.is_a?(String)
@text = @target.dmgcustom
elsif @target.dmgcustom.is_a?(Array)
self.bitmap.font.color = @target.dmgcustom
@text = @target.dmgcustom
end
end
battler.result.clear
end
# text set and position
def set_text
self.x = @target.screen_x - 98
self.y = @target.screen_y - 54
self.z = 3 * 100
self.opacity = @target.opacity
#self.bitmap.font.bold = true
self.bitmap.font.shadow = true
item = @target.target.battler.used_item
if item != nil and !item.scope.between?(1, 6) and
item.tool_data("User Graphic = ", false).nil?
@text = item.name if @text.nil?
end
@target.target.battler.used_item = nil
self.bitmap.draw_text(0, 0, 200, 32, @text, 1)
end
# Buffs display
def display_changed_buffs(target)
display_buffs(target, target.result.added_buffs, Vocab::BuffAdd)
display_buffs(target, target.result.added_debuffs, Vocab::DebuffAdd)
display_buffs(target, target.result.removed_buffs, Vocab::BuffRemove)
end
def display_buffs(target, buffs, fmt)
buffs.each do |param_id|
@text = sprintf(fmt,'', Vocab::param(param_id)).sub("'s","")
end
end
# States display
def display_changed_states(target)
display_added_states(target)
display_removed_states(target)
end
# Display added states
def display_added_states(target)
target.result.added_state_objects.each do |state|
state_msg = target.actor? ? state.message1 : state.message2
#target.perform_collapse_effect if state.id == target.death_state_id
next if state_msg.empty?
@text = state_msg
end
end
# Display removed states
def display_removed_states(target)
target.result.removed_state_objects.each do |state|
next if state.message4.empty?
@text = state.message4
end
end
def update
@target.timingg -= 1 if @target.timingg > 0
@target.plus_time += @resto_plus
self.opacity -= 5 if @target.timingg <= 25
@target.destroy_it = true if @target.timingg == 0
self.x = @target.target.screen_x - 98
self.y = @target.target.screen_y - 54 - @target.plus_time
end
def dispose
self.bitmap.dispose
super
end
end
#===============================================================================
# Sprite set map
class Spriteset_Map
alias falcaopearl_create_characters create_characters
def create_characters
create_pearl_abs_sprites
falcaopearl_create_characters
end
def create_pearl_abs_sprites
if $game_player.send_dispose_signal
dispose_pearlabs_sprites
$game_player.send_dispose_signal = false
end
@projectile_sprites =
$game_player.projectiles.each do |projectile|
@projectile_sprites.push(Sprite_Character.new(@viewport1, projectile))
end
@damagepop_sprites =
$game_player.damage_pop.each do |target|
@damagepop_sprites.push(Sprite_DamagePop.new(@viewport1, target))
end
@animeabs_sprites =
$game_player.anime_action.each do |anime|
@animeabs_sprites.push(Sprite_Character.new(@viewport1, anime))
end
@enemy_drop_sprites =
$game_player.enemy_drops.each do |enemy|
for i in enemy.dropped_items
@enemy_drop_sprites.push(Sprite_EnemyDrop.new(@viewport1, enemy, i))
end
end
@dead_iconsprites =
@dead_characters =
end
# Drop sprites update
def update_drop_sprites
@enemy_drop_sprites.each {|sprite| sprite.update if !sprite.disposed?
if sprite.disposed?
@enemy_drop_sprites.delete(sprite)
$game_player.enemy_drops.delete(sprite.event)
end
}
$game_player.enemy_drops.each do |enemy|
unless enemy.draw_drop
for i in enemy.dropped_items
@enemy_drop_sprites.push(Sprite_EnemyDrop.new(@viewport1, enemy, i))
end
enemy.draw_drop = true
end
end
end
alias falcaopearl_upsp_update update
def update
update_pearl_abs_main_sprites
falcaopearl_upsp_update
end
# pearl abs main sprites update
def update_pearl_abs_main_sprites
if $game_player.pearl_menu_call == 1
dispose_tool_sprite
dispose_state_icons
dispose_buff_icons
dispose_actorlifebars if $imported
$game_player.pearl_menu_call = 0
case $game_player.pearl_menu_call
when :tools then SceneManager.call(Scene_QuickTool)
when :character then SceneManager.call(Scene_CharacterSet)
when :battler then SceneManager.call(Scene_BattlerSelection)
end
return
end
update_projectile_sprites
update_damagepop_sprites
update_absanime_sprites
update_dead_characters
update_drop_sprites
$game_system.skillbar_enable.nil? ? create_tool_sprite : dispose_tool_sprite
@pearl_tool_sprite.update unless @pearl_tool_sprite.nil?
$game_player.actor.state_icons.empty? ? dispose_state_icons :
create_state_icons
$game_player.actor.buff_icons.empty? ? dispose_buff_icons :
create_buff_icons
@states_sprites.update unless @states_sprites.nil?
@buff_sprites.update unless @buff_sprites.nil?
end
# create tool sprite
def create_tool_sprite
return if !@pearl_tool_sprite.nil?
@pearl_tool_sprite = Sprite_PearlTool.new(@viewport2)
end
# dispose tool sprite
def dispose_tool_sprite
return if @pearl_tool_sprite.nil?
@pearl_tool_sprite.dispose
@pearl_tool_sprite = nil
end
# Create State icons
def create_state_icons
return if !@states_sprites.nil?
@states_sprites = StateBuffIcons.new(@viewport2, 'States')
end
# dispose state icons
def dispose_state_icons
return if @states_sprites.nil?
@states_sprites.dispose
@states_sprites = nil
end
# Create Buff icons
def create_buff_icons
return if !@buff_sprites.nil?
@buff_sprites = StateBuffIcons.new(@viewport2, 'Buffs')
end
# dispose buff icons
def dispose_buff_icons
return if @buff_sprites.nil?
@buff_sprites.dispose
@buff_sprites = nil
end
# Projectiles
def update_projectile_sprites
@projectile_sprites.each {|sprite| sprite.update if !sprite.disposed?}
$game_player.projectiles.each do |projectile|
unless projectile.draw_it
@projectile_sprites.push(Sprite_Character.new(@viewport1, projectile))
projectile.draw_it = true
end
if projectile.destroy_it
@projectile_sprites.each {|i|
if i.character.is_a?(Projectile) and i.character.destroy_it
i.dispose
@projectile_sprites.delete(i)
end
}
if projectile.user.making_spiral
projectile.user.making_spiral = false
end
if projectile.user.battler_guarding
projectile.user.battler_guarding =
projectile.user.battler.remove_state(9)
end
$game_player.projectiles.delete(projectile)
end
end
end
# Damage pop
def update_damagepop_sprites
@damagepop_sprites.each {|sprite| sprite.update if !sprite.disposed?}
$game_player.damage_pop.each do |target|
unless target.draw_it
@damagepop_sprites.push(Sprite_DamagePop.new(@viewport1, target))
target.draw_it = true
end
if target.destroy_it
@damagepop_sprites.each {|i|
if i.target.destroy_it
i.dispose
@damagepop_sprites.delete(i)
end
}
$game_player.damage_pop.delete(target)
end
end
end
#=================================
# ANIME SPRITES
def update_absanime_sprites
@animeabs_sprites.each {|s| s.update if !s.disposed?
unless $game_player.anime_action.include?(s.character)
s.dispose
@animeabs_sprites.delete(s)
$game_player.anime_action.delete(s.character)
end
}
$game_player.anime_action.each do |anime|
unless anime.draw_it
@animeabs_sprites.push(Sprite_Character.new(@viewport1, anime))
anime.draw_it = true
end
if anime.destroy_it
@animeabs_sprites.each {|i|
if i.character.is_a?(Anime_Obj) and i.character.destroy_it
i.dispose
@animeabs_sprites.delete(i)
end
}
$game_player.anime_action.delete(anime)
end
end
end
def update_dead_characters
for follower in $game_player.followers
next if follower.visible? == nil
next unless follower.battler.dead?
unless @dead_characters.include?(follower)
sprite = Sprite_DeadIcon.new(@viewport1, follower)
@dead_iconsprites.push(sprite)
@dead_characters.push(follower)
end
end
for sprite in @dead_iconsprites
sprite.update if !sprite.disposed?
if !sprite.character.battler.dead?
@dead_iconsprites.delete(sprite)
@dead_characters.delete(sprite.character)
sprite.dispose
end
end
end
alias falcaopearl_spdispose dispose
def dispose
dispose_pearl_main_sprites
falcaopearl_spdispose
end
# pearl abs disposing
def dispose_pearl_main_sprites
@dead_iconsprites.each {|icon| icon.dispose}
dispose_tool_sprite
dispose_state_icons
dispose_buff_icons
dispose_pearlabs_sprites
end
def dispose_pearlabs_sprites
@projectile_sprites.each {|pro| pro.dispose}
@projectile_sprites.clear
@damagepop_sprites.each {|target| target.dispose}
@damagepop_sprites.clear
@animeabs_sprites.each {|anime| anime.dispose}
@animeabs_sprites.clear
@enemy_drop_sprites.each {|sprite| sprite.dispose}
@enemy_drop_sprites.clear
end
end
# * Falcao Pearl ABS script shelf # 5
#
# This script handles all sprites of Pearl ABS engine
#===============================================================================
# Anime action enguine
class Anime_Obj < Game_Character
attr_accessor :draw_it, :destroy_it, :item, :user, :original_speed
attr_reader :custom_graphic
def initialize(user, item)
super()
PearlKernel.load_item(item)
@draw_it = false
@destroy_it = false
@item = item
@user = user
@custom_graphic = false
graphic = PearlKernel.user_graphic
if graphic.split(" ").include?('custom')
graphic = graphic.sub("custom ","")
@custom_graphic = true
user.transparent = true
user.using_custom_g = true
end
@character_name = graphic
moveto(@user.x, @user.y)
set_direction(@user.direction)
@original_speed = PearlKernel.user_animespeed
#patch
PearlKernel.check_iconset(@item, "User Iconset = ", self)
@character_name = "" if @user_iconset != nil
end
end
# Sprite character added battlers as enemies and the anime sprites fit
class Sprite_Character < Sprite_Base
alias falcaopearl_update_position update_position
def update_position
if !@character.battler.nil? and @character.battler.is_a?(
Game_Enemy) and @character.battler.breath_enable
apply_breath_effect(@character)
end
self.zoom_x = @character.zoomfx_x
self.zoom_y = @character.zoomfx_y
self.angle = @character.angle_fx
falcaopearl_update_position
update_anime_object_pos
end
# anime object position and action
def update_anime_object_pos
if @character.is_a?(Anime_Obj)
if @character.custom_graphic
add = 0
else
@ch == 128 ? add = 48 : add = (@ch / 2) / 2
end
self.x = @character.user.screen_x
self.y = @character.user.screen_y + add
self.z = @character.user.screen_z + 1
@character.direction = @character.user.direction
if @character.user.anime_speed == 0
if @character.custom_graphic
@character.user.transparent = false
@character.user.using_custom_g = false
end
@character.destroy_it = true
end
if @character.user.making_spiral
@character.direction == 8 ? @character.pattern=1 : @character.pattern=2
return
end
a= @character.user.anime_speed.to_f/@character.original_speed.to_f * 100.0
case a
when 80..100 ; @character.pattern = 0
when 60..80 ; @character.pattern = 1
when 25..60 ; @character.pattern = 2
end
end
end
# Enemy battler graphics engine
alias falcaopearl_battler_bitmap set_character_bitmap
def set_character_bitmap
if battler_graphic?
self.bitmap= Cache.battler(@character_name,@character.battler.battler_hue)
self.ox = self.bitmap.width / 2
self.oy = self.bitmap.height
return
end
falcaopearl_battler_bitmap
end
def battler_graphic?
if !@character.battler.nil? and @character.battler.is_a?(
Game_Enemy) and @character.battler.battler_graphic
return false if @character.page.nil?
@character_name = @character.battler.battler_name
return true
end
return false
end
alias falcaopearl_battler_graphic update_src_rect
def update_src_rect
return if battler_graphic?
falcaopearl_battler_graphic
end
# breath effect
def apply_breath_effect(char)
return if @character.is_a?(Game_Event) and @character.erased
char.zoomfx_x -= 0.0023 if !char.zfx_bol
char.zoomfx_y -= 0.0023 if !char.zfx_bol
char.zoomfx_x += 0.0023 if char.zfx_bol
char.zoomfx_y += 0.0023 if char.zfx_bol
char.zfx_bol = true if char.zoomfx_x <= 0.93
char.zfx_bol = false if char.zoomfx_x >= 1.0
end
end
#sprite characters part 2 (icon graphics feature
class Sprite_Character < Sprite_Base
def iconset_graphic?
!@character.user_iconset.nil? || !@character.pro_iconset.nil?
end
alias falcao_fantastic_bit update_bitmap
def update_bitmap
if iconset_graphic?
if @apply_iconset.nil?
icon = @character.user_iconset if !@character.user_iconset.nil? and
@character.is_a?(Anime_Obj)
icon = @character.pro_iconset if !@character.pro_iconset.nil? and
@character.is_a?(Projectile)
set_iconsetbitmap(icon)
@apply_iconset = true
end
apply_breath_effect2(@character) if !@character.pro_iconset.nil? and
@character.is_a?(Projectile) and @character.pro_iconset == :animated
@enable_angle = @character.user_iconset if
!@character.user_iconset.nil? and @character.is_a?(Anime_Obj)
return
end
falcao_fantastic_bit
end
alias falcao_fantastic_update_position update_position
def update_position
falcao_fantastic_update_position
set_angle_changes(@enable_angle) if @enable_angle != nil
end
def apply_angle_pattern(x_plus, y_plus, angle)
self.x = @character.user.screen_x + x_plus
self.y = @character.user.screen_y + y_plus
self.angle = angle
end
def set_angle_changes(type)
ani= @character.user.anime_speed.to_f/@character.original_speed.to_f * 100.0
case ani
when 80..100
perform_animated(0) if type == :animated
when 60..80
perform_animated(1) if type == :animated
when 0..60
perform_animated(2) if type == :animated
end
if type != :animated
perform_static if type == :static
perform_shielding if type == :shielding
end
end
# animated
def perform_animated(pattern)
case pattern
when 0
apply_angle_pattern(10, -12, -166) if @character.user.direction == 2
if @character.user.direction == 4 || @character.user.direction == 6
apply_angle_pattern(-8, -26, -46)
self.z = @character.user.screen_z - 1
end
apply_angle_pattern(-22, -10, 0) if @character.user.direction == 8
when 1
apply_angle_pattern(0, 0, -266) if @character.user.direction == 2
apply_angle_pattern(-20, -10, 12) if @character.user.direction == 4
apply_angle_pattern(7, -20, -78) if @character.user.direction == 6
if @character.user.direction == 8
apply_angle_pattern(-8, -26, -46)
self.z = @character.user.screen_z - 1
end
when 2
apply_angle_pattern(8, -5, -210) if @character.user.direction == 2
apply_angle_pattern(-10, 2, 52) if @character.user.direction == 4
apply_angle_pattern(8, -15, -126) if @character.user.direction == 6
apply_angle_pattern(10, -16, - 100) if @character.user.direction == 8
end
end
# static
def perform_static
apply_angle_pattern(8, -5, -210) if @character.user.direction == 2
apply_angle_pattern(-10, 2, 52) if @character.user.direction == 4
apply_angle_pattern(8, -15, -126) if @character.user.direction == 6
if @character.user.direction == 8
apply_angle_pattern(-8, -26, -46)
self.z = @character.user.screen_z - 1
end
end
# shielding
def perform_shielding
apply_angle_pattern(2, 4, 0) if @character.user.direction == 2
apply_angle_pattern(-10, 0, 0) if @character.user.direction == 4
if @character.user.direction == 6
apply_angle_pattern(10, 0, 0)
self.z = @character.user.screen_z - 1
elsif @character.user.direction == 8
apply_angle_pattern(11, -9, 0)
self.z = @character.user.screen_z - 1
end
end
def apply_breath_effect2(char)
char.zoomfx_x -= 0.03 if !char.zfx_bol
char.zoomfx_y -= 0.03 if !char.zfx_bol
char.zoomfx_x += 0.03 if char.zfx_bol
char.zoomfx_y += 0.03 if char.zfx_bol
char.zfx_bol = true if char.zoomfx_x <= 0.84
char.zfx_bol = false if char.zoomfx_x >= 1.0
end
alias falcao_fantastic_src update_src_rect
def update_src_rect
return if iconset_graphic?
falcao_fantastic_src
end
def set_iconsetbitmap(icon_index, enabled = true)
self.bitmap = Bitmap.new(24, 24)
bit = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.bitmap.blt(0, 0, bit, rect, enabled ? 255 : 150)
@cw = self.ox = 12
@ch = self.oy = 24
end
end
#===============================================================================
# Drop sprites
class Sprite_EnemyDrop < Sprite
attr_reader :event
def initialize(viewport, event, item)
super(viewport)
@event = event
@item = item
@drop_quantity = @item.tool_data("Drop Quantity = ")
@drop_quantity = 1 if @drop_quantity.nil?
self.z = $game_player.screen_z - 1
@object_zooming = 0
set_bitmap
update
end
def update
super
self.bush_depth = @event.bush_depth
@object_zooming += 1
case @object_zooming
when 1..8 ; self.zoom_x -= 0.01 ; self.zoom_y -= 0.01
when 9..16 ; self.zoom_x += 0.01 ; self.zoom_y += 0.01
when 17..24 ; self.zoom_x = 1.0 ; self.zoom_y = 1.0; @object_zooming = 0
end
self.x = @event.screen_x - 12
self.y = @event.screen_y - 24
if @event.x == $game_player.x and @event.y == $game_player.y and
!$game_player.moving?
complete_action
return
end
complete_action(false) if @event.respawn_count == 1
end
def complete_action(gaining=true)
$game_party.gain_item(@item, @drop_quantity) if gaining
dispose
@event.dropped_items.delete(@item)
$game_map.events_withtags.delete(@event)
end
def dispose
self.bitmap.dispose
super
end
def set_bitmap
self.bitmap = Bitmap.new(26, 38)
bitmap = Cache.system("Iconset")
icon = @item.icon_index
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
self.bitmap.blt(0, 0, bitmap, rect)
##num adds
return if @drop_quantity == 0
self.bitmap.font.size = 14
self.bitmap.font.bold = true
self.bitmap.draw_text(0, 8, 26, 32, @drop_quantity.to_s, 1)
end
end
#===============================================================================
# Dead icon sprites for player and followers
class Sprite_DeadIcon < Sprite
attr_reader :character
def initialize(viewport, character)
super(viewport)
@character = character
self.bitmap = Bitmap.new(24, 24)
bitmap = Cache.system("Iconset")
icon = 1
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
self.bitmap.blt(0, 0, bitmap, rect)
@knok = @character.actor.actor.tool_data("Knockdown Graphic = ",false)!= nil
update
end
def update
super
self.x = @character.screen_x - 10
self.y = @character.screen_y - 54
self.z = @character.screen_z + 1
self.opacity = @character.opacity
self.visible = !@character.transparent
if @knok
@character.knockdown_data = 10 if !@character.battler.deadposing.nil?
else
@character.playdead
@character.direction = 8
self.x = @character.screen_x - 26
end
end
def dispose
self.bitmap.dispose
@character.angle_fx = 0.0 unless @knok
super
end
end
#===============================================================================
# State and buff icons sprites
class StateBuffIcons < Sprite
def initialize(viewport, mode)
super(viewport)
@mode = mode
self.bitmap = Bitmap.new(36, 134)
@picture = Cache.system("Iconset")
if @mode == "States"
self.x = 544 - 36
self.y = 90
else
self.x = 544 - 36
self.y = 230
end
@actor = $game_player.actor
@old_status =
refresh_icons
update
end
def icons
return @actor.state_icons if @mode == 'States'
return @actor.buff_icons if @mode == 'Buffs'
end
def update
5.times.each {|i|
if @old_status != icons
refresh_icons
$game_player.actor.apply_usability
end}
if @actor != $game_player.actor
@actor = $game_player.actor
refresh_icons
end
end
def dispose
self.bitmap.dispose
super
end
def refresh_icons
self.bitmap.clear
self.bitmap.font.size = 15
self.bitmap.draw_text(-2, -8, self.bitmap.width + 6, 32, @mode, 1)
y = 12; count = 0
for i in icons
draw_icon(6, y, i)
y += 24; count += 1
break if count == 5
end
5.times.each {|i| @old_status = icons}
end
def draw_icon(x, y, index)
icon = index
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
self.bitmap.blt(x, y, @picture, rect)
end
end
#===============================================================================
# * Damage pop engine
class DamagePop_Obj < Game_Character
attr_accessor :draw_it, :destroy_it, :target, :dmgcustom, :timingg, :plus_time
attr_accessor :plus_time
def initialize(target, custom=nil)
super()
@draw_it = false
@destroy_it = false
@target = target
@timingg = 70
@plus_time = 0.0
@dmgcustom = custom
moveto(@target.x, @target.y)
end
end
class Sprite_DamagePop < Sprite
attr_reader :target
def initialize(viewport, target)
super(viewport)
@target = target
self.bitmap = Bitmap.new(200, 50)
self.bitmap.font.size = 20
case rand(4)
when 0 then @resto_plus = 0.5
when 1 then @resto_plus = 0.6
when 2 then @resto_plus = 0.7
when 3 then @resto_plus = 0.8
end
create_text_for_display
set_text
update
end
def create_text_for_display
battler = @target.target.battler
value = battler.result.hp_damage
value2 = battler.result.mp_damage
value3 = battler.result.tp_damage
# hp damage texts
if value > 0
battler.result.critical ? @text = 'Critical ' + value.to_s :
@text = value.to_s
elsif value < 0
self.bitmap.font.color = Color.new(10,220,45)
@text = value.to_s.sub("-","")
elsif battler.result.missed
@text = 'Miss'
elsif battler.result.evaded
@text = 'Evaded'
elsif battler.result.success # tanget take no damage but result succes
@text = value.to_s
end
# mp damage text
if value2 < 0
self.bitmap.font.color = Color.new(20,160,225)
@text = value2.to_s.sub("-","")
elsif value2 > 0
@text = 'Mp lose' + value2.to_s
end
# TP damage text
if value3 < 0
self.bitmap.font.color = Color.new(20,160,225)
@text = value3.to_s.sub("-","")
elsif value3 > 0
@text = 'Tp lose' + value3.to_s
end
# states and buff display
if battler.result.status_affected?
display_changed_states(battler)
display_changed_buffs(battler)
end
# Custom text (it has hightest priority
if !@target.dmgcustom.nil?
if @target.dmgcustom == 1
@text = 'Block ' + value.to_s
elsif @target.dmgcustom == 2
@text = 'Guard!'
elsif @target.dmgcustom.is_a?(String)
@text = @target.dmgcustom
elsif @target.dmgcustom.is_a?(Array)
self.bitmap.font.color = @target.dmgcustom
@text = @target.dmgcustom
end
end
battler.result.clear
end
# text set and position
def set_text
self.x = @target.screen_x - 98
self.y = @target.screen_y - 54
self.z = 3 * 100
self.opacity = @target.opacity
#self.bitmap.font.bold = true
self.bitmap.font.shadow = true
item = @target.target.battler.used_item
if item != nil and !item.scope.between?(1, 6) and
item.tool_data("User Graphic = ", false).nil?
@text = item.name if @text.nil?
end
@target.target.battler.used_item = nil
self.bitmap.draw_text(0, 0, 200, 32, @text, 1)
end
# Buffs display
def display_changed_buffs(target)
display_buffs(target, target.result.added_buffs, Vocab::BuffAdd)
display_buffs(target, target.result.added_debuffs, Vocab::DebuffAdd)
display_buffs(target, target.result.removed_buffs, Vocab::BuffRemove)
end
def display_buffs(target, buffs, fmt)
buffs.each do |param_id|
@text = sprintf(fmt,'', Vocab::param(param_id)).sub("'s","")
end
end
# States display
def display_changed_states(target)
display_added_states(target)
display_removed_states(target)
end
# Display added states
def display_added_states(target)
target.result.added_state_objects.each do |state|
state_msg = target.actor? ? state.message1 : state.message2
#target.perform_collapse_effect if state.id == target.death_state_id
next if state_msg.empty?
@text = state_msg
end
end
# Display removed states
def display_removed_states(target)
target.result.removed_state_objects.each do |state|
next if state.message4.empty?
@text = state.message4
end
end
def update
@target.timingg -= 1 if @target.timingg > 0
@target.plus_time += @resto_plus
self.opacity -= 5 if @target.timingg <= 25
@target.destroy_it = true if @target.timingg == 0
self.x = @target.target.screen_x - 98
self.y = @target.target.screen_y - 54 - @target.plus_time
end
def dispose
self.bitmap.dispose
super
end
end
#===============================================================================
# Sprite set map
class Spriteset_Map
alias falcaopearl_create_characters create_characters
def create_characters
create_pearl_abs_sprites
falcaopearl_create_characters
end
def create_pearl_abs_sprites
if $game_player.send_dispose_signal
dispose_pearlabs_sprites
$game_player.send_dispose_signal = false
end
@projectile_sprites =
$game_player.projectiles.each do |projectile|
@projectile_sprites.push(Sprite_Character.new(@viewport1, projectile))
end
@damagepop_sprites =
$game_player.damage_pop.each do |target|
@damagepop_sprites.push(Sprite_DamagePop.new(@viewport1, target))
end
@animeabs_sprites =
$game_player.anime_action.each do |anime|
@animeabs_sprites.push(Sprite_Character.new(@viewport1, anime))
end
@enemy_drop_sprites =
$game_player.enemy_drops.each do |enemy|
for i in enemy.dropped_items
@enemy_drop_sprites.push(Sprite_EnemyDrop.new(@viewport1, enemy, i))
end
end
@dead_iconsprites =
@dead_characters =
end
# Drop sprites update
def update_drop_sprites
@enemy_drop_sprites.each {|sprite| sprite.update if !sprite.disposed?
if sprite.disposed?
@enemy_drop_sprites.delete(sprite)
$game_player.enemy_drops.delete(sprite.event)
end
}
$game_player.enemy_drops.each do |enemy|
unless enemy.draw_drop
for i in enemy.dropped_items
@enemy_drop_sprites.push(Sprite_EnemyDrop.new(@viewport1, enemy, i))
end
enemy.draw_drop = true
end
end
end
alias falcaopearl_upsp_update update
def update
update_pearl_abs_main_sprites
falcaopearl_upsp_update
end
# pearl abs main sprites update
def update_pearl_abs_main_sprites
if $game_player.pearl_menu_call == 1
dispose_tool_sprite
dispose_state_icons
dispose_buff_icons
dispose_actorlifebars if $imported
$game_player.pearl_menu_call = 0
case $game_player.pearl_menu_call
when :tools then SceneManager.call(Scene_QuickTool)
when :character then SceneManager.call(Scene_CharacterSet)
when :battler then SceneManager.call(Scene_BattlerSelection)
end
return
end
update_projectile_sprites
update_damagepop_sprites
update_absanime_sprites
update_dead_characters
update_drop_sprites
$game_system.skillbar_enable.nil? ? create_tool_sprite : dispose_tool_sprite
@pearl_tool_sprite.update unless @pearl_tool_sprite.nil?
$game_player.actor.state_icons.empty? ? dispose_state_icons :
create_state_icons
$game_player.actor.buff_icons.empty? ? dispose_buff_icons :
create_buff_icons
@states_sprites.update unless @states_sprites.nil?
@buff_sprites.update unless @buff_sprites.nil?
end
# create tool sprite
def create_tool_sprite
return if !@pearl_tool_sprite.nil?
@pearl_tool_sprite = Sprite_PearlTool.new(@viewport2)
end
# dispose tool sprite
def dispose_tool_sprite
return if @pearl_tool_sprite.nil?
@pearl_tool_sprite.dispose
@pearl_tool_sprite = nil
end
# Create State icons
def create_state_icons
return if !@states_sprites.nil?
@states_sprites = StateBuffIcons.new(@viewport2, 'States')
end
# dispose state icons
def dispose_state_icons
return if @states_sprites.nil?
@states_sprites.dispose
@states_sprites = nil
end
# Create Buff icons
def create_buff_icons
return if !@buff_sprites.nil?
@buff_sprites = StateBuffIcons.new(@viewport2, 'Buffs')
end
# dispose buff icons
def dispose_buff_icons
return if @buff_sprites.nil?
@buff_sprites.dispose
@buff_sprites = nil
end
# Projectiles
def update_projectile_sprites
@projectile_sprites.each {|sprite| sprite.update if !sprite.disposed?}
$game_player.projectiles.each do |projectile|
unless projectile.draw_it
@projectile_sprites.push(Sprite_Character.new(@viewport1, projectile))
projectile.draw_it = true
end
if projectile.destroy_it
@projectile_sprites.each {|i|
if i.character.is_a?(Projectile) and i.character.destroy_it
i.dispose
@projectile_sprites.delete(i)
end
}
if projectile.user.making_spiral
projectile.user.making_spiral = false
end
if projectile.user.battler_guarding
projectile.user.battler_guarding =
projectile.user.battler.remove_state(9)
end
$game_player.projectiles.delete(projectile)
end
end
end
# Damage pop
def update_damagepop_sprites
@damagepop_sprites.each {|sprite| sprite.update if !sprite.disposed?}
$game_player.damage_pop.each do |target|
unless target.draw_it
@damagepop_sprites.push(Sprite_DamagePop.new(@viewport1, target))
target.draw_it = true
end
if target.destroy_it
@damagepop_sprites.each {|i|
if i.target.destroy_it
i.dispose
@damagepop_sprites.delete(i)
end
}
$game_player.damage_pop.delete(target)
end
end
end
#=================================
# ANIME SPRITES
def update_absanime_sprites
@animeabs_sprites.each {|s| s.update if !s.disposed?
unless $game_player.anime_action.include?(s.character)
s.dispose
@animeabs_sprites.delete(s)
$game_player.anime_action.delete(s.character)
end
}
$game_player.anime_action.each do |anime|
unless anime.draw_it
@animeabs_sprites.push(Sprite_Character.new(@viewport1, anime))
anime.draw_it = true
end
if anime.destroy_it
@animeabs_sprites.each {|i|
if i.character.is_a?(Anime_Obj) and i.character.destroy_it
i.dispose
@animeabs_sprites.delete(i)
end
}
$game_player.anime_action.delete(anime)
end
end
end
def update_dead_characters
for follower in $game_player.followers
next if follower.visible? == nil
next unless follower.battler.dead?
unless @dead_characters.include?(follower)
sprite = Sprite_DeadIcon.new(@viewport1, follower)
@dead_iconsprites.push(sprite)
@dead_characters.push(follower)
end
end
for sprite in @dead_iconsprites
sprite.update if !sprite.disposed?
if !sprite.character.battler.dead?
@dead_iconsprites.delete(sprite)
@dead_characters.delete(sprite.character)
sprite.dispose
end
end
end
alias falcaopearl_spdispose dispose
def dispose
dispose_pearl_main_sprites
falcaopearl_spdispose
end
# pearl abs disposing
def dispose_pearl_main_sprites
@dead_iconsprites.each {|icon| icon.dispose}
dispose_tool_sprite
dispose_state_icons
dispose_buff_icons
dispose_pearlabs_sprites
end
def dispose_pearlabs_sprites
@projectile_sprites.each {|pro| pro.dispose}
@projectile_sprites.clear
@damagepop_sprites.each {|target| target.dispose}
@damagepop_sprites.clear
@animeabs_sprites.each {|anime| anime.dispose}
@animeabs_sprites.clear
@enemy_drop_sprites.each {|sprite| sprite.dispose}
@enemy_drop_sprites.clear
end
end
pearl scenes
#===============================================================================
# * Falcao Pearl ABS script shelf # 6
#
# This script handles all scenes related in pearl ABS
#===============================================================================
module PearlScenes
# Cursor icon displayed when selecting a target
CursorIcon = 389
# Status text displayed in the player selection menu
DeathStatus = 'Death' # Displayed when death
BadStatus = 'Bad' # Displayed when 0 to 25% of hp
OverageStatus = 'Overage' # Displayed when 25 to 50% of hp
GoodStatus = 'Good' # Displayed when 50 to 75% of hp
ExellentStatus = 'Exellent' # Displayed when 75 to 100% of hp
end
#===============================================================================
# target slection engine
class Window_EventSelect < Window_Selectable
attr_reader :participants
def initialize(object)
super(0, 0, 150, 192)
self.z = 101
@participants =
refresh(object)
self.index = 0
self.visible = false
activate
end
def item
return @data
end
def refresh(object)
self.contents.clear if self.contents != nil
@data =
for character in object
if character.is_a?(Game_Event)
if character.on_battle_screen? and character.enemy_ready?
@data.push(character)
character.target_index = @data.size - 1
@participants.push(character)
end
elsif character.on_battle_screen?
next if character.battler.deadposing != nil and
$game_map.map_id != character.battler.deadposing
@data.push(character)
character.target_index = @data.size - 1
@participants.push(character)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 26)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data
x, y = index % col_max * (120 + 32), index / col_max * 24
self.contents.font.size = 16
self.contents.draw_text(x + 24, y, 212, 32, 'none', 0)
end
def item_max
return @item_max.nil? ? 0 : @item_max
end
end
# Scenen events selection target
class Scene_BattlerSelection < Scene_MenuBase
def start
super
@mouse_exist = defined?(Map_Buttons).is_a?(String)
item = $game_player.targeting
if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
load_target(item)
else
invoke = item.tool_data("Tool Invoke Skill = ")
if invoke != 0
load_target($data_skills)
else
@event_window = Window_EventSelect.new($game_map.events.values)
end
end
# info window
@info_window = Sprite.new
@event_window.item.nil? ? t = 'No targets!' : t = 'Select target'
@info_window.bitmap = Bitmap.new(300, 60)
@info_window.z = 900
x, y = Graphics.width / 2 - 300 / 2, Graphics.height / 2 - 60 / 2
@info_window.x = x; @info_window.y = y
@info_window.bitmap.font.size = 30
@info_window.bitmap.font.shadow = true
@info_window.bitmap.draw_text(0, 0, @info_window.width, 32, t, 1)
@info_time = 60
create_cursor unless @event_window.item.nil?
@background_sprite.color.set(16, 16, 16, 70)
end
def create_name_sprites
return if !@name_text.nil?
@name_text = Sprite.new
@name_text.bitmap = Bitmap.new(200, 60)
@name_text.bitmap.font.size = 20
@name_text.bitmap.font.shadow = true
@name_text.x = @event_window.item.screen_x - 100
@name_text.y = @event_window.item.screen_y - 58
text = @event_window.item.battler.name
@name_text.bitmap.draw_text(0, 0, @name_text.width, 32, text, 1)
end
def dispose_name_sprites
return if @name_text.nil?
@name_text.bitmap.dispose
@name_text.dispose
@name_text = nil
end
# load item target
def load_target(item)
if item.scope.between?(1, 6)
@event_window = Window_EventSelect.new($game_map.events.values)
else
targets =
$game_player.followers.each {|i| targets << i if i.visible?}
targets << $game_player
@event_window = Window_EventSelect.new(targets)
end
end
def refresh_info(type)
@info_window.bitmap.clear
t = 'Invalid Target!' if type == 2
@info_window.bitmap.draw_text(-30, 0, @info_window.width, 32, t, 1)
end
def create_cursor
if @mouse_exist
@cursor = $mouse_cursor
@cursor_zooming = 0 ; update_cursor_position
return
end
@cursor = Sprite.new
icon = PearlScenes::CursorIcon
@cursor.bitmap = Bitmap.new(24, 24)
bitmap = Cache.system("Iconset")
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
@cursor.bitmap.blt(0, 0, bitmap, rect)
@cursor_zooming = 0
update_cursor_position
end
def update
super
if Input.trigger?(:B)
$game_player.targeting =
SceneManager.return
Sound.play_cancel
end
@info_time -= 1 if @info_time > 0
if @info_time == 0
@info_window.opacity -= 8 if @info_window.opacity > 0
if @info_window.opacity == 0 and @event_window.item.nil?
Sound.play_cancel
$game_player.targeting =
SceneManager.return
end
end
return if @event_window.item.nil?
if @mouse_exist
for target in @event_window.participants
if Mouse.map_grid == target.x and Mouse.map_grid == target.y
@event_window.select(target.target_index)
end
end
end
if @current_index != @event_window.index
@current_index = @event_window.index
dispose_name_sprites
create_name_sprites
end
update_cursor_position
update_target_selection
end
# target selection
def update_target_selection
if Input.trigger?(:C)
if @mouse_exist
for event in @event_window.participants
if Mouse.map_grid == event.x and Mouse.map_grid == event.y
@event_window.select(event.target_index)
@selected = true
end
end
if @selected.nil?
refresh_info(2)
@info_time = 60; @info_window.opacity = 255
Sound.play_buzzer
return
end
end
Sound.play_ok
$game_player.targeting = @event_window.item
SceneManager.return
end
end
def update_cursor_position
if @mouse_exist
@cursor.x = Mouse.pos
@cursor.y = Mouse.pos
else
@cursor.x = @event_window.item.screen_x
@cursor.y = @event_window.item.screen_y - 16
end
@cursor_zooming += 1
case @cursor_zooming
when 1..10 ; @cursor.zoom_x -= 0.01 ; @cursor.zoom_y -= 0.01
when 11..20; @cursor.zoom_x += 0.01 ; @cursor.zoom_y += 0.01
when 21..30; @cursor.zoom_x = 1.0 ; @cursor.zoom_y = 1.0
@cursor_zooming = 0
end
end
def terminate
super
@event_window.dispose
@info_window.dispose
@info_window.bitmap.dispose
dispose_name_sprites
if @mouse_exist and !@cursor.nil?
@cursor.zoom_x = 1.0 ; @cursor.zoom_y = 1.0 ; @selected = nil
else
@cursor.dispose unless @cursor.nil?
@cursor.bitmap.dispose unless @cursor.nil?
end
end
end
#===============================================================================
#===============================================================================
# * Player slection engine
# Primary use selection
class Window_Primaryuse < Window_Command
attr_accessor :actor
def initialize(x, y, actor)
@actor = actor
super(x, y)
deactivate ; unselect
end
def window_width() return 544 end
def window_height() return 80 end
def make_command_list
add_command('Weapon ' + Key::Weapon, 'Weapon ' + Key::Weapon)
add_command('Armor ' + Key::Armor, 'Armor ' + Key::Armor)
add_command('Item ' + Key::Item, 'Item ' + Key::Item)
add_command('Item ' + Key::Item2, 'Item ' + Key::Item2)
add_command('Skill ' + Key::Skill, 'Skill ' + Key::Skill)
add_command('Skill ' + Key::Skill2, 'Skill ' + Key::Skill2)
add_command('Skill ' + Key::Skill3, 'Skill ' + Key::Skill3)
add_command('Skill ' + Key::Skill4, 'Skill ' + Key::Skill4)
end
def refresh_actor(actor)
@actor = actor
refresh
end
def col_max
return 4
end
def draw_item(index)
contents.font.size = 20
if @actor.primary_use == index + 1
contents.font.color = Color.new(255, 120, 0, 255)
draw_text(item_rect_for_text(index), command_name(index), alignment)
change_color(normal_color, command_enabled?(index))
return
end
super
end
end
class Window_CharacterSet < Window_Selectable
include PearlScenes
def initialize(x=0, y=0)
super(x, y, 544, 156)
refresh
self.index = 0
activate
end
def item
return @data
end
def refresh
self.contents.clear if self.contents != nil
@data =
$game_party.battle_members.each {|actor| @data.push(actor)}
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 26, row_max * 128)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data
x, y = index % col_max * (138), index / col_max * 130
self.contents.font.size = 20
contents.fill_rect(x, y, item_width, item_height, Color.new(0, 0, 0, 60))
draw_character(item.character_name, item.character_index, x + 22, y + 56)
hp_color =
mp_color =
PearlKernel.draw_hp(self.contents, item, x + 4, y + 66, 96, 12, hp_color)
PearlKernel.draw_mp(self.contents, item, x + 4, y + 86, 96, 12, mp_color)
contents.draw_text(x - 2, y, item_width, 32, item.name, 2)
contents.draw_text(x - 2, y + 20, item_width, 32, item.class.name, 2)
case (item.hp.to_f / item.mhp.to_f * 100.0)
when 0 ; text = DeathStatus
when 1..25 ; text = BadStatus
when 26..50 ; text = OverageStatus
when 51..75 ; text = GoodStatus
when 76..100 ; text = ExellentStatus
end
if item.state?(1)
draw_icon($data_states.icon_index, x + 50, y + 100)
end
contents.draw_text(x + 4, y + 100, item_width, 32, text) rescue nil
end
def item_max
return @item_max.nil? ? 0 : @item_max
end
def col_max
return 4
end
def line_height
return 130
end
end
class Scene_CharacterSet < Scene_MenuBase
def start
super
x, y = Graphics.width / 2 - 544 / 2, Graphics.height / 2 - 60 / 2
@top_text = Window_Base.new(x, y - 170, 544, 60)
@top_text.draw_text(0, 0, @top_text.width, 32, 'Select your Player', 1)
@window_charset = Window_CharacterSet.new(@top_text.x, @top_text.y + 60)
@primary_info = Window_Base.new(@top_text.x,@window_charset.y + 156, 544,60)
@timer = 0
refresh_primary_info('Press A to set up')
@primary_use = Window_Primaryuse.new(@top_text.x,@primary_info.y + 60,actor)
@primary_use.set_handler('Weapon ' + Key::Weapon, method(:apply_item))
@primary_use.set_handler('Armor ' + Key::Armor, method(:apply_item))
@primary_use.set_handler('Item ' + Key::Item, method(:apply_item))
@primary_use.set_handler('Item ' + Key::Item2, method(:apply_item))
@primary_use.set_handler('Skill ' + Key::Skill, method(:apply_item))
@primary_use.set_handler('Skill ' + Key::Skill2, method(:apply_item))
@primary_use.set_handler('Skill ' + Key::Skill3, method(:apply_item))
@primary_use.set_handler('Skill ' + Key::Skill4, method(:apply_item))
DisplayTools.create(@primary_use.x + 94, @primary_use.y + 85)
if $game_player.in_combat_mode?
$game_temp.pop_w(180, 'Pearl ABS',
'You cannot switch player while in combat!')
end
@index_char = @window_charset.index
@background_sprite.color.set(16, 16, 16, 70)
end
def apply_item
case @primary_use.current_symbol
when 'Weapon ' + Key::Weapon then actor.primary_use = 1
when 'Armor ' + Key::Armor then actor.primary_use = 2
when 'Item ' + Key::Item then actor.primary_use = 3
when 'Item ' + Key::Item2 then actor.primary_use = 4
when 'Skill ' + Key::Skill then actor.primary_use = 5
when 'Skill ' + Key::Skill2 then actor.primary_use = 6
when 'Skill ' + Key::Skill3 then actor.primary_use = 7
when 'Skill ' + Key::Skill4 then actor.primary_use = 8
end
refresh_primary_info(actor.name+ " now use #{@primary_use.current_symbol}!")
@primary_use.refresh_actor(actor)
cancel_setup; @timer = 120
end
def actor
@window_charset.item
end
def refresh_primary_info(text)
@primary_info.contents.clear
@primary_info.contents.font.size = 20
@primary_info.draw_text(0, 0, 544, 32, 'As a follower primarily use tool?')
@primary_info.draw_text(-26, 0, 544, 32, text, 2)
end
def update
super
if $game_player.in_combat_mode?
SceneManager.return if $game_temp.pop_windowdata == 4
return
end
if @timer > 0
@timer -= 1
refresh_primary_info('Press A to set up') if @timer == 0
end
DisplayTools.update
if @index_char != @window_charset.index
@index_char = @window_charset.index
DisplayTools.sprite.actor = actor
DisplayTools.sprite.refresh_icons
DisplayTools.sprite.refresh_texts
@primary_use.refresh_actor(actor)
end
update_cancel if Input.trigger?(:B)
update_player_selection if Input.trigger?(:C)
update_setup if Input.trigger?(:X)
end
def update_setup
return if @primary_use.active
Sound.play_ok
@window_charset.deactivate
@primary_use.activate
@primary_use.select(0)
end
def cancel_setup
@window_charset.activate
@primary_use.deactivate
@primary_use.unselect
end
def update_cancel
Sound.play_cancel
if @window_charset.active
if $game_player.actor.dead?
Sound.play_buzzer
return
end
SceneManager.return
else
cancel_setup
end
end
def update_player_selection
if @window_charset.active
if @window_charset.item.dead?
Sound.play_buzzer
return
end
Sound.play_ok
$game_party.swap_order(0, @window_charset.index)
SceneManager.return
end
end
def terminate
super
@window_charset.dispose
@top_text.dispose
@primary_use.dispose
@primary_info.dispose
DisplayTools.dispose
end
end
#===============================================================================
#===============================================================================
# * Quick tool se3lection engine
class Window_Base < Window
def draw_text_ex2(x, y, text)
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
end
# window horizon
class Window_ItemSelect < Window_HorzCommand
def initialize(x=0, y=0)
super(x, y)
end
def window_width() return 460 end
def window_height() return 50 end
def make_command_list
add_command("Weapons", :weapon)
add_command("Left Hand", :armor)
add_command("Items", :item)
add_command("Skills", :skill)
end
def draw_item(index)
contents.font.size = 20
super
end
end
# window slot ask
class Window_SlotConfirm < Window_Command
def initialize(x, y, kind)
@kind = kind
super(x, y)
activate
end
def window_width() return 130 end
def window_height() return @kind == :item ? 80 : 120 end
def make_command_list
case @kind
when :item
add_command('Slot ' + Key::Item, :slot1)
add_command('Slot ' + Key::Item2, :slot2)
when :skill
add_command('Slot ' + Key::Skill, :slot1)
add_command('Slot ' + Key::Skill2, :slot2)
add_command('Slot ' + Key::Skill3, :slot3)
add_command('Slot ' + Key::Skill4, :slot4)
end
end
def draw_item(index)
contents.font.size = 20
super
end
end
# Actor quick tool
class Window_ActorQuickTool < Window_Selectable
def initialize(x=0, y=124, w=460, h=148)
super(x, y, w, h)
unselect
end
def item() return @data end
def col_max() return 2 end
def spacing() return 6 end
def refresh(actor, kind)
self.contents.clear if self.contents != nil
@data =
if kind == :weapon
operand = $game_party.weapons
operand.push(actor.equips) if actor.equips != nil
end
if kind == :armor
operand = $game_party.armors
operand.push(actor.equips) if actor.equips != nil
end
operand = $game_party.items if kind == :item
operand = actor.skills if kind == :skill
for item in operand
if kind == :weapon || kind == :armor
next unless actor.equippable?(item)
next if item.etype_id > 1
end
unless @data.include?(item)
next if item.tool_data("Exclude From Tool Menu = ", false) == "true"
@data.push(item)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 24)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data
x, y = index % col_max * (190 + 32), index / col_max * 24
self.contents.font.size = 20
draw_icon(item.icon_index, x, y)
contents.draw_text(x + 24, y, 212, 32, item.name)
end
def item_max
return @item_max.nil? ? 0 : @item_max
end
end
module DisplayTools
def self.create(x, y)
@viewport2 = Viewport.new ; @viewport2.z = 999
@pearl_tool_sprite = Sprite_PearlTool.new(@viewport2, )
end
def self.sprite
return @pearl_tool_sprite
end
def self.update
@pearl_tool_sprite.update
end
def self.dispose
@pearl_tool_sprite.dispose ; @viewport2.dispose
@viewport2 = nil ; @pearl_tool_sprite = nil
end
end
# Scene quick tool
class Scene_QuickTool < Scene_MenuBase
def start
super
x, y = Graphics.width / 2 - 460 / 2, Graphics.height / 2 - 85 / 2
@top_text = Window_Base.new(x, y - 156, 460, 85)
@statust =
refresh_top_info
@type_select = Window_ItemSelect.new(@top_text.x, @top_text.y + 85)
@type_select.set_handler(:weapon, method(:refresh_tools))
@type_select.set_handler(:armor, method(:refresh_tools))
@type_select.set_handler(:item, method(:refresh_tools))
@type_select.set_handler(:skill, method(:refresh_tools))
@type_select.set_handler(:cancel, method(:refresh_cancel))
@type_index = @type_select.index
@items_w = Window_ActorQuickTool.new(@type_select.x, @type_select.y + 50)
@items_w.refresh($game_player.actor, @type_select.current_symbol)
@description = Window_Base.new(@items_w.x, @items_w.y + 148, 460, 75)
DisplayTools.create(@description.x + 75, @description.y + 80)
@background_sprite.color.set(16, 16, 16, 70)
end
# create slot confirm
def create_slot_confirm
@slot_confirm = Window_SlotConfirm.new(@items_w.x + 144, @items_w.y + 36,
@type_select.current_symbol)
if @type_select.current_symbol == :item
@slot_confirm.set_handler(:slot1, method(:open_slots))
@slot_confirm.set_handler(:slot2, method(:open_slots))
else
@slot_confirm.set_handler(:slot1, method(:open_slots))
@slot_confirm.set_handler(:slot2, method(:open_slots))
@slot_confirm.set_handler(:slot3, method(:open_slots))
@slot_confirm.set_handler(:slot4, method(:open_slots))
end
end
# dispose slot confirm
def dispose_slot_confirm
return if @slot_confirm.nil?
@slot_confirm.dispose
@slot_confirm = nil
end
# top info
def refresh_top_info
@top_text.contents.clear
@top_text.contents.font.size = 20
@top_text.contents.fill_rect(0, 0, 58, 74, Color.new(0, 0, 0, 60))
@top_text.draw_character(actor.character_name,actor.character_index, 26, 60)
@top_text.draw_text(62, 0, @top_text.width, 32, actor.name + ' Equippment')
@top_text.draw_text(62, 22, @top_text.width, 32, actor.class.name)
@top_text.draw_text(-22, 30, @top_text.width, 32, @statust, 2)
@top_text.draw_text(-22, 0,@top_text.width,32, 'M = Switch Player',2) unless
PearlKernel::SinglePlayer
end
def refresh_tools
enable_items
end
def refresh_cancel
SceneManager.return
end
def enable_items
@items_w.activate
@items_w.select(0)
end
def refresh_description
@description.contents.clear
@desc_index = @items_w.index
return if @items_w.item.nil? || @items_w.index < 0
@description.contents.font.size = 20
@description.draw_text_ex2(0, -4, @items_w.item.description)
end
def update
super
perform_item_ok if Input.trigger?(:C)
perform_canceling if Input.trigger?(:B)
if PearlKey.trigger?(Key::PlayerSelect) and !PearlKernel::SinglePlayer
Sound.play_ok
SceneManager.call(Scene_CharacterSet)
end
DisplayTools.update
perform_refresh
end
def perform_item_ok
return if @items_w.item.nil?
case @type_select.current_symbol
when :weapon
actor.change_equip_by_id(0, @items_w.item.id)
equip_play
when :armor
actor.change_equip_by_id(1, @items_w.item.id)
equip_play
when :item
activate_slots
when :skill
activate_slots
end
DisplayTools.sprite.refresh_texts
end
def activate_slots
@items_w.deactivate
create_slot_confirm
Sound.play_ok
end
def deactivate_slots
@items_w.activate
dispose_slot_confirm
end
def actor
return $game_player.actor
end
def equip_play
Sound.play_equip
@statust = 80
end
# open slots
def open_slots
if @type_select.current_symbol == :item
case @slot_confirm.current_symbol
when :slot1 then actor.assigned_item = @items_w.item
when :slot2 then actor.assigned_item2 = @items_w.item
end
else
case @slot_confirm.current_symbol
when :slot1 then actor.assigned_skill = @items_w.item
when :slot2 then actor.assigned_skill2 = @items_w.item
when :slot3 then actor.assigned_skill3 = @items_w.item
when :slot4 then actor.assigned_skill4 = @items_w.item
end
end
equip_play ; deactivate_slots
DisplayTools.sprite.refresh_texts
end
def perform_canceling
Sound.play_cancel
if @items_w.active
@items_w.deactivate
@items_w.unselect
@type_select.activate
else
deactivate_slots
end
end
def perform_refresh
if @type_index != @type_select.index
@type_index = @type_select.index
@items_w.refresh($game_player.actor, @type_select.current_symbol)
refresh_description
end
if @desc_index != @items_w.index
@desc_index = @items_w.index
refresh_description
end
if @statust > 0
@statust -= 1
if @statust == 78
@statust = @items_w.item.name + ' Equipped'
refresh_top_info
elsif @statust == 0
@statust =
refresh_top_info
end
end
end
def terminate
super
@top_text.dispose
@type_select.dispose
@items_w.dispose
@description.dispose
dispose_slot_confirm
DisplayTools.dispose
end
end
#===============================================================================
# * Falcao Pearl ABS script shelf # 6
#
# This script handles all scenes related in pearl ABS
#===============================================================================
module PearlScenes
# Cursor icon displayed when selecting a target
CursorIcon = 389
# Status text displayed in the player selection menu
DeathStatus = 'Death' # Displayed when death
BadStatus = 'Bad' # Displayed when 0 to 25% of hp
OverageStatus = 'Overage' # Displayed when 25 to 50% of hp
GoodStatus = 'Good' # Displayed when 50 to 75% of hp
ExellentStatus = 'Exellent' # Displayed when 75 to 100% of hp
end
#===============================================================================
# target slection engine
class Window_EventSelect < Window_Selectable
attr_reader :participants
def initialize(object)
super(0, 0, 150, 192)
self.z = 101
@participants =
refresh(object)
self.index = 0
self.visible = false
activate
end
def item
return @data
end
def refresh(object)
self.contents.clear if self.contents != nil
@data =
for character in object
if character.is_a?(Game_Event)
if character.on_battle_screen? and character.enemy_ready?
@data.push(character)
character.target_index = @data.size - 1
@participants.push(character)
end
elsif character.on_battle_screen?
next if character.battler.deadposing != nil and
$game_map.map_id != character.battler.deadposing
@data.push(character)
character.target_index = @data.size - 1
@participants.push(character)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 26)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data
x, y = index % col_max * (120 + 32), index / col_max * 24
self.contents.font.size = 16
self.contents.draw_text(x + 24, y, 212, 32, 'none', 0)
end
def item_max
return @item_max.nil? ? 0 : @item_max
end
end
# Scenen events selection target
class Scene_BattlerSelection < Scene_MenuBase
def start
super
@mouse_exist = defined?(Map_Buttons).is_a?(String)
item = $game_player.targeting
if item.is_a?(RPG::Skill) || item.is_a?(RPG::Item)
load_target(item)
else
invoke = item.tool_data("Tool Invoke Skill = ")
if invoke != 0
load_target($data_skills)
else
@event_window = Window_EventSelect.new($game_map.events.values)
end
end
# info window
@info_window = Sprite.new
@event_window.item.nil? ? t = 'No targets!' : t = 'Select target'
@info_window.bitmap = Bitmap.new(300, 60)
@info_window.z = 900
x, y = Graphics.width / 2 - 300 / 2, Graphics.height / 2 - 60 / 2
@info_window.x = x; @info_window.y = y
@info_window.bitmap.font.size = 30
@info_window.bitmap.font.shadow = true
@info_window.bitmap.draw_text(0, 0, @info_window.width, 32, t, 1)
@info_time = 60
create_cursor unless @event_window.item.nil?
@background_sprite.color.set(16, 16, 16, 70)
end
def create_name_sprites
return if !@name_text.nil?
@name_text = Sprite.new
@name_text.bitmap = Bitmap.new(200, 60)
@name_text.bitmap.font.size = 20
@name_text.bitmap.font.shadow = true
@name_text.x = @event_window.item.screen_x - 100
@name_text.y = @event_window.item.screen_y - 58
text = @event_window.item.battler.name
@name_text.bitmap.draw_text(0, 0, @name_text.width, 32, text, 1)
end
def dispose_name_sprites
return if @name_text.nil?
@name_text.bitmap.dispose
@name_text.dispose
@name_text = nil
end
# load item target
def load_target(item)
if item.scope.between?(1, 6)
@event_window = Window_EventSelect.new($game_map.events.values)
else
targets =
$game_player.followers.each {|i| targets << i if i.visible?}
targets << $game_player
@event_window = Window_EventSelect.new(targets)
end
end
def refresh_info(type)
@info_window.bitmap.clear
t = 'Invalid Target!' if type == 2
@info_window.bitmap.draw_text(-30, 0, @info_window.width, 32, t, 1)
end
def create_cursor
if @mouse_exist
@cursor = $mouse_cursor
@cursor_zooming = 0 ; update_cursor_position
return
end
@cursor = Sprite.new
icon = PearlScenes::CursorIcon
@cursor.bitmap = Bitmap.new(24, 24)
bitmap = Cache.system("Iconset")
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
@cursor.bitmap.blt(0, 0, bitmap, rect)
@cursor_zooming = 0
update_cursor_position
end
def update
super
if Input.trigger?(:B)
$game_player.targeting =
SceneManager.return
Sound.play_cancel
end
@info_time -= 1 if @info_time > 0
if @info_time == 0
@info_window.opacity -= 8 if @info_window.opacity > 0
if @info_window.opacity == 0 and @event_window.item.nil?
Sound.play_cancel
$game_player.targeting =
SceneManager.return
end
end
return if @event_window.item.nil?
if @mouse_exist
for target in @event_window.participants
if Mouse.map_grid == target.x and Mouse.map_grid == target.y
@event_window.select(target.target_index)
end
end
end
if @current_index != @event_window.index
@current_index = @event_window.index
dispose_name_sprites
create_name_sprites
end
update_cursor_position
update_target_selection
end
# target selection
def update_target_selection
if Input.trigger?(:C)
if @mouse_exist
for event in @event_window.participants
if Mouse.map_grid == event.x and Mouse.map_grid == event.y
@event_window.select(event.target_index)
@selected = true
end
end
if @selected.nil?
refresh_info(2)
@info_time = 60; @info_window.opacity = 255
Sound.play_buzzer
return
end
end
Sound.play_ok
$game_player.targeting = @event_window.item
SceneManager.return
end
end
def update_cursor_position
if @mouse_exist
@cursor.x = Mouse.pos
@cursor.y = Mouse.pos
else
@cursor.x = @event_window.item.screen_x
@cursor.y = @event_window.item.screen_y - 16
end
@cursor_zooming += 1
case @cursor_zooming
when 1..10 ; @cursor.zoom_x -= 0.01 ; @cursor.zoom_y -= 0.01
when 11..20; @cursor.zoom_x += 0.01 ; @cursor.zoom_y += 0.01
when 21..30; @cursor.zoom_x = 1.0 ; @cursor.zoom_y = 1.0
@cursor_zooming = 0
end
end
def terminate
super
@event_window.dispose
@info_window.dispose
@info_window.bitmap.dispose
dispose_name_sprites
if @mouse_exist and !@cursor.nil?
@cursor.zoom_x = 1.0 ; @cursor.zoom_y = 1.0 ; @selected = nil
else
@cursor.dispose unless @cursor.nil?
@cursor.bitmap.dispose unless @cursor.nil?
end
end
end
#===============================================================================
#===============================================================================
# * Player slection engine
# Primary use selection
class Window_Primaryuse < Window_Command
attr_accessor :actor
def initialize(x, y, actor)
@actor = actor
super(x, y)
deactivate ; unselect
end
def window_width() return 544 end
def window_height() return 80 end
def make_command_list
add_command('Weapon ' + Key::Weapon, 'Weapon ' + Key::Weapon)
add_command('Armor ' + Key::Armor, 'Armor ' + Key::Armor)
add_command('Item ' + Key::Item, 'Item ' + Key::Item)
add_command('Item ' + Key::Item2, 'Item ' + Key::Item2)
add_command('Skill ' + Key::Skill, 'Skill ' + Key::Skill)
add_command('Skill ' + Key::Skill2, 'Skill ' + Key::Skill2)
add_command('Skill ' + Key::Skill3, 'Skill ' + Key::Skill3)
add_command('Skill ' + Key::Skill4, 'Skill ' + Key::Skill4)
end
def refresh_actor(actor)
@actor = actor
refresh
end
def col_max
return 4
end
def draw_item(index)
contents.font.size = 20
if @actor.primary_use == index + 1
contents.font.color = Color.new(255, 120, 0, 255)
draw_text(item_rect_for_text(index), command_name(index), alignment)
change_color(normal_color, command_enabled?(index))
return
end
super
end
end
class Window_CharacterSet < Window_Selectable
include PearlScenes
def initialize(x=0, y=0)
super(x, y, 544, 156)
refresh
self.index = 0
activate
end
def item
return @data
end
def refresh
self.contents.clear if self.contents != nil
@data =
$game_party.battle_members.each {|actor| @data.push(actor)}
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 26, row_max * 128)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data
x, y = index % col_max * (138), index / col_max * 130
self.contents.font.size = 20
contents.fill_rect(x, y, item_width, item_height, Color.new(0, 0, 0, 60))
draw_character(item.character_name, item.character_index, x + 22, y + 56)
hp_color =
mp_color =
PearlKernel.draw_hp(self.contents, item, x + 4, y + 66, 96, 12, hp_color)
PearlKernel.draw_mp(self.contents, item, x + 4, y + 86, 96, 12, mp_color)
contents.draw_text(x - 2, y, item_width, 32, item.name, 2)
contents.draw_text(x - 2, y + 20, item_width, 32, item.class.name, 2)
case (item.hp.to_f / item.mhp.to_f * 100.0)
when 0 ; text = DeathStatus
when 1..25 ; text = BadStatus
when 26..50 ; text = OverageStatus
when 51..75 ; text = GoodStatus
when 76..100 ; text = ExellentStatus
end
if item.state?(1)
draw_icon($data_states.icon_index, x + 50, y + 100)
end
contents.draw_text(x + 4, y + 100, item_width, 32, text) rescue nil
end
def item_max
return @item_max.nil? ? 0 : @item_max
end
def col_max
return 4
end
def line_height
return 130
end
end
class Scene_CharacterSet < Scene_MenuBase
def start
super
x, y = Graphics.width / 2 - 544 / 2, Graphics.height / 2 - 60 / 2
@top_text = Window_Base.new(x, y - 170, 544, 60)
@top_text.draw_text(0, 0, @top_text.width, 32, 'Select your Player', 1)
@window_charset = Window_CharacterSet.new(@top_text.x, @top_text.y + 60)
@primary_info = Window_Base.new(@top_text.x,@window_charset.y + 156, 544,60)
@timer = 0
refresh_primary_info('Press A to set up')
@primary_use = Window_Primaryuse.new(@top_text.x,@primary_info.y + 60,actor)
@primary_use.set_handler('Weapon ' + Key::Weapon, method(:apply_item))
@primary_use.set_handler('Armor ' + Key::Armor, method(:apply_item))
@primary_use.set_handler('Item ' + Key::Item, method(:apply_item))
@primary_use.set_handler('Item ' + Key::Item2, method(:apply_item))
@primary_use.set_handler('Skill ' + Key::Skill, method(:apply_item))
@primary_use.set_handler('Skill ' + Key::Skill2, method(:apply_item))
@primary_use.set_handler('Skill ' + Key::Skill3, method(:apply_item))
@primary_use.set_handler('Skill ' + Key::Skill4, method(:apply_item))
DisplayTools.create(@primary_use.x + 94, @primary_use.y + 85)
if $game_player.in_combat_mode?
$game_temp.pop_w(180, 'Pearl ABS',
'You cannot switch player while in combat!')
end
@index_char = @window_charset.index
@background_sprite.color.set(16, 16, 16, 70)
end
def apply_item
case @primary_use.current_symbol
when 'Weapon ' + Key::Weapon then actor.primary_use = 1
when 'Armor ' + Key::Armor then actor.primary_use = 2
when 'Item ' + Key::Item then actor.primary_use = 3
when 'Item ' + Key::Item2 then actor.primary_use = 4
when 'Skill ' + Key::Skill then actor.primary_use = 5
when 'Skill ' + Key::Skill2 then actor.primary_use = 6
when 'Skill ' + Key::Skill3 then actor.primary_use = 7
when 'Skill ' + Key::Skill4 then actor.primary_use = 8
end
refresh_primary_info(actor.name+ " now use #{@primary_use.current_symbol}!")
@primary_use.refresh_actor(actor)
cancel_setup; @timer = 120
end
def actor
@window_charset.item
end
def refresh_primary_info(text)
@primary_info.contents.clear
@primary_info.contents.font.size = 20
@primary_info.draw_text(0, 0, 544, 32, 'As a follower primarily use tool?')
@primary_info.draw_text(-26, 0, 544, 32, text, 2)
end
def update
super
if $game_player.in_combat_mode?
SceneManager.return if $game_temp.pop_windowdata == 4
return
end
if @timer > 0
@timer -= 1
refresh_primary_info('Press A to set up') if @timer == 0
end
DisplayTools.update
if @index_char != @window_charset.index
@index_char = @window_charset.index
DisplayTools.sprite.actor = actor
DisplayTools.sprite.refresh_icons
DisplayTools.sprite.refresh_texts
@primary_use.refresh_actor(actor)
end
update_cancel if Input.trigger?(:B)
update_player_selection if Input.trigger?(:C)
update_setup if Input.trigger?(:X)
end
def update_setup
return if @primary_use.active
Sound.play_ok
@window_charset.deactivate
@primary_use.activate
@primary_use.select(0)
end
def cancel_setup
@window_charset.activate
@primary_use.deactivate
@primary_use.unselect
end
def update_cancel
Sound.play_cancel
if @window_charset.active
if $game_player.actor.dead?
Sound.play_buzzer
return
end
SceneManager.return
else
cancel_setup
end
end
def update_player_selection
if @window_charset.active
if @window_charset.item.dead?
Sound.play_buzzer
return
end
Sound.play_ok
$game_party.swap_order(0, @window_charset.index)
SceneManager.return
end
end
def terminate
super
@window_charset.dispose
@top_text.dispose
@primary_use.dispose
@primary_info.dispose
DisplayTools.dispose
end
end
#===============================================================================
#===============================================================================
# * Quick tool se3lection engine
class Window_Base < Window
def draw_text_ex2(x, y, text)
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
end
# window horizon
class Window_ItemSelect < Window_HorzCommand
def initialize(x=0, y=0)
super(x, y)
end
def window_width() return 460 end
def window_height() return 50 end
def make_command_list
add_command("Weapons", :weapon)
add_command("Left Hand", :armor)
add_command("Items", :item)
add_command("Skills", :skill)
end
def draw_item(index)
contents.font.size = 20
super
end
end
# window slot ask
class Window_SlotConfirm < Window_Command
def initialize(x, y, kind)
@kind = kind
super(x, y)
activate
end
def window_width() return 130 end
def window_height() return @kind == :item ? 80 : 120 end
def make_command_list
case @kind
when :item
add_command('Slot ' + Key::Item, :slot1)
add_command('Slot ' + Key::Item2, :slot2)
when :skill
add_command('Slot ' + Key::Skill, :slot1)
add_command('Slot ' + Key::Skill2, :slot2)
add_command('Slot ' + Key::Skill3, :slot3)
add_command('Slot ' + Key::Skill4, :slot4)
end
end
def draw_item(index)
contents.font.size = 20
super
end
end
# Actor quick tool
class Window_ActorQuickTool < Window_Selectable
def initialize(x=0, y=124, w=460, h=148)
super(x, y, w, h)
unselect
end
def item() return @data end
def col_max() return 2 end
def spacing() return 6 end
def refresh(actor, kind)
self.contents.clear if self.contents != nil
@data =
if kind == :weapon
operand = $game_party.weapons
operand.push(actor.equips) if actor.equips != nil
end
if kind == :armor
operand = $game_party.armors
operand.push(actor.equips) if actor.equips != nil
end
operand = $game_party.items if kind == :item
operand = actor.skills if kind == :skill
for item in operand
if kind == :weapon || kind == :armor
next unless actor.equippable?(item)
next if item.etype_id > 1
end
unless @data.include?(item)
next if item.tool_data("Exclude From Tool Menu = ", false) == "true"
@data.push(item)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 24)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data
x, y = index % col_max * (190 + 32), index / col_max * 24
self.contents.font.size = 20
draw_icon(item.icon_index, x, y)
contents.draw_text(x + 24, y, 212, 32, item.name)
end
def item_max
return @item_max.nil? ? 0 : @item_max
end
end
module DisplayTools
def self.create(x, y)
@viewport2 = Viewport.new ; @viewport2.z = 999
@pearl_tool_sprite = Sprite_PearlTool.new(@viewport2, )
end
def self.sprite
return @pearl_tool_sprite
end
def self.update
@pearl_tool_sprite.update
end
def self.dispose
@pearl_tool_sprite.dispose ; @viewport2.dispose
@viewport2 = nil ; @pearl_tool_sprite = nil
end
end
# Scene quick tool
class Scene_QuickTool < Scene_MenuBase
def start
super
x, y = Graphics.width / 2 - 460 / 2, Graphics.height / 2 - 85 / 2
@top_text = Window_Base.new(x, y - 156, 460, 85)
@statust =
refresh_top_info
@type_select = Window_ItemSelect.new(@top_text.x, @top_text.y + 85)
@type_select.set_handler(:weapon, method(:refresh_tools))
@type_select.set_handler(:armor, method(:refresh_tools))
@type_select.set_handler(:item, method(:refresh_tools))
@type_select.set_handler(:skill, method(:refresh_tools))
@type_select.set_handler(:cancel, method(:refresh_cancel))
@type_index = @type_select.index
@items_w = Window_ActorQuickTool.new(@type_select.x, @type_select.y + 50)
@items_w.refresh($game_player.actor, @type_select.current_symbol)
@description = Window_Base.new(@items_w.x, @items_w.y + 148, 460, 75)
DisplayTools.create(@description.x + 75, @description.y + 80)
@background_sprite.color.set(16, 16, 16, 70)
end
# create slot confirm
def create_slot_confirm
@slot_confirm = Window_SlotConfirm.new(@items_w.x + 144, @items_w.y + 36,
@type_select.current_symbol)
if @type_select.current_symbol == :item
@slot_confirm.set_handler(:slot1, method(:open_slots))
@slot_confirm.set_handler(:slot2, method(:open_slots))
else
@slot_confirm.set_handler(:slot1, method(:open_slots))
@slot_confirm.set_handler(:slot2, method(:open_slots))
@slot_confirm.set_handler(:slot3, method(:open_slots))
@slot_confirm.set_handler(:slot4, method(:open_slots))
end
end
# dispose slot confirm
def dispose_slot_confirm
return if @slot_confirm.nil?
@slot_confirm.dispose
@slot_confirm = nil
end
# top info
def refresh_top_info
@top_text.contents.clear
@top_text.contents.font.size = 20
@top_text.contents.fill_rect(0, 0, 58, 74, Color.new(0, 0, 0, 60))
@top_text.draw_character(actor.character_name,actor.character_index, 26, 60)
@top_text.draw_text(62, 0, @top_text.width, 32, actor.name + ' Equippment')
@top_text.draw_text(62, 22, @top_text.width, 32, actor.class.name)
@top_text.draw_text(-22, 30, @top_text.width, 32, @statust, 2)
@top_text.draw_text(-22, 0,@top_text.width,32, 'M = Switch Player',2) unless
PearlKernel::SinglePlayer
end
def refresh_tools
enable_items
end
def refresh_cancel
SceneManager.return
end
def enable_items
@items_w.activate
@items_w.select(0)
end
def refresh_description
@description.contents.clear
@desc_index = @items_w.index
return if @items_w.item.nil? || @items_w.index < 0
@description.contents.font.size = 20
@description.draw_text_ex2(0, -4, @items_w.item.description)
end
def update
super
perform_item_ok if Input.trigger?(:C)
perform_canceling if Input.trigger?(:B)
if PearlKey.trigger?(Key::PlayerSelect) and !PearlKernel::SinglePlayer
Sound.play_ok
SceneManager.call(Scene_CharacterSet)
end
DisplayTools.update
perform_refresh
end
def perform_item_ok
return if @items_w.item.nil?
case @type_select.current_symbol
when :weapon
actor.change_equip_by_id(0, @items_w.item.id)
equip_play
when :armor
actor.change_equip_by_id(1, @items_w.item.id)
equip_play
when :item
activate_slots
when :skill
activate_slots
end
DisplayTools.sprite.refresh_texts
end
def activate_slots
@items_w.deactivate
create_slot_confirm
Sound.play_ok
end
def deactivate_slots
@items_w.activate
dispose_slot_confirm
end
def actor
return $game_player.actor
end
def equip_play
Sound.play_equip
@statust = 80
end
# open slots
def open_slots
if @type_select.current_symbol == :item
case @slot_confirm.current_symbol
when :slot1 then actor.assigned_item = @items_w.item
when :slot2 then actor.assigned_item2 = @items_w.item
end
else
case @slot_confirm.current_symbol
when :slot1 then actor.assigned_skill = @items_w.item
when :slot2 then actor.assigned_skill2 = @items_w.item
when :slot3 then actor.assigned_skill3 = @items_w.item
when :slot4 then actor.assigned_skill4 = @items_w.item
end
end
equip_play ; deactivate_slots
DisplayTools.sprite.refresh_texts
end
def perform_canceling
Sound.play_cancel
if @items_w.active
@items_w.deactivate
@items_w.unselect
@type_select.activate
else
deactivate_slots
end
end
def perform_refresh
if @type_index != @type_select.index
@type_index = @type_select.index
@items_w.refresh($game_player.actor, @type_select.current_symbol)
refresh_description
end
if @desc_index != @items_w.index
@desc_index = @items_w.index
refresh_description
end
if @statust > 0
@statust -= 1
if @statust == 78
@statust = @items_w.item.name + ' Equipped'
refresh_top_info
elsif @statust == 0
@statust =
refresh_top_info
end
end
end
def terminate
super
@top_text.dispose
@type_select.dispose
@items_w.dispose
@description.dispose
dispose_slot_confirm
DisplayTools.dispose
end
end
pearl lifebars
#===============================================================================
# * Falcao Pearl ABS script shelf # 7
#
# Actor / Eenemies HP and MP bars display v 2.0
#
# This script acts like an Add-On, the main system can run without this piece
#
#-------------------------------------------------------------------------------
# * Features
# - Display HP, MP, experience and TP bars of the current player actor
# - Display the Enemy HP bar when was hit
# - Boss HP bar anabled
# - Display enemy states and buff / debuff icons
# - Non-graphical bars but hightly customizable
# - 2.0 now support images instead of script drawing bars
# * Usage and Installation
# Just copy and paste below the Pearl ABS System
#
# * Commands
# PearlBars.hide - Hide the actor bars
# PearlBars.show - Show the actor bars (by default)
#
# PearlBars.enemy_auto(id)- Show automatically the enemy HP bars without need
# to hit, this is mostly used for bosses, change id for the event id
# Tag any enemy with Enemy Boss Bar = true to eneble the boss bar mode
#------------------------------------------------------------------------------
module PearlBars
#=============================================================================
# * Actors bars configuration
#
# Bars x and y position on the screen
ScreenPos_X = 10
ScreenPos_Y = 10
#
# Dimentions of the bars you cant exceed 300 width x 100 height
# x y width height
HP_BarDimentions =
MP_BarDimentions =
EX_BarDimentions =
# Tp info x y
TP_Info =
#
# color definition
# color 1 R G B Opa color 2 R G B Opa
HP_Color =
MP_Color =
EX_Color =
# Do you want to display graphics instead of script drawing bars?
# if so, fill this actors bars graphics requirements
ActorsHp = "" # Actor Hp graphic bar name (inside quotation marks)
ActorsMp = "" # Actor Mp graphic bar name
ActorsExp = "" # Actor Experience, if you dont want it leave it ""
ActorsBack = "" # Background semi-transparent bar
#=============================================================================
# * Normal Enemies bars
#
# Normal enemies Bars x and y position on the screen
NeScreenPos_X = 390
NeScreenPos_Y = 10
#
# Dimentions of the bars you cant exceed 300 width x 100 height
# x y width height
EHP_BarDimentions =
#
# color definition
# color 1 R G B Opa color 2 R G B Opa
EHP_Color =
# if you want to display grahics bar pictures fill this
NormalEne = "" # normal enemy hp bar
NormalBack = "" # Background semi-transparent bar
#=============================================================================
# * Enemy Boss HP Bar
#
# Boss enemies Bar x and y position on the screen
BeScreenPos_X = 100
BeScreenPos_Y = 286
#
# Dimentions of the bars you cant exceed 640 width x 100 height
# x y width height
BHP_BarDimentions =
#
# color 1 R G B Opa color 2 R G B Opa
BHP_Color =
# if you want to display grahics bar pictures fill this
BossEne = "" # Boss enemy Hp bar
BossBack = "" # Background semi-transparent bar
#=============================================================================
def self.show() $game_system.pearlbars = nil end
def self.hide() $game_system.pearlbars = true end
def self.enemy_auto(event_id)
$game_system.enemy_lifeobject = $game_map.events
end
end
($imported ||= {}) = true
class Spriteset_Map
alias falcaopearl_lifebars_create create_pictures
def create_pictures
create_hud_lifebars
falcaopearl_lifebars_create
end
def create_hud_lifebars
@enemy_lifeobject = $game_system.enemy_lifeobject
@enemyhpsp = Sprite_LifeBars.new(@viewport2, @enemy_lifeobject) if
not @enemy_lifeobject.nil?
end
def create_actorlifebars
return if !@actor_lifebar.nil?
@actor_lifebar = Sprite_LifeBars.new(@viewport2, $game_player)
end
def dispose_actorlifebars
return if @actor_lifebar.nil?
@actor_lifebar.dispose
@actor_lifebar = nil
end
alias falcaopearl_lifebars_update update
def update
update_lifebars_sprites
falcaopearl_lifebars_update
end
def update_lifebars_sprites
$game_system.pearlbars.nil? ? create_actorlifebars : dispose_actorlifebars
@actor_lifebar.update unless @actor_lifebar.nil?
# enemy
if !@enemyhpsp.nil?
unless @enemyhpsp.disposed?
@enemyhpsp.update
else
@enemyhpsp.dispose
@enemyhpsp = nil
$game_system.enemy_lifeobject = nil
@enemy_lifeobject = nil
end
end
if @enemy_lifeobject != $game_system.enemy_lifeobject
@enemyhpsp.dispose if !@enemyhpsp.nil?
@enemyhpsp = nil
@enemyhpsp = Sprite_LifeBars.new(@viewport2,$game_system.enemy_lifeobject)
@enemy_lifeobject = $game_system.enemy_lifeobject
end
end
alias falcaopearl_lifebars_dispose dispose
def dispose
dispose_actorlifebars
@enemyhpsp.dispose unless @enemyhpsp.nil?
falcaopearl_lifebars_dispose
end
end
# Life bars sprite
class Sprite_LifeBars < Sprite
include PearlBars
def initialize(viewport, character)
super(viewport)
@character = character
self.bitmap = Bitmap.new(boss? ? 640 : 300, 120)
@old_hp = battler.hp
@old_mp = battler.mp
@erasetimer = 180
@state_checker =
@buff_checker =
refresh_contents
@view = viewport
update
end
def boss?
return true if battler.is_a?(Game_Enemy) && battler.boss_hud
return false
end
def battler
return @character.battler
end
def refresh_contents
self.bitmap.clear
self.bitmap.font.size = 19
@erasetimer = 180
self.opacity = 255
if battler.is_a?(Game_Actor)
@old_exp = battler.exp
@old_tp = battler.tp
self.x = ScreenPos_X
self.y = ScreenPos_Y
h = HP_BarDimentions ; m = MP_BarDimentions ; e = EX_BarDimentions
if PearlBars::ActorsHp != ""
@pimg = Cache.picture(PearlBars::ActorsHp) if @pimg.nil?
@bimg = Cache.picture(PearlBars::ActorsBack) if @bimg.nil?
@pimp = Cache.picture(PearlBars::ActorsMp) if @pimp.nil?
PearlKernel.image_hp(self.bitmap, h + 4, h,@bimg,
@pimg, battler,true)
PearlKernel.image_mp(self.bitmap, m + 4, m, @bimg, @pimp, battler)
if PearlBars::ActorsExp != ""
@piexp = Cache.picture(PearlBars::ActorsExp) if @piexp.nil?
PearlKernel.image_exp(self.bitmap,e + 4,e,@bimg,@piexp, battler)
end
else
hc = HP_Color ; mc = MP_Color ; ec = EX_Color
PearlKernel.draw_hp(self.bitmap,battler, h, h, h, h, hc)
PearlKernel.draw_mp(self.bitmap,battler, m, m, m, m, mc)
PearlKernel.draw_exp(self.bitmap,battler, e, e, e, e, ec)
end
PearlKernel.draw_tp(self.bitmap, TP_Info, TP_Info, battler)
else battler.is_a?(Game_Enemy)
if boss?
self.x = BeScreenPos_X
self.y = BeScreenPos_Y
h = BHP_BarDimentions ; hc = BHP_Color
if PearlBars::BossEne != ""
@n_img = Cache.picture(PearlBars::BossEne) if @n_img.nil?
@n_back = Cache.picture(PearlBars::BossBack) if @n_back.nil?
PearlKernel.image_hp(self.bitmap, h + 4, h,@n_back,
@n_img, battler,true)
else
PearlKernel.draw_hp(self.bitmap,battler, h,h,h, h,hc,true)
end
else
self.x = NeScreenPos_X
self.y = NeScreenPos_Y
h = EHP_BarDimentions ; hc = EHP_Color
if PearlBars::NormalEne != ""
@n_img = Cache.picture(PearlBars::NormalEne) if @n_img.nil?
@n_back = Cache.picture(PearlBars::NormalBack) if @n_back.nil?
PearlKernel.image_hp(self.bitmap, h + 4, h,@n_back,
@n_img, battler,true)
else
PearlKernel.draw_hp(self.bitmap,battler,h,h,h, h, hc,true)
end
end
end
end
def update
super
if battler.nil?
dispose
return
end
if @old_hp != battler.hp
refresh_contents
@old_hp = battler.hp
end
if @old_mp != battler.mp
refresh_contents
@character.actor.apply_usability if @character.is_a?(Game_Player)
@old_mp = battler.mp
end
if battler.is_a?(Game_Actor)
if @old_exp != battler.exp
@old_exp = battler.exp
refresh_contents
end
if @old_tp != battler.tp
@old_tp = battler.tp
@character.actor.apply_usability if @character.is_a?(Game_Player)
refresh_contents
end
elsif battler.is_a?(Game_Enemy)
if boss?
dispose if battler.dead?
else
if @erasetimer > 0
@erasetimer -= 1
self.opacity -= 10 if @erasetimer <= 25
@states.opacity = self.opacity if !@states.nil?
dispose if @erasetimer == 0
end
end
update_enemy_status_icons
end
end
# enemy status icons engine
def update_enemy_status_icons
display_status? ? create_states_icons : dispose_state_icons
4.times.each {|i| refresh_states_icons if
@state_checker != battler.state_icons}
2.times.each {|i| refresh_states_icons if
@buff_checker != battler.buff_icons}
end
def display_status?
return true if !battler.state_icons.empty?
return true if !battler.buff_icons.empty?
return false
end
def create_states_icons
return if disposed?
return if !@states.nil?
@states = ::Sprite.new(@view)
@states.bitmap = Bitmap.new(144, 24)
@n_back.nil? ? y_plus = BHP_BarDimentions : y_plus = @n_back.height
pos = if boss?
pos = if !boss?
@states.x = pos + 10
@states.y = pos + pos + 24
@states.zoom_x = 0.8
@states.zoom_y = 0.8
refresh_states_icons
end
def dispose_state_icons
return if @states.nil?
@states.bitmap.dispose
@states.dispose
@states = nil
end
def refresh_states_icons
4.times.each {|i| @state_checker = battler.state_icons}
2.times.each {|i| @buff_checker = battler.buff_icons}
return if @states.nil?
@states.bitmap.clear
x = 0
battler.state_icons.each {|icon| draw_icon(icon, x, 0) ; x += 24
break if x == 96}
count = 0
battler.buff_icons.each {|icon| draw_icon(icon, x, 0) ; x += 24 ; count += 1
break if count == 2}
end
def draw_icon(icon_index, x, y, enabled = true)
bit = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
@states.bitmap.blt(x, y, bit, rect, enabled ? 255 : 150)
end
def dispose
self.bitmap.dispose
dispose_state_icons
super
end
end
# Make the enemy bars to load when enemy is hited
class Projectile < Game_Character
alias falcao_lifebars_execute execute_damageto_enemy
def execute_damageto_enemy(event)
$game_system.enemy_lifeobject = event if @user.is_a?(Game_Player) &&
!event.battler.object
falcao_lifebars_execute(event)
end
end
#===============================================================================
# * Falcao Pearl ABS script shelf # 7
#
# Actor / Eenemies HP and MP bars display v 2.0
#
# This script acts like an Add-On, the main system can run without this piece
#
#-------------------------------------------------------------------------------
# * Features
# - Display HP, MP, experience and TP bars of the current player actor
# - Display the Enemy HP bar when was hit
# - Boss HP bar anabled
# - Display enemy states and buff / debuff icons
# - Non-graphical bars but hightly customizable
# - 2.0 now support images instead of script drawing bars
# * Usage and Installation
# Just copy and paste below the Pearl ABS System
#
# * Commands
# PearlBars.hide - Hide the actor bars
# PearlBars.show - Show the actor bars (by default)
#
# PearlBars.enemy_auto(id)- Show automatically the enemy HP bars without need
# to hit, this is mostly used for bosses, change id for the event id
# Tag any enemy with Enemy Boss Bar = true to eneble the boss bar mode
#------------------------------------------------------------------------------
module PearlBars
#=============================================================================
# * Actors bars configuration
#
# Bars x and y position on the screen
ScreenPos_X = 10
ScreenPos_Y = 10
#
# Dimentions of the bars you cant exceed 300 width x 100 height
# x y width height
HP_BarDimentions =
MP_BarDimentions =
EX_BarDimentions =
# Tp info x y
TP_Info =
#
# color definition
# color 1 R G B Opa color 2 R G B Opa
HP_Color =
MP_Color =
EX_Color =
# Do you want to display graphics instead of script drawing bars?
# if so, fill this actors bars graphics requirements
ActorsHp = "" # Actor Hp graphic bar name (inside quotation marks)
ActorsMp = "" # Actor Mp graphic bar name
ActorsExp = "" # Actor Experience, if you dont want it leave it ""
ActorsBack = "" # Background semi-transparent bar
#=============================================================================
# * Normal Enemies bars
#
# Normal enemies Bars x and y position on the screen
NeScreenPos_X = 390
NeScreenPos_Y = 10
#
# Dimentions of the bars you cant exceed 300 width x 100 height
# x y width height
EHP_BarDimentions =
#
# color definition
# color 1 R G B Opa color 2 R G B Opa
EHP_Color =
# if you want to display grahics bar pictures fill this
NormalEne = "" # normal enemy hp bar
NormalBack = "" # Background semi-transparent bar
#=============================================================================
# * Enemy Boss HP Bar
#
# Boss enemies Bar x and y position on the screen
BeScreenPos_X = 100
BeScreenPos_Y = 286
#
# Dimentions of the bars you cant exceed 640 width x 100 height
# x y width height
BHP_BarDimentions =
#
# color 1 R G B Opa color 2 R G B Opa
BHP_Color =
# if you want to display grahics bar pictures fill this
BossEne = "" # Boss enemy Hp bar
BossBack = "" # Background semi-transparent bar
#=============================================================================
def self.show() $game_system.pearlbars = nil end
def self.hide() $game_system.pearlbars = true end
def self.enemy_auto(event_id)
$game_system.enemy_lifeobject = $game_map.events
end
end
($imported ||= {}) = true
class Spriteset_Map
alias falcaopearl_lifebars_create create_pictures
def create_pictures
create_hud_lifebars
falcaopearl_lifebars_create
end
def create_hud_lifebars
@enemy_lifeobject = $game_system.enemy_lifeobject
@enemyhpsp = Sprite_LifeBars.new(@viewport2, @enemy_lifeobject) if
not @enemy_lifeobject.nil?
end
def create_actorlifebars
return if !@actor_lifebar.nil?
@actor_lifebar = Sprite_LifeBars.new(@viewport2, $game_player)
end
def dispose_actorlifebars
return if @actor_lifebar.nil?
@actor_lifebar.dispose
@actor_lifebar = nil
end
alias falcaopearl_lifebars_update update
def update
update_lifebars_sprites
falcaopearl_lifebars_update
end
def update_lifebars_sprites
$game_system.pearlbars.nil? ? create_actorlifebars : dispose_actorlifebars
@actor_lifebar.update unless @actor_lifebar.nil?
# enemy
if !@enemyhpsp.nil?
unless @enemyhpsp.disposed?
@enemyhpsp.update
else
@enemyhpsp.dispose
@enemyhpsp = nil
$game_system.enemy_lifeobject = nil
@enemy_lifeobject = nil
end
end
if @enemy_lifeobject != $game_system.enemy_lifeobject
@enemyhpsp.dispose if !@enemyhpsp.nil?
@enemyhpsp = nil
@enemyhpsp = Sprite_LifeBars.new(@viewport2,$game_system.enemy_lifeobject)
@enemy_lifeobject = $game_system.enemy_lifeobject
end
end
alias falcaopearl_lifebars_dispose dispose
def dispose
dispose_actorlifebars
@enemyhpsp.dispose unless @enemyhpsp.nil?
falcaopearl_lifebars_dispose
end
end
# Life bars sprite
class Sprite_LifeBars < Sprite
include PearlBars
def initialize(viewport, character)
super(viewport)
@character = character
self.bitmap = Bitmap.new(boss? ? 640 : 300, 120)
@old_hp = battler.hp
@old_mp = battler.mp
@erasetimer = 180
@state_checker =
@buff_checker =
refresh_contents
@view = viewport
update
end
def boss?
return true if battler.is_a?(Game_Enemy) && battler.boss_hud
return false
end
def battler
return @character.battler
end
def refresh_contents
self.bitmap.clear
self.bitmap.font.size = 19
@erasetimer = 180
self.opacity = 255
if battler.is_a?(Game_Actor)
@old_exp = battler.exp
@old_tp = battler.tp
self.x = ScreenPos_X
self.y = ScreenPos_Y
h = HP_BarDimentions ; m = MP_BarDimentions ; e = EX_BarDimentions
if PearlBars::ActorsHp != ""
@pimg = Cache.picture(PearlBars::ActorsHp) if @pimg.nil?
@bimg = Cache.picture(PearlBars::ActorsBack) if @bimg.nil?
@pimp = Cache.picture(PearlBars::ActorsMp) if @pimp.nil?
PearlKernel.image_hp(self.bitmap, h + 4, h,@bimg,
@pimg, battler,true)
PearlKernel.image_mp(self.bitmap, m + 4, m, @bimg, @pimp, battler)
if PearlBars::ActorsExp != ""
@piexp = Cache.picture(PearlBars::ActorsExp) if @piexp.nil?
PearlKernel.image_exp(self.bitmap,e + 4,e,@bimg,@piexp, battler)
end
else
hc = HP_Color ; mc = MP_Color ; ec = EX_Color
PearlKernel.draw_hp(self.bitmap,battler, h, h, h, h, hc)
PearlKernel.draw_mp(self.bitmap,battler, m, m, m, m, mc)
PearlKernel.draw_exp(self.bitmap,battler, e, e, e, e, ec)
end
PearlKernel.draw_tp(self.bitmap, TP_Info, TP_Info, battler)
else battler.is_a?(Game_Enemy)
if boss?
self.x = BeScreenPos_X
self.y = BeScreenPos_Y
h = BHP_BarDimentions ; hc = BHP_Color
if PearlBars::BossEne != ""
@n_img = Cache.picture(PearlBars::BossEne) if @n_img.nil?
@n_back = Cache.picture(PearlBars::BossBack) if @n_back.nil?
PearlKernel.image_hp(self.bitmap, h + 4, h,@n_back,
@n_img, battler,true)
else
PearlKernel.draw_hp(self.bitmap,battler, h,h,h, h,hc,true)
end
else
self.x = NeScreenPos_X
self.y = NeScreenPos_Y
h = EHP_BarDimentions ; hc = EHP_Color
if PearlBars::NormalEne != ""
@n_img = Cache.picture(PearlBars::NormalEne) if @n_img.nil?
@n_back = Cache.picture(PearlBars::NormalBack) if @n_back.nil?
PearlKernel.image_hp(self.bitmap, h + 4, h,@n_back,
@n_img, battler,true)
else
PearlKernel.draw_hp(self.bitmap,battler,h,h,h, h, hc,true)
end
end
end
end
def update
super
if battler.nil?
dispose
return
end
if @old_hp != battler.hp
refresh_contents
@old_hp = battler.hp
end
if @old_mp != battler.mp
refresh_contents
@character.actor.apply_usability if @character.is_a?(Game_Player)
@old_mp = battler.mp
end
if battler.is_a?(Game_Actor)
if @old_exp != battler.exp
@old_exp = battler.exp
refresh_contents
end
if @old_tp != battler.tp
@old_tp = battler.tp
@character.actor.apply_usability if @character.is_a?(Game_Player)
refresh_contents
end
elsif battler.is_a?(Game_Enemy)
if boss?
dispose if battler.dead?
else
if @erasetimer > 0
@erasetimer -= 1
self.opacity -= 10 if @erasetimer <= 25
@states.opacity = self.opacity if !@states.nil?
dispose if @erasetimer == 0
end
end
update_enemy_status_icons
end
end
# enemy status icons engine
def update_enemy_status_icons
display_status? ? create_states_icons : dispose_state_icons
4.times.each {|i| refresh_states_icons if
@state_checker != battler.state_icons}
2.times.each {|i| refresh_states_icons if
@buff_checker != battler.buff_icons}
end
def display_status?
return true if !battler.state_icons.empty?
return true if !battler.buff_icons.empty?
return false
end
def create_states_icons
return if disposed?
return if !@states.nil?
@states = ::Sprite.new(@view)
@states.bitmap = Bitmap.new(144, 24)
@n_back.nil? ? y_plus = BHP_BarDimentions : y_plus = @n_back.height
pos = if boss?
pos = if !boss?
@states.x = pos + 10
@states.y = pos + pos + 24
@states.zoom_x = 0.8
@states.zoom_y = 0.8
refresh_states_icons
end
def dispose_state_icons
return if @states.nil?
@states.bitmap.dispose
@states.dispose
@states = nil
end
def refresh_states_icons
4.times.each {|i| @state_checker = battler.state_icons}
2.times.each {|i| @buff_checker = battler.buff_icons}
return if @states.nil?
@states.bitmap.clear
x = 0
battler.state_icons.each {|icon| draw_icon(icon, x, 0) ; x += 24
break if x == 96}
count = 0
battler.buff_icons.each {|icon| draw_icon(icon, x, 0) ; x += 24 ; count += 1
break if count == 2}
end
def draw_icon(icon_index, x, y, enabled = true)
bit = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
@states.bitmap.blt(x, y, bit, rect, enabled ? 255 : 150)
end
def dispose
self.bitmap.dispose
dispose_state_icons
super
end
end
# Make the enemy bars to load when enemy is hited
class Projectile < Game_Character
alias falcao_lifebars_execute execute_damageto_enemy
def execute_damageto_enemy(event)
$game_system.enemy_lifeobject = event if @user.is_a?(Game_Player) &&
!event.battler.object
falcao_lifebars_execute(event)
end
end
pearl item popup
#===============================================================================
# * Falcao Pearl ABS script shelf # 8
#
# Item and gold pop up v 1.0
# This is just an add on for the Pearl ABS system, it run as standalone mode too
#
# Website: http://falcaorgss.wordpress.com/
# Foro: www.makerpalace.com
#===============================================================================
#
# * Installation
# This work as plug and play, copy and paste the script above main
#
# * Usage
# There is no special references, when you earn an item or gold, then pop appear
# Edit the module below for convenience
#-------------------------------------------------------------------------------
module PearlItemPop
# Position X of the pop up object
Pos_X = 10
# Position Y of the pop up object
Pos_Y = 320
# Icon displayed when earnig gold
GoldIcon = 245
# Se sound played when gaining items (set nil if you dont want to play sound)
ItemSe = "Item3"
# Se sound played when gainig gold (set nil if you dont want to play sound)
GoldSe = "Shop"
end
class Game_Party < Game_Unit
alias falcaopearl_itempop_gain gain_item
def gain_item(item, amount, include_equip = false)
if !item_container(item.class).nil? && SceneManager.scene_is?(Scene_Map)
if amount > 0
$game_system.item_object =
RPG::SE.new(PearlItemPop::ItemSe, 80).play rescue nil
end
end
falcaopearl_itempop_gain(item, amount, include_equip = false)
end
alias falcaopearl_itempop_gold gain_gold
def gain_gold(amount)
if SceneManager.scene_is?(Scene_Map)
$game_system.item_object =
RPG::SE.new(PearlItemPop::GoldSe, 80).play rescue nil
end
falcaopearl_itempop_gold(amount)
end
end
class Game_System
attr_accessor :item_object
end
class Spriteset_Map
alias falcaopearl_itempop_create create_pictures
def create_pictures
create_itempop_sprites
falcaopearl_itempop_create
end
def create_itempop_sprites
@item_object = $game_system.item_object
@item_sprite = Sprite_PopItem.new(@viewport2, @item_object) if
not @item_object.nil?
end
alias falcaopearl_itempop_update update
def update
if !@item_sprite.nil?
unless @item_sprite.disposed?
@item_sprite.update
else
@item_sprite.dispose
@item_object = nil
$game_system.item_object = nil
@item_sprite = nil
end
end
if @item_object != $game_system.item_object
@item_sprite.dispose if !@item_sprite.nil?
@item_sprite = nil
@item_sprite = Sprite_PopItem.new(@viewport2, $game_system.item_object)
@item_object = $game_system.item_object
end
falcaopearl_itempop_update
end
alias falcaopearl_itempop_dispose dispose
def dispose
@item_sprite.dispose unless @item_sprite.nil?
falcaopearl_itempop_dispose
end
end
class Sprite_PopItem < Sprite
def initialize(viewport, item)
super(viewport)
@item = item
@num = item
set_bitmap
self.x = PearlItemPop::Pos_X
self.y = PearlItemPop::Pos_Y
@erasetimer = 120
update
end
def update
super
if @erasetimer > 0
@erasetimer -= 1
self.opacity -= 10 if @erasetimer <= 25
dispose if @erasetimer == 0
end
end
def dispose
self.bitmap.dispose
super
end
def set_bitmap
@item.nil? ? operand = Vocab::currency_unit : operand = @item.name
string = operand + ' X' + @num.to_s
self.bitmap = Bitmap.new(26 + string.length * 9, 28)
self.bitmap.fill_rect(0, 0, self.bitmap.width, 28, Color.new(0, 0, 0, 100))
self.bitmap.font.size = 20
bitmap = Cache.system("Iconset")
icon = @item.nil? ? PearlItemPop::GoldIcon : @item.icon_index
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
self.bitmap.blt(4, 0, bitmap, rect)
self.bitmap.draw_text(28, 0, 250, 32, string)
end
end
#===============================================================================
# * Falcao Pearl ABS script shelf # 8
#
# Item and gold pop up v 1.0
# This is just an add on for the Pearl ABS system, it run as standalone mode too
#
# Website: http://falcaorgss.wordpress.com/
# Foro: www.makerpalace.com
#===============================================================================
#
# * Installation
# This work as plug and play, copy and paste the script above main
#
# * Usage
# There is no special references, when you earn an item or gold, then pop appear
# Edit the module below for convenience
#-------------------------------------------------------------------------------
module PearlItemPop
# Position X of the pop up object
Pos_X = 10
# Position Y of the pop up object
Pos_Y = 320
# Icon displayed when earnig gold
GoldIcon = 245
# Se sound played when gaining items (set nil if you dont want to play sound)
ItemSe = "Item3"
# Se sound played when gainig gold (set nil if you dont want to play sound)
GoldSe = "Shop"
end
class Game_Party < Game_Unit
alias falcaopearl_itempop_gain gain_item
def gain_item(item, amount, include_equip = false)
if !item_container(item.class).nil? && SceneManager.scene_is?(Scene_Map)
if amount > 0
$game_system.item_object =
RPG::SE.new(PearlItemPop::ItemSe, 80).play rescue nil
end
end
falcaopearl_itempop_gain(item, amount, include_equip = false)
end
alias falcaopearl_itempop_gold gain_gold
def gain_gold(amount)
if SceneManager.scene_is?(Scene_Map)
$game_system.item_object =
RPG::SE.new(PearlItemPop::GoldSe, 80).play rescue nil
end
falcaopearl_itempop_gold(amount)
end
end
class Game_System
attr_accessor :item_object
end
class Spriteset_Map
alias falcaopearl_itempop_create create_pictures
def create_pictures
create_itempop_sprites
falcaopearl_itempop_create
end
def create_itempop_sprites
@item_object = $game_system.item_object
@item_sprite = Sprite_PopItem.new(@viewport2, @item_object) if
not @item_object.nil?
end
alias falcaopearl_itempop_update update
def update
if !@item_sprite.nil?
unless @item_sprite.disposed?
@item_sprite.update
else
@item_sprite.dispose
@item_object = nil
$game_system.item_object = nil
@item_sprite = nil
end
end
if @item_object != $game_system.item_object
@item_sprite.dispose if !@item_sprite.nil?
@item_sprite = nil
@item_sprite = Sprite_PopItem.new(@viewport2, $game_system.item_object)
@item_object = $game_system.item_object
end
falcaopearl_itempop_update
end
alias falcaopearl_itempop_dispose dispose
def dispose
@item_sprite.dispose unless @item_sprite.nil?
falcaopearl_itempop_dispose
end
end
class Sprite_PopItem < Sprite
def initialize(viewport, item)
super(viewport)
@item = item
@num = item
set_bitmap
self.x = PearlItemPop::Pos_X
self.y = PearlItemPop::Pos_Y
@erasetimer = 120
update
end
def update
super
if @erasetimer > 0
@erasetimer -= 1
self.opacity -= 10 if @erasetimer <= 25
dispose if @erasetimer == 0
end
end
def dispose
self.bitmap.dispose
super
end
def set_bitmap
@item.nil? ? operand = Vocab::currency_unit : operand = @item.name
string = operand + ' X' + @num.to_s
self.bitmap = Bitmap.new(26 + string.length * 9, 28)
self.bitmap.fill_rect(0, 0, self.bitmap.width, 28, Color.new(0, 0, 0, 100))
self.bitmap.font.size = 20
bitmap = Cache.system("Iconset")
icon = @item.nil? ? PearlItemPop::GoldIcon : @item.icon_index
rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
self.bitmap.blt(4, 0, bitmap, rect)
self.bitmap.draw_text(28, 0, 250, 32, string)
end
end
pearl antilag
#===============================================================================
# * Falcao Pearl ABS script shelf # 9
#
# Pearl Antilag v 1.1
# This is just an add on for the Pearl ABS system, it run as standalone mode too
#
# This script reduce the lag coused by tons of events on a map, this script
# ignores parallel process events, and autorun events triggers
#
# Website: http://falcaorgss.wordpress.com/
# Foro: www.makerpalace.com
#===============================================================================
module PearlAntilag
# How many tiles outside the screen the script going to tolerate
OutRange = 2
# if you want to disable the script for an especific evet, tag <global> in the
# event name box
end
class Game_Map
attr_reader :max_width, :max_height
alias falcaopearl_antilag_initialize initialize
def initialize
set_max_screen
falcaopearl_antilag_initialize
end
def set_max_screen
@max_width = (Graphics.width / 32).truncate
@max_height = (Graphics.height / 32).truncate
end
end
class << Graphics
alias falcaopearl_antilag_g resize_screen
def resize_screen(w, h)
falcaopearl_antilag_g(w, h)
$game_map.set_max_screen unless $game_map.nil?
end
end
class Game_Event < Game_Character
attr_accessor :allow_update
alias falcaopearl_antilag_ini initialize
def initialize(map_id, event)
falcaopearl_antilag_ini(map_id, event)
@ignore_antilag = event.name.include?('<global>')
@parallel_mode = @trigger == 3 || @trigger == 4 || @ignore_antilag
@allow_update = true
update_on_screen_event
end
alias falcaopearl_antilag_page setup_page_settings
def setup_page_settings
falcaopearl_antilag_page
@parallel_mode = @trigger == 3 || @trigger == 4 || @ignore_antilag
end
def update_on_screen_event
@allow_update = false unless @parallel_mode
max_w = $game_map.max_width ; max_h = $game_map.max_height
out = PearlAntilag::OutRange
sx = (screen_x / 32).to_i
sy = (screen_y / 32).to_i
if sx.between?(0 - out, max_w + out) and sy.between?(0 - out, max_h + out)
@allow_update = true
end
end
alias falcaopearl_antilag_up update
def update
unless @parallel_mode
update_on_screen_event
return unless @allow_update
end
falcaopearl_antilag_up
end
end
class Sprite_Character < Sprite_Base
alias falcaopearl_antilag_update update
def update
if @character.is_a?(Game_Event) #and !@character.parallel_mode
unless @character.allow_update
end_animation if @character.animation_id > 0
end_balloon if @character.balloon_id > 0
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z
return
end
end
falcaopearl_antilag_update
end
end
#===============================================================================
# * Falcao Pearl ABS script shelf # 9
#
# Pearl Antilag v 1.1
# This is just an add on for the Pearl ABS system, it run as standalone mode too
#
# This script reduce the lag coused by tons of events on a map, this script
# ignores parallel process events, and autorun events triggers
#
# Website: http://falcaorgss.wordpress.com/
# Foro: www.makerpalace.com
#===============================================================================
module PearlAntilag
# How many tiles outside the screen the script going to tolerate
OutRange = 2
# if you want to disable the script for an especific evet, tag <global> in the
# event name box
end
class Game_Map
attr_reader :max_width, :max_height
alias falcaopearl_antilag_initialize initialize
def initialize
set_max_screen
falcaopearl_antilag_initialize
end
def set_max_screen
@max_width = (Graphics.width / 32).truncate
@max_height = (Graphics.height / 32).truncate
end
end
class << Graphics
alias falcaopearl_antilag_g resize_screen
def resize_screen(w, h)
falcaopearl_antilag_g(w, h)
$game_map.set_max_screen unless $game_map.nil?
end
end
class Game_Event < Game_Character
attr_accessor :allow_update
alias falcaopearl_antilag_ini initialize
def initialize(map_id, event)
falcaopearl_antilag_ini(map_id, event)
@ignore_antilag = event.name.include?('<global>')
@parallel_mode = @trigger == 3 || @trigger == 4 || @ignore_antilag
@allow_update = true
update_on_screen_event
end
alias falcaopearl_antilag_page setup_page_settings
def setup_page_settings
falcaopearl_antilag_page
@parallel_mode = @trigger == 3 || @trigger == 4 || @ignore_antilag
end
def update_on_screen_event
@allow_update = false unless @parallel_mode
max_w = $game_map.max_width ; max_h = $game_map.max_height
out = PearlAntilag::OutRange
sx = (screen_x / 32).to_i
sy = (screen_y / 32).to_i
if sx.between?(0 - out, max_w + out) and sy.between?(0 - out, max_h + out)
@allow_update = true
end
end
alias falcaopearl_antilag_up update
def update
unless @parallel_mode
update_on_screen_event
return unless @allow_update
end
falcaopearl_antilag_up
end
end
class Sprite_Character < Sprite_Base
alias falcaopearl_antilag_update update
def update
if @character.is_a?(Game_Event) #and !@character.parallel_mode
unless @character.allow_update
end_animation if @character.animation_id > 0
end_balloon if @character.balloon_id > 0
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z
return
end
end
falcaopearl_antilag_update
end
end
...I should've specified that I meant the part that turns the self switch on. :P















