[VX]Skill to cause Random aminations

0 Members and 1 Guest are viewing this topic.

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
Here's a nut for you smrt people to crack. Let's say I want to make a skill that checks a random number and based off of that number, actually plays a different skill altogether.

For example: A skill called Blast could, based on a random number, manifest on-screen as a fire, lightning or ice spell. All 4 skills are seperate in the database, I'd assume... Is there a way to event this with common events?
:tinysmile:

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Sure, have the Blast skill just call a common event, and then use the Force Action command on Last Target.

Ie, something like this:

@>Control Variable: [XXXX: Random] = Random (0...4)
@>Conditional Branch: Variable [XXXX:Random] == 0
  @>Force Action: [Actor No. 2], [Ice], Last Target
  : Else
  @>Conditional Branch: Variable [XXXX:Random] == 1
    @>Force Action: [Actor No. 2], [Fire], Last Target
    : Else
    @>Conditional Branch: Variable [XXXX:Random] == 2
      @>Force Action: [Actor No. 2], [Storm], Last Target
    : Else
      @>Force Action: [Actor No. 2], [Water], Last Target
   :Branch END
 :Branch END
:Branch END

Naturally, that will only work if you know which position the actor is in in the party.
« Last Edit: January 26, 2013, 05:42:43 PM by modern algebra »

***
Rep:
Level 76
RMRK Junior
Yanfly made a script for VXA, but I don't know about Redux or Melody

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
@ModAlg: I had somethin simialr untill I realized party composition is variable. Could I but in another set of conditional branches to decide which slot the caster is in?

EDIT: I sure can't find a way...

@Wise: Dang, I'm using VX... but thatnks for your input, dude!
« Last Edit: January 27, 2013, 02:41:31 AM by EvilM00s »
:tinysmile:

*
*crack*
Rep:
Level 63
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Code: [Select]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#             Metronome Skill in Battle
#             Author: DiamondandPlatinum3
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Description:
#
#    This script puts in a skill similar to pokemon's metronome, in the sense
#    that skills will be chosen at random to be used if this skill is used.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#------------------------------------------------------------------------------
#  Instructions:

#     Simply create a new skill in the database and call it whatever you want,
#     set the scope to random enemies (so you don't actually have to choose an
#     enemy in battle when trying to use this skill) then set the skill ID below.
#
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
module DiamondandPlatinum3
  module MetronomeSkill
   
    # Skill ID for Metronome
    METRONOME_SKILL_ID = 84
   
    # Skill IDs that you do not wish to be selected with Metronome.
    # If you want all skills to be available, simply make the below empty
    NON_USABLE_SKILLS = [ 49, 50, 51, ]
   
  end
end



#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base 
  #--------------------------------------------------------------------------
  # * Aliased Method: Execute Battle Action: Skill
  #--------------------------------------------------------------------------
  alias metronome_scnbat_eas_ihg      execute_action_skill
  def execute_action_skill(*args)
    skill = @active_battler.action.skill
    if skill.id == DiamondandPlatinum3::MetronomeSkill::METRONOME_SKILL_ID
      text = @active_battler.name + skill.message1
      @message_window.add_instant_text(text)
      unless skill.message2.empty?
        wait(10)
        @message_window.add_instant_text(skill.message2)
      end
      # Setup Metronome
      @active_battler.dp3_set_metronome_skill_used(true)
      @active_battler.action.set_skill(rand($data_skills.size - 1) + 1) while(!metronome_skillselect_ok?())
    end
    metronome_scnbat_eas_ihg(*args) # Call Original Method
  end
  #--------------------------------------------------------------------------
  # * Metronome Selected Skill OK?
  #--------------------------------------------------------------------------
  def metronome_skillselect_ok?()
    return false if @active_battler.action.skill_id == DiamondandPlatinum3::MetronomeSkill::METRONOME_SKILL_ID
    for id in DiamondandPlatinum3::MetronomeSkill::NON_USABLE_SKILLS
      return false if @active_battler.action.skill_id == id
    end
    return true
  end
end




