Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: akkrin on January 20, 2008, 09:58:52 am

Title: [RESOLVED] Need help finishing a script
Post by: akkrin on January 20, 2008, 09:58:52 am
back on the old forum WcW had started working on a blood mage script for me.  He had finished it but there were a bug in it and when I went to use magic not only would it take my Hp like I wanted it to but it still took my Mp.  I was just wongering if anybody could help me finish it.
Spoiler: ShowHide
#============================================================================
# Blood Mage Magic Script v 1.0.0
# by WcW
#
# Introduction:
# I made this script for Akkein(Akkrin) at http://chaosproject.co.nr/ at his request.
# If he has allowed you to use this, enjoy. If he has not, ask him.
#
# Features:
# - Allows for certain classes to use up their HP instead of MP when using
#   spells.
# - Lightweight.
#
# Instructions:
# Place this script below the default scripts that come with RMXP, but above
# all of Blizzard's scripts and the "Main" script that is included with RMXP.
# Then add the IDs of all your "Blood Mage" classes to the [] thingy in the
# CONFIG section.
#
# Compatibility:
# This has no known compatibility issues, but it might because it edits tiny
# parts of Scene_Battle. If you find any problems, please post them at
# http://chaosproject.co.nr/.
#
# WcW, Signing Off
#============================================================================

#----------------------------------------------------------------------------
# * CONFIG
#     Configuration section
#----------------------------------------------------------------------------
class Game_System
attr_reader :bloodmages
alias init_bloodmage_later initialize
def initialize
   @bloodmages = [] # Between the "[" and "]", add the ID of each class the you
                    # want to be a blood mage and seperate each with a comma.
   init_bloodmage_later
end
end

# Below lies the code



#----------------------------------------------------------------------------
# * Battle Scene
#----------------------------------------------------------------------------
class Scene_Battle
#--------------------------------------------------------------------------
# * Make Skill Action Result
#--------------------------------------------------------------------------
def make_skill_action_result
   @skill = $data_skills[@active_battler.current_action.skill_id]
   unless @active_battler.current_action.forcing
     unless @active_battler.skill_can_use?(@skill.id)
       $game_temp.forcing_battler = nil
       @phase4_step = 1
       return
     end
   end
   if @active_battler.is_a?(Game_actor) &&
     $game_system.bloodmages.include?(@active_battler.class_id)
     @active_battler.hp -= @skill.sp_cost
   else
     @active_battler.sp -= @skill.sp_cost
   end
   @status_window.refresh
   @help_window.set_text(@skill.name, 1)
   @animation1_id = @skill.animation1_id
   @animation2_id = @skill.animation2_id
   @common_event_id = @skill.common_event_id
   set_target_battlers(@skill.scope)
   for target in @target_battlers
     target.skill_effect(@active_battler, @skill)
   end
end
end
Title: Re: Need help finishing a script
Post by: Blizzard on January 20, 2008, 10:03:54 am
There's a bug in a line where it says Game_actor. It should be Game_Actor. That's all I can tell that is wrong. Try fixing it, it may just be the cause of the problem.
Title: Re: Need help finishing a script
Post by: akkrin on January 20, 2008, 10:36:40 am
sorry but now the script crashes when I get into a fight and have him attack.  it says
Script 'Blood Mage' line 62: NameError occurred.  Uninitialized constant Scene_Battle::Game_actor
Title: Re: Need help finishing a script
Post by: Blizzard on January 20, 2008, 10:45:44 am
It should be Game_Actor, not Game_actor. I suppose I wasn't clear enough. >.<
Title: Re: Need help finishing a script
Post by: akkrin on January 20, 2008, 10:57:39 am
I did change it but that is still what pops up becase before it was Game_actor it never poped up but when i changed it the error started poping up which now that I think about it is really wierd.
So ya now it says
if @active_battler.is_a?(Game_Actor) &&
but it doesn't seem to do any thing.

PS sorry for repeating myself, hope that was the right line.  only one I noticed

*Edit*
Just thinking could it maybe be line 64-66
@active_battler.hp -= @skill.sp_cost
   else
     @active_battler.sp -= @skill.sp_cost

most likely line 66?
Title: Re: Need help finishing a script
Post by: Blizzard on January 20, 2008, 11:13:53 am
I just tried it and it worked fine after I changed it to Game_Actor. You DO know that you need to start a new game if you are using this, do you? It won't work with old savegames that didn't use this script.
Title: Re: Need help finishing a script
Post by: Fantasist on January 20, 2008, 01:24:22 pm
And change ALL instances of Game_actor to Game_Actor, I just guessed you might have missed that.
Title: Re: Need help finishing a script
Post by: Blizzard on January 20, 2008, 01:49:32 pm
There is only one. -_-
Title: Re: Need help finishing a script
Post by: Fantasist on January 20, 2008, 02:09:18 pm
...oops (^_^')
Title: Re: Need help finishing a script
Post by: akkrin on January 20, 2008, 05:44:53 pm
I did start a new game because I don't have a save file in the one I was making.  When I brought this up with WcW he said that it was just a slight error and he just needed to do some aliasing.  so could it have anything to do with the scripts that I have.  Which is just Blizz's tons of add-ons. (bars, hud, caterpiller, arrow over player and heal At lvl up).
Title: Re: Need help finishing a script
Post by: Blizzard on January 20, 2008, 05:54:53 pm
Actually, that could be it. You need to put this under Tons. But then again, it should only override Tons if it is below. >_>
Title: Re: Need help finishing a script
Post by: akkrin on January 21, 2008, 08:55:18 am
thanks Blizz that got it working properly.

PS. posting this script was also a way of giving permission to the public to use it but it must be properly credited to me and WcW.
Title: Re: Need help finishing a script
Post by: Blizzard on January 21, 2008, 09:00:16 am
How about I add it to Tons of Add-ons?
Title: Re: Need help finishing a script
Post by: akkrin on January 21, 2008, 06:33:52 pm
sure
Title: Re: Need help finishing a script
Post by: Nortos on January 21, 2008, 07:02:09 pm
ohhhh now I have a got a reason to update tons :)