Hello, I hope this is the right section for this sort of question. I wasn't entirely positive, but I'm using a script to achieve most of what I want, so I thought this was probably the best place.
Anyway, in my game, every attack the player has costs MP, and you must guard to refill your MP to continue attacking. I'm using the following script by wltr3565 to achieve the recovery of MP when guarding:
=begin ================================================================================ MP increasing by guarding template by wltr3565, v1.2 ================================================================================ This script works for increasing mp of the guarding corresponding battler. It won't disturb any guarding-related scripts because it's aliased already. So don't worry about any incompability. Now can heal hp if wanted! ================================================================================ Effect: Makes the guarder's mp (and/or hp) to increase at the calculated amount. This effects foes as well. ================================================================================ Instructions of using: Put this script above main and below any battle system related scripts. You can adjust how the mp increase at the script below. Instructions incoming. Don't forget to credit me :)
Calculation reference for using other status: @active_battler.hp = guarder's hp @active_battler.maxhp = guarder's max hp @active_battler.mp = guarder's mp @active_battler.maxmp = guarder's max mp @active_battler.atk = guarder's attack @active_battler.def = guarder's defense @active_battler.spi = guarder's spirit @active_battler.agi = guarder's agility @active_battler.level = guarder's level. I suggest to not use this.
Sample for calculation:
@active_battler.mp += (@active_battler.spi + @active_battler.maxhp) When Ralph is guarding, his mp will heal by the total of his spirit and maxhp. So: Spirit = 1; maxhp = 50; then his mp will increase by 51 while guarding. ================================================================================ History: -This script is publicized. (v1.0) -Added HP healing (by calculation) (v1.1) -The healing is now executed while guarding, not at start of guarding. (v1.2) thanking Mithran for this! ================================================================================ =end module WLTR module HEALING_ADJUSTMENTS
MP_HEAL = true #if you want the mp to be healed...
MP_HEAL_LEAST = 10 #amount of points mp healed if the calculation made is not reaching 1
HP_HEAL = false #if you want the hp to be healed...
HP_HEAL_LEAST = 1 #amount of points hp healed if the calculation made is not reaching 1
#================================================================================ #Adjusting the calculation is below #================================================================================
class Scene_Battle < Scene_Base alias mp_increase_template execute_action_guard def execute_action_guard if WLTR::HEALING_ADJUSTMENTS::MP_HEAL if (@active_battler.spi / 10) < 1 #calculation for making sure mp to increase at least 1 is added here. @active_battler.mp += WLTR::HEALING_ADJUSTMENTS::MP_HEAL_LEAST else @active_battler.mp += (@active_battler.maxmp * 100 / 100) #calculation for mp increase is added here. end end if WLTR::HEALING_ADJUSTMENTS::HP_HEAL if (@active_battler.def / 5) < 1 #calculation for making sure hp to increase at least 1 is added here. @active_battler.hp += WLTR::HEALING_ADJUSTMENTS::HP_HEAL_LEAST else @active_battler.hp += (@active_battler.def / 5) #calculation for hp increase is added here. end end mp_increase_template end end
#=============================================================================== #SETTING END #===============================================================================
The thing is, I would like it to be apparent to the player what is happening by guarding, aside from just explaining the mechanic ahead of time. I'd like to play a sound effect when the guard command is issued. I know nothing about scripting, so I don't really have the foggiest idea how to go about this.
Any help is appreciated, and thanks for reading. :3
This post has been edited by Jaide: Nov 26 2011, 01:01 AM
Audio.se_play(filename, volume, pitch) # plays a SE Audio.me_play(filename, volume, pitch) # plays a ME
Where voulme and pitch can be omitted. I'd put it before the line containing "if WLTR::HEALING_ADJUSTMENTS::MP_HEAL" Oh, and I think the filename needs to be in the format "Audio/SE/filename" or "Audio/ME/filename". I don't think you need the filetype.