#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Alised Method: Calculation of MP Consumed for Skills
  #--------------------------------------------------------------------------
  alias metronome_gamebat_cmpc_ihg      calc_mp_cost
  def calc_mp_cost(skill)
    skill = $data_skills[DiamondandPlatinum3::MetronomeSkill::METRONOME_SKILL_ID] if @dp3_metronome_skill_used
    dp3_set_metronome_skill_used(false)
    metronome_gamebat_cmpc_ihg(skill) # Call Original Method
  end
  #--------------------------------------------------------------------------
  # * Set Metronome Used? Instance Variable
  #--------------------------------------------------------------------------
  def dp3_set_metronome_skill_used( set )
    @dp3_metronome_skill_used = set
  end
end

Ported my VXA Metronome Snippet for you, not sure if it does what you want.

Also did a video showing how to use it... works the same for VX.
Spoiler for:
<a href="http://www.youtube.com/watch?v=2n5zoZSbzas" target="_blank">http://www.youtube.com/watch?v=2n5zoZSbzas</a>
« Last Edit: January 27, 2013, 05:44:34 AM by D&P3 »

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
I can't wait to try this out! Thank you so very much! + rep and already in game credits.
:tinysmile:

*
*crack*
Rep:
Level 63
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Thanks! Also updated snippet above. Difference is that MP is only deducted from the Metronome skill rather than whatever skill you end up using :)

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
Alright! The effect works, but the animation doesn't play. I'm thinking something to do with the Tankentai SBS I'm using... any ideas?
:tinysmile:

*
*crack*
Rep:
Level 63
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Both Animation and Effects played just fine when I tried in the Tankentai 3.4e ATB 1.2c Demo just then, did you change the skill ID in the script to match the Metronome Skill ID?

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
I sure did, and I also changed the non-usable skill ID array to reflect the proper skill needed. However, when the "Metronome" skill goe soff, I only get the effect of the random skill... That skill has the correct animation attached to it.

