Hime-Works / Requests

Bug reports and requests that may require longer discussions and is not suitable to leave on the blog
http://himeworks.com/
GNU General Public License v2.0
7 stars 9 forks source link

visual battlers #350

Open zackhsb opened 7 years ago

zackhsb commented 7 years ago

Not sure if this is the right place to ask this, but I am using rpg maker ace with yanfly core engine, battle script and visual battlers. I've come across a problem that spell animations won't display in battle when being used on a dead character. So a life spell or phoenix down animation won't display when being used on a dead character. It still removes the death status and even plays the sound effect, but it doesn't show the animation to go along with it. Is there a fix for this? I'm sure I'm not the only one to have come across this. Please let me know if there is any more info you need from me.

HimeWorks commented 7 years ago

I would recommend sending a message to yanfly directly as he would understand his scripts better than me.

zackhsb commented 7 years ago

Ok. Would you know how to get a hold of him? I've heard he doesn't reply to messages left on his website.

zackhsb commented 7 years ago

Ok, here is another way I might be able to go about it. Just don't know a lot about ruby. The default ace engine allows you to play a battle animation through a common event. The only problem is it only lets you select enemies to use them on. Would there be a way to get the animation to play on the previously dead ally? Doesn't have to be a script. Something as simple as a line of code to put under the "script" button under "advanced."

Or another option (if this is easier) would be to have an item (when used) invoke another item or a skill that would play the animation. There is a script that allows skills to invoke other skills using note tags, but I haven't seen one for items.

HimeWorks commented 7 years ago

You would need to first be able to determine who is the "previously dead ally", if any. This could potentially be done using script calls as well, but you're basically building a battle mechanic using script calls, which will be very tricky. I'm not sure if you mean "an ally who was dead, but is now alive", or "the most recent ally that died", but both are equally tricky to keep track of if you're going to use script calls.

Once you know who the previously dead ally is you can use script calls to set whether an animation should be played or not.

However it isn't something that I would think about until you figure out how to actually get the ally you want.

zackhsb commented 7 years ago

What about making a script that uses notetags in items where it will invoke another item? So every time a phoenix down is used, it will invoke another item animation? I have seen scripts like this for skills. Do you know of one for items? Or if I supplied you with a script that already uses it with skills, would it be fairly quick to adjust it to work with items?

HimeWorks commented 7 years ago

Depending on how the script is written, it may be easy to modify it.

zackhsb commented 7 years ago

It's not a very long script: (pasted below)

==============================================================================

▼ Yanfly Engine Ace - Random Skill Invoke v1.00

-- Last Updated: 2011.12.17

-- Level: Normal, Hard

-- Requires: n/a

==============================================================================

$imported = {} if $imported.nil? $imported["YEA-RandomSkillInvoke"] = true

==============================================================================

▼ Updates

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

2011.12.17 - Started Script and Finished.

==============================================================================

▼ Introduction

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This script grants the option, that when designated skills with random

invokes are used, they have the ability to result in other skills (within the

skill's designated random pool). Only valid skills are capable of being used

(meaning that they must meet the conditions to be used).

==============================================================================

▼ Instructions

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

To install this script, open up your script editor and copy/paste this script

to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.

-----------------------------------------------------------------------------

Skill Notetags - These notetags go in the skills notebox in the database.

-----------------------------------------------------------------------------

<random invoke: x, x>

This adds skill x to the random invoke pool (which includes the base skill

itself, too). When the base skill is used, it will random select from all of

the skills within the random invoke pool and use one. Only skills that meet

the requirements of being used can be selected (meaning the battler must have

sufficient MP costs, TP costs, no states that seal it, etc.). Multiples of

this tag may be used to add more skills, and multiples of the same skill may

be added to the random invoke pool.

==============================================================================

▼ Compatibility

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This script is made strictly for RPG Maker VX Ace. It is highly unlikely that

it will run with RPG Maker VX without adjusting.

==============================================================================

▼ Editting anything past this point may potentially result in causing

computer damage, incontinence, explosion of user's head, coma, death, and/or

halitosis so edit at your own risk.

==============================================================================

module YEA module REGEXP module SKILL

RANDOM_INVOKE = 
  /<(?:RANDOM_INVOKE|random invoke):[ ]*(\d+(?:\s*,\s*\d+)*)>/i

end # SKILL end # REGEXP end # YEA

==============================================================================

■ DataManager

==============================================================================

module DataManager

--------------------------------------------------------------------------

alias method: load_database

--------------------------------------------------------------------------

class <<self; alias load_database_rsi load_database; end def self.load_database load_database_rsi load_notetags_rsi end

--------------------------------------------------------------------------

new method: load_notetags_rsi

--------------------------------------------------------------------------

def self.load_notetags_rsi for skill in $data_skills next if skill.nil? skill.load_notetags_rsi end end

end # DataManager

==============================================================================

■ RPG::Skill

==============================================================================

class RPG::Skill < RPG::UsableItem

--------------------------------------------------------------------------

public instance variables

--------------------------------------------------------------------------

attr_accessor :random_invoke

--------------------------------------------------------------------------

common cache: load_notetags_rsi

--------------------------------------------------------------------------

def load_notetags_rsi @random_invoke = []

---

self.note.split(/[\r\n]+/).each { |line|
  case line
  #---
  when YEA::REGEXP::SKILL::RANDOM_INVOKE
    $1.scan(/\d+/).each { |num| 
    @random_invoke.push(num.to_i) if num.to_i > 0 }
  #---
  end
} # self.note.split
#---

end

end # RPG::Weapon

==============================================================================

■ Game_Battler

==============================================================================

class Game_Battler < Game_BattlerBase

--------------------------------------------------------------------------

new method: invoke_random_skill

--------------------------------------------------------------------------

def invoke_random_skill return unless current_action.item.is_a?(RPG::Skill) valid_skills = [current_action.item] for random_skill_id in current_action.item.random_invoke next unless usable?($data_skills[random_skill_id]) valid_skills.push($data_skills[random_skill_id]) end skill_id = valid_skills.sample.id current_action.set_skill(skill_id) end

end # Game_Battler

==============================================================================

■ Scene_Battle

==============================================================================

class Scene_Battle < Scene_Base

--------------------------------------------------------------------------

alias method: use_item

--------------------------------------------------------------------------

alias scene_battle_use_item_rsi use_item def use_item @subject.invoke_random_skill scene_battle_use_item_rsi end

end # Scene_Battle

==============================================================================

▼ End of File

==============================================================================

HimeWorks commented 7 years ago

If you're going to be replacing an item with another item, why not just have the phoenix down item play an animation?

It's not like using that script will allow you to chain multiple skills together.

zackhsb commented 7 years ago

From what I can gather, for some reason, the yanfly visual battlers script won't play animations on characters with the death status. So I would have one item (phoenix down) that would remove the death status, then have the next item play the animation on the previously dead character. I am not an expert scripter or else I would have already changed yanfly's scripts around to play animations on dead characters. Could you alter the above script I pasted for skills and make them work for items? or even have the item call a skill that can play the animation? Any help will be greatly appreciated. I thought it would be easier to change the random skill script to include items rather than find out what's missing in the visual battlers script and change it to work.

HimeWorks commented 7 years ago

Are you sure the script you pasted works the way you are describing? That it executes one skill, and then executes another skill?

If it doesn't do that, then changing it to support items won't solve the problem. The description of the script suggests it only executes one skill.

zackhsb commented 7 years ago

sorry for the late reply. have been ill. anyway, I did test the script and it works. Seems like it should work for items if it is adjusted to do so. The script isn't that long. Can you please help?

I only need it to execute one skill. For example (if the phoenix down item) can select another item or skill that can play a phoenix down animation, then it should work. Seems to me that the only problem is the way yanfly wrote his visual battlers script is to not play animations on characters with death status. So the item would remove death status, then call either a skill or other item from the database to play the animation once the death status is removed. I hope I'm explaining it well. I tested the script and made a dummy skill invoke another skill from the database. It worked fine.

The script only does execute one skill. That's all it needs to do. So you have a skill that you add to the database and add the random invoke tag in the notebox of the skill you want it to call. So if I had a skill called "Fire Breath" that had in its notebox <random invoke: 10>. When I used the spell in battle, it would call whatever skill was in the 10th position in the skill database.

zackhsb commented 7 years ago

If you ever have time to get around to it that would be great. In any case, thanks for at least listening.