The last demo for FFIV II has the skill in there if you feel like taking a look. Its Asyura (that's the met -like skill) and the random I tested it with is Asyura as well, but the skill sheet has healing effects and no MP cost.
:tinysmile:

*
*crack*
Rep:
Level 63
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
Well I just put the Metronome script below all other scripts and changed the Metronome skill ID to 277 (Same ID as your Asyura skill, boy was it a bitch to find) and it did both the animation and effects just fine, you have a lot of empty skills in the database, that's probably going to take you a long time to enter that information into the script :/




So I guess these are the questions:
Did you place the Metronome script below Tankentai? Due to the way they made their script, mine needs to be below it for this to work.
Have you included any new scripts since this demo I'm currently inspecting?

Quite a few of the skills I see in the database have no animations assosciated with them, it will still give the effects but no animation unless there is one for the randomly selected skill.

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
Well if you have the demo Ireleased today it should be in there, all the way at the bottom below everything including your spelling fix script. Nothing else added at all

Not currently at the home computer, but I seem to remember having followed just those directions... perhaps it's a fluke; I modified the script and used the battle test under the enemies tab without saving, closing and opening back up ( it seems Vista has a way of effing up one's programming if you don't do that) so I shall look again, but your test gives me hope.

I do know that I set the met skill to the generic Asyura skill, and included the Asyura that actually does something as the ONLY skill it can select. That skill does have an animation.  Unless I did that wrong... I set it up like an array:

Code: [Select]
NON_USABLE_SKILLS = [ 1 ... 276, 278...400 ]

with the missing number being the Asyura skill that does something. I got the healing but no animation. I'm sure it's something small I overlooked.

Heh, yeah... lots of blank spaces that I fill every time I make a new monster! Lots of non-animated skills because I'm not that far yet! In time, those will both be rectified.

Anyhow, thanks again for the help. WhenI get this working in about 6 hours (at work now) I'll let you know.
« Last Edit: January 28, 2013, 07:26:06 AM by EvilM00s »
:tinysmile:

*
*crack*
Rep:
Level 63
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
ANNNDDD we have found our problem. You've basically blocked off every skill from being used.
That Array tells the script that these are the skills you don't want to be randomly selected when you use Asyura. The script also prevents Asyura from being chosen.
Since you've set the Skill ID to 277 (Asyura), the script doesn't allow that skill to be randomly selected (because why would you use Metronome only to end up using it a second time?), then it disallows any skills to be chosen that you've specified in the array.

So from what I've seen, you've disabled all skills from being used.

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
Okay, fair enough, but now with the skill array fixed, she's casting everything out of the met skill regardless of the array! Did you DL the newet version yet? Maybe that'll hold the answer, if you are still inclined to investigate.
:tinysmile:

*
*crack*
Rep:
Level 63
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
So the problem is that you are using Ranges rather than Integers, I've updated the script to allow you to use both of them.
Also your game seems to have done something to the script which forced almost half of it into a one line comment (how the fuck did that happen?). This is actually game breaking, so you may just want to fix that and re-upload your project.

Spoiler for code:
Code: [Select]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#             Metronome Skill in Battle
#             Author: DiamondandPlatinum3
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Description:
#
#    This script puts in a skill similar to pokemon's metronome, in the sense
#    that skills will be chosen at random to be used if this skill is used.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#------------------------------------------------------------------------------
#  Instructions:

#     Simply create a new skill in the database and call it whatever you want,
#     set the scope to random enemies (so you don't actually have to choose an
#     enemy in battle when trying to use this skill) then set the skill ID below.
#
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
module DiamondandPlatinum3 
  module MetronomeSkill       
    # Skill ID for Metronome   
    METRONOME_SKILL_ID =  248       
    # Skill IDs that you do not wish to be selected with Metronome.   
    # If you want all skills to be available, simply make the below empty
    NON_USABLE_SKILLS = [1..248, 250..400 ]   
  end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base   
  #-------------------------------------------------------------------------- 
  # * Aliased Method: Execute Battle Action: Skill 
  #-------------------------------------------------------------------------- 
  alias metronome_scnbat_eas_ihg      execute_action_skill 
  def execute_action_skill(*args)   
    skill = @active_battler.action.skill   
    if skill.id == DiamondandPlatinum3::MetronomeSkill::METRONOME_SKILL_ID     
      text = @active_battler.name + skill.message1     
      @message_window.add_instant_text(text)     
      unless skill.message2.empty?       
        wait(10)       
        @message_window.add_instant_text(skill.message2)     
      end     
      # Setup Metronome     
      @active_battler.dp3_set_metronome_skill_used(true)     
      @active_battler.action.set_skill(rand($data_skills.size - 1) + 1) while(!metronome_skillselect_ok?())   
    end   
    metronome_scnbat_eas_ihg(*args) # Call Original Method 
  end 
  #-------------------------------------------------------------------------- 
  # * Metronome Selected Skill OK? 
  #-------------------------------------------------------------------------- 
  def metronome_skillselect_ok?()   
    return false if @active_battler.action.skill_id == DiamondandPlatinum3::MetronomeSkill::METRONOME_SKILL_ID   
    for id in DiamondandPlatinum3::MetronomeSkill::NON_USABLE_SKILLS 
      if id.is_a?(Range)
        for i in id
          return false if @active_battler.action.skill_id == i
        end
      else
        return false if @active_battler.action.skill_id == id   
      end
    end   
    return true 
  end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Alised Method: Calculation of MP Consumed for Skills
  #--------------------------------------------------------------------------
  alias metronome_gamebat_cmpc_ihg      calc_mp_cost
  def calc_mp_cost(skill)
    skill = $data_skills[DiamondandPlatinum3::MetronomeSkill::METRONOME_SKILL_ID] if @dp3_metronome_skill_used
    dp3_set_metronome_skill_used(false)
    metronome_gamebat_cmpc_ihg(skill) # Call Original Method
  end
  #--------------------------------------------------------------------------
  # * Set Metronome Used? Instance Variable
  #--------------------------------------------------------------------------
  def dp3_set_metronome_skill_used( set )
    @dp3_metronome_skill_used = set
  end
end

Alright I've tried this out and only skill id 249 was used every single time I used Metronome, obviously it's not Metronome if there is no random skill coming out of it, but this absolutely worked and no other skill was called.

Ranges are also made with two dots not three by the way. So be sure to kep that in mind.

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
Excellent! Thank you very much for taking the time to look and explain that to me; I'm not a scripter of any skill as you can tell. Your effort is noted and appreciated! I will fix the code and reupload the skill demo tomorrow.

Now to proceed with the plan to add 2 more random skills to the range; the goal is to have a summon that will cast a small heal, a larger heal, and a res on the entire party.


EDIT: Damned fine work, broseph. It works just fine now! Thank you so very much!
« Last Edit: January 29, 2013, 05:56:06 PM by EvilM00s »
:tinysmile: